/* Doodle Dash – Layout & Komponenten (nutzt Tokens/Buttons/Panels aus /css/base.css) */
html, body { background: var(--bg0); }
body {
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(138, 75, 255, .28), transparent 60%),
    radial-gradient(800px 600px at 92% 90%, rgba(255, 47, 166, .20), transparent 60%),
    radial-gradient(700px 500px at 60% 0%, rgba(25, 227, 255, .14), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
}
#app { position: fixed; inset: 0; pointer-events: auto; }
.view { position: absolute; inset: 0; }
.view.center { display: flex; align-items: center; justify-content: center; padding: 14px; overflow: auto; animation: screen-in .4s var(--ease) both; }
.view.center > .panel { margin: auto; }
.scroll { overflow-y: auto; overscroll-behavior: contain; }
.input, .chat-log, .turn-word, .room-code { user-select: text; -webkit-user-select: text; }

/* ---------- Beitritt ---------- */
.join-card { width: min(440px, 100%); display: flex; flex-direction: column; gap: 6px; }
.logo { margin: 0; font-family: var(--font-display); font-style: italic; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  font-size: clamp(34px, 9vw, 52px); line-height: 1; color: #fff; text-shadow: 0 0 24px rgba(255, 47, 166, .55); }
.logo span { background: linear-gradient(90deg, var(--cyan), var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 14px rgba(25, 227, 255, .45)); }
.tagline { margin: 0 0 12px; color: var(--ink-dim); font-size: 14px; letter-spacing: .03em; }
.invite-hint { margin: 0 0 8px; padding: 8px 12px; border-radius: 4px 12px 4px 12px; background: rgba(25, 227, 255, .12); border: 1px solid rgba(25, 227, 255, .35); color: var(--cyan); font-weight: 600; font-size: 14px; }
.join-actions { display: flex; justify-content: center; margin: 14px 0 4px; }
.join-error { margin-top: 8px; color: var(--red); font-weight: 600; font-size: 14px; }
.join-or { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; color: var(--ink-mute); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.join-or::before, .join-or::after { content: ""; flex: 1; height: 1px; background: var(--glass-line); }
.join-code-row { display: flex; gap: 10px; align-items: center; }
.join-code-row .input.code { flex: 1; min-width: 0; font-size: 26px; height: 54px; }

/* ---------- Lobby ---------- */
.lobby-card { width: min(920px, 100%); }
.lobby-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 3vw, 32px); }
.lobby-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.room-code { font-family: var(--font-display); font-weight: 900; font-style: italic; font-size: clamp(44px, 9vw, 72px); letter-spacing: .22em; line-height: 1;
  color: var(--yellow); text-shadow: 0 0 26px rgba(255, 210, 63, .5); margin-bottom: 6px; }
.invite-row { display: flex; gap: 8px; align-items: center; }
.invite-row .input { font-size: 13px; height: 40px; min-width: 0; }
.lobby-players-label { margin-top: 10px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lobby-players li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(5, 8, 30, .5); border: 1px solid var(--glass-line); border-radius: 4px 12px 4px 12px; font-weight: 600; min-width: 0; }
.lobby-players li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.lobby-players .crown { color: var(--yellow); }
.lobby-note { margin: 4px 0 0; min-height: 18px; color: var(--ink-dim); font-size: 13px; }
#btn-start { align-self: flex-start; margin-top: 6px; }
.z-slider { grid-template-columns: 110px 1fr 56px; }
.lobby-col .seg { align-self: flex-start; }
.lobby-col .seg-btn.on[disabled], .lobby-col .toggle.on[disabled] { opacity: .85; }

.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 14px var(--font-display);
  color: #07102a; text-transform: uppercase; box-shadow: 0 0 10px rgba(255, 255, 255, .18), inset 0 -3px 6px rgba(0, 0, 0, .25); }

/* ---------- Spiel-Layout ---------- */
#view-game { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 12px; padding: 12px; animation: screen-in .4s var(--ease) both; }
#stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.side { display: flex; flex-direction: column; min-height: 0; padding: 12px; }
.side-head { appearance: none; background: none; border: 0; padding: 0; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; width: 100%; cursor: default; text-align: left; }
.side-head .panel-title { margin: 0; }
.side-sum { margin-left: auto; color: var(--ink-dim); font-size: 12px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { display: none; width: 10px; height: 10px; border-right: 2px solid var(--ink-dim); border-bottom: 2px solid var(--ink-dim); transform: rotate(45deg); transition: transform .2s; margin: 0 4px 3px 0; }

.players-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; }
.players-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px 12px 4px 12px; background: rgba(5, 8, 30, .45); border: 1px solid transparent; position: relative; min-width: 0; }
.players-list li.me { border-color: rgba(25, 227, 255, .4); }
.players-list li.drawing { border-color: rgba(255, 210, 63, .7); background: rgba(255, 210, 63, .1); }
.players-list li.guessed { background: rgba(61, 255, 139, .12); }
.players-list .rank { width: 16px; text-align: center; color: var(--ink-mute); font: 800 12px var(--font-display); }
.players-list .info { flex: 1; min-width: 0; line-height: 1.15; }
.players-list .nm { display: block; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players-list .sc { display: block; color: var(--cyan); font: 700 12px var(--font-display); letter-spacing: .04em; }
.players-list .late { color: var(--ink-mute); font-weight: 600; font-size: 11px; }
.badge { flex: none; font-size: 15px; line-height: 1; }
.badge.draw { color: var(--yellow); filter: drop-shadow(0 0 6px rgba(255, 210, 63, .7)); }
.badge.ok { color: var(--green); }
.badge.host { color: var(--yellow); font-size: 12px; }
.kick { appearance: none; border: 0; background: rgba(255, 77, 94, .18); color: var(--red); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-weight: 800; line-height: 1; flex: none; }
.kick:hover { background: rgba(255, 77, 94, .45); color: #fff; }

/* HUD */
.hud { display: grid; grid-template-columns: minmax(90px, 1fr) auto minmax(90px, 1fr); align-items: center; gap: 12px; padding: 8px 14px 12px; min-height: 64px; }
.hud-left { min-width: 0; }
.hud-round { font: 800 italic 15px var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); }
.hud-sub { color: var(--ink-dim); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-word { text-align: center; min-width: 0; }
.hud-label { color: var(--ink-mute); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; min-height: 14px; }
.word-line { font: 800 italic clamp(20px, 3.4vw, 32px) var(--font-display); letter-spacing: .14em; color: #fff; text-shadow: 0 0 18px rgba(25, 227, 255, .5); display: flex; justify-content: center; flex-wrap: wrap; gap: 0 .2em; min-height: 1.2em; }
.word-line .ch { display: inline-block; min-width: .7em; text-align: center; }
.word-line .ch.blank { border-bottom: 3px solid var(--ink-dim); height: 1.05em; margin: 0 .05em; }
.word-line .ch.gap { min-width: .5em; }
.word-line .cnt { font-size: .45em; color: var(--ink-mute); align-self: flex-end; letter-spacing: 0; margin-left: .4em; }
.word-line.mine { color: var(--yellow); text-shadow: 0 0 18px rgba(255, 210, 63, .55); }
.hud-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.icon-btn { appearance: none; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .06); color: var(--ink-dim); width: 36px; height: 36px; border-radius: 4px 12px 4px 12px; cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s; }
.icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.icon-btn[aria-pressed="true"] { color: var(--red); }
.timer { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(5, 8, 30, .7); border: 2px solid var(--cyan); box-shadow: var(--glow-cyan); font: 800 italic 20px var(--font-display); }
.timer.warn { border-color: var(--red); color: var(--red); box-shadow: 0 0 22px rgba(255, 77, 94, .6); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.timer-bar { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--cyan), var(--magenta)); transform-origin: left; }

/* Zeichenfläche */
.board-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#board { display: block; background: #fff; border-radius: 6px 22px 6px 22px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .18), 0 18px 50px rgba(0, 0, 0, .55), 0 0 40px rgba(25, 227, 255, .18);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: not-allowed; image-rendering: auto; }
#board.can-draw { cursor: crosshair; box-shadow: 0 0 0 2px var(--yellow), 0 18px 50px rgba(0, 0, 0, .55), 0 0 40px rgba(255, 210, 63, .3); }
.board-ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 10px; }
.board-ov.interactive { pointer-events: auto; }
.ov-card { background: var(--glass-strong); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: 6px 22px 6px 22px; padding: clamp(12px, 2.6vh, 24px) clamp(16px, 3vw, 32px); text-align: center; max-width: 100%; max-height: 100%; overflow: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6); animation: screen-in .3s var(--ease) both; pointer-events: auto; }
.ov-title { font: 800 italic clamp(18px, 3vw, 26px) var(--font-display); text-transform: uppercase; letter-spacing: .08em; }
.ov-sub { color: var(--ink-dim); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.choose-words { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 16px 0 12px; }
.choose-words .btn { min-width: 120px; text-transform: none; letter-spacing: .04em; font-size: clamp(15px, 2.4vw, 20px); }
.ov-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.ov-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); transform-origin: left; }
.turn-word { font: 900 italic clamp(26px, 5vw, 44px) var(--font-display); color: var(--yellow); text-shadow: 0 0 26px rgba(255, 210, 63, .55); letter-spacing: .08em; margin: 4px 0 6px; overflow-wrap: anywhere; }
.turn-list { list-style: none; margin: 12px auto 0; padding: 0; display: grid; gap: 4px; min-width: min(300px, 100%); text-align: left; }
.turn-list li { display: flex; gap: 10px; align-items: baseline; padding: 4px 10px; border-radius: 3px 9px 3px 9px; background: rgba(255, 255, 255, .06); font-weight: 600; }
.turn-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.turn-list .dl { font: 800 14px var(--font-display); color: var(--green); }
.turn-list .dl.zero { color: var(--ink-mute); }
.turn-list .tt { color: var(--ink-dim); font-size: 12px; min-width: 44px; text-align: right; }

/* Werkzeuge */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 12px; position: relative; }
.tools.disabled .palette, .tools.disabled .tool-group { display: none; } /* Rater sehen nur den Hinweis – mehr Platz für die Zeichnung */
.tools-note { display: none; flex: 1; align-items: center; justify-content: center; text-align: center; color: var(--ink-dim); font-weight: 600; font-size: 14px; min-height: 28px; }
.tools.disabled .tools-note { display: flex; }
.palette { display: grid; grid-template-columns: repeat(12, 26px); gap: 4px; }
.swatch { appearance: none; width: 26px; height: 26px; border-radius: 4px 9px 4px 9px; border: 2px solid rgba(255, 255, 255, .25); cursor: pointer; padding: 0; transition: transform .12s; }
.swatch:hover { transform: scale(1.12); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--cyan), 0 0 14px var(--cyan); transform: scale(1.12); }
.tool-group { display: flex; gap: 6px; align-items: center; }
.tool, .size { appearance: none; cursor: pointer; border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .07); color: var(--ink-dim); width: 40px; height: 40px;
  border-radius: 4px 12px 4px 12px; display: grid; place-items: center; transition: background .15s, color .15s, transform .15s; padding: 0; }
.tool:hover, .size:hover { background: rgba(255, 255, 255, .17); color: #fff; }
.tool.on, .size.on { background: linear-gradient(180deg, #5af3ff, #19b9e8); color: #05102a; box-shadow: 0 0 14px rgba(25, 227, 255, .55); border-color: transparent; }
.tool:active { transform: scale(.92); }
.size i { display: block; border-radius: 50%; background: currentColor; }

/* Chat */
.chat-log { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; font-size: 14px; line-height: 1.3; }
.chat-log .msg { overflow-wrap: anywhere; padding: 2px 6px; border-radius: 3px 8px 3px 8px; }
.chat-log .msg b { color: var(--cyan); font-weight: 700; }
.chat-log .msg.sys { color: var(--ink-mute); font-style: italic; font-size: 13px; }
.chat-log .msg.correct { color: var(--green); font-weight: 800; background: rgba(61, 255, 139, .12); }
.chat-log .msg.guessed { color: var(--green); font-weight: 700; }
.chat-log .msg.close { color: var(--yellow); font-weight: 700; background: rgba(255, 210, 63, .1); }
.chat-log .msg.team { background: rgba(138, 75, 255, .18); }
.chat-log .msg.team b { color: #c6a6ff; }
.chat-log .msg.mine b { color: var(--magenta); }
.chat-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.chat-form .input { height: 42px; font-size: 15px; min-width: 0; }
.chat-form .btn { flex: none; }

/* Overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(3, 4, 16, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 30; overflow: auto; animation: screen-in .4s var(--ease) both; }
.end-card { width: min(720px, 100%); text-align: center; margin: auto; }
.end-card .screen-heading { margin-bottom: 8px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; height: clamp(180px, 34vh, 280px); margin: 14px 0 10px; }
.pod { flex: 1; max-width: 170px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.pod .pn { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .ps { font: 800 italic 18px var(--font-display); color: var(--cyan); margin-bottom: 6px; }
.pod .blk { width: 100%; border-radius: 6px 16px 0 0; display: grid; place-items: start center; padding-top: 8px; font: 900 italic 34px var(--font-display); color: #05102a;
  transform-origin: bottom; animation: rise .8s var(--ease-bounce) both; }
.pod.p1 .blk { height: 100%; background: linear-gradient(180deg, #ffe66b, #f0a500); box-shadow: 0 0 34px rgba(255, 210, 63, .55); }
.pod.p2 .blk { height: 68%; background: linear-gradient(180deg, #e8eefc, #96a3c8); animation-delay: .15s; }
.pod.p3 .blk { height: 48%; background: linear-gradient(180deg, #ffb27a, #c5682a); animation-delay: .3s; }
.pod .crown { font-size: 28px; filter: drop-shadow(0 0 10px rgba(255, 210, 63, .8)); }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.end-rest { list-style: none; margin: 0 auto 12px; padding: 0; display: grid; gap: 4px; max-width: 420px; text-align: left; max-height: 22vh; overflow: auto; }
.end-rest li { display: flex; gap: 10px; padding: 4px 10px; border-radius: 3px 9px 3px 9px; background: rgba(255, 255, 255, .06); font-weight: 600; }
.end-rest .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-rest .sc { color: var(--cyan); font-family: var(--font-display); font-weight: 700; }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60; background: rgba(255, 77, 94, .9); color: #fff; font-weight: 700; padding: 8px 18px; border-radius: 4px 14px 4px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); max-width: 92vw; text-align: center; }
.toasts { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 4px 14px 4px 14px; padding: 8px 16px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: screen-in .25s var(--ease) both; text-align: center; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) { #view-game { grid-template-columns: 190px minmax(0, 1fr) 250px; } }

@media (max-width: 860px) {
  /* Handy/Tablet hochkant: Spieler und Chat als einklappbare Leisten, Zeichenfläche in der Mitte */
  #view-game { display: flex; flex-direction: column; gap: 6px; padding: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  #players { order: 1; padding: 8px 10px; flex: none; }
  #stage { order: 2; flex: 1; gap: 6px; }
  #chat { order: 3; padding: 8px 10px; flex: none; }
  .side-head { cursor: pointer; margin-bottom: 0; }
  .chev { display: block; }
  .side-head[aria-expanded="true"] .chev { transform: rotate(225deg); margin-bottom: 0; }
  .players-list { margin-top: 8px; max-height: 34vh; overflow-y: auto; }
  #players.collapsed .players-list { display: none; }
  #chat .chat-log { margin-top: 8px; height: clamp(52px, 9vh, 96px); flex: none; }
  #chat.collapsed .chat-log { display: none; }
  .hud { grid-template-columns: auto 1fr auto; padding: 6px 10px 12px; min-height: 0; gap: 8px; }
  .hud-sub { display: none; }
  .hud-round { font-size: 12px; }
  .word-line { font-size: clamp(16px, 5.4vw, 26px); letter-spacing: .08em; }
  .timer { width: 38px; height: 38px; font-size: 16px; }
  .icon-btn { width: 32px; height: 32px; }
  .palette { grid-template-columns: repeat(12, 1fr); width: 100%; }
  .swatch { width: 100%; height: 20px; }
  .tools { padding: 6px 8px; gap: 6px 10px; justify-content: center; }
  .tool, .size { width: 34px; height: 34px; }
  .lobby-grid { grid-template-columns: 1fr; }
  #btn-start { align-self: stretch; min-width: 0; }
  .btn.big { min-width: 0; width: 100%; }
}
@media (max-height: 560px) and (min-width: 600px) {
  /* Querformat-Handy: Spieler/Chat schmal rechts, wenig Rand */
  #view-game { display: grid; grid-template-columns: minmax(0, 1fr) 230px; grid-template-rows: auto 1fr; gap: 6px; padding: 6px; }
  #players { order: 0; grid-column: 2; grid-row: 1; }
  #stage { order: 0; grid-column: 1; grid-row: 1 / span 2; }
  #chat { order: 0; grid-column: 2; grid-row: 2; min-height: 0; }
  #chat .chat-log { height: auto; flex: 1; }
  .hud { min-height: 0; padding: 4px 10px 10px; }
  .tool, .size { width: 32px; height: 32px; }
  .swatch { height: 20px; }
}
@media (max-width: 420px) {
  .lobby-players { grid-template-columns: 1fr 1fr; }
  .chat-form .btn { min-width: 0; }
  .chat-form .btn > .btn-label { padding: 0 12px; }
}

/* Glanz-Effekt der Buttons nur beim Hover zeigen (ruhend liegt er sonst als Streifen neben dem Button) */
.btn::after { opacity: 0; transition: transform .6s var(--ease), opacity .15s; }
.btn:hover::after, .btn:focus-visible::after { opacity: 1; }
