:root {
  --bg: #000;
  --card: rgb(28, 28, 30);
  --fill: rgba(255, 255, 255, .07);
  --text: #f8f8fa;
  --hint: #8e8e93;
  --accent: #4f8dff;
  --gold: #ffc107;
  --navy: #05204a;
  --ok: #34c759;
  --bad: #ff453a;
  --glass: rgba(28, 28, 30, .72);
  --glass-border: rgba(255, 255, 255, .08);
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --appear: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --head: "Racama", "Unbounded", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, system-ui, "Segoe UI", Roboto, sans-serif;
  --safe-top: max(env(safe-area-inset-top), 0px);
  --safe-bottom: max(env(safe-area-inset-bottom), 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --card: #fff;
    --fill: rgba(120, 120, 128, .12);
    --text: #000;
    --hint: #6c6c70;
    --accent: #3d7afe;
    --glass: rgba(242, 242, 247, .78);
    --glass-border: rgba(255, 255, 255, .6);
    --shadow: 0 8px 30px rgba(0, 0, 0, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#fade { position: fixed; inset: 0; background: #03070f; opacity: 0; pointer-events: none; transition: opacity .24s var(--ease); }
#fade.on { opacity: 1; }
#app { position: fixed; inset: 0; pointer-events: none; }
#app > * { pointer-events: auto; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), inset 0 -.5px 0 rgba(255, 255, 255, .05), var(--shadow);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(28, 28, 30, .94); }
}

.kicker { color: var(--hint); font-size: 13px; letter-spacing: .01em; margin-bottom: 6px; }

h1, h2, .sheet-title {
  font-family: var(--head);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.08;
  margin: 0;
}

#hud {
  position: fixed;
  top: calc(var(--safe-top) + 10px);
  left: 50%;
  transform: translate(-50%, -140%);
  width: min(480px, calc(100% - 24px));
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 18px;
  transition: transform .46s var(--spring), opacity .3s var(--ease);
  opacity: 0;
}
#hud.show { transform: translate(-50%, 0); opacity: 1; }
.hud-left { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); flex: none; }
.hud-right { display: flex; align-items: center; gap: 4px; flex: none; }
.score { display: flex; align-items: center; gap: 5px; padding: 0 10px; height: 38px; border-radius: 999px; background: var(--fill); font-weight: 700; font-variant-numeric: tabular-nums; }
.score-star { color: var(--gold); font-size: 14px; }
[data-hud=score] { display: inline-block; min-width: 2ch; text-align: right; }
[data-hud=score].bump { animation: bump .46s var(--spring); color: var(--ok); }
[data-hud=score].drop { animation: bump .46s var(--spring); color: var(--bad); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

.energy {
  --p: 80;
  width: 38px; height: 38px; border-radius: 50%;
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0);
  display: grid; place-items: center;
  transition: background .4s var(--ease);
}
.energy.low { background: conic-gradient(var(--bad) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0); }
.energy span { width: 30px; height: 30px; border-radius: 50%; background: var(--card); display: grid; place-items: center; line-height: 0; color: var(--ok); }
.energy.low span { color: var(--bad); }
.energy span svg { display: block; }
.energy { padding: 0; flex: none; }

.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: transform .18s var(--ease), background .18s var(--ease); }
.icon-btn:active { transform: scale(.92); background: var(--fill); }

#title {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(var(--safe-bottom) + 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .46s var(--ease);
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, .35));
}
#title.show { opacity: 1; pointer-events: auto; }
#title.hide { opacity: 0; pointer-events: none; }
#title.hide .title-card { transform: translateY(40px); }
.title-card {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px - var(--safe-bottom));
  overflow-y: auto;
  border-radius: 28px;
  padding: 22px 20px 20px;
  transition: transform .46s var(--appear);
  scrollbar-width: none;
}
.title-card::-webkit-scrollbar { display: none; }
.title-card > * { animation: rise .46s var(--appear) both; }
.title-card > *:nth-child(2) { animation-delay: 35ms; }
.title-card > *:nth-child(3) { animation-delay: 70ms; }
.title-card > *:nth-child(4) { animation-delay: 105ms; }
.title-card > *:nth-child(5) { animation-delay: 140ms; }
.title-card > *:nth-child(6) { animation-delay: 175ms; }
.title-card > *:nth-child(7) { animation-delay: 210ms; }
.title-card > *:nth-child(8) { animation-delay: 245ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.title-card h1 { font-size: clamp(34px, 9vw, 44px); margin: 2px 0 10px; }
.lead { color: var(--hint); font-size: 15px; line-height: 1.45; margin: 0 0 16px; }
.lead b { color: var(--text); font-variant-numeric: tabular-nums; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; color: var(--hint); margin: 0 0 8px 4px; }
.field input {
  width: 100%; height: 50px; border-radius: 16px; border: 0;
  background: var(--fill); padding: 0 16px; font-size: 16px;
}
.field input::placeholder { color: var(--hint); }

.profiles { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.profiles::-webkit-scrollbar { display: none; }
.profile {
  flex: none; width: 168px; text-align: left; padding: 12px 14px; border-radius: 20px;
  background: var(--fill); scroll-snap-align: start;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
.profile b { display: block; font-size: 15px; margin-bottom: 4px; overflow-wrap: anywhere; hyphens: auto; }
.profile span { display: block; font-size: 12.5px; color: var(--hint); line-height: 1.3; }
.profile.active { background: color-mix(in srgb, var(--accent) 16%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.profile:active { transform: scale(.97); }

.segment { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 999px; padding: 3px; --x: 0; }
.segment::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 6px) / var(--n, 2)); border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 16px rgba(0, 0, 0, .3);
  transform: translateX(calc(var(--x) * 100%));
  transition: transform .42s cubic-bezier(.34, 1.36, .5, 1);
}
.segment button { position: relative; z-index: 1; height: 38px; border-radius: 999px; font-size: 14px; color: var(--hint); font-weight: 500; white-space: nowrap; padding: 0 8px; transition: color .18s var(--ease); }
.segment button.active { color: var(--text); font-weight: 600; }
.diary .segment { --n: 6; margin-bottom: 10px; }

.row { display: flex; gap: 10px; margin-top: 6px; }
.row > * { flex: 1; }
.primary, .secondary {
  height: 52px; border-radius: 999px; font-weight: 600; font-size: 16px; padding: 0 20px;
  transition: transform .18s var(--ease), filter .18s var(--ease);
}
.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent); }
.secondary { background: var(--fill); color: var(--accent); }
.primary:active, .secondary:active { transform: scale(.97); }
.primary.small { height: 40px; font-size: 14px; flex: none; padding: 0 16px; }
.sheet-inner > .primary { width: 100%; margin-top: 14px; }

.resume { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-radius: 20px; background: color-mix(in srgb, var(--gold) 14%, var(--card)); margin-bottom: 14px; }
.resume[hidden] { display: none; }
.resume div { flex: 1; min-width: 0; }
.resume b { display: block; font-size: 14px; }
.resume span { display: block; font-size: 12.5px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#sheet {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 12px);
  width: min(480px, calc(100% - 24px));
  max-height: min(66vh, 620px);
  overflow-y: auto;
  border-radius: 28px;
  transform: translate(-50%, 115%);
  transition: transform .46s var(--appear), opacity .2s var(--ease);
  opacity: 0;
  scrollbar-width: none;
}
#sheet::-webkit-scrollbar { display: none; }
#sheet.open { transform: translate(-50%, 0); opacity: 1; }
#sheet.leaving .sheet-inner { opacity: 0; transform: translateY(6px); }
.sheet-inner { padding: 18px 18px 18px; transition: opacity .16s var(--ease), transform .16s var(--ease); }
.sheet-inner > * { animation: rise .42s var(--appear) both; }
.sheet-title { font-size: 26px; margin-bottom: 8px; }
.sheet-title.hero { font-size: clamp(28px, 7.6vw, 36px); }
.sheet-text { margin: 0 0 14px; color: var(--text); opacity: .86; font-size: 15.5px; line-height: 1.45; }
.sheet-text.quote { font-size: 17px; opacity: 1; }
.sheet-note { margin: -6px 0 12px; font-size: 13px; color: var(--hint); }

.speaker { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border-radius: 999px; background: var(--fill); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.speaker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.speaker-dot.red { background: var(--bad); }
.speaker-dot.blue { background: var(--accent); }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px;
  padding: 10px 14px; border-radius: 20px; background: var(--fill); text-align: left;
  animation: rise .42s var(--appear) both; animation-delay: calc(var(--i) * 35ms + 60ms);
  transition: transform .18s var(--ease), background .18s var(--ease), opacity .2s var(--ease);
}
.choice:active { transform: scale(.98); }
.choice:disabled:not(.picked) { opacity: .45; }
.choice.picked { background: color-mix(in srgb, var(--accent) 22%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.choice-icon { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.choice.warn .choice-icon { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.choice.danger .choice-icon { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.choice-body { flex: 1; min-width: 0; }
.choice-label { display: block; font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.choice-sub { display: block; font-size: 13px; color: var(--hint); margin-top: 2px; }
.choice-badge { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 999px; background: var(--fill); color: var(--ok); font-variant-numeric: tabular-nums; }
.choice-badge.warn { color: var(--bad); }

.quiz-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dots { display: flex; gap: 5px; padding-top: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.dot.done { background: var(--ok); }
.dot.now { background: var(--text); transform: scale(1.25); }
.timer { height: 4px; border-radius: 999px; background: var(--fill); overflow: hidden; margin: 6px 0 14px; }
.timer span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); transform-origin: left; animation: drain linear forwards; }
.timer.stop span { animation-play-state: paused; }
@keyframes drain { to { transform: scaleX(0); } }
.question { font-size: 19px; line-height: 1.35; margin: 0 0 14px; font-weight: 650; }
.answers { display: grid; gap: 8px; }
.answer {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px;
  border-radius: 16px; background: var(--fill); text-align: left;
  animation: rise .4s var(--appear) both; animation-delay: calc(var(--i) * 35ms + 40ms);
  transition: transform .18s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.answer:active { transform: scale(.98); }
.answer-key { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .08); color: var(--hint); }
.answer-text { font-size: 15.5px; line-height: 1.3; }
.answer.right { background: color-mix(in srgb, var(--ok) 22%, var(--card)); box-shadow: inset 0 0 0 2px var(--ok); }
.answer.right .answer-key { background: var(--ok); color: #fff; }
.answer.wrong { background: color-mix(in srgb, var(--bad) 22%, var(--card)); box-shadow: inset 0 0 0 2px var(--bad); animation: shake .36s var(--ease); }
.answer.wrong .answer-key { background: var(--bad); color: #fff; }
.answer:disabled:not(.right):not(.wrong) { opacity: .5; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

#toasts { position: fixed; top: calc(var(--safe-top) + 72px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 5; width: min(480px, calc(100% - 24px)); }
.toast {
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(28, 28, 30, .86); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow);
  animation: toastIn .42s var(--spring) both; font-variant-numeric: tabular-nums; color: #f8f8fa;
}
.toast.plus { color: #6ee58e; }
.toast.minus { color: #ff7b72; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .4s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.9); } to { opacity: 1; transform: none; } }

#modal { position: fixed; inset: 0; display: grid; place-items: end center; padding: 16px 12px calc(var(--safe-bottom) + 12px); background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); z-index: 10; }
#modal.open { opacity: 1; pointer-events: auto; }
.modal-card { width: min(480px, 100%); max-height: 82vh; overflow-y: auto; border-radius: 28px; padding: 18px; background: var(--card); box-shadow: var(--shadow); transform: translateY(30px); transition: transform .46s var(--appear); }
#modal.open .modal-card { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }

.diary-day { font-family: var(--head); font-weight: 700; font-size: 17px; margin: 6px 4px 8px; }
.diary-table { border-radius: 20px; background: var(--fill); padding: 4px 0; }
.diary-row { display: grid; grid-template-columns: 48px 1fr auto 34px; align-items: center; gap: 8px; padding: 9px 12px; font-size: 14.5px; border-bottom: .5px solid rgba(255, 255, 255, .06); }
.diary-row:last-child { border-bottom: 0; }
.diary-row.current { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.d-time { color: var(--hint); font-variant-numeric: tabular-nums; font-size: 13px; }
.d-subject { font-weight: 550; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.d-room { color: var(--hint); font-size: 12.5px; }
.tag { font-size: 11px; font-weight: 600; color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); padding: 2px 7px; border-radius: 999px; }
.mark { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 15px; justify-self: end; }
.mark.empty { color: var(--hint); font-family: var(--body); }
.mark.g5 { color: #fff; background: var(--ok); }
.mark.g4 { color: #fff; background: #30b0c7; }
.mark.g3 { color: #1c1c1e; background: var(--gold); }
.mark.g2 { color: #fff; background: var(--bad); }
.mark.skip { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); font-family: var(--body); }
.remark { margin: 12px 0 0; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--bad) 10%, var(--card)); font-family: "Caveat", cursive; font-size: 21px; line-height: 1.2; color: #ff8d86; }
.remark span { display: block; font-family: var(--body); font-size: 12px; color: var(--hint); margin-bottom: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.stat { padding: 12px 10px; border-radius: 18px; background: var(--fill); }
.stat b { display: block; font-family: var(--head); font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--hint); }

#loader { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(120% 80% at 50% 20%, #0f2a5c, #05204a 45%, #020a18); z-index: 20; transition: opacity .5s var(--ease); }
#loader.hide { opacity: 0; pointer-events: none; }
.loader-inner { display: grid; justify-items: center; gap: 18px; }
.loader-mark { font-family: var(--head); font-weight: 700; font-size: 64px; color: var(--gold); letter-spacing: -.02em; text-shadow: 0 8px 30px rgba(255, 193, 7, .35); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); } }
.loader-bar { width: 180px; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--gold); transition: width .4s var(--ease); }
#loader-text { color: rgba(255, 255, 255, .6); font-size: 13px; }

@media (min-width: 900px) {
  #sheet { left: auto; right: 24px; transform: translate(0, 115%); bottom: 24px; }
  #sheet.open { transform: none; }
  #title { justify-content: flex-start; align-items: flex-end; padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

#hud button { font: inherit; color: inherit; }
.hud-left { background: none; border-radius: 999px; height: 44px; padding: 0 8px 0 0; text-align: left; }
.hud-left:active, .score:active, .energy:active { transform: scale(.96); }
.score, .energy { transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.score.pressed, .energy.pressed, .hud-left.pressed, .icon-btn.pressed { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }

#pop {
  position: fixed; z-index: 8; border-radius: 24px; padding: 14px 14px 12px;
  transform-origin: var(--ox, 50%) -10px; transform: translateY(-6px) scale(.86); opacity: 0; pointer-events: none;
  transition: transform .42s var(--spring), opacity .2s var(--ease);
  max-height: calc(100vh - 120px); overflow-y: auto;
}
#pop.open { transform: none; opacity: 1; pointer-events: auto; }
#pop::before { content: ""; position: absolute; top: -6px; left: calc(var(--ox, 50%) - 7px); width: 14px; height: 14px; background: inherit; border-left: 1px solid var(--glass-border); border-top: 1px solid var(--glass-border); transform: rotate(45deg); border-radius: 3px 0 0 0; }
.pop-title { font-family: var(--head); font-weight: 700; font-size: 16px; margin: 0 2px 10px; }
.pop-big { font-family: var(--head); font-weight: 700; font-size: 34px; line-height: 1; margin: 0 2px 12px; font-variant-numeric: tabular-nums; }
.pop-big span { display: block; font-family: var(--body); font-weight: 500; font-size: 13px; color: var(--hint); margin-top: 6px; }
.pop-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.pop-grid div { padding: 10px 12px; border-radius: 16px; background: var(--fill); }
.pop-grid b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.pop-grid span { font-size: 12px; color: var(--hint); }
.pop-list { border-radius: 16px; background: var(--fill); padding: 2px 0; margin-bottom: 10px; }
.pop-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 12px; font-size: 14px; }
.pop-list.compact .pop-row { grid-template-columns: 0 minmax(0, 1fr) auto; padding: 7px 12px; }
.pop-row span:first-child { color: var(--hint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pop-row.now { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.pop-row b { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.pop-row b.g5 { background: var(--ok); color: #fff; } .pop-row b.g4 { background: #30b0c7; color: #fff; } .pop-row b.g3 { background: var(--gold); color: #1c1c1e; } .pop-row b.g2 { background: var(--bad); color: #fff; }
.pop-row b.skip { color: var(--bad); } .pop-row b.plus { color: var(--ok); } .pop-row b.minus { color: var(--bad); }
.pop-bar { height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; margin: 0 2px 12px; }
.pop-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--ok), #8be28f); transition: width .46s var(--appear); }
.pop-bar.low span { background: linear-gradient(90deg, var(--bad), var(--gold)); }
.pop-note { margin: 0 2px; font-size: 12.5px; line-height: 1.4; color: var(--hint); }
.pop-slider { display: block; margin: 0 2px 12px; font-size: 13.5px; }
.pop-slider span { display: block; margin-bottom: 6px; }
.pop-slider input { width: 100%; accent-color: var(--accent); height: 28px; }
.secondary.small, .primary.small { height: 40px; font-size: 14px; padding: 0 16px; }
.wide { width: 100%; margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; background: var(--fill); font-size: 14px; font-weight: 550; line-height: 1.2; text-align: left; transition: transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease); }
.chip.active { background: color-mix(in srgb, var(--accent) 18%, var(--card)); box-shadow: inset 0 0 0 2px var(--accent); }
.chip:active { transform: scale(.96); }
.hint { margin: 8px 4px 0; font-size: 13px; color: var(--hint); min-height: 18px; }
.actions { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin-top: 4px; }
.actions .primary, .actions .secondary { white-space: nowrap; }

#bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.bubble { position: absolute; transform: translate(-50%, -100%); padding: 9px 14px; border-radius: 18px 18px 18px 6px; font-size: 14.5px; font-weight: 600; max-width: 220px; text-align: left; animation: pop .42s var(--spring) both; }
.bubble.out { opacity: 0; transform: translate(-50%, -120%); transition: all .4s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -80%) scale(.7); } to { opacity: 1; transform: translate(-50%, -100%) scale(1); } }

.toast.chat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border-radius: 18px; padding: 9px 14px; color: #f8f8fa; max-width: 100%; text-align: left; }
.toast.chat span { font-size: 11.5px; color: var(--gold); font-weight: 700; }

#draw { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 14, .55); opacity: 0; transition: opacity .3s var(--ease); }
#draw.open { opacity: 1; }
.draw-card { width: min(720px, 100%); border-radius: 28px; padding: 16px; background: var(--card); box-shadow: var(--shadow); transform: translateY(24px) scale(.97); transition: transform .46s var(--spring); }
#draw.open .draw-card { transform: none; }
.draw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.draw-board { border-radius: 18px; overflow: hidden; background: linear-gradient(135deg, #fbfcfd, #e8ecf0); box-shadow: inset 0 0 0 6px #c8ccd2, 0 10px 30px rgba(0, 0, 0, .25); aspect-ratio: 2 / 1; }
#draw-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.draw-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.swatches { display: flex; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25); transition: transform .18s var(--spring); }
.swatch.active { transform: scale(1.15); box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--accent); }
.swatch.eraser { background: repeating-linear-gradient(45deg, #f2f2f2 0 6px, #d8d8d8 6px 12px); }
.draw-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

.loader-beaver { width: 96px; height: 96px; animation: breathe 2.4s ease-in-out infinite; filter: drop-shadow(0 10px 24px rgba(0,0,0,.4)); }
.loader-mark { font-size: 40px; }
.back { display: inline-block; font-size: 13px; color: var(--accent); text-decoration: none; margin-bottom: 8px; }
#draw[hidden] { display: none; }

.actions { position: sticky; bottom: -20px; margin: 4px -20px -20px; padding: 12px 20px 20px; background: linear-gradient(180deg, transparent, var(--glass) 30%); }
@media (max-width: 420px), (max-height: 760px) {
  .title-card h1 { font-size: 32px; margin-bottom: 8px; }
  .title-card h1 br { display: none; }
  .lead { font-size: 14px; margin-bottom: 12px; }
  .field { margin-bottom: 11px; }
  .field input { height: 46px; }
  .chip { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
}

.title-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.title-body { overflow-y: auto; padding: 22px 20px 10px; scrollbar-width: none; min-height: 0; }
.title-body::-webkit-scrollbar { display: none; }
.title-body > * { animation: rise .46s var(--appear) both; }
.actions { position: static; margin: 0; padding: 12px 20px 18px; background: none; border-top: 1px solid var(--glass-border); flex: none; }
