:root {
  /* Oruk brand palette (oruk.ai/branding) */
  --primary: #118659;      /* brand green */
  --warm: #16827d;         /* secondary accent */
  --bg: #fafafb;           /* page canvas */
  --fg: #18181d;           /* primary text */
  --card: #ffffff;         /* raised surfaces */
  --fill: #f0f0f2;         /* subtle fills */
  --muted: #5d5d64;        /* secondary text */
  --destructive: #c92f33;  /* errors only */
  --line: #e7e7ec;         /* hairline borders */

  /* emotion colors */
  --happy: #16a34a;
  --neutral: #e0a200;
  --sad: #2f6fed;
  --angry: #e5484d;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, monospace;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --shadow: 0 1px 2px rgba(24, 24, 29, 0.05), 0 16px 44px -20px rgba(24, 24, 29, 0.22);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1000px 520px at 50% -12%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 60%),
    radial-gradient(760px 520px at 50% 116%, color-mix(in srgb, var(--warm) 11%, transparent), transparent 62%),
    var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
.stage { max-width: 44rem; margin: 0 auto; padding: 1.4rem 1.1rem 2.5rem; }

/* marquee / logo */
.marquee { text-align: center; margin-bottom: 1.3rem; }
.brandrow { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.mark { width: clamp(2.2rem, 8vw, 3rem); height: auto; display: block; }
.logo {
  font-weight: 600; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; letter-spacing: -0.03em;
  color: var(--fg);
}
.logo .says { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--primary); letter-spacing: 0; }
.tagline { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.24em; text-transform: uppercase; margin-top: 0.55rem; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow); }
/* stage lighting on the game card */
.panel.game { position: relative; overflow: hidden; background: radial-gradient(130% 90% at 50% -18%, color-mix(in srgb, var(--primary) 9%, var(--card)), var(--card) 58%); }
.panel.game::before {
  content: ""; position: absolute; left: 50%; top: -46%; width: 150%; aspect-ratio: 1; transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--warm) 22%, transparent), transparent 70%);
  pointer-events: none; z-index: 0; opacity: 0.7; animation: stageDrift 9s ease-in-out infinite;
}
.panel.game > * { position: relative; z-index: 1; }
@keyframes stageDrift { 0%, 100% { transform: translateX(-58%); opacity: 0.55; } 50% { transform: translateX(-42%); opacity: 0.85; } }
/* ambient glow around the whole stage while playing */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 0.7s ease;
  background:
    radial-gradient(46% 38% at 20% 16%, color-mix(in srgb, var(--primary) 20%, transparent), transparent 60%),
    radial-gradient(46% 38% at 82% 20%, color-mix(in srgb, var(--warm) 18%, transparent), transparent 62%);
}
body.playing::before { opacity: 1; animation: ambientDrift 10s ease-in-out infinite; }
@keyframes ambientDrift { 0%, 100% { filter: hue-rotate(0deg); opacity: 0.85; } 50% { filter: hue-rotate(-8deg); opacity: 1; } }
.stage { position: relative; z-index: 1; }

/* setup */
.lead { color: var(--fg); font-size: 1.02rem; line-height: 1.55; margin: 0 0 1.6rem; text-align: center; }
.lead strong { color: var(--primary); font-weight: 600; }

.section-label { font-family: var(--mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); margin: 0 0 0.7rem; }

.steps { list-style: none; margin: 0 0 1.6rem; padding: 0; display: grid; gap: 0.7rem; }
.steps li { display: flex; gap: 0.7rem; align-items: flex-start; }
.steps p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.steps b { color: var(--fg); font-weight: 600; }
.step-n {
  flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 600; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
}

.emolegend { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; margin-bottom: 1.7rem; }
.leg { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 0.85rem 0.3rem; border-radius: 16px; background: color-mix(in srgb, var(--c) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line)); }
.leg .e { width: 42px; height: 42px; }
.leg .n { font-size: 0.74rem; font-weight: 600; }

.difficulties { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-bottom: 1.5rem; }
.diff {
  position: relative; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  padding: 0.85rem 1rem; cursor: pointer; color: var(--fg); text-align: left;
  display: flex; flex-direction: column; gap: 0.25rem; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.diff:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); }
.diff.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.diff.selected::after {
  content: "\2713"; position: absolute; top: 0.55rem; right: 0.65rem;
  width: 1.05rem; height: 1.05rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.66rem; font-weight: 700; color: #fff; background: var(--primary);
}
.diff-name { font-weight: 600; font-size: 1.02rem; }
.diff-req { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

.play-btn {
  width: 100%; border: none; border-radius: 14px; cursor: pointer;
  font-family: var(--sans); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; padding: 0.95rem 1.4rem; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--warm));
  box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--primary) 60%, transparent);
  transition: transform 0.08s, filter 0.15s;
}
.play-btn:hover { filter: brightness(1.05); }
.play-btn:active { transform: scale(0.985); }
.play-btn:disabled { opacity: 0.55; cursor: default; filter: grayscale(0.3); box-shadow: none; }
.fineprint { color: var(--muted); font-size: 0.74rem; text-align: center; margin: 0.95rem 0 0; }

/* game HUD */
.hud { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.2rem; }
.hud-item { display: flex; align-items: baseline; gap: 0.35rem; }
.hud-label { font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.hud-val { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hud-of { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.badge { margin-left: auto; background: color-mix(in srgb, var(--primary) 11%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 999px; padding: 0.32rem 0.8rem; font-size: 0.76rem; font-weight: 600; color: var(--primary); align-self: center; }
.mutebtn { width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--card); border: 1px solid var(--line); cursor: pointer; font-size: 1rem; line-height: 1; }
.mutebtn:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }

/* emotion pads */
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.1rem; }
.pad {
  --c: #888;
  position: relative; border-radius: 20px; padding: 1.5rem 1rem; min-height: 8.5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  background: linear-gradient(180deg, var(--card), color-mix(in srgb, var(--c) 9%, var(--card)));
  border: 2px solid color-mix(in srgb, var(--c) 32%, var(--line));
  color: var(--fg); user-select: none; transition: transform 0.12s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}
.pad .pe { width: 64px; height: 64px; }
.pad .pe svg { display: block; width: 100%; height: 100%; }
.pad .pl { font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; color: color-mix(in srgb, var(--c) 45%, var(--fg)); }
.pad.active {
  border-color: var(--c);
  background: linear-gradient(180deg, var(--card), color-mix(in srgb, var(--c) 18%, var(--card)));
  transform: translateY(-2px) scale(1.02);
  animation: padGlow 1.05s ease-in-out infinite;
}
@keyframes padGlow {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 26%, transparent), 0 16px 34px -12px color-mix(in srgb, var(--c) 55%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 42%, transparent), 0 22px 48px -10px color-mix(in srgb, var(--c) 85%, transparent); }
}
.pad.correct { animation: pop-good 0.55s ease; border-color: var(--happy); box-shadow: 0 0 0 3px var(--happy), 0 14px 40px -8px color-mix(in srgb, var(--happy) 70%, transparent); }
.pad.wrong { animation: shake 0.4s ease; border-color: var(--angry); box-shadow: 0 0 0 3px var(--angry), 0 14px 40px -8px color-mix(in srgb, var(--angry) 70%, transparent); }
@keyframes pop-good { 0% { transform: scale(1); } 40% { transform: scale(1.07); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

/* status + reading */
.statusrow { text-align: center; min-height: 2.2rem; margin-bottom: 0.6rem; }
.status { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; }
.status .em { color: var(--primary); }
.skip-btn { margin-top: 0.5rem; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.skip-btn:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); color: var(--fg); }
.skip-btn[hidden] { display: none; }

.reading { margin-top: 0.6rem; }
.reading[hidden] { display: none; }
.rc-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem; }
.rc { display: inline-flex; align-items: center; gap: 0.32rem; font-family: var(--mono); font-size: 0.8rem; font-weight: 500; font-variant-numeric: tabular-nums; padding: 0.24rem 0.55rem 0.24rem 0.4rem; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); color: var(--muted); }
.rc-ico { width: 18px; height: 18px; display: inline-block; }
.rc-ico svg { display: block; width: 100%; height: 100%; }
.rc.good { color: #06341f; background: color-mix(in srgb, var(--happy) 20%, var(--card)); border-color: color-mix(in srgb, var(--happy) 55%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--happy) 20%, transparent); }
.rc.miss { color: var(--fg); background: color-mix(in srgb, var(--c) 14%, var(--card)); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.rc-note { margin-top: 0.4rem; font-size: 0.82rem; color: var(--muted); }
.rc-note b { color: var(--fg); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rc-text { margin-top: 0.3rem; font-size: 0.8rem; color: var(--muted); }
.rc-text .tx-ok { color: var(--primary); font-weight: 600; }
.rc-text .tx-no { color: var(--destructive); font-weight: 600; }

/* Extreme: the exact sentence to say */
.sayThis { margin: 0 0 0.9rem; padding: 0.85rem 1rem; border-radius: 14px; text-align: center; background: color-mix(in srgb, var(--primary) 6%, var(--card)); border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line)); }
.sayThis[hidden] { display: none; }
.st-head { font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.st-head b { font-weight: 600; }
.st-line { margin-top: 0.35rem; font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; color: var(--fg); }

/* controls */
.controls { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.mic { width: 4.4rem; height: 4.4rem; border-radius: 50%; border: none; cursor: pointer; color: #fff; background: linear-gradient(135deg, var(--primary), var(--warm)); display: grid; place-items: center; box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--primary) 55%, transparent); transition: transform 0.1s, box-shadow 0.2s, filter 0.15s; }
.mic:hover:not(:disabled) { filter: brightness(1.05); }
.mic:disabled { opacity: 0.5; cursor: default; background: var(--fill); color: var(--muted); box-shadow: none; }
.mic[data-state="recording"] { background: linear-gradient(135deg, #ff5a67, var(--destructive)); color: #fff; animation: pulse-red 1.05s ease-out infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--destructive) 55%, transparent); } 100% { box-shadow: 0 0 0 20px rgba(201,47,51,0); } }
.hint { color: var(--muted); font-size: 0.9rem; min-height: 1.2rem; text-align: center; }
.hint.live { color: var(--destructive); font-weight: 600; }

/* answer countdown */
.timer { width: 100%; max-width: 18rem; text-align: center; }
.timer[hidden] { display: none; }
.timer-bar { height: 7px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--warm)); transition: width 0.1s linear; }
.timer-num { margin-top: 0.35rem; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted); }
.timer-num span { font-weight: 600; color: var(--fg); }
.timer.low .timer-fill { background: linear-gradient(90deg, #ff5a67, var(--destructive)); }
.timer.low .timer-num, .timer.low .timer-num span { color: var(--destructive); font-weight: 600; }

/* confetti overlay */
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

.foot { color: var(--muted); font-size: 0.76rem; text-align: center; margin: 1.5rem auto 0; }
.foot a { color: var(--primary); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot strong { color: var(--fg); font-weight: 600; }

/* overlay */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--fg) 32%, transparent); backdrop-filter: blur(6px); display: grid; place-items: safe center; overflow-y: auto; z-index: 30; padding: 1.5rem 1rem; }
.overlay[hidden] { display: none; }
.over-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 2rem 1.8rem; text-align: center; max-width: 24rem; width: 100%; box-shadow: 0 40px 90px -30px rgba(24,24,29,0.4); }
.over-emoji { width: 84px; height: 84px; margin: 0 auto 0.3rem; }
.over-emoji svg { display: block; width: 100%; height: 100%; }
.over-card h1 { margin: 0.3rem 0 0.3rem; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; }
.over-sub { color: var(--muted); font-size: 0.94rem; line-height: 1.55; margin: 0 0 1.1rem; }
.finalscore { font-family: var(--mono); font-size: 2.5rem; font-weight: 600; color: var(--primary); margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.fs-of { font-size: 1rem; color: var(--muted); }

/* end-of-game stats */
.over-stats { margin: 0 0 1.2rem; text-align: left; }
.over-stats[hidden] { display: none; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
.stat { background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.3rem; text-align: center; }
.stat-n { font-family: var(--mono); font-size: 1.05rem; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat-l { font-family: var(--mono); font-size: 0.54rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 0.15rem; }
.se-title { font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin: 1rem 0 0.5rem; }
.stat-emos { display: grid; gap: 0.4rem; }
.se-row { --c: #888; display: grid; grid-template-columns: 3.6rem 1fr auto; align-items: center; gap: 0.5rem; }
.se-name { font-size: 0.82rem; font-weight: 600; color: color-mix(in srgb, var(--c) 55%, var(--fg)); }
.se-bar { height: 7px; border-radius: 999px; background: var(--fill); border: 1px solid var(--line); overflow: hidden; }
.se-fill { display: block; height: 100%; border-radius: 999px; background: var(--c); }
.se-val { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.perm-hint { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); border-radius: 999px; padding: 0.6rem 1rem; font-size: 0.85rem; z-index: 50; box-shadow: var(--shadow); }
.perm-hint[hidden] { display: none; }

@media (max-width: 560px) {
  .stage { padding: 1rem 0.85rem 2rem; }
  .panel { padding: 1.2rem; border-radius: 18px; }
  .brandrow { gap: 0.5rem; }
  .mark { width: 2.2rem; }
  .lead { font-size: 0.96rem; margin-bottom: 1.3rem; }
  .steps { margin-bottom: 1.3rem; }
  .hud { gap: 0.55rem; }
  .hud-val { font-size: 1.4rem; }
  .badge { font-size: 0.72rem; padding: 0.28rem 0.7rem; }
  .mutebtn { width: 2rem; height: 2rem; }
  .difficulties { grid-template-columns: repeat(2, 1fr); }
  .pads { gap: 0.7rem; }
  .pad { min-height: 7rem; padding: 1.1rem 0.8rem; }
  .pad .pe { width: 52px; height: 52px; }
  .pad .pl { font-size: 0.95rem; }
  .emolegend { gap: 0.45rem; }
  .leg { padding: 0.65rem 0.2rem; border-radius: 13px; }
  .leg .e { width: 34px; height: 34px; }
  .leg .n { font-size: 0.66rem; }
  .st-line { font-size: 1.15rem; }
  .sayThis { padding: 0.75rem 0.85rem; }
  .over-card { padding: 1.6rem 1.3rem; }
  .rc { font-size: 0.74rem; padding: 0.22rem 0.5rem 0.22rem 0.36rem; }
  .rc-ico { width: 16px; height: 16px; }
}
@media (max-width: 380px) {
  .hud { gap: 0.45rem; }
  .hud-label { font-size: 0.56rem; }
  .hud-val { font-size: 1.25rem; }
  .hud-of { font-size: 0.72rem; }
  .badge { font-size: 0.68rem; padding: 0.26rem 0.6rem; }
  .leg .n { font-size: 0.6rem; }
  .diff { padding: 0.75rem 0.7rem; }
  .diff-name { font-size: 0.96rem; }
  .diff-req { font-size: 0.64rem; }
}
@media (prefers-reduced-motion: reduce) {
  .panel.game::before, body.playing::before, .pad.active { animation: none; }
  .timer-fill { transition: none; }
}
