:root { --bg: #f4f2ee; --fg: #151515; --muted: #8a867f; --line: #dcd8d0; }
body.dark { --bg: #0e0e0f; --fg: #f1efe9; --muted: #8d8a84; --line: #2a2a2c; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
#stage { position: fixed; inset: 0; }
#canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; font-size: 12px; pointer-events: none; transition: opacity .4s; }
#loading.done { opacity: 0; }
#hint { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); color: var(--muted);
  font-size: 12px; pointer-events: none; }
#brand { position: fixed; top: 18px; left: 22px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.logo { font-weight: 600; letter-spacing: .32em; font-size: 13px; }
.piece { color: var(--muted); font-size: 12px; letter-spacing: .04em; }
#panel { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); display: flex; gap: 22px;
  align-items: flex-end; padding: 14px 18px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; width: max-content; max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
#panel h3 { margin: 0 0 8px; font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.swatches { display: flex; gap: 8px; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; padding: 0;
  outline-offset: 3px; position: relative; }
.sw.active { outline: 1.5px solid var(--fg); }
.sw[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11px; background: var(--fg); color: var(--bg); padding: 3px 7px; border-radius: 4px; }
.row { display: flex; gap: 6px; }
.btn { font: inherit; font-size: 12px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--fg); cursor: pointer; display: inline-block; }
.btn.on { background: var(--fg); color: var(--bg); }
#studio { position: fixed; top: 16px; right: 16px; width: 230px; display: flex; flex-direction: column; gap: 6px;
  padding: 12px; background: color-mix(in srgb, var(--bg) 85%, transparent); border: 1px solid var(--line); border-radius: 12px; }
#studio[hidden] { display: none; }
#studio h3 { margin: 0; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.small { margin: 0; font-size: 11px; color: var(--muted); }
#disclaimer { position: fixed; bottom: 8px; left: 0; right: 0; text-align: center; margin: 0; font-size: 10px; color: var(--muted); }
@media (max-width: 640px) {
  #panel { bottom: 44px; gap: 12px; padding: 10px 12px; }
  #disclaimer { padding: 0 16px; }
  #hint { bottom: 210px; }
  .sw { width: 24px; height: 24px; }
}
.mini { font: inherit; font-size: 9px; letter-spacing: .1em; padding: 1px 6px; margin-left: 6px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; vertical-align: 1px; }
.mini.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
#sides .sw { width: 20px; height: 20px; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
#shots { position: fixed; top: 16px; right: 16px; display: flex; gap: 6px; max-width: calc(100vw - 180px); overflow-x: auto; }
#shots[hidden] { display: none; }
#shots img { height: 56px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; background: var(--bg); }
