:root {
  --ink: #e8e6df;
  --dim: #8a877e;
  --accent: #d7b46a;
  color-scheme: dark;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #000; }
body {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color: var(--ink);
  cursor: default;
  -webkit-font-smoothing: antialiased;
}
body.playing { cursor: none; }

#gl {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  image-rendering: auto;
}

/* the flam: a same-frame flash proving your touch landed */
#flam {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255,255,255,0.18), transparent 60%);
  opacity: 0;
  mix-blend-mode: screen;
}

#fatal {
  display: none;
  position: fixed; inset: 0;
  align-items: center; justify-content: center;
  padding: 2rem; text-align: center; color: var(--dim);
  background: #000;
}

/* ---- the hint (only UI), fades once you play ---- */
.hint {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1.4rem; text-align: center;
  pointer-events: none;
  transition: opacity 1.6s ease 0.3s, filter 1.6s ease;
  z-index: 5;
}
.hint.gone { opacity: 0; filter: blur(8px); }
.wordmark {
  font-size: clamp(1.8rem, 6vw, 4rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  font-weight: 600;
  text-shadow: 0 0 40px rgba(215,180,106,0.35);
  animation: breathe 3.75s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.82; letter-spacing: 0.5em; }
  50% { opacity: 1; letter-spacing: 0.56em; }
}
.hint .sub { color: var(--accent); font-size: clamp(0.8rem, 2vw, 1rem); letter-spacing: 0.15em; }
.hint .rows {
  display: flex; flex-direction: column; gap: 0.5rem;
  color: var(--dim); font-size: clamp(0.68rem, 1.6vw, 0.86rem);
  line-height: 1.7;
}
.hint .rows b { color: var(--ink); font-weight: 600; }
.hint .rows .dim { opacity: 0.6; margin-top: 0.4rem; }

#ghosthint {
  display: none;
  position: fixed; top: 6vh; left: 50%; transform: translateX(-50%);
  padding: 0.6rem 1.2rem; border: 1px solid rgba(215,180,106,0.3);
  border-radius: 2rem; background: rgba(0,0,0,0.4); backdrop-filter: blur(8px);
  color: var(--dim); font-size: 0.8rem; letter-spacing: 0.08em; z-index: 6;
}
#ghosthint b { color: var(--accent); }

/* ---- help (TAB) ---- */
.help {
  position: fixed; inset: 0; z-index: 10;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(14px);
  padding: 2rem;
}
.help.show { display: flex; }
.helpcard { max-width: 900px; width: 100%; }
.helpcard h1 {
  font-weight: 600; letter-spacing: 0.3em; text-align: center;
  margin-bottom: 2rem; color: var(--accent);
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.6rem 2.4rem;
}
.grid h2 { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.grid p { font-size: 0.82rem; line-height: 1.7; margin-bottom: 0.3rem; }
.grid b { color: var(--ink); }
.grid .dim { color: var(--dim); font-size: 0.74rem; }
.helpfoot { text-align: center; color: var(--dim); font-size: 0.8rem; margin-top: 2rem; }
.helpfoot b { color: var(--ink); }

/* ---- finish overlay ---- */
.overlay {
  position: fixed; inset: 0; z-index: 12;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.62); backdrop-filter: blur(16px); padding: 2rem;
}
.overlay.show { display: flex; }
.card {
  width: 100%; max-width: 520px;
  border: 1px solid rgba(232,230,223,0.12); border-radius: 1rem;
  background: rgba(12,12,14,0.7); padding: 2rem;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
}
.card h1 { font-weight: 600; letter-spacing: 0.2em; margin-bottom: 0.4rem; }
.card .dim { color: var(--dim); font-size: 0.82rem; margin-bottom: 1.4rem; }
.share { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.share input {
  flex: 1; min-width: 0; padding: 0.6rem 0.8rem;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(232,230,223,0.12);
  border-radius: 0.5rem; color: var(--dim); font-family: inherit; font-size: 0.72rem;
}
.actions { display: flex; gap: 0.6rem; }
button {
  padding: 0.6rem 1.1rem; border-radius: 0.5rem; cursor: pointer;
  background: rgba(232,230,223,0.06); border: 1px solid rgba(232,230,223,0.16);
  color: var(--ink); font-family: inherit; font-size: 0.8rem; letter-spacing: 0.05em;
  transition: background 0.15s, border-color 0.15s;
}
button:hover { background: rgba(232,230,223,0.12); border-color: rgba(232,230,223,0.3); }
button.primary { background: var(--accent); color: #1a1408; border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }

.renderpane { display: none; margin-top: 1.4rem; }
.renderpane.show { display: block; }
.progresslabel { font-size: 0.78rem; color: var(--accent); letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.progresstrack { height: 6px; border-radius: 3px; background: rgba(232,230,223,0.1); overflow: hidden; }
.progressbar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; box-shadow: 0 0 12px var(--accent); }
.tiny { font-size: 0.68rem !important; margin-top: 0.7rem; }
