@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #11151d;
  --surface: #181d27;
  --surface-2: #1f2531;
  --surface-3: #283040;
  --border: #2b3242;
  --border-strong: #3a4357;
  --text: #eceef3;
  --muted: #9097a8;
  --faint: #6b7385;
  --accent: #6d8dff;
  --accent-strong: #5674f0;
  --ok: #2f9e6e;
  --skip: #c48a2c;
  --bad: #e5484d;
  --cat-P: #c9955a; /* Pantomime */
  --cat-E: #5a86bd; /* Erklären */
  --cat-Z: #b8687c; /* Zeichnen */
  --d5: #d4574f;
  --d4: #d39a3a;
  --d3: #3f9f6f;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-tap-highlight-color: transparent; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 16px;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -200px, #1b2232, transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.ico {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Header */
header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 20px; max-width: 1200px; margin: 0 auto;
}
.logo { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.logo-mark { display: inline-flex; gap: 3px; }
.logo-mark i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.logo-mark .P { background: var(--cat-P); }
.logo-mark .E { background: var(--cat-E); }
.logo-mark .Z { background: var(--cat-Z); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-actions .btn { white-space: nowrap; }
.header-actions select { padding: 7px 10px; font-size: .9rem; }

main { max-width: 1200px; width: 100%; margin: 0 auto; padding: 0 20px 40px; flex: 1; display: flex; flex-direction: column; }
body { display: flex; flex-direction: column; }
header { width: 100%; }
/* Play screen fills exactly the space below the header, whatever sits above the round */
body[data-screen="play"] main { padding-bottom: 12px; }
#screen-play:not([hidden]) { flex: 1; display: flex; flex-direction: column; width: 100%; }
.screen { animation: screen-in .25s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } }

h3 { margin: 0 0 14px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.eyebrow { margin: 0; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .14em; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.hint { color: var(--muted); font-size: .92rem; margin: 0 0 14px; }

input, select {
  font: inherit; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
}
select option { color: #222; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
.btn, button.diff {
  font: inherit; font-weight: 700; cursor: pointer; border: 1px solid transparent; color: #fff;
  border-radius: var(--radius-sm); padding: 11px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:active:not(:disabled), button.diff:active:not(:disabled) { transform: scale(.98); }
.btn:disabled, button.diff:disabled { opacity: .4; cursor: not-allowed; }
.btn.big { font-size: 1.08rem; padding: 15px 22px; }
.btn.small { font-size: .88rem; padding: 7px 13px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.primary { background: var(--accent); width: 100%; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn.ok { background: var(--ok); flex: 1; }
.btn.ok:hover:not(:disabled) { background: #2a8d62; }
.btn.skip { background: var(--surface-3); border-color: var(--border-strong); flex: 1; }
.btn.skip:hover:not(:disabled) { background: #313a4d; }
.btn.quiet { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn.quiet:hover:not(:disabled) { background: var(--surface-2); }
.btn .ico { width: 1.2em; height: 1.2em; }

/* Avatars: team colour + initial */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 800; font-size: .9rem;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px color-mix(in srgb, var(--c) 60%, transparent);
}
.avatar.lg { width: 44px; height: 44px; font-size: 1.15rem; }
.avatar.xl { width: 88px; height: 88px; font-size: 2.3rem; box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px color-mix(in srgb, var(--c) 55%, transparent), 0 12px 32px rgba(0, 0, 0, .4); }

/* Setup */
.hero { text-align: center; margin: 20px 0 28px; }
.hero-title { margin: 8px 0 0; font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.how-item {
  display: flex; gap: 14px; align-items: center;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.how-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c);
}
.how-icon .ico { width: 26px; height: 26px; }
.how-item.P { --c: var(--cat-P); }
.how-item.E { --c: var(--cat-E); }
.how-item.Z { --c: var(--cat-Z); }
.how-item b { display: block; font-size: 1rem; }
.how-item small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }

.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.setup-grid .panel { margin-bottom: 0; }
#btn-start { margin-top: 20px; }
.team-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.team-row .avatar { width: 40px; height: 40px; font-size: 1.05rem; }
.team-row input { flex: 1; min-width: 0; width: 100%; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; }
.rule { color: var(--muted); font-size: .88rem; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }

/* Scores with progress */
#scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.score {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 10px 8px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.score::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p);
  background: var(--c); transition: width .25s;
}
.score-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.score-pos { font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); }
.score.active { border-color: color-mix(in srgb, var(--c) 70%, var(--border)); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }

/* Board */
.table { display: flex; gap: 16px; align-items: stretch; }
.board-frame {
  position: relative; flex: 1; min-width: 0;
  border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #1d2433, #141922 75%);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
#board3d { width: 100%; height: calc(100dvh - 170px); min-height: 420px; touch-action: none; cursor: grab; }
#board3d:active { cursor: grabbing; }
#board3d canvas { display: block; width: 100% !important; height: 100% !important; }
.view-reset { position: absolute; right: 12px; bottom: 12px; background: rgba(17, 21, 29, .7); backdrop-filter: blur(6px); }

/* 2D fallback board */
#board {
  --gap-y: 12px; padding: 16px;
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: var(--gap-y) 8px;
}
.field {
  aspect-ratio: 1.6; border-radius: 8px; position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px;
  background: var(--c); color: #fff;
}
.field.P { --c: var(--cat-P); }
.field.E { --c: var(--cat-E); }
.field.Z { --c: var(--cat-Z); }
.field.start { background: #e9e4d8; }
.field.goal { background: repeating-conic-gradient(#1d2330 0 25%, #f4f2ec 0 50%) 0 0 / 14px 14px; }
.field .icon { position: absolute; width: 40%; height: 40%; opacity: .8; }
.field .num { position: absolute; top: 2px; left: 5px; font-size: .62rem; font-weight: 700; }
.field.turn-down::after {
  content: ""; position: absolute; bottom: calc(-1 * var(--gap-y)); left: 50%;
  width: 10px; height: var(--gap-y); margin-left: -5px; background: #e9e4d8;
}
.token {
  position: relative; z-index: 2; width: 20px; height: 20px; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; display: grid; place-items: center; font-size: .6rem; font-weight: 800;
}

/* Side panel */
.side { width: 240px; flex: none; display: flex; flex-direction: column; gap: 12px; }
.turn-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.turn-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side .turn-card > .cat-badge { order: 3; }
.turn-card small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; font-weight: 700; }
.turn-card strong { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-msg { width: 100%; order: 4; margin: 0; font-size: .88rem; color: var(--muted); }
@media (min-width: 861px) {
  .side .turn-info { flex: 1 1 calc(100% - 60px); }
  .side .turn-card > .cat-badge { margin-left: 56px; }
}
.turn-msg:empty { display: none; }
.pick { margin: 6px 0 0; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

#difficulty { display: flex; flex-direction: column; gap: 10px; }
button.diff {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: 14px; text-align: left;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow); overflow: hidden;
}
button.diff::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
button.diff:hover:not(:disabled) { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); background: var(--surface-2); }
button.diff b { grid-row: 1 / 3; font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--c); font-variant-numeric: tabular-nums; }
button.diff small { font-size: .95rem; font-weight: 700; text-transform: capitalize; }
button.diff em { font-size: .82rem; font-style: normal; color: var(--muted); font-weight: 500; }
button.diff .pips { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); display: flex; gap: 4px; }
button.diff .pips i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
button.diff.d5 { --c: var(--d5); }
button.diff.d4 { --c: var(--d4); }
button.diff.d3 { --c: var(--d3); }

.cat-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 999px;
  font-weight: 700; font-size: .9rem;
  background: color-mix(in srgb, var(--c) 20%, transparent); color: color-mix(in srgb, var(--c) 70%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.cat-badge.lg { font-size: 1.1rem; padding: 8px 18px 8px 14px; }
.cat-badge.P { --c: var(--cat-P); }
.cat-badge.E { --c: var(--cat-E); }
.cat-badge.Z { --c: var(--cat-Z); }
.chip { padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .88rem; color: var(--muted); }

/* Play */
#screen-play, #screen-summary { max-width: 620px; margin: 0 auto; }
.play-head { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.ready { text-align: center; padding-top: 16px; }
.ready-icons { position: relative; display: inline-block; margin-bottom: 10px; }
.ready-icon {
  position: absolute; right: -14px; bottom: -6px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--c); color: #fff; box-shadow: 0 0 0 4px var(--bg);
}
.ready-icon.P { --c: var(--cat-P); }
.ready-icon.E { --c: var(--cat-E); }
.ready-icon.Z { --c: var(--cat-Z); }
.ready-icon .ico { width: 24px; height: 24px; }
.ready p { font-size: 1.1rem; margin: 14px 0; line-height: 1.5; }
.ready .tip {
  font-size: .92rem; color: var(--muted); margin-bottom: 24px;
  padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
}

#round { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.round-top { display: flex; align-items: center; justify-content: center; gap: 26px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 276.46; transition: stroke-dashoffset 1s linear, stroke .3s; }
#timer {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 2.3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.ring.low .ring-fg { stroke: var(--bad); }
.ring.low #timer { color: var(--bad); }
.count { display: flex; align-items: center; gap: 10px; font-size: 1rem; line-height: 1.25; }
.count b { font-size: 2.8rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.count small { color: var(--muted); }

.word-card {
  margin: 18px auto; width: 100%; padding: 34px 16px; text-align: center;
  background: #f4f2ec; color: #1d2330; border-radius: var(--radius); cursor: pointer; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.word-card.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: .3; } }
#word { display: block; font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 800; letter-spacing: -.01em; transition: filter .15s; word-break: break-word; }
.word-card small { color: #7a8091; }
.word-card.hidden-word { background: repeating-linear-gradient(135deg, #ebe8e0 0 10px, #f4f2ec 10px 20px); }
.word-card.hidden-word #word { filter: blur(16px); }

#round:not(.drawing) .round-head { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
#round:not(.drawing) .word-card { margin: 0; padding: 52px 16px; }
.actions .btn { min-height: 60px; }

#draw-wrap { position: relative; margin-bottom: 14px; }
#canvas {
  width: 100%; height: 50vh; background: #fbfaf7; border-radius: var(--radius); display: block;
  touch-action: none; box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  background-image: radial-gradient(#dcd8ce 1px, transparent 1px); background-size: 18px 18px;
}
.btn.clear { position: absolute; top: 10px; right: 10px; background: #fff; color: #1d2330; border-color: #dcd8ce; }

/* Drawing round: compact head, canvas fills the screen, buttons below */
#round.drawing .round-head { display: flex; gap: 12px; align-items: stretch; margin-bottom: 12px; }
#round.drawing .round-top { flex-direction: column; gap: 4px; justify-content: center; }
#round.drawing .ring { width: 72px; height: 72px; }
#round.drawing #timer { font-size: 1.5rem; }
#round.drawing .count { font-size: .82rem; gap: 6px; }
#round.drawing .count b { font-size: 1.5rem; }
#round.drawing .count small { display: none; }
#round.drawing .word-card { flex: 1; margin: 0; padding: 14px 10px; display: flex; flex-direction: column; justify-content: center; }
#round.drawing #word { font-size: clamp(1.3rem, 5vw, 2rem); }
#round.drawing #canvas { height: max(240px, calc(100dvh - 400px)); }
#round.drawing .actions { margin-top: 0; }

/* Summary */
#summary-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
#summary-list .empty { color: var(--muted); }
.sum-word {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 7px; border-radius: 999px; border: 1px solid; color: var(--text);
  transition: background-color .15s;
}
.sum-word .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sum-word .mark .ico { width: 14px; height: 14px; }
.sum-word.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.sum-word.ok .mark { background: var(--ok); }
.sum-word.no { background: transparent; border-color: var(--border-strong); color: var(--muted); text-decoration: line-through; }
.sum-word.no .mark { background: var(--surface-3); }
.summary-total { font-size: 1.3rem; font-weight: 800; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.summary-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.summary-head h3 { margin: 0; }
.summary-head strong { font-size: 1.2rem; }
/* Keep "continue" reachable even with a long word list */
#btn-summary-ok { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px var(--bg); }

/* Handoff overlay */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(10, 13, 19, .78); backdrop-filter: blur(8px); cursor: pointer;
  animation: screen-in .2s ease-out;
}
.handoff {
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 36px 40px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5); min-width: min(360px, 100%);
}
.handoff .avatar { margin-bottom: 6px; }
.handoff h2 { font-size: clamp(1.7rem, 6vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; margin: 0; }
.handoff .hint { margin: 6px 0 0; font-size: .85rem; }

/* Feedback flash */
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 50; }
#flash.ok { box-shadow: inset 0 0 0 6px var(--ok); animation: flash .4s ease-out; }
#flash.skip { box-shadow: inset 0 0 0 6px var(--border-strong); animation: flash .4s ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Win */
#screen-win { text-align: center; padding-top: 32px; max-width: 480px; margin: 0 auto; }
.win-badge {
  width: 52px; height: 52px; margin: 0 auto -20px; position: relative; z-index: 1; left: 40px;
  border-radius: 50%; display: grid; place-items: center; background: #f4f2ec; color: #1d2330;
  box-shadow: 0 0 0 4px var(--bg);
}
#win-text { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; margin: 22px 0 24px; }
#standings { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 8px; counter-reset: rank; }
#standings li {
  counter-increment: rank; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 12px 10px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); text-align: left;
}
#standings li::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p); background: var(--c); }
#standings li:first-child { border-color: color-mix(in srgb, var(--c) 60%, var(--border)); }
#standings .score-name { flex: 1; font-weight: 600; }
#standings .score-name::before { content: counter(rank) ".  "; color: var(--muted); }
#standings .score-pos { color: var(--muted); font-variant-numeric: tabular-nums; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

@media (max-width: 860px) {
  .table { flex-direction: column; }
  #board3d { height: 58dvh; min-height: 340px; }
  /* Sticky bottom bar so the cards stay reachable */
  .side {
    width: auto; align-self: stretch; position: sticky; bottom: 0; z-index: 5; gap: 8px;
    margin: 0 -20px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
    background: rgba(17, 21, 29, .92); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  }
  .pick { display: none; }
  .turn-card { padding: 8px 10px; gap: 10px; box-shadow: none; flex-wrap: nowrap; }
  .turn-card .avatar.lg { width: 34px; height: 34px; font-size: .95rem; }
  .turn-card strong { font-size: 1rem; }
  .turn-msg { display: none; }
  #difficulty { flex-direction: row; }
  button.diff { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 6px; gap: 2px; text-align: center; box-shadow: none; }
  button.diff::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 3px; }
  button.diff b { font-size: 1.7rem; }
  button.diff small { font-size: .82rem; }
  button.diff em, button.diff .pips { display: none; }
  .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .how { grid-template-columns: 1fr; }
  #scores { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  header, main { padding-left: 16px; padding-right: 16px; }
  .side { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .turn-card .cat-badge { font-size: .8rem; padding: 4px 10px 4px 8px; }
  .round-top { gap: 16px; }
  .handoff { padding: 28px 20px; }
}

/* Very small phones (iPhone SE 1st gen, Galaxy Fold folded) */
@media (max-width: 420px) {
  .header-actions select { max-width: 96px; padding: 6px 6px; font-size: .82rem; }
  #btn-new { padding: 7px 9px; }
  #btn-new .label { display: none; }
}
@media (max-width: 360px) {
  header, main { padding-left: 12px; padding-right: 12px; }
  .side { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .logo { font-size: 1.05rem; gap: 7px; }
  .logo-mark i { width: 7px; height: 7px; }
  .panel { padding: 14px; }
  .how-item { padding: 12px; gap: 10px; }
  .how-icon { width: 38px; height: 38px; }
  .how-item small { display: none; }
  .setting { flex-wrap: wrap; gap: 6px; }
  .setting select { flex: 1; min-width: 0; }
  #scores { gap: 6px; }
  .score { padding: 6px 10px 8px 6px; gap: 6px; }
  .score-name { display: none; }
  .score .avatar { width: 28px; height: 28px; font-size: .8rem; }
  .turn-card { padding: 6px 8px; gap: 8px; }
  .turn-card small { display: none; }
  .turn-card .avatar.lg { width: 30px; height: 30px; }
  button.diff b { font-size: 1.45rem; }
  button.diff small { font-size: .74rem; }
  .play-head { gap: 6px; }
  .chip { font-size: .78rem; padding: 4px 10px; }
  .ring { width: 92px; height: 92px; }
  #timer { font-size: 1.9rem; }
  .count b { font-size: 2.2rem; }
  .actions { gap: 8px; }
  .actions .btn { font-size: 1rem; padding: 12px 8px; min-height: 54px; }
  #round.drawing .round-head { gap: 8px; }
  #round.drawing .ring { width: 60px; height: 60px; }
  #round.drawing #timer { font-size: 1.25rem; }
  .avatar.xl { width: 72px; height: 72px; font-size: 1.9rem; }
  .handoff { padding: 24px 16px; min-width: 0; }
  #win-text { font-size: 1.7rem; }
}

/* Short portrait screens (iPhone SE etc.): tighter round */
@media (max-height: 700px) and (orientation: portrait) {
  .play-head { margin-bottom: 8px; }
  #round:not(.drawing) .round-head { gap: 12px; }
  #round:not(.drawing) .word-card { padding: 22px 12px; }
  #word { font-size: clamp(1.4rem, 6.5vw, 2rem); }
  .ring { width: 84px; height: 84px; }
  #timer { font-size: 1.8rem; }
  .btn.wide { margin-top: 8px; padding: 10px; }
}

/* Short landscape screens: board and cards side by side, compact round */
@media (max-height: 500px) and (orientation: landscape) {
  header { padding-top: 6px; padding-bottom: 6px; }
  .hero { margin: 4px 0 14px; }
  #scores { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-bottom: 8px; }
  .score { padding: 4px 10px 6px 4px; }
  .score .avatar { width: 24px; height: 24px; font-size: .75rem; }
  .table { flex-direction: row; gap: 10px; }
  #board3d { height: calc(100dvh - 124px); min-height: 0; }
  .view-reset { display: none; }
  .side {
    position: static; width: 180px; margin: 0; padding: 0; gap: 6px;
    background: none; border: 0; backdrop-filter: none;
  }
  .turn-card { flex-wrap: wrap; padding: 6px 8px; gap: 6px; }
  .turn-card small { display: none; }
  .turn-card .avatar.lg { width: 28px; height: 28px; font-size: .8rem; }
  .side .turn-info { flex: 1 1 calc(100% - 40px); }
  .turn-card .cat-badge { font-size: .78rem; padding: 3px 8px 3px 6px; }
  #difficulty { flex-direction: column; gap: 6px; }
  button.diff { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 6px 10px; }
  button.diff::before { left: 0; top: 0; bottom: 0; right: auto; width: 3px; height: auto; }
  button.diff b { font-size: 1.4rem; }

  .play-head { margin-bottom: 6px; }
  .ready { padding-top: 0; }
  .ready-icons { margin-bottom: 0; }
  .avatar.xl { width: 56px; height: 56px; font-size: 1.5rem; }
  .ready-icon { width: 30px; height: 30px; right: -10px; }
  .ready p { margin: 6px 0; font-size: .95rem; }
  .ready .tip { margin-bottom: 10px; padding: 6px 10px; }
  #round:not(.drawing) .round-head { flex-direction: row; align-items: stretch; gap: 12px; margin-bottom: 10px; }
  #round:not(.drawing) .round-top { flex-direction: column; gap: 4px; }
  #round:not(.drawing) .word-card { padding: 18px 12px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
  .ring, #round.drawing .ring { width: 64px; height: 64px; }
  #timer, #round.drawing #timer { font-size: 1.3rem; }
  .count { font-size: .8rem; gap: 6px; }
  .count b { font-size: 1.5rem; }
  .count small { display: none; }
  .actions { margin-top: 0; }
  .actions .btn { min-height: 46px; padding: 8px; }
  .btn.wide { margin-top: 8px; padding: 8px; }
  /* Normal round: actions and "end round" share one row */
  #round { flex-flow: row wrap; gap: 8px; }
  #round:not(.drawing) > .round-head, #round > #draw-wrap { flex: 1 1 100%; width: 100%; }
  #round .actions { flex: 1; margin: 0; }
  #btn-end.wide { width: auto; margin: 0; flex: none; }
  /* Drawing round: canvas left, timer/word/buttons in a column on the right */
  #round.drawing { display: grid; grid-template-columns: minmax(0, 1fr) 190px; grid-template-rows: auto auto 1fr; gap: 8px 10px; }
  #round.drawing #draw-wrap { grid-column: 1; grid-row: 1 / 4; width: auto; margin: 0; }
  #round.drawing #canvas { height: calc(100dvh - 66px); }
  #round.drawing .round-head { grid-column: 2; width: auto; flex-direction: column; margin: 0; gap: 6px; }
  #round.drawing .round-top { flex-direction: row; gap: 10px; }
  #round.drawing .word-card { padding: 10px 8px; }
  #round.drawing .actions { grid-column: 2; gap: 6px; }
  #round.drawing .actions .btn { padding: 8px 4px; font-size: .9rem; }
  #round.drawing .actions .ico { display: none; }
  /* Category was shown on the ready screen; free the vertical space during the round */
  #screen-play:has(#round:not([hidden])) .play-head { display: none; }
  #round.drawing #btn-end { grid-column: 2; align-self: end; width: 100%; }
  .handoff { padding: 16px 24px; gap: 8px; }
  .summary { padding: 12px 14px; margin-bottom: 8px; }
  .summary-head { margin-bottom: 6px; }
  .summary .hint { margin-bottom: 8px; }
  .summary-total, .summary .hint { display: none; }
  #win-text { margin: 8px 0 12px; font-size: 1.6rem; }
  #screen-win { padding-top: 8px; }
}

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