@import url('fonts/fonts.css');

:root {
  --sky: #7FD8FF;
  --grass: #6BD26B;
  --ink: #372F5C;
  --ink-soft: #6A6296;
  --coral: #FF6B7A;
  --coral-dark: #E8495B;
  --orange: #FFA353;
  --orange-dark: #E8813A;
  --pink: #FF6FB0;
  --pink-dark: #E0489A;
  --amber: #FFD23F;
  --amber-dark: #F0B400;
  --purple: #8B5CF6;
  --purple-dark: #6D3FD1;
  --green: #4ADE80;
  --green-dark: #22B368;
  --blue: #5AC8FA;
  --blue-dark: #2E9FE0;
  --white: #FFFFFF;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 16px;

  /* semantic chrome tokens - swapped under dark mode below */
  --bg: var(--sky);
  --surface: var(--white);
  --surface-border: #D8D2F5;
  --text: var(--ink);
  --text-soft: var(--ink-soft);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1B1533;
    --surface: #2E2650;
    --surface-border: #4A3F7A;
    --text: #F5F2FF;
    --text-soft: #B6ACDC;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  margin: 0;
}

#app {
  max-width: 420px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.screen { display: flex; flex-direction: column; gap: 18px; }

.splash { align-items: center; padding-top: 12px; gap: 14px; }
.splash .brand { padding: 0; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: -4px; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--surface-border);
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }

.instructions .ready-card { text-align: left; }
.instructions .ready-card h2 { text-align: center; margin-bottom: 14px; }
.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.steps li { padding-left: 4px; }

.brand { text-align: center; padding: 4px 0; }
.suite-tag {
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 4px;
}
@keyframes mascotBounce {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}
.mascot-group {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 6px;
}
.mascot { display: block; animation: mascotBounce 2.6s ease-in-out infinite; }
.mascot-group .mascot:nth-child(1) { animation-delay: 0.3s; }
.mascot-group .mascot:nth-child(3) { animation-delay: 0.6s; }
.brand h1 {
  font-size: 78px;
  line-height: 0.92;
  margin-bottom: 14px;
  color: var(--coral);
  text-shadow: 0 7px 0 var(--coral-dark);
  letter-spacing: 0.5px;
  padding: 0 6px;
}
@keyframes letterWobble {
  0%, 100% { transform: translateY(0) rotate(var(--tilt, 0deg)); }
  50% { transform: translateY(-15px) rotate(calc(var(--tilt, 0deg) * -1)); }
}
.wobbly-word { display: inline-block; white-space: nowrap; }
.wobbly-letter {
  display: inline-block;
  animation: letterWobble 1.6s ease-in-out infinite;
}
.subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  box-shadow: 0 3px 0 var(--surface-border);
  margin: 18px 0 0;
}

.block-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.theme-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--surface);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--surface-border);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}
.theme-tile:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-border); }

.theme-tile.c-teal { background: var(--blue); color: var(--white); box-shadow: 0 5px 0 var(--blue-dark); }
.theme-tile.c-coral { background: var(--coral); color: var(--white); box-shadow: 0 5px 0 var(--coral-dark); }
.theme-tile.c-pink { background: var(--pink); color: var(--white); box-shadow: 0 5px 0 var(--pink-dark); }
.theme-tile.c-amber { background: var(--amber); color: var(--ink); box-shadow: 0 5px 0 var(--amber-dark); }
.theme-tile.c-green { background: var(--green); color: var(--white); box-shadow: 0 5px 0 var(--green-dark); }
.theme-tile.c-blue { background: var(--orange); color: var(--white); box-shadow: 0 5px 0 var(--orange-dark); }
.theme-tile.c-purple { background: var(--purple); color: var(--white); box-shadow: 0 5px 0 var(--purple-dark); }
.theme-tile:not(.selected) { opacity: 0.6; filter: saturate(0.65); }
.theme-tile.selected { opacity: 1; filter: none; transform: translateY(-2px); animation: tileSelect 0.3s ease; }

@keyframes tileSelect {
  0% { transform: scale(0.94) translateY(-2px); }
  60% { transform: scale(1.03) translateY(-2px); }
  100% { transform: scale(1) translateY(-2px); }
}

.tile-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-dark);
  border: none;
  box-shadow: 0 2px 5px rgba(55, 47, 92, 0.25);
}
.tile-check svg { width: 100%; height: 100%; display: block; }

.tile-icon { width: 28px; height: 28px; color: currentColor; }
.tile-icon svg { width: 100%; height: 100%; display: block; }
.tile-name { font-family: 'Fredoka', sans-serif; font-size: 14px; font-weight: 600; }
.tile-tag { font-size: 11px; opacity: 0.9; }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: 0 5px 0 var(--surface-border);
}
.step-btn {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--amber);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--amber-dark);
}
.step-btn:active { transform: translateY(3px); box-shadow: none; }
.step-value { font-family: 'Fredoka', sans-serif; font-size: 20px; font-weight: 700; }

.name-list { display: flex; flex-direction: column; gap: 8px; }
.name-row { display: flex; align-items: center; gap: 8px; }
.name-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--surface);
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 16px;
  box-sizing: border-box;
  box-shadow: 0 3px 0 var(--surface-border);
}
.block > .name-input, .screen > .name-input { width: 100%; flex: none; }
.name-input:focus { outline: 2px solid var(--purple); outline-offset: 1px; }
.name-score {
  flex-shrink: 0;
  font-family: 'Fredoka', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--amber);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  opacity: 0.55;
  box-shadow: 0 4px 0 var(--surface-border);
}
.mode-btn:active { transform: translateY(3px); box-shadow: none; }
.mode-btn.active {
  opacity: 1;
  background: var(--amber);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--amber-dark);
}
.mode-name { font-family: 'Fredoka', sans-serif; font-size: 14px; font-weight: 600; }
.mode-desc { font-size: 11px; line-height: 1.3; }

.cta {
  width: 100%;
  padding: 17px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--green);
  color: var(--white);
  font-family: 'Fredoka', sans-serif;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--green-dark);
}
.cta:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--green-dark); }

.cta.c-coral { background: var(--coral); box-shadow: 0 6px 0 var(--coral-dark); }
.cta.c-coral:active { box-shadow: 0 2px 0 var(--coral-dark); }

.ghost-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.footnote {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: -4px 0 0;
}

.pass-hint {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: none;
  box-shadow: 0 3px 0 var(--surface-border);
  border-radius: 999px;
  padding: 8px 16px;
  margin: 0 auto;
  width: fit-content;
}

.player-list { display: flex; flex-direction: column; gap: 10px; }
.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--surface);
  font-family: 'Fredoka', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 5px 0 var(--surface-border);
}
.player-row:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--surface-border); }
.player-row.seen { opacity: 0.5; box-shadow: none; cursor: default; }
.row-hint { font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 600; color: var(--text-soft); }

@keyframes cardPop {
  0% { transform: scale(0.9) rotate(-1deg); opacity: 0; }
  60% { transform: scale(1.03) rotate(0.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.word-card {
  background: var(--purple);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 7px 0 var(--purple-dark);
  padding: 40px 20px;
  text-align: center;
  color: var(--white);
  animation: cardPop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.word-card-label { font-size: 13px; font-weight: 700; opacity: 0.9; margin: 0 0 10px; }
.word-card-value {
  font-family: 'Fredoka', sans-serif;
  font-size: 36px;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
}

.imposter-card { background: var(--coral); box-shadow: 0 7px 0 var(--coral-dark); }
.imposter-value { font-size: 27px; }
.imposter-hint {
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 0;
  opacity: 0.95;
  line-height: 1.4;
}

.ready-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 0 var(--surface-border);
  padding: 28px 20px;
  text-align: center;
}
.ready-icon {
  display: inline-flex;
  width: 48px; height: 48px;
  padding: 12px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--green);
  border: none;
  box-shadow: 0 3px 8px rgba(55, 47, 92, 0.25);
  color: var(--white);
  margin-bottom: 10px;
}
.ready-icon svg { width: 100%; height: 100%; }
.ready-card h2 { font-size: 19px; margin-bottom: 6px; }
.ready-card p { font-size: 14px; font-weight: 600; color: var(--text-soft); margin: 0; }

@keyframes toastIn {
  0% { transform: translate(-50%, 12px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 0);
  background: var(--ink);
  color: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.25s ease;
  z-index: 100;
}

.cta.c-purple { background: var(--purple); box-shadow: 0 6px 0 var(--purple-dark); }
.cta.c-purple:active { box-shadow: 0 2px 0 var(--purple-dark); }
.cta:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.room-code { font-size: 46px; letter-spacing: 10px; padding-left: 10px; }
.code-input {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 8px;
  text-transform: uppercase;
}
.footnote.error { color: var(--coral-dark); font-weight: 700; min-height: 1em; }
@media (prefers-color-scheme: dark) { .footnote.error { color: var(--coral); } }

.player-row.static { cursor: default; }
.player-row.static:active { transform: none; box-shadow: 0 5px 0 var(--surface-border); }
.player-row { gap: 12px; }
.player-row.picked { background: var(--amber); color: var(--ink); box-shadow: 0 5px 0 var(--amber-dark); }
.player-row.picked .row-hint, .player-row.picked .clue-text { color: var(--ink); }
.clue-text { font-family: 'Nunito', sans-serif; font-size: 14px; font-weight: 700; text-align: right; word-break: break-word; }

.mode-toggle.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- footer links, safety sheet ---------- */
.splash-foot { display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--text-soft); font-size: 13px; margin-top: 4px; }
.link-btn { background: none; border: none; padding: 6px 2px; color: var(--text-soft); font: 700 13px 'Nunito', sans-serif; text-decoration: none; cursor: pointer; }
.footnote.small { font-size: 11.5px; line-height: 1.45; color: var(--text-soft); margin-top: 4px; }
.footnote.small a { color: var(--text-soft); font-weight: 800; }
.ghost-btn.small { font-size: 12.5px; padding: 8px; opacity: 0.85; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 14, 40, 0.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fadeIn 0.15s ease-out; }
.sheet { width: 100%; max-width: 460px; background: var(--surface); color: var(--text); border-radius: 26px 26px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: sheetUp 0.22s ease-out; max-height: 85vh; overflow-y: auto; }
.sheet h2 { font-size: 22px; }
.sheet-note { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-soft); }
.safety-list { display: flex; flex-direction: column; gap: 10px; }
.safety-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 2px solid var(--surface-border); }
.safety-name { font: 600 16px 'Fredoka', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.safety-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chip-btn { border: none; border-radius: 999px; padding: 8px 12px; font: 800 12.5px 'Nunito', sans-serif; background: var(--surface-border); color: var(--text); cursor: pointer; }
.chip-btn.warn { background: var(--coral); color: var(--white); }
.chip-btn:disabled { opacity: 0.5; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-backdrop, .sheet { animation: none; } }

/* ---------- word reveal ---------- */
.word-screen { min-height: calc(100vh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); justify-content: center; }
.word-mascot { display: flex; justify-content: center; margin-bottom: -6px; }
.word-mascot .mascot { animation: mascotPop 0.5s cubic-bezier(.2,1.4,.4,1) both, mascotBounce 2.6s ease-in-out 0.5s infinite; }
.word-mascot.sneaky .mascot { animation: mascotPop 0.5s cubic-bezier(.2,1.4,.4,1) both, sneak 1.8s ease-in-out 0.5s infinite; }
.word-tip { text-align: center; font-size: 14px; font-weight: 700; line-height: 1.45; color: var(--text-soft); margin: 0 12px; }
@keyframes mascotPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sneak { 0%, 100% { transform: translateX(0) rotate(0); } 30% { transform: translateX(-10px) rotate(-6deg); } 70% { transform: translateX(10px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .word-mascot .mascot { animation: none !important; } }
