/* 🐍 Rex Snake V2 – baut auf arcade-ui.css auf */

.slither { display: inline-block; animation: slither 2.6s ease-in-out infinite; }
@keyframes slither { 0%, 100% { transform: translateX(-10px) rotate(-8deg); } 50% { transform: translateX(10px) rotate(8deg); filter: drop-shadow(0 0 22px rgba(61, 255, 162, 0.8)); } }
.hero-logo h1 span { background: linear-gradient(135deg, var(--green), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { color: var(--green); }

/* ---------- Menü ---------- */
.menu-layout { width: 100%; max-width: 1000px; display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.menu-layout .card { max-width: none; }
.solo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1rem; text-align: left; }
.best-line { margin-top: 0.7rem; color: var(--muted); font-size: 0.85rem; text-align: center; }
.best-line b { color: var(--gold); }
.howto { margin-top: 1rem; text-align: left; color: #cbd5e1; font-size: 0.85rem; }
.howto summary { cursor: pointer; color: var(--gold); font-weight: 700; }
.howto ul { margin: 0.6rem 0 0 1.1rem; display: grid; gap: 0.35rem; }
.howto kbd, .end-actions kbd { padding: 0.05rem 0.35rem; border-radius: 5px; background: rgba(255,255,255,0.1); border: 1px solid var(--stroke); font-size: 0.72rem; }
.small { font-size: 0.75rem; margin-top: 0.4rem; }
.top-list { display: grid; gap: 0.2rem; margin-top: 0.6rem; }
.top-row { display: grid; grid-template-columns: 1.8rem 1fr auto; gap: 0.4rem; font-size: 0.85rem; padding: 0.25rem 0.5rem; border-radius: 8px; background: rgba(255,255,255,0.03); }
.top-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.top-row b { color: var(--gold); font-variant-numeric: tabular-nums; }
.top-row:nth-child(1) span:first-child { color: var(--gold); }

/* ---------- Lobby ---------- */
.lobby-layout { width: 100%; max-width: 1100px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
.lobby-layout .card { max-width: none; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.lobby-head .room-code { font-size: 2.4rem; margin: 0; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1.1rem; }
.mode-card { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.8rem 0.9rem; border-radius: var(--radius-sm); background: rgba(0,0,0,0.25); border: 1.5px solid var(--stroke); cursor: pointer; text-align: left; transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s; }
.mode-card b { font-size: 0.95rem; }
.mode-card small { color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.mode-card.selected { border-color: var(--c); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); }
.size-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 1.1rem; }
.size-card { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.6rem 0.3rem; border-radius: var(--radius-sm); background: rgba(0,0,0,0.25); border: 1.5px solid var(--stroke); cursor: pointer; text-align: center; transition: transform 0.15s, border-color 0.2s; }
.size-card .preview { height: 46px; display: grid; place-items: center; }
.size-card .preview i { display: block; border: 2px solid var(--green); border-radius: 4px; box-shadow: 0 0 10px rgba(61,255,162,0.4); background-image: linear-gradient(rgba(61,255,162,0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(61,255,162,0.15) 1px, transparent 1px); background-size: 6px 6px; }
.size-card b { font-size: 0.82rem; }
.size-card small { color: var(--muted); font-size: 0.64rem; }
.size-card.selected { border-color: var(--green); background: rgba(61,255,162,0.1); box-shadow: 0 0 18px rgba(61,255,162,0.3); }
.mode-card:hover:not(.readonly), .size-card:hover:not(.readonly) { transform: translateY(-2px); }
.readonly { cursor: default; }
.settings-grid.three { grid-template-columns: repeat(3, 1fr); }
.member-list { display: grid; gap: 0.4rem; margin-bottom: 1rem; max-height: 340px; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid var(--stroke); animation: popIn 0.3s cubic-bezier(.3,1.6,.5,1); }
.member-row.me { border-color: rgba(255, 210, 63, 0.5); }
.member-row.cpu { opacity: 0.6; border-style: dashed; }
.member-row .name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .tag { font-size: 0.7rem; color: var(--muted); font-weight: 700; }
.snake-dot { width: 26px; height: 12px; border-radius: 6px 8px 8px 6px; background: var(--c); box-shadow: 0 0 10px var(--c); position: relative; flex-shrink: 0; }
.snake-dot::after { content: ""; position: absolute; right: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: #0b0b1a; }
.color-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.35rem; margin-bottom: 1rem; }
.color-sw { aspect-ratio: 1.6; border-radius: 8px; border: 2px solid transparent; background: var(--c); cursor: pointer; box-shadow: 0 0 8px color-mix(in srgb, var(--c) 50%, transparent); transition: transform 0.12s; }
.color-sw:hover:not(:disabled) { transform: scale(1.1); }
.color-sw.sel { border-color: #fff; transform: scale(1.1); }
.color-sw:disabled { opacity: 0.18; cursor: not-allowed; box-shadow: none; }
.start-problem { text-align: center; color: #fda4af; font-size: 0.85rem; min-height: 1.2em; margin-top: 0.5rem; }

/* ---------- Spiel ---------- */
#gameScreen.active { justify-content: flex-start; }
.game-wrap { width: 100%; max-width: 1400px; }
.game-hud { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.game-hud > div { background: rgba(11,11,26,0.7); border: 1px solid var(--stroke); border-radius: 12px; padding: 0.3rem 0.8rem; backdrop-filter: blur(6px); }
.game-hud small { display: block; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 800; }
.game-hud b { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.hud-score b { color: var(--gold); }
.hud-len b { color: var(--green); }
.hud-combo { font-weight: 900; font-size: 1.2rem; color: var(--muted); align-self: stretch; display: grid; place-items: center; min-width: 3.4rem; transition: color 0.2s, transform 0.2s; }
.hud-combo.hot { color: var(--pink); border-color: var(--pink) !important; box-shadow: 0 0 18px rgba(255,77,141,0.45); }
.hud-combo.bump { animation: popIn 0.25s cubic-bezier(.3,1.8,.5,1); }
.hud-mid { flex: 1; text-align: center; font-weight: 800; align-self: stretch; display: flex !important; align-items: center; justify-content: center; gap: 0.6rem; font-size: 1rem; min-width: 160px; }
.hud-mid .sn-timer { font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--cyan); }
.hud-mid .sn-timer.urgent { color: var(--red); animation: pulse 0.6s infinite; }
.hud-fx { display: flex !important; gap: 0.35rem; align-self: stretch; align-items: center; min-width: 3rem; }
.hud-fx:empty { visibility: hidden; }
.fx-chip { position: relative; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 1.15rem; background: rgba(0,0,0,0.35); border: 1.5px solid var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 50%, transparent); overflow: hidden; }
.fx-chip i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--c); }

.arena { position: relative; width: 100%; height: calc(100vh - 210px); min-height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--stroke); box-shadow: var(--shadow); background: #070712; touch-action: none; user-select: none; -webkit-user-select: none; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#minimap { position: absolute; right: 10px; bottom: 10px; width: 150px; height: auto; border-radius: 10px; background: rgba(11,11,26,0.6); border: 1px solid var(--stroke); pointer-events: none; }
.scoreboard { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 2px; pointer-events: none; max-height: 70%; overflow: hidden; }
.sb-row { display: flex; align-items: center; gap: 0.35rem; font-size: 0.7rem; font-weight: 800; background: rgba(11,11,26,0.66); border-radius: 999px; padding: 0.1rem 0.6rem 0.1rem 0.3rem; width: max-content; max-width: 200px; margin-left: auto; transition: opacity 0.3s; }
.sb-row .pl { width: 1.2rem; text-align: center; color: var(--muted); }
.sb-row .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); flex-shrink: 0; }
.sb-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.sb-row b { color: var(--gold); font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.sb-row.me { background: rgba(255, 210, 63, 0.28); outline: 1px solid var(--gold); }
.sb-row.dead { opacity: 0.45; text-decoration: line-through; }

.center-msg { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; }
.center-msg .big { font-size: clamp(3rem, 12vw, 8rem); font-weight: 900; font-style: italic; background: linear-gradient(135deg, var(--green), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(61, 255, 162, 0.6)); animation: cdPop 0.7s cubic-bezier(.2,1.6,.4,1) both; }
.center-msg .sub { font-size: clamp(1rem, 3vw, 1.4rem); font-weight: 900; text-shadow: 0 2px 16px rgba(0,0,0,0.9); margin-top: 0.4rem; }
@keyframes cdPop { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.banner { position: absolute; top: 14%; left: 50%; transform: translateX(-50%); padding: 0.5rem 1.4rem; border-radius: 999px; font-weight: 900; font-size: clamp(0.95rem, 2.4vw, 1.4rem); background: rgba(11,11,26,0.82); border: 2px solid var(--cyan); white-space: nowrap; pointer-events: none; animation: popIn 0.35s cubic-bezier(.3,1.6,.5,1); }
.banner.good { border-color: var(--green); color: #d1ffe6; }
.banner.bad { border-color: var(--red); color: #ffd1d9; }
.banner.warn { border-color: var(--orange); background: linear-gradient(90deg, rgba(255,77,109,0.45), rgba(255,138,61,0.45)); }
.spectate-banner { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 0.4rem 1rem; border-radius: 999px; background: rgba(167, 139, 250, 0.22); border: 1px solid rgba(167, 139, 250, 0.55); font-weight: 800; font-size: 0.85rem; pointer-events: none; white-space: nowrap; }
.controls-hint { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 0.6rem; }
.game-actions { display: flex; justify-content: center; margin-top: 0.5rem; }

.results-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(7,7,18,0.6); backdrop-filter: blur(3px); padding: 1rem; z-index: 5; }
.results-overlay .card { max-width: 560px; width: 100%; max-height: 92%; overflow-y: auto; animation: popIn 0.35s cubic-bezier(.3,1.5,.5,1); }
.results-overlay h2 { margin-bottom: 0.6rem; }
.over-emoji { font-size: 3.2rem; animation: bob 2.4s ease-in-out infinite; }
.over-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 1rem 0; }
.over-stats div { background: rgba(0,0,0,0.3); border: 1px solid var(--stroke); border-radius: 12px; padding: 0.5rem; }
.over-stats small { display: block; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 800; }
.over-stats b { font-size: 1.4rem; font-weight: 900; }
.over-stats div:first-child b { color: var(--gold); }
.save-note { min-height: 1.2em; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.8rem; }
.save-note.record { color: var(--gold); font-weight: 800; }
.results-list { display: grid; gap: 0.3rem; margin: 0.8rem 0; text-align: left; }
.res-row { display: grid; grid-template-columns: 1.6rem 12px 1fr 3.4rem 2.6rem 3.6rem; gap: 0.5rem; align-items: center; padding: 0.35rem 0.6rem; border-radius: 9px; background: rgba(255,255,255,0.04); border: 1px solid var(--stroke); font-size: 0.82rem; }
.res-row.head { background: none; border: none; color: var(--muted); font-size: 0.66rem; font-weight: 800; text-transform: uppercase; padding-top: 0; padding-bottom: 0; }
.res-row.me { border-color: rgba(255, 210, 63, 0.6); background: rgba(255,210,63,0.08); }
.res-row .pl { font-weight: 900; text-align: center; }
.res-row .pl.p1 { color: var(--gold); } .res-row .pl.p2 { color: #cbd5e1; } .res-row .pl.p3 { color: #f59e5b; }
.res-row .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.res-row .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.res-row .pts { font-weight: 900; color: var(--gold); text-align: right; font-variant-numeric: tabular-nums; }
.end-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

.touch-controls { position: absolute; inset: auto 0 12px 0; display: none; justify-content: space-between; align-items: flex-end; padding: 0 14px; pointer-events: none; z-index: 4; }
.dpad { display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); gap: 4px; pointer-events: auto; opacity: 0.85; }
.dpad button, .tc-sprint { border-radius: 14px; border: 2px solid rgba(255,255,255,0.22); background: rgba(11, 11, 26, 0.5); color: #fff; font-size: 1.3rem; font-weight: 900; backdrop-filter: blur(4px); touch-action: none; }
.dpad .up { grid-column: 2; grid-row: 1; } .dpad .left { grid-column: 1; grid-row: 2; } .dpad .right { grid-column: 3; grid-row: 2; } .dpad .down { grid-column: 2; grid-row: 3; }
.dpad button.active, .tc-sprint.active { background: rgba(61, 255, 162, 0.35); border-color: var(--green); }
.tc-sprint { width: 84px; height: 84px; border-radius: 50%; font-size: 2rem; pointer-events: auto; }
body.touch .touch-controls { display: flex; }
.arena-exit { display: none; position: absolute; left: 8px; bottom: 190px; z-index: 43; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--stroke); background: rgba(11,11,26,0.6); color: #fff; font-weight: 900; }
body.touch.in-game .arena-exit { display: block; }
body.touch .controls-hint { display: none; }

/* ---------- Ende ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 0.6rem; margin-bottom: 0.8rem; min-height: 170px; }
.pod { width: 110px; display: flex; flex-direction: column; align-items: center; animation: popIn 0.6s cubic-bezier(.3,1.6,.5,1) both; }
.pod.empty { visibility: hidden; }
.pod-snake { font-size: 2.4rem; filter: drop-shadow(0 0 14px var(--c)); }
.pod-name { font-weight: 800; font-size: 0.8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0.2rem 0; }
.pod-block { width: 100%; display: grid; place-items: center; font-weight: 900; font-size: 1.8rem; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)); border: 1px solid var(--stroke); }
.pod1 .pod-block { height: 90px; color: var(--gold); border-color: rgba(255,210,63,0.6); box-shadow: 0 0 30px rgba(255,210,63,0.25); }
.pod2 .pod-block { height: 64px; color: #cbd5e1; }
.pod3 .pod-block { height: 46px; color: #f59e5b; }
.pod2 { animation-delay: 0.2s; } .pod3 { animation-delay: 0.35s; }
#endTitle { font-size: clamp(1.6rem, 4.5vw, 2.4rem); margin: 0.3rem 0; }
#endTitle span { color: var(--gold); }

@media (max-width: 900px) {
    .menu-layout, .lobby-layout { grid-template-columns: 1fr; }
    .size-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid.three { grid-template-columns: 1fr 1fr; }
    .res-row { grid-template-columns: 1.4rem 12px 1fr 3rem 3.2rem; }
    .res-row > :nth-child(5) { display: none; }
    .over-stats { grid-template-columns: repeat(2, 1fr); }
    .scoreboard { top: 6px; right: 6px; }
    .sb-row:nth-child(n+6) { display: none; }
    .banner { white-space: normal; text-align: center; width: max-content; max-width: 92%; border-radius: 18px; }
}

/* Touch-Geräte: Spielfeld im Vollbild, HUD schwebt oben */
body.touch.in-game .topbar, body.touch.in-game .volume-box, body.touch.in-game .controls-hint, body.touch.in-game .game-actions { display: none; }
body.touch.in-game .arena { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-height: none; border-radius: 0; border: none; z-index: 40; }
body.touch.in-game .game-hud { position: fixed; top: 6px; left: 6px; right: 6px; z-index: 41; gap: 0.3rem; pointer-events: none; }
body.touch.in-game .game-hud > div { padding: 0.15rem 0.5rem; }
body.touch.in-game .game-hud b { font-size: 1rem; }
body.touch.in-game .hud-mid { min-width: 0; font-size: 0.8rem; }
body.touch.in-game .scoreboard { top: 52px; }
body.touch.in-game #minimap { right: auto; left: 8px; bottom: auto; top: 52px; width: 120px; }
body.touch.in-game .touch-controls { z-index: 42; }
body.touch.in-game .results-overlay { z-index: 45; }
