/* The local OFL card face keeps long grid words readable on narrow phones. */
@font-face {
  font-family: "Chameleon Cards";
  src: url("fonts/BarlowCondensed-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Chameleon — a sunny tabletop game, made for one thumb or a whole table. */
:root {
  color-scheme: light;
  --paper: #f5f3e7; --card: #fffef7; --ink: #173d35; --muted: #52685b; --line: #cbd2bd;
  --lime: #bfe65c; --lime-soft: #e8efcb; --amber: #f8ce67; --amber-soft: #f9eac2;
  --coral: #ee8267; --coral-soft: #fae1d6; --error: #9c3826;
  --radius: 16px; --radius-sm: 12px; --shadow: 0 12px 32px -16px rgb(23 61 53 / 28%);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font: "Avenir Next", Avenir, "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  font-family: var(--font); color: var(--ink); background: var(--paper);
  font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; scrollbar-color: #8a9b76 var(--paper); scrollbar-width: thin; }
body { margin: 0; min-height: 100dvh; touch-action: manipulation; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-appearance: none; appearance: none; }
button, a, input { touch-action: manipulation; }
button:disabled { cursor: default; }
button svg, a svg { flex: 0 0 auto; pointer-events: none; }
button svg, .icon { width: 22px; height: 22px; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1.5px; }
input { min-width: 0; caret-color: var(--ink); }
input::placeholder { color: #687761; opacity: 1; }
::selection { background: var(--lime); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
h1:focus { outline: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { line-height: 1.55; }
h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 850; overflow-wrap: anywhere; }
h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
h3 { font-size: 1.12rem; line-height: 1.35; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* The small, steady header stays out of the way of the game. */
.topbar { max-width: 1112px; margin: 0 auto; min-height: calc(80px + var(--sat)); padding: calc(16px + var(--sat)) 32px 12px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 0 5px 0 0; min-height: 44px; border: 0; background: transparent; font-size: 1.3rem; font-weight: 850; letter-spacing: -.035em; }
.brand > svg, .brand .mascot { width: 44px; height: 44px; }
.header-actions, #header-context { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 46px; height: 46px; min-width: 46px; padding: 10px; background: transparent; border: 1px solid var(--line); border-radius: 50%; transition: background 160ms ease, transform 160ms var(--ease); }
.icon-btn:active { transform: scale(.92); }
.icon-btn[aria-pressed="true"] { background: var(--amber-soft); }
.icon-btn .icon { width: 22px; height: 22px; }
#app { width: min(100%, 1064px); margin: 0 auto; padding: 18px 32px calc(44px + var(--sab)); }
.screen { min-width: 0; }
.screen.home { padding-top: 34px; }
.screen.friends { max-width: 860px; margin: 12px auto 0; }
.screen.result { max-width: 750px; margin: 0 auto; }
.footer-note { margin-top: 28px; text-align: center; font-size: .82rem; color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-title > span { color: var(--muted); font-size: .76rem; text-align: right; }
.section-title > h2 { font-size: 1.12rem; }

/* A creature and three clues are the invitation. */
.home-layout { display: grid; grid-template-columns: .95fr 1.05fr; gap: 28px; align-items: center; min-height: 465px; }
.home-copy { min-width: 0; position: relative; z-index: 2; padding-bottom: 14px; }
.home h1 { font-size: clamp(3.1rem, 6.1vw, 4.9rem); line-height: 1.025; letter-spacing: -.04em; font-weight: 900; max-width: 10ch; }
.home h1 em { font-style: normal; color: #628128; }
.home .tagline { max-width: 29ch; margin-top: 22px; font-size: 1.08rem; color: var(--muted); }
.home-actions { display: grid; gap: 11px; max-width: 335px; margin-top: 28px; width: 100%; }
.home-actions .btn { min-height: 56px; }
.home-meta { max-width: 350px; margin-top: 18px; color: var(--muted); font-size: .82rem; }
.hero-art { position: relative; min-width: 0; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.hero-art > .mascot { width: 114%; max-width: none; margin: 29px -7% 0; }
.clue-bubble { position: absolute; display: inline-flex; align-items: center; gap: 8px; padding: 13px 20px; border-radius: 16px 16px 16px 3px; font-weight: 850; font-size: 1.2rem; background: var(--card); color: var(--ink); box-shadow: var(--shadow); z-index: 2; }
.clue-bubble .icon { width: 18px; height: 18px; }
.bubble-1 { left: 0; top: 21%; transform: rotate(-8deg); background: var(--amber); }
.bubble-2 { right: 0; top: 8%; transform: rotate(7deg); background: var(--coral); }
.bubble-3 { right: -1%; bottom: 14%; transform: rotate(-5deg); background: var(--lime); }
.hero-note { position: absolute; bottom: 2%; left: 12%; right: 12%; text-align: center; color: var(--muted); font-size: .86rem; }
.personal-best { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 18px; color: var(--muted); font-size: .87rem; }
.personal-best .icon { width: 19px; height: 19px; color: var(--ink); }
.personal-best strong { color: var(--ink); }
.home-copy .personal-best { justify-content: flex-start; }

/* One shared control family. */
.btn { width: 100%; min-height: 52px; padding: 14px 20px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 800; line-height: 1.2; text-align: center; background: var(--lime-soft); color: var(--ink); text-decoration: none; transition: transform 170ms var(--ease), background 170ms ease, box-shadow 170ms ease; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.secondary { background: transparent; border-color: #9bab91; }
.btn.quiet { width: auto; background: transparent; color: var(--muted); padding-left: 12px; padding-right: 12px; }
.btn.danger { background: var(--coral-soft); color: var(--error); }
.btn.small { width: auto; min-height: 44px; padding: 11px 15px; font-size: .9rem; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.975); }
.btn:disabled { background: #dce1ce; color: #566951; border-color: transparent; opacity: .8; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after { content: ""; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: loading-turn 750ms linear infinite; }
.action-row { display: flex; gap: 10px; width: 100%; margin-top: 24px; }
.action-row .btn { flex: 1; }
.action-row .btn.quiet { flex: 0 0 auto; }

/* Three visible rounds, a single next decision. */
.roundbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 12px; }
.roundbar > span:not(.score-chip) { color: var(--muted); font-size: .84rem; }
.round-progress { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; font-weight: 750; }
.round-progress > span:last-child { margin-left: 4px; }
.round-progress .step { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 7px; background: #e1e5d3; border-radius: 50%; font-size: .78rem; font-variant-numeric: tabular-nums; }
.round-progress .step.active { background: var(--ink); color: var(--paper); }
.round-progress .step.done { background: var(--lime); color: var(--ink); }
.round-progress .step .icon { width: 15px; height: 15px; }
.score-chip { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 13px; min-height: 38px; background: var(--amber-soft); border-radius: 12px; color: var(--ink); font-size: .85rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.score-chip strong { font-size: 1.08rem; font-weight: 850; }
.score-chip .icon { width: 18px; height: 18px; }
.game-heading { margin: 18px 0 26px; }
.game-heading .help, .help { margin-top: 10px; font-size: .99rem; color: var(--muted); max-width: 65ch; }
.game-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: start; }
.play-area, .side-area { min-width: 0; }
.side-area > h2 { margin-bottom: 15px; }
.role-strip { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; padding: 14px 18px; border-radius: var(--radius); background: var(--ink); color: var(--paper); }
.solo > .role-strip { max-width: 100%; }
.role-strip > span { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.secret-label { display: block; font-size: .86rem; font-weight: 650; color: #dce6cc; }
.role-strip strong { display: block; font-size: 1.47rem; line-height: 1.2; font-weight: 850; text-wrap: balance; }
.role-strip .icon-btn { border-color: #668577; color: var(--paper); }
.role-strip.chameleon, .role-strip.bluffer { color: var(--ink); background: var(--coral-soft); }
.role-strip.chameleon .secret-label, .role-strip.bluffer .secret-label { color: #765040; }
.solo.role-bluff > .role-strip { color: var(--ink); background: var(--coral-soft); }
.solo.role-bluff > .role-strip .secret-label { color: #765040; }
.theme-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 1px 12px; }
.theme-name, .theme-line > strong { display: inline-flex; align-items: center; gap: 7px; font-size: .95rem; font-weight: 800; }
.round-label, .theme-line > span { color: var(--muted); font-size: .77rem; text-align: right; }
.word-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.word-tile { position: relative; min-width: 0; min-height: 65px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: 700 1.125rem/1.15 "Chameleon Cards", var(--font); text-align: center; text-wrap: balance; overflow-wrap: normal; transition: transform 160ms var(--ease), background 160ms ease, border-color 160ms ease; }
div.word-tile { cursor: default; }
.word-tile:disabled { opacity: 1; }
.word-tile.secret { background: var(--lime); border-color: #759d36; }
.word-tile.selected, .word-tile[aria-pressed="true"] { background: var(--amber); border-color: var(--ink); }
.word-tile.answer { background: var(--lime); border-color: var(--ink); animation: answer-pop 480ms var(--ease); }
.word-tile.wrong { background: var(--coral-soft); border-color: #b75c46; }
.tile-mark { display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-size: .6rem; font-weight: 800; line-height: 1; margin: 4px 0 -3px; }

/* The clue is the star of each player's card. */
.players-grid, .clue-line { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clue-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.player-card { position: relative; min-width: 0; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: center; padding: 13px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); text-align: left; transition: transform 180ms var(--ease), border-color 180ms ease, background 180ms ease; }
.player-card .avatar { width: 34px; height: 34px; }
.player-card .player-name { grid-column: 2; align-self: center; font-size: .86rem; line-height: 1.2; }
.player-card .clue-word { grid-column: 1 / -1; font-size: clamp(1.2rem, 2.2vw, 1.72rem); font-weight: 850; letter-spacing: -.03em; line-height: 1.18; padding: 6px 0 3px; overflow-wrap: anywhere; }
.player-card .player-status { grid-column: 1 / -1; min-height: 15px; color: var(--muted); font-size: .73rem; font-weight: 600; }
.player-card.suspect { border-color: #94a977; }
.player-card.selected, .player-card[aria-pressed="true"] { background: var(--lime-soft); border-color: var(--ink); }
.player-card.is-you { background: #ecefde; }
.player-card.active { border-color: #557843; background: var(--lime-soft); }
.player-card.locked { border-color: #a7b493; }
.player-card.bluffer { background: var(--coral-soft); border-color: #b05f47; }
.player-card.bluffer .player-status { color: #884b37; font-weight: 800; }
.player-card:active:not(:disabled) { transform: scale(.97) rotate(-.5deg); }
.player-card:disabled { cursor: default; }
.clue-line .player-card { grid-template-columns: 26px minmax(0, 1fr); padding: 10px; gap: 6px; }
.clue-line .player-card .avatar { width: 26px; height: 26px; font-size: .8rem; }
.clue-line .player-card .player-name { font-size: .8125rem; }
.clue-line .player-card .clue-word { font-size: 1.15rem; padding: 5px 0 2px; }
.clue-line .player-card .player-status { font-size: .7rem; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: var(--lime-soft); font-size: .95rem; font-weight: 850; overflow: hidden; }
.avatar .mascot { width: 100%; height: 100%; }
.color-green { background: var(--lime); }
.color-pink { background: #efb0b7; }
.color-yellow { background: var(--amber); }
.color-blue { background: #99cbd1; }
.player-name { min-width: 0; overflow-wrap: anywhere; font-weight: 800; }
.player-name small { display: block; margin-top: 4px; color: var(--muted); font-size: .73rem; font-weight: 550; }
.vote-actions { margin-top: 16px; display: grid; gap: 10px; }
.waiting-note { margin-top: 14px; color: var(--muted); font-size: .89rem; text-align: center; }
.waiting-note strong { color: var(--ink); }

/* Forms are decisions, not setup hurdles. */
.clue-form { margin-top: 22px; }
.clue-form label, .friends-form label { display: block; margin-bottom: 8px; font-size: .88rem; font-weight: 800; }
.input-row { display: flex; align-items: stretch; gap: 8px; }
.input-row .btn { width: auto; flex: 0 0 auto; padding-left: 17px; padding-right: 17px; }
input[type="text"], input[type="search"], input:not([type]) { width: 100%; min-height: 52px; border: 1px solid #7f916e; border-radius: var(--radius-sm); padding: 12px 15px; background: var(--card); color: var(--ink); font-size: 1rem; font-weight: 650; line-height: 1.3; }
input[aria-invalid="true"] { border-color: var(--error); outline-color: var(--error); background: #fff7f1; }
input:disabled { background: #e7eadb; color: var(--muted); }
.field-error { min-height: 0; margin-top: 8px; color: var(--error); font-size: .83rem; font-weight: 650; }
.field-error:empty { display: none; }
.form-help { margin-top: 8px; color: var(--muted); font-size: .76rem; }
.friends-layout { display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: 32px; }
.friends-art { min-width: 0; }
.friends-art .mascot { width: 100%; }
.friends-form { max-width: 430px; width: 100%; margin: 0 auto; }
.friends-form label:not(:first-child) { margin-top: 18px; }
.friends-form .btn[type="submit"] { margin-top: 18px; }
.mode-tabs { display: flex; gap: 4px; padding: 4px; background: #e3e7d5; border-radius: var(--radius); margin: 10px 0 22px; }
.mode-tabs .btn { flex: 1; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; font-size: .87rem; font-weight: 800; }
.mode-tabs .btn.selected { background: var(--card); }
.friends > .game-heading { text-align: center; }
.friends > .game-heading .help { margin-left: auto; margin-right: auto; }
.color-picker { margin: 20px 0 0; padding: 0; border: 0; display: flex; gap: 10px; }
.color-picker legend { padding: 0; margin-bottom: 9px; font-size: .88rem; font-weight: 800; }
.color-choice { display: inline-flex; align-items: center; justify-content: center; height: 46px; width: 46px; padding: 10px; border: 2px solid transparent; border-radius: 50%; }
.color-choice.selected { border-color: var(--ink); }
.notice { margin: 16px 0; padding: 14px 16px; background: var(--amber-soft); color: #5c4b22; border-radius: var(--radius-sm); font-size: .87rem; line-height: 1.45; }
.notice.error { background: var(--coral-soft); color: var(--error); }
.connection-banner { margin: 0 auto 14px; padding: 12px 16px; max-width: 1000px; background: var(--amber-soft); color: #5c4b22; text-align: center; font-size: .86rem; line-height: 1.4; border-radius: 12px; }

/* The invitation reads cleanly across a real table. */
.room-chip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; min-height: 44px; background: var(--lime-soft); color: var(--ink); border: 0; border-radius: 10px; font-weight: 800; letter-spacing: .06em; font-size: .88rem; }
.room-chip .icon { width: 16px; height: 16px; }
.lobby-layout { display: grid; grid-template-columns: .95fr 1.05fr; gap: 35px; align-items: start; }
.invite-panel { padding: 26px; background: var(--ink); color: var(--paper); border-radius: var(--radius); text-align: center; }
.invite-panel h2 { font-size: 1.2rem; }
.room-code { display: block; margin: 15px 0 19px; font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 900; line-height: 1; letter-spacing: .13em; text-indent: .13em; font-variant-numeric: tabular-nums; }
.qr-code { display: block; width: min(190px, 100%); height: auto; margin: 0 auto 20px; padding: 11px; background: #fff; border-radius: 12px; }
.qr-code img, .qr-code svg { display: block; width: 100%; height: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row .btn { min-height: 48px; }
.invite-panel .btn.primary { color: var(--ink); background: var(--lime); }
.invite-panel .btn.secondary { color: var(--paper); border-color: #8ba281; }
.invite-panel .btn.quiet { color: var(--paper); }
.invite-panel :focus-visible { outline-color: var(--lime); }
.join-link { margin: 14px auto 0; max-width: 100%; display: block; color: #deead3; font-size: .73rem; line-height: 1.5; overflow-wrap: anywhere; }
.seats-panel { min-width: 0; }
.seat-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.seat { min-width: 0; min-height: 68px; padding: 12px 0; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.seat .player-name { flex: 1; }
.seat > .icon { width: 20px; height: 20px; }
.seats-panel > .btn { margin-top: 20px; }
.seats-panel > .btn.quiet { margin-top: 10px; }
.turn-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.turn-item { display: flex; align-items: center; gap: 10px; min-height: 59px; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: .88rem; }
.turn-item .player-name { flex: 1; }
.turn-item .player-status { font-size: .73rem; color: var(--muted); }
.turn-item .avatar { width: 35px; height: 35px; }
.turn-item.current .avatar { background: var(--lime); }
.turn-item.current .player-status { color: #3e652e; font-weight: 800; }
.turn-item.away .player-status { color: #8e593a; }
.turn-item.done .icon { width: 18px; height: 18px; }
.cover-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; width: 100%; min-height: 290px; padding: 22px; border: 0; border-radius: var(--radius); color: var(--ink); background: var(--lime-soft); text-align: center; }
.cover-card .mascot { width: 190px; height: 130px; }
.cover-card strong { font-size: 1.5rem; }
.cover-card span { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: .88rem; }
.cover-card.flipped { background: var(--amber-soft); animation: answer-pop 460ms var(--ease); }
.cover-card.flipped strong { font-size: 2.1rem; }
.cover-card .private-note { font-size: .78rem; }
.role-screen { max-width: 600px; margin: 0 auto; }
.party .side-area > .btn { margin-top: 18px; }
.party.voting { max-width: 730px; margin: 0 auto; }
.voting .players-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.voting > .btn.primary { margin-top: 20px; }
.vote-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 20px; color: var(--muted); font-size: .86rem; }
#countdown { color: #795b20; background: var(--amber-soft); border-radius: 8px; padding: 7px 10px; font-weight: 750; font-variant-numeric: tabular-nums; }
.grid-details, .vote-details { width: 100%; margin-top: 24px; border-top: 1px solid var(--line); }
summary { min-height: 48px; padding: 15px 0; cursor: pointer; font-size: .87rem; font-weight: 750; text-align: left; }
summary::marker { color: #64874c; }
.vote-recap { padding: 0 0 10px; }
.vote-recap p { display: flex; align-items: center; gap: 9px; font-size: .83rem; margin: 8px 0; text-align: left; }
.vote-recap .icon { width: 16px; height: 16px; }

/* The answer gets the only big entrance. */
.round-result { display: flex; flex-direction: column; align-items: center; padding: 10px 0 0; text-align: center; }
.result-art { width: 245px; max-width: 100%; margin: 0 auto; }
.result-art > .mascot { width: 100%; height: 172px; }
.round-result .result-art { margin: -8px 0 6px; animation: reveal-squash 550ms var(--ease); }
.round-result .game-heading { margin: 7px 0 0; }
.round-result h1 { max-width: 18ch; font-size: clamp(2.3rem, 5vw, 3.35rem); margin-left: auto; margin-right: auto; }
.round-result .help { max-width: 43ch; margin: 13px auto 0; }
.answer-line { display: flex; justify-content: center; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 20px; color: var(--muted); font-size: 1rem; }
.answer-line strong { color: var(--ink); font-size: 1.14rem; font-weight: 850; padding: 5px 12px; border-radius: 8px; background: var(--lime); }
.answer-line > span:last-child { display: block; flex-basis: 100%; margin-top: 5px; font-size: .87rem; }
.score-breakdown { width: min(100%, 410px); margin-top: 23px; padding: 7px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.score-breakdown > div, .score-breakdown > p { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; text-align: left; font-size: .92rem; }
.score-breakdown strong { color: var(--ink); font-weight: 850; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-breakdown .round-total { margin-top: 4px; padding-top: 15px; border-top: 1px solid var(--line); font-weight: 800; }
.round-result .action-row { max-width: 410px; }
.round-result > .btn { margin-top: 12px; }
.result-clues { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; max-width: 510px; margin-top: 18px; font-size: .78rem; color: var(--muted); }
.result-clues > span { display: inline; line-height: 1.6; }
.result-clues .bluff-clue { color: #9c4732; }
.score-total { display: flex; align-items: baseline; justify-content: center; gap: 10px; color: var(--ink); font-size: clamp(4.1rem, 10vw, 5.7rem); font-weight: 900; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-top: 18px; }
.score-total strong { font-weight: 900; }
.score-total span { font-size: 1rem; letter-spacing: 0; font-weight: 750; color: var(--muted); }
.stars { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 22px 0 6px; }
.stars .icon { width: 32px; height: 32px; fill: transparent; stroke: #80916c; stroke-width: 1.5; }
.stars .earned .icon { fill: var(--amber); stroke: var(--ink); }
.run-history { display: flex; justify-content: center; width: min(100%, 430px); margin-top: 27px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); gap: 14px; }
.run-history > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: .78rem; }
.run-history strong { color: var(--ink); font-size: 1.1rem; }
.scoreboard { width: 100%; text-align: left; }
.score-row { display: grid; grid-template-columns: 24px 38px minmax(0, 1fr) 40px 54px; gap: 10px; align-items: center; min-height: 65px; padding: 11px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.score-row .rank { font-size: .82rem; color: var(--muted); font-weight: 750; text-align: center; }
.score-row .avatar { width: 36px; height: 36px; }
.score-row .player-name { font-size: .94rem; }
.score-delta { grid-column: 4; font-size: .8rem; font-weight: 800; text-align: right; color: #3e652e; }
.score-row .points { grid-column: 5; font-size: 1.25rem; font-weight: 850; text-align: right; }
.score-row:has(> .icon-btn) { grid-template-columns: 19px 30px minmax(0, 1fr) 31px 39px 46px; gap: 6px; }
.score-row > .icon-btn { grid-column: 6; grid-row: 1; justify-self: end; }
.result .scoreboard { margin-top: 13px; }
.round-result > h2 { margin-top: 28px; align-self: flex-start; }
.guess-recap { margin-top: 12px; color: var(--muted); font-size: .87rem; }

/* Focused dialogs, quiet feedback, and failure recovery. */
dialog { width: min(500px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; margin: auto; border: 0; border-radius: var(--radius); box-shadow: 0 24px 72px -20px rgb(23 61 53 / 42%); background: var(--paper); color: var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(15 37 30 / 46%); }
.dialog-inner { padding: 27px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dialog-heading h2 { margin: 0; }
.dialog-inner h2 { margin-bottom: 13px; }
.dialog-inner p { margin-top: 10px; font-size: .95rem; color: var(--muted); }
.dialog-inner .dialog-close { float: right; margin: -8px -8px 8px 12px; }
.dialog-actions { display: flex; gap: 10px; margin-top: 25px; }
.dialog-actions > .btn { flex: 1; }
.dialog-scoreboard { margin-top: 20px; }
#toast { position: fixed; z-index: 80; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 13px 19px; border-radius: 12px; color: var(--paper); background: var(--ink); box-shadow: var(--shadow); font-size: .88rem; font-weight: 650; line-height: 1.4; text-align: center; pointer-events: none; animation: toast-enter 250ms var(--ease); }
#confetti { position: fixed; inset: 0; z-index: 75; width: 100%; height: 100%; pointer-events: none; }
.loading-screen { display: flex; align-items: center; justify-content: center; min-height: 45dvh; color: var(--muted); }
.loading-dots { display: inline-flex; align-items: center; gap: 6px; }
.loading-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: dot-pulse 1200ms ease-in-out infinite; }
.loading-dots span:nth-child(2) { animation-delay: 150ms; }
.loading-dots span:nth-child(3) { animation-delay: 300ms; }
noscript p { max-width: 430px; margin: 50px auto; padding: 20px; color: var(--ink); }

/* Original vector mascot. Its silhouette stays the same as its colour changes. */
.mascot { overflow: visible; --skin: #bfe65c; --skin-deep: #9cc649; --skin-light: #e6f1b1; }
.mascot .skin { fill: var(--skin); }
.mascot .skin-line { stroke: var(--skin); }
.mascot .skin-deep { fill: var(--skin-deep); }
.mascot .skin-light { fill: var(--skin-light); }
.mascot .mascot-eye { transform-box: fill-box; transform-origin: center; }
.mascot--hero .mascot-animal { transform-box: fill-box; transform-origin: 50% 90%; animation: mascot-breathe 5s ease-in-out infinite; }
.mascot--hero .mascot-eye { animation: mascot-blink 7s ease-in-out infinite; }
.mascot--hero .skin { animation: mascot-colour 24s ease-in-out infinite; }
.mascot--hero .skin-line { animation: mascot-colour-line 24s ease-in-out infinite; }
.mascot--hero .skin-deep { animation: mascot-colour-deep 24s ease-in-out infinite; }
.mascot--hero .skin-light { animation: mascot-colour-light 24s ease-in-out infinite; }
.mascot--tiny .mascot-ground, .mascot--small .mascot-ground, .mascot--tiny .mascot-branch, .mascot--small .mascot-branch { display: none; }

@media (hover: hover) and (pointer: fine) {
  .btn.primary:hover:not(:disabled) { background: #2a5747; box-shadow: 0 8px 18px -12px rgb(23 61 53 / 70%); }
  .btn.secondary:hover:not(:disabled), .btn.quiet:hover:not(:disabled), .icon-btn:hover { background: var(--lime-soft); }
  .btn.danger:hover:not(:disabled) { background: #f7cfbe; }
  button.word-tile:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--ink); }
  button.player-card:hover:not(:disabled) { transform: translateY(-3px); border-color: #64874c; }
  .brand:hover > svg { transform: rotate(-5deg); }
  .cover-card:hover { background: #dfeabd; }
  .invite-panel .btn.secondary:hover { background: #2a5747; }
}
@media (max-width: 760px) {
  .topbar { min-height: calc(69px + var(--sat)); padding: calc(11px + var(--sat)) 20px 10px; }
  .brand { font-size: 1.21rem; }
  .brand > svg, .brand .mascot { width: 39px; height: 39px; }
  #app { padding: 12px 20px calc(32px + var(--sab)); }
  .screen.home { padding-top: 0; }
  .home-layout { display: flex; flex-direction: column; gap: 4px; min-height: 0; max-width: 440px; margin: 0 auto; }
  .hero-art { order: -1; width: 100%; height: 228px; min-height: 228px; align-self: center; }
  .hero-art > .mascot { width: 325px; height: 245px; margin: 8px 0 0; }
  .clue-bubble { padding: 9px 14px; font-size: .96rem; border-radius: 12px 12px 12px 3px; }
  .bubble-1 { top: 31%; left: 1%; }
  .bubble-2 { top: 3%; right: 5%; }
  .bubble-3 { right: 0; bottom: 13%; }
  .hero-note { display: none; }
  .home-copy { width: 100%; padding-bottom: 0; text-align: center; }
  .home h1 { max-width: 10ch; margin: 0 auto; font-size: clamp(2.65rem, 8.9vw, 3.8rem); line-height: 1.04; }
  .home .tagline { max-width: 30ch; margin: 14px auto 0; font-size: .95rem; line-height: 1.45; }
  .home-actions { max-width: none; margin-top: 20px; gap: 9px; }
  .home-actions .btn { min-height: 53px; }
  .home-meta { max-width: none; margin-top: 15px; font-size: .77rem; }
  .home-copy .personal-best { justify-content: center; margin-top: 19px; }
  .game-heading { margin: 13px 0 21px; }
  .game-heading h1 { font-size: clamp(2rem, 6.5vw, 2.8rem); }
  .game-heading .help { font-size: .91rem; margin-top: 8px; }
  .game-layout { grid-template-columns: 1fr; gap: 25px; max-width: 530px; margin-left: auto; margin-right: auto; }
  .game > .roundbar, .game > .game-heading, .party > .roundbar, .party > .game-heading, .solo > .role-strip { max-width: 530px; margin-left: auto; margin-right: auto; }
  .solo .game-heading { margin-top: 9px; margin-bottom: 15px; }
  .solo .game-heading h1 { font-size: 1.875rem; line-height: 1.08; }
  .solo .game-heading .help { margin-top: 7px; font-size: .875rem; line-height: 1.4; }
  .solo > .role-strip { min-height: 60px; margin-bottom: 14px; padding: 11px 14px; }
  .solo .game-layout { gap: 17px; }
  .solo .theme-line { margin-bottom: 10px; }
  .solo .word-grid { gap: 6px; }
  .solo .word-tile { min-height: 52px; }
  .solo .section-title { margin-bottom: 10px; }
  .solo .section-title > h2 { font-size: 1.05rem; }
  .solo .clue-line .player-card { min-height: 91px; padding: 8px; gap: 5px; }
  .solo .clue-form { margin-top: 14px; }
  .solo .clue-form label { margin-bottom: 6px; }
  .solo .vote-actions { margin-top: 13px; }
  .solo.phase-vote .side-area { order: -1; }
  .solo.phase-vote .play-area { order: 1; }
  .role-strip { margin-bottom: 18px; min-height: 65px; padding: 12px 15px; }
  .role-strip strong { font-size: 1.3rem; }
  .secret-label { font-size: .76rem; }
  .word-tile { min-height: 59px; font-size: 1rem; }
  .word-tile.long-word { font-size: .9375rem; padding-left: 2px; padding-right: 2px; letter-spacing: -.025em; }
  .word-tile > span:first-child { hyphens: none; }
  .word-grid { gap: 7px; }
  .side-area > h2 { font-size: 1.23rem; margin-bottom: 12px; }
  .player-card { padding: 12px; min-height: 110px; }
  .player-card .clue-word { font-size: 1.5rem; }
  .clue-line .player-card { min-height: 101px; padding: 9px; }
  .clue-line .player-card .clue-word { font-size: 1.08rem; }
  .clue-form { margin-top: 19px; }
  .lobby-layout { grid-template-columns: 1fr; gap: 27px; max-width: 470px; margin: 0 auto; }
  .invite-panel { padding: 22px; }
  .invite-panel .qr-code { width: 153px; }
  .room-code { font-size: 2.8rem; margin: 15px 0 17px; }
  .friends-layout { grid-template-columns: 1fr; gap: 0; }
  .friends-art { display: none; }
  .friends-form { margin-top: 0; }
  .round-result { padding-top: 4px; }
  .result-art { width: 215px; }
  .result-art > .mascot { height: 147px; }
  .round-result h1 { font-size: 2.55rem; }
  .round-result .help { font-size: .91rem; }
  .score-total { font-size: 4.5rem; }
  .dialog-inner { padding: 23px; }
  .voting .players-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voting .player-card { min-height: 96px; }
}
@media (max-width: 380px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  #app { padding-left: 16px; padding-right: 16px; }
  .hero-art { height: 205px; min-height: 205px; }
  .hero-art > .mascot { width: 285px; height: 214px; }
  .clue-bubble { font-size: .84rem; padding: 8px 12px; }
  .bubble-1 { left: -1%; } .bubble-2 { right: 1%; } .bubble-3 { right: -2%; }
  .home h1 { font-size: 2.65rem; }
  .home .tagline { margin-top: 12px; font-size: .88rem; }
  .home-actions { margin-top: 17px; }
  .home-meta { font-size: .72rem; }
  .round-progress { gap: 5px; }
  .round-progress > span:last-child { font-size: .68rem; margin-left: 0; }
  .round-progress .step { min-width: 25px; height: 25px; padding: 0 5px; }
  .score-chip { padding: 8px 10px; gap: 4px; font-size: .75rem; }
  .score-chip .icon { width: 15px; height: 15px; }
  .word-grid { gap: 6px; }
  .word-tile { padding: 8px 3px; min-height: 55px; font-size: .9375rem; border-radius: 10px; }
  .word-tile.long-word { font-size: .8125rem; }
  .tile-mark { font-size: .56rem; }
  .theme-name { font-size: .87rem; }
  .players-grid, .clue-line { gap: 8px; }
  .player-card { padding: 10px; grid-template-columns: 30px minmax(0, 1fr); gap: 7px; }
  .player-card .avatar { width: 30px; height: 30px; }
  .player-card .player-name { font-size: .8125rem; }
  .player-card .clue-word { font-size: 1.3rem; }
  .clue-line .player-card { grid-template-columns: 23px minmax(0, 1fr); min-height: 100px; padding: 7px; gap: 5px; }
  .clue-line .player-card .avatar { width: 23px; height: 23px; font-size: .72rem; }
  .clue-line .player-card .player-name { font-size: .75rem; }
  .clue-line .player-card .clue-word { font-size: 1rem; }
  .clue-line .player-card .player-status { font-size: .67rem; }
  .input-row .btn { padding-left: 13px; padding-right: 13px; }
  .score-row { grid-template-columns: 19px 30px minmax(0, 1fr) 31px 39px; gap: 7px; padding-left: 2px; padding-right: 2px; }
  .score-row .avatar { width: 30px; height: 30px; }
  .score-row .player-name { font-size: .83rem; }
  .score-row .points { font-size: 1.08rem; }
  .score-row .score-delta { font-size: .72rem; }
  .round-result h1 { font-size: 2.3rem; }
  .action-row { gap: 8px; }
  .action-row .btn { padding-left: 12px; padding-right: 12px; font-size: .92rem; }
  .room-chip { font-size: .75rem; padding-left: 9px; padding-right: 9px; gap: 5px; }
  .roundbar { gap: 7px; }
}
@keyframes mascot-breathe { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-.6deg); } }
@keyframes mascot-blink { 0%, 44%, 48%, 100% { transform: scaleY(1); } 46% { transform: scaleY(.08); } }
@keyframes mascot-colour { 0%, 27%, 100% { fill: #bfe65c; } 34%, 60% { fill: #f8ce67; } 67%, 94% { fill: #ee9678; } }
@keyframes mascot-colour-line { 0%, 27%, 100% { stroke: #bfe65c; } 34%, 60% { stroke: #f8ce67; } 67%, 94% { stroke: #ee9678; } }
@keyframes mascot-colour-deep { 0%, 27%, 100% { fill: #9cc649; } 34%, 60% { fill: #dfae48; } 67%, 94% { fill: #d4775a; } }
@keyframes mascot-colour-light { 0%, 27%, 100% { fill: #e6f1b1; } 34%, 60% { fill: #f9e5a1; } 67%, 94% { fill: #f8cbb3; } }
@keyframes reveal-squash { 0% { transform: translateY(8px) scale(.9, 1.06); } 40% { transform: translateY(-7px) scale(1.07, .94); } 70% { transform: translateY(2px) scale(.985, 1.015); } 100% { transform: none; } }
@keyframes answer-pop { 0% { transform: perspective(300px) rotateX(-22deg) scale(.94); } 65% { transform: perspective(300px) rotateX(4deg) scale(1.025); } 100% { transform: none; } }
@keyframes toast-enter { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes loading-turn { to { transform: rotate(360deg); } }
@keyframes dot-pulse { 0%, 80%, 100% { transform: translateY(0); opacity: .55; } 35% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  #confetti { display: none; }
}
