/* =====================================================================
   Kritzel – Gestaltung „Zeichenblock“
   Papier, Tusche, Textmarker. Harte Kanten und versetzte Schatten statt
   Glow und Verläufe. Dunkel = Schiefertafel.
   ===================================================================== */

@font-face {
  font-family: 'Bricolage';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/bricolage/bricolage-grotesque-latin-opsz-normal.woff2') format('woff2-variations');
  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: 'Bricolage';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../fonts/bricolage/bricolage-grotesque-latin-ext-opsz-normal.woff2') format('woff2-variations');
  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;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('../fonts/caveat/caveat-latin-700-normal.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;
}

/* ---------- Farben ---------- */
:root,
[data-theme='light'] {
  --paper: #f3eee3;        /* Seite */
  --paper-2: #fdfaf3;      /* Blätter, Karten */
  --paper-3: #e8e0cf;      /* leichte Flächen */
  --ink: #1f1c18;          /* Tusche */
  --ink-2: #5d564b;        /* Bleistift */
  --line: #1f1c18;         /* Konturen */
  --line-soft: #cfc4ae;
  --dot: rgb(31 28 24 / 0.13);
  --rule: rgb(47 108 223 / 0.14); /* Linien im Chat */
  --marker: #ffd23f;       /* Textmarker gelb – Hauptakzent */
  --marker-ink: #1f1c18;
  --hl-green: rgb(52 199 120 / 0.32);
  --hl-yellow: rgb(255 210 63 / 0.55);
  --hl-red: rgb(232 85 61 / 0.22);
  --red: #d9482b;
  --blue: #2d6cdf;
  --green: #17865a;
  --focus: #2d6cdf;
  --shadow: 3px 3px 0 var(--line);
  --shadow-lg: 5px 5px 0 var(--line);
  --canvas-edge: var(--line);
  color-scheme: light;
}
[data-theme='dark'] {
  --paper: #1c2023;
  --paper-2: #252a2e;
  --paper-3: #2f353a;
  --ink: #efeae0;
  --ink-2: #a9a397;
  --line: #efeae0;
  --line-soft: #454c52;
  --dot: rgb(239 234 224 / 0.08);
  --rule: rgb(239 234 224 / 0.06);
  --marker: #ffd23f;
  --marker-ink: #1f1c18;
  --hl-green: rgb(79 209 160 / 0.22);
  --hl-yellow: rgb(255 210 63 / 0.2);
  --hl-red: rgb(255 122 89 / 0.2);
  --red: #ff7a59;
  --blue: #7aa7ff;
  --green: #4fd1a0;
  --focus: #7aa7ff;
  --shadow: 3px 3px 0 #0b0d0e;
  --shadow-lg: 5px 5px 0 #0b0d0e;
  --canvas-edge: #0b0d0e;
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Bricolage', ui-sans-serif, system-ui, sans-serif;
  font-optical-sizing: auto;
  font-size: 16px;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.05; margin: 0; letter-spacing: -0.02em; font-weight: 800; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.hand { font-family: 'Caveat', cursive; font-weight: 700; letter-spacing: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 1.1em; height: 1.1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--marker); color: var(--marker-ink); }

/* Textmarker-Effekt für einzelne Wörter */
.hl { background: linear-gradient(transparent 55%, var(--hl-yellow) 55%, var(--hl-yellow) 92%, transparent 92%); padding: 0 0.1em; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border: 2px solid var(--line); background: var(--paper-2); color: var(--ink);
  padding: 0.5rem 0.95rem; border-radius: 8px; font-weight: 700; cursor: pointer;
  text-decoration: none; box-shadow: 2px 2px 0 var(--line); white-space: nowrap;
  transition: transform 0.08s, box-shadow 0.08s, background 0.12s;
}
[data-theme='dark'] .btn { box-shadow: 2px 2px 0 #0b0d0e; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
[data-theme='dark'] .btn:hover { box-shadow: 3px 3px 0 #0b0d0e; }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--marker); color: var(--marker-ink); }
[data-theme='dark'] .btn-primary { border-color: var(--marker); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-3); color: var(--ink); box-shadow: none; transform: none; }
[data-theme='dark'] .btn-ghost, [data-theme='dark'] .btn-ghost:hover { box-shadow: none; }
.btn-ghost:active { transform: none; }
.btn-danger:hover { color: var(--red); }
.btn-lg { padding: 0.7rem 1.25rem; font-size: 1.08rem; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.86rem; border-width: 2px; }
.btn-icon { padding: 0.45rem; }

/* ---------- Formulare ---------- */
.input, select.input, textarea.input {
  width: 100%; background: var(--paper-2); border: 2px solid var(--line); border-radius: 8px;
  padding: 0.55rem 0.75rem; transition: box-shadow 0.12s;
}
.input::placeholder { color: var(--ink-2); opacity: 0.75; }
.input:focus { outline: none; box-shadow: 3px 3px 0 var(--marker); }
.input:disabled { opacity: 0.65; border-style: dashed; }
select.input { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { resize: vertical; min-height: 5rem; line-height: 1.4; }
label.field, .field { display: grid; gap: 0.3rem; font-size: 0.85rem; font-weight: 700; }

/* ---------- Blätter ---------- */
.card { background: var(--paper-2); border: 2px solid var(--line); border-radius: 10px; padding: 1.2rem; box-shadow: var(--shadow); }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.65rem;
  border: 2px solid var(--line-soft); border-radius: 999px; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  user-select: none; background: var(--paper-2);
}
.chip input { accent-color: var(--ink); margin: 0; }
.chip:has(input:checked) { border-color: var(--line); background: var(--hl-yellow); }
.chip:has(input:disabled) { cursor: default; }
.switch { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; }
.switch input { width: 2.5rem; height: 1.4rem; appearance: none; background: var(--paper-3); border: 2px solid var(--line); border-radius: 999px; position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.12s; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--ink); transition: transform 0.15s; }
.switch input:checked { background: var(--marker); }
.switch input:checked::after { transform: translateX(1.1rem); background: var(--marker-ink); }
.switch input:disabled { opacity: 0.55; cursor: default; }

.avatar { width: 2.4rem; height: 2.4rem; flex: none; display: inline-block; line-height: 0; }
.avatar svg { width: 100%; height: 100%; overflow: visible; }
.avatar.sm { width: 1.7rem; height: 1.7rem; }
.avatar.lg { width: 3.4rem; height: 3.4rem; }
.avatar.xl { width: 4.6rem; height: 4.6rem; }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line-soft); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { display: grid; place-items: center; min-height: 50vh; }

/* ---------- Kopfzeile ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem clamp(0.75rem, 3vw, 1.5rem); background: var(--paper); border-bottom: 2px solid var(--line);
}
.appbar:empty { display: none; }
.logo { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 800; font-size: 1.45rem; letter-spacing: -0.04em; color: var(--ink); text-decoration: none; }
.logo svg { width: 2.1rem; height: 2.1rem; }
.logo em { font-style: normal; }
.appbar .spacer { flex: 1; }
.appbar nav { display: flex; gap: 0.2rem; align-items: center; }
.appbar .me { gap: 0.45rem; padding: 0.25rem 0.55rem 0.25rem 0.3rem; font-weight: 700; color: var(--ink); }
.instance-badge { background: var(--red); color: #fff; font-weight: 800; font-size: 0.72rem; letter-spacing: 0.1em; padding: 0.1rem 0.45rem; border-radius: 4px; transform: rotate(-4deg); }
@media (max-width: 640px) {
  .appbar .me span:not(.avatar), .appbar .label { display: none; }
}

.view { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: clamp(0.75rem, 2.5vw, 1.5rem); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: 0.5rem; z-index: 100; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 0.65rem 1rem; border-radius: 8px; box-shadow: 3px 3px 0 var(--marker); font-weight: 600; animation: pop 0.18s ease-out; }
.toast.error { box-shadow: 3px 3px 0 var(--red); }
.toast.ok { box-shadow: 3px 3px 0 var(--green); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- Anmeldung ---------- */
.auth { min-height: calc(100dvh - 3rem); display: grid; place-items: center; padding: 1rem 0; }
.auth-card { width: min(100%, 390px); padding: 1.6rem; box-shadow: var(--shadow-lg); position: relative; }
.auth-card::before { /* Klebestreifen */
  content: ''; position: absolute; top: -14px; left: 50%; width: 96px; height: 26px; transform: translateX(-50%) rotate(-3deg);
  background: rgb(255 210 63 / 0.75); border-left: 2px dashed rgb(0 0 0 / 0.12); border-right: 2px dashed rgb(0 0 0 / 0.12);
}
.auth-hero { margin-bottom: 1.2rem; }
.auth-hero .logo { font-size: 2.6rem; }
.auth-hero .logo svg { width: 3rem; height: 3rem; }
.auth-hero p { margin-top: 0.3rem; font-size: 1.35rem; color: var(--ink-2); }
.tabs { display: flex; gap: 0; margin-bottom: 1.1rem; border-bottom: 2px solid var(--line); }
.tabs button { border: 2px solid transparent; border-bottom: 0; background: transparent; padding: 0.45rem 0.9rem; border-radius: 8px 8px 0 0; font-weight: 700; cursor: pointer; color: var(--ink-2); margin-bottom: -2px; }
.tabs button[aria-selected='true'] { background: var(--paper-2); border-color: var(--line); color: var(--ink); }
.tabs button:hover { color: var(--ink); }
.form { display: grid; gap: 0.9rem; }
.form-error { color: var(--red); font-size: 0.9rem; font-weight: 600; min-height: 1.3em; margin: -0.25rem 0 0; }
.or { display: flex; align-items: center; gap: 0.7rem; margin: 1.1rem 0; color: var(--ink-2); font-family: 'Caveat', cursive; font-size: 1.35rem; }
.or::before, .or::after { content: ''; flex: 1; border-top: 2px dashed var(--line-soft); }
.auth-card a.btn { text-decoration: none; }
/* Minigame-Maniac im Raum */
.party-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-bottom: 0.9rem; background: var(--hl-yellow); }
.party-bar a.btn { text-decoration: none; }

/* ---------- Start ---------- */
.home { display: grid; gap: 1.6rem; max-width: 1040px; margin: 0 auto; padding-top: clamp(0.5rem, 3vw, 2rem); }
.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: end; }
.home-hero h1 { font-size: clamp(2.3rem, 6.5vw, 4.4rem); font-weight: 800; letter-spacing: -0.045em; line-height: 0.95; }
.home-hero .note { display: inline-block; font-size: clamp(1.35rem, 3vw, 1.8rem); color: var(--red); transform: rotate(-3deg); margin-top: 0.6rem; }
.home-hero .note svg { width: 38px; height: 26px; vertical-align: -6px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
.home-grid { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr; gap: 1.2rem; align-items: start; }
.action-card { display: grid; gap: 0.75rem; align-content: start; }
.action-card h2 { font-size: 1.35rem; }
.action-card p { color: var(--ink-2); }
.action-card.sticky { background: var(--marker); color: var(--marker-ink); border-color: #1f1c18; transform: rotate(-1.2deg); }
.action-card.sticky p { color: #4a4232; }
.action-card.sticky .btn { background: #fdfaf3; color: #1f1c18; border-color: #1f1c18; box-shadow: 2px 2px 0 #1f1c18; }
.join-row { display: flex; gap: 0.5rem; }
.join-row .input { text-transform: uppercase; letter-spacing: 0.3em; font-weight: 800; font-size: 1.15rem; text-align: center; min-width: 0; }
.char-card { display: grid; justify-items: center; text-align: center; gap: 0.5rem; padding: 1rem 1rem 1.1rem; transform: rotate(1.2deg); }
.char-card h2 { font-size: 1.1rem; }
.char-card .char-card-fig .avatar.xl { width: 6.5rem; height: 6.5rem; }
.char-card p { font-size: 0.88rem; }
.char-card .grow { display: grid; gap: 0.15rem; }
.public-rooms { display: grid; gap: 0; border: 2px solid var(--line); border-radius: 10px; background: var(--paper-2); overflow: hidden; }
.public-room { display: flex; align-items: center; gap: 0.9rem; padding: 0.65rem 0.9rem; border-bottom: 2px dashed var(--line-soft); }
.public-room:last-child { border-bottom: 0; }
.public-room .code { font-weight: 800; letter-spacing: 0.18em; font-size: 1.05rem; background: var(--hl-yellow); padding: 0 0.3rem; }
.public-room .grow { flex: 1; min-width: 0; }
.public-room .small .i { vertical-align: -2px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.65rem; }
.section-head h2 { font-size: 1.3rem; }
.empty { color: var(--ink-2); padding: 1.1rem; text-align: center; border: 2px dashed var(--line-soft); border-radius: 10px; font-weight: 600; }
.public-rooms .empty { border: 0; }
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .char-card { grid-column: 1 / -1; grid-template-columns: auto 1fr auto; justify-items: start; text-align: left; transform: none; }
  .char-card .char-card-fig .avatar.xl { width: 4.5rem; height: 4.5rem; }
}
@media (max-width: 600px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-grid { grid-template-columns: 1fr; }
  .action-card.sticky { transform: none; }
  .char-card { grid-template-columns: auto 1fr; }
  .char-card .btn { grid-column: 1 / -1; width: 100%; }
}

/* ---------- Raum ---------- */
.room {
  display: grid; gap: 0.9rem;
  grid-template-columns: 236px minmax(0, 1fr) 300px;
  grid-template-areas: 'top top top' 'players stage chat';
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - 4.2rem - 2 * clamp(0.75rem, 2.5vw, 1.5rem));
  min-height: 560px;
}
.room-top { grid-area: top; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 0.5rem 0.9rem; }
.room-top .left, .room-top .right { display: flex; align-items: center; gap: 0.7rem; }
.room-top .right { justify-content: flex-end; gap: 0.4rem; }
.timer { position: relative; width: 3rem; height: 3rem; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 5; }
.timer .track { stroke: var(--paper-3); }
.timer .bar { stroke: var(--ink); stroke-linecap: butt; transition: stroke 0.3s; }
.timer.low .bar { stroke: var(--red); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.timer.low span { color: var(--red); }
.round-label { font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.round-label small { display: block; font-weight: 600; color: var(--ink-2); font-size: 0.8rem; }
.word { text-align: center; min-width: 0; }
.word .hint { font-family: 'Caveat', cursive; font-size: 1.2rem; color: var(--ink-2); line-height: 1; }
.word .letters { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.3rem 0.35rem; font-size: clamp(1.25rem, 2.6vw, 1.75rem); font-weight: 800; }
.word .letters .wd { display: inline-flex; gap: 0.32rem; }
.word .letters .l { min-width: 0.85em; text-align: center; border-bottom: 3px solid var(--ink); line-height: 1.1; }
.word .letters .l.shown { background: var(--hl-yellow); }
.word .letters .sep { border: 0; }
.word .letters .gap { width: 0.6em; }
.word .count { font-size: 0.85rem; color: var(--ink-2); margin-left: 0.35rem; font-weight: 700; }
.word .plain { font-size: clamp(1.25rem, 2.6vw, 1.75rem); font-weight: 800; line-height: 1.15; }
.word .plain.solved { background: linear-gradient(transparent 50%, var(--hl-green) 50%, var(--hl-green) 95%, transparent 95%); display: inline-block; padding: 0 0.2em; }

.players { grid-area: players; padding: 0.45rem; overflow: auto; display: flex; flex-direction: column; gap: 0; }
.player { display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.4rem; border-bottom: 2px dashed var(--line-soft); position: relative; }
.player:last-child { border-bottom: 0; }
.player.me .name > :first-child { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.player.guessed { background: var(--hl-green); }
.player.drawing { background: var(--hl-yellow); }
.player.offline { opacity: 0.45; }
.player .rank { width: 1.7rem; text-align: center; font-family: 'Caveat', cursive; font-size: 1.45rem; line-height: 1; color: var(--ink-2); }
.player .info { flex: 1; min-width: 0; }
.player .name { font-weight: 700; display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .name .i { color: var(--ink); width: 0.95em; height: 0.95em; }
.player .pts { font-size: 0.82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.player .state { display: grid; place-items: center; color: var(--green); }
.player .state.draw { color: var(--ink); }
.player .kick { opacity: 0; position: absolute; right: 0.2rem; }
.player:hover .kick, .player .kick:focus-visible { opacity: 1; }

.stage { grid-area: stage; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.paper-wrap { flex: 1; min-height: 0; display: grid; place-items: center; }
.paper { position: relative; width: 100%; max-height: 100%; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; background: #fff; border: 2px solid var(--line); box-shadow: 5px 5px 0 var(--canvas-edge); }
@supports (width: 1cqw) {
  .paper-wrap { container-type: size; }
  .paper { width: min(calc(100cqw - 8px), calc((100cqh - 8px) * 4 / 3)); }
}
.paper canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.paper.can-draw canvas { cursor: none; }
.brush-cursor { position: absolute; pointer-events: none; border-radius: 50%; border: 1.5px solid rgb(0 0 0 / 0.7); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.8); transform: translate(-50%, -50%); display: none; }
.paper.can-draw:hover .brush-cursor { display: block; }
.paper.fill-tool canvas { cursor: crosshair; }
.paper.fill-tool .brush-cursor { display: none !important; }

/* Overlay auf der Zeichenfläche: ein Zettel statt Glas */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgb(243 238 227 / 0.72); animation: fade 0.15s; color: #1f1c18; text-align: center; }
[data-theme='dark'] .overlay { background: rgb(28 32 35 / 0.72); }
.overlay > div { display: flex; flex-direction: column; align-items: center; max-width: min(92%, 520px); background: #fdfaf3; border: 2px solid #1f1c18; border-radius: 8px; padding: 1.2rem 1.5rem 1.3rem; box-shadow: 5px 5px 0 #1f1c18; transform: rotate(-0.8deg); }
.overlay > div > .avatar { margin-bottom: 0.3rem; }
.overlay h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
.overlay p { margin: 0.35rem 0 0; color: #5d564b; }
.overlay .big { font-weight: 800; font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -0.03em; background: linear-gradient(transparent 52%, rgb(255 210 63 / 0.6) 52%, rgb(255 210 63 / 0.6) 92%, transparent 92%); padding: 0 0.2em; }
.choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; margin-top: 1.1rem; }
.choices button { background: #ffd23f; color: #1f1c18; border: 2px solid #1f1c18; border-radius: 8px; padding: 0.65rem 1.15rem; font-weight: 800; font-size: 1.12rem; cursor: pointer; box-shadow: 3px 3px 0 #1f1c18; transition: transform 0.08s, box-shadow 0.08s; }
.choices button:hover { transform: translate(-1px, -2px); box-shadow: 4px 5px 0 #1f1c18; }
.gains { list-style: none; padding: 0; margin: 0.9rem 0 0; display: grid; gap: 0.2rem; min-width: min(280px, 100%); }
.gains li { display: flex; justify-content: space-between; gap: 2rem; font-weight: 700; border-bottom: 1.5px dashed #cfc4ae; padding: 0.15rem 0; }
.gains li:last-child { border-bottom: 0; }
.gains .i { vertical-align: -2px; }
.gains .plus { color: #17865a; font-variant-numeric: tabular-nums; }
.gains .zero { color: #8b8374; }

/* Federmäppchen */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; }
.palette { display: grid; grid-template-columns: repeat(11, 1.5rem); gap: 3px; }
.palette button { width: 1.5rem; height: 1.5rem; border-radius: 4px; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.palette button[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--line); transform: scale(1.08); }
.tool-group { display: flex; gap: 0.25rem; align-items: center; }
.tool-group + .tool-group { padding-left: 0.6rem; border-left: 2px dashed var(--line-soft); }
.tool { width: 2.35rem; height: 2.35rem; border-radius: 8px; border: 2px solid var(--line); background: var(--paper-2); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.tool:hover { background: var(--paper-3); }
.tool[aria-pressed='true'] { background: var(--marker); color: var(--marker-ink); box-shadow: 2px 2px 0 var(--line); }
[data-theme='dark'] .tool[aria-pressed='true'] { box-shadow: 2px 2px 0 #0b0d0e; }
.size-dot { background: currentColor; border-radius: 50%; }
.current-color { width: 2.35rem; height: 2.35rem; border-radius: 8px; border: 2px solid var(--line); padding: 0; cursor: pointer; background: none; }
.current-color::-webkit-color-swatch-wrapper { padding: 2px; }
.current-color::-webkit-color-swatch { border: 0; border-radius: 4px; }
.current-color::-moz-color-swatch { border: 0; border-radius: 4px; }

/* Chat: liniertes Papier */
.chat { grid-area: chat; display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-log {
  flex: 1; overflow-y: auto; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; font-size: 0.93rem; overflow-wrap: anywhere;
  background-image: linear-gradient(var(--rule) 1.5px, transparent 1.5px); background-size: 100% 1.75rem; background-attachment: local; line-height: 1.75rem;
}
.msg { padding: 0 0.3rem; }
.msg b { font-weight: 800; }
.msg.system { color: var(--ink-2); font-family: 'Caveat', cursive; font-size: 1.15rem; }
.msg.join { color: var(--green); font-family: 'Caveat', cursive; font-size: 1.15rem; }
.msg.leave { color: var(--red); font-family: 'Caveat', cursive; font-size: 1.15rem; }
.msg.correct { background: var(--hl-green); font-weight: 800; }
.msg.close { background: var(--hl-yellow); font-weight: 700; }
.msg.insider { color: var(--green); }
.msg.word, .msg.start { font-weight: 800; text-align: center; }
.msg .nm { color: var(--ink); }
.chat-form { display: flex; gap: 0.4rem; padding: 0.55rem; border-top: 2px solid var(--line); background: var(--paper-2); }

/* Warteraum */
.lobby { flex: 1; overflow: auto; display: grid; gap: 1rem; align-content: start; padding: 0 6px 6px 0; }
.lobby-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.room-code { display: flex; align-items: center; gap: 0.9rem; }
.room-code .code { font-size: 2.3rem; font-weight: 800; letter-spacing: 0.18em; line-height: 1; background: var(--hl-yellow); padding: 0.05em 0.2em; }
.room-code .small { font-family: 'Caveat', cursive; font-size: 1.2rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.9rem; }
.cats { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lobby-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.lobby-foot [data-start-note] { font-family: 'Caveat', cursive; font-size: 1.35rem; color: var(--ink-2); line-height: 1.1; }
.settings-note { font-size: 0.85rem; color: var(--ink-2); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.5rem; }
.lobby-foot .row { gap: 0.5rem; }

/* Ergebnis */
.results { flex: 1; overflow: auto; display: grid; gap: 1.2rem; align-content: start; padding: 0 6px 6px 0; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 0.6rem; padding-top: 0.5rem; border-bottom: 2px solid var(--line); }
.podium .step { display: grid; justify-items: center; gap: 0.3rem; width: min(30%, 150px); text-align: center; }
.podium .block { width: 100%; border: 2px solid var(--line); border-bottom-width: 0; border-radius: 6px 6px 0 0; display: grid; place-items: center; font-weight: 800; font-size: 2rem; color: #1f1c18; }
.podium .p1 .block { height: 110px; background: var(--marker); }
.podium .p2 .block { height: 78px; background: #d9d4c8; }
.podium .p3 .block { height: 56px; background: #f0a47a; }
.podium .avatar.xl { width: 4.2rem; height: 4.2rem; }
.podium .nm { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .sc { font-size: 0.85rem; color: var(--ink-2); font-weight: 600; }
.rest { list-style: none; margin: 0.5rem auto 0; padding: 0; display: grid; gap: 0; max-width: 420px; width: 100%; }
.rest li { display: flex; gap: 0.6rem; align-items: center; padding: 0.4rem 0.2rem; border-bottom: 2px dashed var(--line-soft); }
.rest li .grow { flex: 1; font-weight: 600; }
.results-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.6rem; }
.results-actions [data-wait] { font-family: 'Caveat', cursive; font-size: 1.3rem; }

/* Bilder */
.arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.1rem; }
.art { display: grid; gap: 0.5rem; padding: 0.55rem 0.55rem 0.7rem; background: var(--paper-2); border: 2px solid var(--line); border-radius: 6px; cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform 0.12s; color: var(--ink); }
.art:nth-child(3n + 1) { transform: rotate(-0.8deg); }
.art:nth-child(3n + 2) { transform: rotate(0.6deg); }
.art:hover { transform: rotate(0) translateY(-3px); }
.art canvas { width: 100%; aspect-ratio: 4 / 3; background: #fff; display: block; border: 1.5px solid var(--line-soft); }
.art .w { font-weight: 800; font-size: 1.05rem; }
.art .by { font-size: 0.85rem; color: var(--ink-2); display: flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.art .i { vertical-align: -2px; color: var(--green); }

/* Meine Spiele */
.page { max-width: 1100px; margin: 0 auto; display: grid; gap: 1.3rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; }
.page-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); letter-spacing: -0.04em; }
.page-head p { margin-top: 0.35rem; color: var(--ink-2); }
.page-head a.small { font-weight: 700; display: inline-flex; align-items: center; gap: 0.2rem; margin-bottom: 0.3rem; text-decoration: none; }
.page-head a.small:hover { text-decoration: underline; }
.game-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.game-card { display: grid; gap: 0.7rem; text-decoration: none; color: inherit; transition: transform 0.12s, box-shadow 0.12s; position: relative; }
.game-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.thumbs canvas { width: 100%; aspect-ratio: 4 / 3; background: #fff; display: block; border: 1.5px solid var(--line-soft); }
.game-card .meta { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; color: var(--ink-2); font-weight: 600; }
.game-card .meta .i { vertical-align: -2px; }
.game-card .winner { font-weight: 800; display: flex; align-items: center; gap: 0.4rem; font-size: 1.05rem; }
.game-card .remove { position: absolute; top: 0.5rem; right: 0.5rem; opacity: 0; }
.game-card:hover .remove, .game-card .remove:focus-visible { opacity: 1; }
.ranking { width: 100%; border-collapse: collapse; }
.ranking td { padding: 0.45rem 0.4rem; border-bottom: 2px dashed var(--line-soft); }
.ranking tr:last-child td { border-bottom: 0; }
.ranking .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; }
.ranking td:first-child { font-family: 'Caveat', cursive; font-size: 1.4rem; color: var(--ink-2); }
.ranking .who { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; }
.game-detail-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); gap: 1.2rem; align-items: start; }
.facts { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; color: var(--ink-2); font-size: 0.92rem; font-weight: 600; }
.facts span { display: inline-flex; align-items: center; gap: 0.3rem; }
@media (max-width: 800px) { .game-detail-top { grid-template-columns: 1fr; } }

/* Großansicht */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(31 28 24 / 0.92); display: grid; grid-template-rows: auto 1fr auto; gap: 0.75rem; padding: clamp(0.75rem, 3vw, 2rem); animation: fade 0.15s; color: #f3eee3; }
.lightbox header { display: flex; align-items: center; gap: 1rem; justify-content: space-between; }
.lightbox h2 { font-size: clamp(1.4rem, 3.5vw, 2.1rem); }
.lightbox .sub { color: #c8c0b0; font-size: 0.95rem; }
.lightbox .canvas-box { min-height: 0; display: grid; place-items: center; container-type: size; }
.lightbox canvas { width: min(calc(100cqw - 10px), calc((100cqh - 10px) * 4 / 3)); aspect-ratio: 4 / 3; background: #fff; border: 2px solid #f3eee3; box-shadow: 6px 6px 0 #000; }
.lightbox footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; }
.lightbox .btn { background: #fdfaf3; color: #1f1c18; border-color: #1f1c18; box-shadow: 2px 2px 0 #000; }
.lightbox .btn:hover { box-shadow: 3px 3px 0 #000; }
.lightbox .guessers { color: #c8c0b0; font-size: 0.95rem; text-align: center; width: 100%; }

/* Charakter-Editor */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(31 28 24 / 0.55); display: grid; place-items: center; padding: 1rem; animation: fade 0.15s; overflow: auto; }
.modal { width: min(100%, 840px); max-height: calc(100dvh - 2rem); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 0.9rem; animation: pop 0.18s ease-out; box-shadow: var(--shadow-lg); }
.modal .section-head { margin: 0; align-items: center; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; }
.char-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.2rem; min-height: 0; }
.char-preview { display: grid; justify-items: center; align-content: start; gap: 0.5rem; padding: 1rem; background: var(--paper); border: 2px dashed var(--line-soft); border-radius: 8px; }
.char-big { width: 180px; height: 180px; }
.char-big svg { width: 100%; height: 100%; overflow: visible; }
.char-name { font-weight: 800; font-size: 1.1rem; }
.char-side { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0.6rem; min-height: 0; }
.char-tabs { margin: 0; overflow-x: auto; scrollbar-width: none; }
.char-tabs button { padding: 0.4rem 0.7rem; font-size: 0.92rem; white-space: nowrap; }
.char-panel { overflow-y: auto; max-height: min(56dvh, 520px); padding: 0.1rem 0.3rem 0.3rem 0.1rem; display: grid; gap: 1rem; align-content: start; }
.char-sec h3 { font-family: 'Caveat', cursive; font-size: 1.35rem; font-weight: 700; margin: 0 0 0.3rem; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.opt { aspect-ratio: 1; padding: 3px; border-radius: 8px; border: 2px solid var(--line-soft); background: var(--paper); cursor: pointer; line-height: 0; transition: border-color 0.1s; }
.opt:hover { border-color: var(--line); }
.opt[aria-pressed='true'] { border-color: var(--line); background: var(--hl-yellow); box-shadow: 2px 2px 0 var(--line); }
.opt svg { width: 100%; height: 100%; overflow: hidden; }
.color-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.sw[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--line); }
.picker { position: relative; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: #fff;
  background: conic-gradient(#ff4d4d, #ffd23f, #4edea3, #48dbfb, #5f27cd, #ff9ff3, #ff4d4d); border: 2px solid var(--line); }
.picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.picker span { pointer-events: none; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.6)); display: grid; }
.picker.custom { background: var(--pick); box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--line); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.tpl { display: grid; justify-items: center; gap: 0.2rem; padding: 0.4rem 0.3rem 0.45rem; border-radius: 8px; border: 2px solid var(--line-soft); background: var(--paper); cursor: pointer; font-size: 0.8rem; font-weight: 700; color: var(--ink); transition: transform 0.1s, border-color 0.1s; }
.tpl:hover { border-color: var(--line); transform: rotate(-1.5deg); }
.tpl-fig { width: 64px; height: 64px; line-height: 0; }
.tpl-fig svg { width: 100%; height: 100%; overflow: visible; }
.tpl > span:last-child { max-width: 100%; text-align: center; line-height: 1.15; hyphens: auto; overflow-wrap: anywhere; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) {
  .room { grid-template-columns: 196px minmax(0, 1fr) 260px; }
}
@media (max-width: 900px) {
  .room {
    height: auto; min-height: 0;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-areas: 'top top' 'stage stage' 'players chat';
    grid-template-rows: auto auto auto;
  }
  .room-top { padding: 0.45rem 0.6rem; gap: 0.5rem; }
  .round-label small { display: none; }
  .players, .chat { height: 42dvh; min-height: 260px; }
  .paper-wrap { display: block; container-type: normal; }
  .paper { width: 100%; }
  .lobby, .results { overflow: visible; }
  .player .rank { display: none; }
  .palette { grid-template-columns: repeat(11, 1.35rem); }
  .palette button { width: 1.35rem; height: 1.35rem; }
  .tool { width: 2.2rem; height: 2.2rem; }
  .tool-group + .tool-group { border-left: 0; padding-left: 0; }
}
@media (max-width: 640px) {
  .room-top .label { display: none; }
  .modal-backdrop { padding: 0.5rem; align-items: start; }
  .modal { padding: 0.9rem; }
  .char-layout { grid-template-columns: 1fr; gap: 0.7rem; }
  .char-preview { grid-template-columns: auto 1fr; align-items: center; justify-items: start; padding: 0.5rem 0.8rem; }
  .char-preview .char-big { width: 96px; height: 96px; grid-row: span 2; }
  .char-panel { max-height: 46dvh; }
  .opt-grid { grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); }
}
@media (max-width: 480px) {
  .timer { width: 2.5rem; height: 2.5rem; }
  .timer span { font-size: 0.9rem; }
  .room-code .code { font-size: 1.7rem; }
  .players { padding: 0.3rem; }
  .player { gap: 0.4rem; padding: 0.4rem 0.25rem; }
  .player .avatar { width: 1.9rem; height: 1.9rem; }
  .player .name { font-size: 0.9rem; }
  .player .pts { font-size: 0.75rem; }
  .room-top { grid-template-columns: auto 1fr auto; }
  .round-label { font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
