/* Skippy page. Mood (idle / listening / thinking / speaking) is body[data-mood]. */
:root {
  --ink: #0b1020;
  --ink-2: #111a30;
  --line: #22304f;
  --text: #e6edf7;
  --dim: #8ea6c6;
  --blue: #5ab4f0;
  --gold: #f2c230;
  --gold-ink: #1b1400;
  --red: #e5534b;
  --pad: max(16px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(120% 80% at 50% 40%, #16223a 0%, var(--ink) 60%);
  display: grid; grid-template-rows: auto 1fr auto auto;
  padding: env(safe-area-inset-top) var(--pad) max(14px, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* --- top bar --- */
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 0; z-index: 3; }
.chip {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: rgba(17, 26, 48, .85); border: 1px solid var(--line); white-space: nowrap;
}
.chip-btn.off { opacity: .55; }
.title { margin-left: auto; letter-spacing: .3em; font-weight: 700; font-size: 13px; color: var(--dim); }
body.awake #status { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(90, 180, 240, .35); }

/* --- the can --- */
#stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; }
#can { height: 100%; max-height: 500px; max-width: 72vw; transition: filter .4s ease; }
#orb { position: absolute; pointer-events: none; }
#shine { opacity: 0; transform-box: view-box; }
body[data-mood="speaking"] #shine { opacity: 1; animation: sweep 1.1s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: translateX(0); } to { transform: translateX(270px); } }
body[data-mood="listening"] #can { filter: drop-shadow(0 0 18px rgba(90, 180, 240, .55)); }
body[data-mood="speaking"] #can { filter: drop-shadow(0 0 14px rgba(255, 255, 255, .3)); }
body[data-mood="thinking"] #can { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(242, 194, 48, .15)); }
  50% { filter: drop-shadow(0 0 22px rgba(242, 194, 48, .55)); }
}

/* --- timers, links, player --- */
#alerts, #links, #player { position: fixed; right: var(--pad); z-index: 4; }
#alerts { top: 56px; display: flex; flex-direction: column; gap: 6px; max-width: min(320px, calc(100vw - 32px)); }
.alert {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 10px;
  background: rgba(17, 26, 48, .92); border: 1px solid var(--line); font-size: 14px;
}
.alert .left { font-variant-numeric: tabular-nums; font-weight: 600; }
.alert .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); }
.alert button { border: 0; border-radius: 8px; padding: 3px 9px; background: #1d2b48; }
.alert.ringing { border-color: var(--gold); animation: ring .8s ease-in-out infinite alternate; }
.alert.ringing button { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
@keyframes ring { to { box-shadow: 0 0 16px rgba(242, 194, 48, .6); } }
#links { bottom: 130px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
#links a {
  text-decoration: none; color: var(--text); padding: 7px 14px; border-radius: 999px;
  background: #1d3a66; border: 1px solid #2e5a96; font-size: 14px;
}
#player {
  bottom: 96px; left: var(--pad); display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px;
  border-radius: 12px; background: rgba(17, 26, 48, .94); border: 1px solid var(--line);
}
#player-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
#player button { border: 0; background: #1d2b48; border-radius: 8px; padding: 4px 9px; }

/* --- captions --- */
#bubble {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 2;
  width: min(640px, calc(100vw - 32px)); margin: 0; transition: opacity .6s ease;
}
#bubble.fading { opacity: 0; }
#bubble p { margin: 0 0 6px; padding: 8px 12px; border-radius: 12px; }
#heard { background: rgba(29, 58, 102, .85); color: #d9e9ff; font-size: 14px; }
#said { background: rgba(10, 16, 32, .92); border: 1px solid var(--line); max-height: 30vh; overflow-y: auto; }
#heard:empty, #said:empty { display: none; }

#tip { text-align: center; color: var(--dim); font-size: 13px; margin: 0 0 8px; min-height: 1em; transition: opacity .5s; }
#tip.gone { opacity: 0; }

/* --- controls --- */
.controls { display: flex; justify-content: center; align-items: center; gap: 18px; z-index: 3; }
#type-btn, #halt-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--ink-2); font-size: 20px;
}
#halt-btn { color: var(--red); }
#mic-btn {
  width: 200px; height: 84px; border: 0; border-radius: 26px; background: var(--gold); color: var(--gold-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-weight: 700; font-size: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
#mic-btn.muted { background: #3a4357; color: #c4ccd8; }
#mic-btn.recording { background: var(--red); color: #fff; }
#mic-btn.nudge { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.04); } }

#typebox {
  position: fixed; left: var(--pad); right: var(--pad); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 6;
  display: flex; gap: 8px; padding: 8px; border-radius: 14px; background: var(--ink-2); border: 1px solid var(--line);
}
#typebox input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--ink); color: var(--text); font: inherit;
}
#typebox button { border: 0; border-radius: 10px; padding: 0 14px; background: #1d3a66; }

/* --- fan notice --- */
#gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 16, .82); }
.gate-card { max-width: 440px; padding: 22px; border-radius: 18px; background: var(--ink-2); border: 1px solid var(--line); }
.gate-card h1 { margin: 0 0 10px; font-size: 20px; }
.gate-card p { margin: 0 0 12px; color: #cdd8e8; }
.gate-card a { color: var(--gold); }
#gate-ok {
  width: 100%; margin-top: 4px; padding: 12px; border: 0; border-radius: 12px;
  background: var(--gold); color: var(--gold-ink); font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  body[data-mood="speaking"] #shine { animation-duration: 2.6s; }
  body[data-mood="thinking"] #can, .alert.ringing, #mic-btn.nudge { animation: none; }
}
