@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0d0a09;
  --surface: #1c1b1b;
  --surface-2: #2e2c2c;
  --line: rgba(255, 255, 255, .13);
  --label: #f7f5f3;
  --label-2: #bdb9b6;
  --label-3: #9f9b98;
  --accent: #ff5a36;
  --radius-l: 22px;
  --radius-m: 15px;
  --spring: cubic-bezier(.2, .9, .25, 1.1);
  --ease: cubic-bezier(.3, .7, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
/* Stops double-tap zoom while tapping fast. Pinch zoom keeps working. */
html, button, label, input, textarea { touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button:not(:disabled), label, input[type="checkbox"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -.012em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 1.2s var(--ease);
}

/* The background colour is a phase signal: you can see from across the room whether it is night. */
body[data-mood="cah"] { --bg: #0a0a0a; }
body[data-mood="night"] { --bg: #080b1c; }
body[data-mood="day"] { --bg: #2b1707; }
body[data-mood="win"] { --bg: #2e2206; }
body[data-mood="lose"] { --bg: #220709; }

#root {
  max-width: 620px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 76px) 16px 32px;
  min-height: calc(100dvh - 44px); display: flex; flex-direction: column; gap: 20px;
}
#root.enter { animation: phase .4s var(--ease); }
@keyframes phase { from { opacity: 0; } }

.foot { text-align: center; color: var(--label-3); font-size: 13px; padding: 0 16px calc(env(safe-area-inset-bottom) + 16px); }

.island {
  position: fixed; z-index: 20; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 16px; border-radius: 19px;
  background: #000; border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; white-space: nowrap; max-width: calc(100vw - 132px);
}
.island .muted { color: var(--label-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.island.pulse { animation: pulse .45s var(--spring); }
@keyframes pulse { 40% { transform: translateX(-50%) scale(1.08); } }

.sound {
  position: fixed; z-index: 21; top: calc(env(safe-area-inset-top) + 9px); right: 12px;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--label); font-size: 17px; display: grid; place-items: center;
}
.sound:hover { background: var(--surface-2); }
/* The only blurred surface: it floats over live game content that must stay readable behind it. */
.sound-menu {
  position: fixed; z-index: 22; top: calc(env(safe-area-inset-top) + 60px); right: 12px; width: 230px; padding: 6px;
  border-radius: var(--radius-m); background: rgba(28, 27, 27, .82); border: 1px solid var(--line);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.sound-menu label { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 12px; font-size: 15px; }

.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 27px; border-radius: 14px; background: #636060; position: relative; margin: 0; transition: background .25s; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 23px; height: 23px; border-radius: 50%; background: #fff; transition: transform .3s var(--spring); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(17px); }

h1, h2, h3, p { margin: 0; }
.display { font-size: clamp(60px, 18vw, 104px); line-height: .96; font-weight: 760; letter-spacing: -.05em; }
.title { font-size: 30px; line-height: 1.12; font-weight: 700; letter-spacing: -.03em; overflow-wrap: anywhere; }
.sub { color: var(--label-2); }
.caption { font-size: 14px; color: var(--label-2); letter-spacing: -.005em; }
.label { font-size: 15px; font-weight: 600; color: var(--label-2); }

/* The 1 to 10 heat scale is the identity motif of the whole product. */
.ten { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; font-weight: 760; font-size: clamp(22px, 6.6vw, 38px); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.ten span { text-align: center; }

.card { background: var(--surface); border-radius: var(--radius-l); padding: 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; align-items: center; justify-content: center; }

.btn {
  appearance: none; border: 0; font: inherit; font-weight: 600; letter-spacing: -.015em; color: #000; background: #fff;
  min-height: 52px; padding: 14px 22px; border-radius: 15px; width: 100%;
  transition: transform .2s var(--spring), background .2s, opacity .2s;
}
.btn:hover:not(:disabled) { background: #dedad7; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { background: var(--surface-2); color: var(--label-3); }
.btn.hot { background: var(--accent); }
.btn.hot:hover:not(:disabled) { background: #ff7a5c; }
.btn.hot:disabled { background: var(--surface-2); }
.btn.quiet { color: var(--label); background: var(--surface-2); }
.btn.quiet:hover:not(:disabled) { background: #3d3a3a; }
.btn.bare { color: var(--label-2); background: none; min-height: 44px; padding: 8px 12px; font-weight: 500; font-size: 15px; width: auto; text-decoration: underline; text-underline-offset: 3px; }
.btn.bare:hover:not(:disabled) { color: var(--label); background: none; }

.field {
  width: 100%; font: inherit; color: var(--label); background: var(--surface-2); border: 1px solid transparent;
  border-radius: 13px; padding: 13px 15px; min-height: 50px; transition: border-color .2s; resize: none;
}
.field:hover { border-color: var(--line); }
.field::placeholder { color: var(--label-3); }
.field.code { text-transform: uppercase; letter-spacing: .24em; font-weight: 700; text-align: center; }

.segmented { display: flex; padding: 2px; border-radius: 12px; background: var(--surface-2); }
.segmented button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: none; color: var(--label); font: inherit; font-size: 15px; font-weight: 500; }
.segmented button:hover:not(:disabled) { background: #3d3a3a; }
.segmented button[aria-pressed="true"] { background: #fff; color: #000; font-weight: 650; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: none; color: var(--label-2); border-radius: 12px; padding: 8px 14px; font: inherit; font-size: 15px; min-height: 44px; }
.chip:hover:not(:disabled) { color: var(--label); border-color: var(--label-3); }
.chip[aria-pressed="true"] { color: #000; background: #fff; font-weight: 600; }

.hero { padding: 6vh 0 4px; display: flex; flex-direction: column; gap: 16px; }

.picker { display: flex; flex-direction: column; }
.game { display: block; width: 100%; text-align: left; padding: 13px 0; color: inherit; font: inherit; background: none; border: 0; border-top: 1px solid var(--line); }
.game:first-child { border-top: 0; }
.game:hover:not(:disabled) strong { text-decoration: underline; text-underline-offset: 3px; }
.game strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.025em; color: var(--label-2); }
.game[aria-pressed="true"] strong { color: var(--accent); }
.game:disabled .caption { color: var(--label-3); }

.roomcode { font-size: 64px; line-height: 1; font-weight: 760; letter-spacing: .08em; font-variant-numeric: tabular-nums; background: none; border: 0; color: inherit; padding: 0; font-family: inherit; margin-right: -.08em; min-height: 44px; }
.roomcode:hover { color: var(--label-2); }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 14px 6px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.person > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--label-2); }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); color: var(--label); display: grid; place-items: center; font-weight: 650; font-size: 20px; position: relative; flex: none; }
.avatar.mini { width: 30px; height: 30px; font-size: 13px; }
.avatar.me { box-shadow: inset 0 0 0 2px #fff; }
.avatar.off { opacity: .45; }
.avatar.done { background: var(--accent); color: #000; }

.theme { display: flex; flex-direction: column; gap: 14px; }
.scale { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--label-2); }
.scale .bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, #5ac8fa, #8e5cf0, #e048b0, #ff5a36, #ffd60a); }
.scale .ends { display: flex; justify-content: space-between; gap: 16px; }
.scale .ends span:last-child { text-align: right; }

.secret { width: 100%; border: 0; color: inherit; font: inherit; border-radius: var(--radius-l); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--surface); overflow: hidden; }
.secret:hover { background: #242222; }
.secret b { font-size: 120px; line-height: 1; font-weight: 760; letter-spacing: -.05em; transition: filter .3s var(--ease); font-variant-numeric: tabular-nums; }
.secret.hidden b { filter: blur(26px); color: #777 !important; }

.ladder { display: flex; flex-direction: column; gap: 8px; }
.rung { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-m); background: var(--surface); transition: transform .3s var(--spring), background .3s; }
.rung.drag { transition: none; z-index: 5; position: relative; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.rung.mine { box-shadow: inset 0 0 0 1px var(--label-3); }
.rung.wrong { background: #4c1216; animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.rung .text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rung .by { font-size: 14px; color: var(--label-2); }
.tile { flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); color: var(--label-2); display: grid; place-items: center; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.tile.open { color: #000; }
.tile.fresh { animation: flip .55s var(--spring); }
@keyframes flip { from { transform: perspective(300px) rotateY(100deg); opacity: .2; } }
.grip { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--label-2); font-size: 20px; touch-action: none; border-radius: 12px; }
.grip:hover { background: var(--surface-2); color: var(--label); }
button.grip { cursor: grab; }
button.grip:active { cursor: grabbing; }

.blackcard { background: #000; border: 1px solid rgba(255, 255, 255, .26); border-radius: var(--radius-l); padding: 24px 22px; font-size: 27px; font-weight: 700; line-height: 1.2; letter-spacing: -.03em; overflow-wrap: anywhere; }
.blackcard .blank { display: inline-block; min-width: 3.4em; border-bottom: 2.5px solid currentColor; }
.fill { color: var(--accent); }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.white { position: relative; text-align: left; border: 0; border-radius: var(--radius-m); padding: 14px; min-height: 118px; background: #f7f5f3; color: #000; font: inherit; font-size: 16px; font-weight: 600; line-height: 1.22; letter-spacing: -.02em; overflow-wrap: anywhere; transition: transform .25s var(--spring); }
.white:hover { background: #fff; }
.white:active { transform: scale(.97); }
.white[aria-pressed="true"] { transform: translateY(-5px); box-shadow: 0 0 0 3px var(--accent); }
.white .badge { position: absolute; right: 10px; bottom: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #000; font-size: 13px; display: grid; place-items: center; }
.answer { text-align: left; width: 100%; border: 0; border-radius: var(--radius-m); padding: 16px; background: var(--surface); color: inherit; font: inherit; font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; overflow-wrap: anywhere; min-height: 44px; }
button.answer { transition: transform .2s var(--spring), background .2s; }
button.answer:hover { background: var(--surface-2); }
button.answer:active { transform: scale(.98); }
.answer.won { box-shadow: 0 0 0 2px var(--accent); }
.answer small { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--label-2); letter-spacing: -.005em; }
.board { display: flex; flex-direction: column; gap: 6px; }
.board .row { font-size: 15px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }

.rolecard { display: block; width: 100%; border: 0; border-radius: var(--radius-m); padding: 12px 14px; background: var(--surface); color: inherit; font: inherit; text-align: left; min-height: 44px; }
.rolecard:hover { background: var(--surface-2); }
.rolecard .blurred { filter: blur(9px); user-select: none; }
.villagers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.villager { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 2px solid transparent; border-radius: var(--radius-m); background: var(--surface); color: inherit; font: inherit; font-size: 14px; min-width: 0; min-height: 44px; transition: background .2s, border-color .2s; }
.villager:hover:not(:disabled) { background: var(--surface-2); }
.villager span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.villager em { font-style: normal; font-size: 13px; color: var(--label-2); }
.villager.dead span { text-decoration: line-through; color: var(--label-3); }
.villager[aria-pressed="true"] { border-color: var(--accent); }

/* Keeps the confirm button in view on short phones while the player list scrolls behind it. */
.dock { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 6; }

.chat { display: flex; flex-direction: column; gap: 10px; }
.bubbles { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; overscroll-behavior: contain; }
.bubble { align-self: flex-start; max-width: 84%; padding: 8px 13px; border-radius: 16px; background: var(--surface-2); font-size: 15px; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: #fff; color: #000; }
.bubble.wolf { background: #5c1a12; }
.bubble.ghost { font-style: italic; }
.bubble b { display: block; font-size: 13px; font-weight: 600; color: var(--label-2); }

/* Runs for about five seconds and then rests, so a long wait has no endless motion. */
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--surface-2); border-top-color: #fff; animation: spin .9s linear 6; }
@keyframes spin { to { transform: rotate(360deg); } }

.reactions { display: flex; justify-content: center; gap: 2px; padding: 3px; border-radius: 16px; background: var(--surface); align-self: center; max-width: 100%; }
.reactions button { width: 44px; height: 44px; border: 0; border-radius: 13px; background: none; font-size: 22px; transition: transform .2s var(--spring); }
.reactions button:hover { background: var(--surface-2); }
.reactions button:active { transform: scale(1.3); }
.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.floater { position: absolute; bottom: 70px; display: flex; flex-direction: column; align-items: center; font-size: 38px; animation: float 2.4s var(--ease) forwards; }
.floater small { font-size: 12px; font-weight: 600; background: #000; padding: 1px 8px; border-radius: 9px; }
@keyframes float { 0% { transform: translateY(20px); opacity: 0; } 15% { transform: none; opacity: 1; } 100% { transform: translateY(-58vh); opacity: 0; } }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 24px); opacity: 0; width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: #fff; color: #000; font-size: 15px; font-weight: 500; pointer-events: none; transition: opacity .25s, transform .3s var(--spring); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.gate { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.bigresult { padding: 5vh 0 2vh; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.bigresult .display { overflow-wrap: anywhere; font-size: clamp(46px, 13vw, 84px); }

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