/* ── Settings page ───────────────────────────────────────────────────────── */

/* Sticky save bar */
.settings-savebar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #07172e;
    border-bottom: 2px solid #1e4080;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.settings-savebar-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.settings-toast-inline {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
}

.settings-toast-inline.ok {
    background: rgba(39,174,96,0.18);
    border: 1px solid #27ae6066;
    color: #2ecc71;
}

.settings-toast-inline.err {
    background: rgba(192,57,43,0.18);
    border: 1px solid #c0392b66;
    color: #e74c3c;
}

.settings-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 20px 48px;
    font-family: inherit;
    color: #d0e4f4;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.settings-header h1 {
    margin: 0;
    flex: 1;
    font-size: 1.5rem;
    color: #ffd700;
}

.settings-ip-badge {
    font-size: 0.78rem;
    color: #7a9cc5;
    background: #0d2444;
    border: 1px solid #1e4080;
    border-radius: 12px;
    padding: 3px 10px;
    white-space: nowrap;
}

.settings-card {
    background: #0a1f3a;
    border: 1px solid #1e4080;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.settings-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e4080;
    letter-spacing: 0.03em;
}

.settings-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #0f3460;
}

.settings-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-row-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.settings-label {
    flex: 1;
    min-width: 0;
}

.settings-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #c8dff5;
    margin-bottom: 3px;
}

.settings-desc {
    display: block;
    font-size: 0.77rem;
    color: #6a8baa;
    line-height: 1.45;
}

.settings-desc em {
    color: #4a7a9b;
    font-style: normal;
}

.settings-desc code {
    background: #0d2444;
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.85em;
    color: #7ec8e3;
}

.settings-input {
    width: 110px;
    flex-shrink: 0;
    background: #0d2444;
    border: 1px solid #1e4080;
    border-radius: 6px;
    color: #e0e8f0;
    padding: 6px 8px;
    font-size: 0.88rem;
    text-align: right;
    outline: none;
    transition: border-color 0.15s;
    align-self: center;
}

.settings-input:focus {
    border-color: #ffd700;
}

.settings-input-wide {
    width: 220px;
    text-align: left;
}

/* Toggle switch */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
    align-self: center;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.settings-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #1e4080;
    border-radius: 26px;
    transition: background 0.2s;
}

.settings-slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background: #7a9cc5;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.settings-toggle input:checked + .settings-slider {
    background: #27ae60;
}

.settings-toggle input:checked + .settings-slider:before {
    transform: translateX(20px);
    background: #fff;
}

.btn-settings-save {
    padding: 10px 36px;
    font-size: 1rem;
    background: linear-gradient(135deg, #1e6b3a, #27ae60);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.btn-settings-save:hover {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.settings-toast {
    padding: 10px 16px;
    border-radius: 7px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 600;
}

.settings-toast.ok {
    background: rgba(39,174,96,0.18);
    border: 1px solid #27ae6066;
    color: #2ecc71;
}

.settings-toast.err {
    background: rgba(192,57,43,0.18);
    border: 1px solid #c0392b66;
    color: #e74c3c;
}

.settings-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #060f1e;
}

.settings-denied-card {
    background: #0a1f3a;
    border: 1px solid #c0392b;
    border-radius: 12px;
    padding: 40px 48px;
    text-align: center;
    max-width: 420px;
}

.settings-denied-card h2 {
    color: #e74c3c;
    margin: 0 0 12px;
}

.settings-denied-card p {
    color: #7a9cc5;
    margin: 4px 0;
}

.room-status-badge.gameover {
    background: rgba(155,89,182,0.18);
    color: #9b59b6;
    border: 1px solid #9b59b644;
}

/* ── Room selection ──────────────────────────────────────────────────────── */

.room-list {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.9rem;
}

.room-list th {
    text-align: left;
    padding: 6px 10px;
    color: #7a9cc5;
    font-weight: 600;
    border-bottom: 1px solid #1e4080;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.room-list-row td {
    padding: 8px 10px;
    border-bottom: 1px solid #0f3460;
    vertical-align: middle;
}

.room-list-row:hover td {
    background: rgba(255,255,255,0.04);
}

.room-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.room-status-badge.lobby {
    background: rgba(46, 204, 113, 0.18);
    color: #2ecc71;
    border: 1px solid #2ecc7144;
}

.room-status-badge.playing {
    background: rgba(230, 126, 34, 0.18);
    color: #e67e22;
    border: 1px solid #e67e2244;
}

.room-name-input {
    background: #0d2444;
    border: 1px solid #1e4080;
    border-radius: 6px;
    color: #e0e8f0;
    padding: 7px 10px;
    font-size: 0.9rem;
    outline: none;
}

.room-name-input:focus {
    border-color: #4a9eff;
}

.btn-create-room {
    white-space: nowrap;
    font-size: 0.85rem !important;
}

/* ── Dice roll animation ─────────────────────────────────────────────────── */

@keyframes diceRoll {
    0%,100% { transform: rotate(0deg)   scale(1);    }
    20%     { transform: rotate(-20deg) scale(1.15); }
    40%     { transform: rotate(12deg)  scale(0.9);  }
    60%     { transform: rotate(-10deg) scale(1.1);  }
    80%     { transform: rotate(8deg)   scale(0.95); }
}

.dice-scrambling {
    display: inline-block;
    animation: diceRoll 0.22s infinite;
}

/* ── Chat whisper (local-only system messages) ──────────────────────────── */

.chat-whisper {
    background: rgba(74, 158, 255, 0.06);
    border-left: 2px solid #4a9eff44;
    padding-left: 4px;
}

.chat-whisper .chat-nick {
    color: #4a9eff !important;
    font-style: italic;
}

.chat-whisper .chat-msg {
    color: #8ab4d4;
    font-style: italic;
}

/* ── Active unit circle animations ─────────────────────────────────────── */

@keyframes riskActivePulse {
    0%   { transform: scale(1);   }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1);   }
}

@keyframes riskFadeOut {
    0%   { opacity: 1;   transform: scale(1); }
    100% { opacity: 0;   transform: scale(0.6); }
}

@keyframes winnerPop {
    0%   { transform: scale(0.3) rotate(-4deg); opacity: 0; }
    70%  { transform: scale(1.06) rotate(1deg); opacity: 1; }
    100% { transform: scale(1)    rotate(0deg); }
}

@keyframes winnerGlow {
    0%, 100% { filter: brightness(1); }
    50%       { filter: brightness(1.5) drop-shadow(0 0 16px currentColor); }
}

@keyframes confettiDrop {
    0%   { transform: translateY(0)     rotate(0deg);   opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── Game layout ────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
    margin: 0;
    background: #1a1a2e;
    color: #eee;
    font-family: 'Segoe UI', sans-serif;
}

.risk-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;   /* game page: no scroll — all scrolling happens inside panels */
    background: #1a1a2e;
    color: #eee;
    font-family: 'Segoe UI', sans-serif;
}

/* Top bar: scoreboard */
.risk-topbar {
    flex: 0 0 auto;
    background: #16213e;
    border-bottom: 2px solid #0f3460;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
}

/* Middle area: board + side panel */
.risk-main {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

/* Board */
.risk-board-wrap {
    flex: 1 1 auto;
    overflow: hidden;
    background: #0a1628;
    min-height: 0;          /* critical for nested flex items */
    display: flex;
}

#board-container {
    position: relative;     /* anchor for unit-label overlays */
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

#board-container svg {
    display: block;
    width: 100%;
    height: 100%;           /* fill container; viewBox preserves aspect ratio */
}

/* Side panel: actions + log */
.risk-side {
    flex: 0 0 260px;
    background: #16213e;
    border-left: 2px solid #0f3460;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px;
    gap: 10px;
}

/* Bottom: chat */
.risk-chat {
    flex: 0 0 180px;
    min-height: 0;
    max-height: 180px;
    border-top: 2px solid #0f3460;
    display: flex;
    flex-direction: column;
    background: #16213e;
    overflow: hidden;
}

/* ── Scoreboard ─────────────────────────────────────────────────────────── */

.score-card {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 2px solid transparent;
    white-space: nowrap;
    font-size: 0.95rem;
}

.score-card.active-player {
    border-color: #ffd700;
    box-shadow: 0 0 8px #ffd700;
}

.score-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
}

.turn-arrow {
    font-size: 1rem;
    color: #ffd700;
}

/* ── Lobby ──────────────────────────────────────────────────────────────── */

.risk-lobby {
    max-width: 680px;
    margin: 30px auto;
    padding: 0 0 20px;
    background: #16213e;
    border-radius: 14px;
    border: 1px solid #1e3a6a;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Hero banner */
@keyframes lobbyTitleGlow {
    0%, 100% { text-shadow: 0 0 12px #ffd70066, 0 2px 6px #000; }
    50%       { text-shadow: 0 0 30px #ffd700bb, 0 0 60px #ffd70033, 0 2px 6px #000; }
}

@keyframes lobbyTaglineFade {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

.lobby-hero {
    background: linear-gradient(160deg, #0d2040 0%, #0a1628 60%, #0d1f38 100%);
    border-bottom: 2px solid #1e3a6a;
    padding: 28px 30px 22px;
    text-align: center;
    position: relative;
}

.lobby-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255,215,0,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.lobby-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffd700;
    letter-spacing: 0.08em;
    animation: lobbyTitleGlow 3.5s ease-in-out infinite;
    line-height: 1.1;
    text-transform: uppercase;
}

.lobby-tagline {
    color: #7a9cc5;
    font-size: 0.88rem;
    margin-top: 8px;
    letter-spacing: 0.06em;
    font-style: italic;
    animation: lobbyTaglineFade 4s ease-in-out infinite;
}

/* Section content inside lobby */
.lobby-dossier {
    padding: 18px 24px 0;
}

.lobby-field-group {
    margin-bottom: 18px;
    padding: 0 24px;
}

.lobby-field-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #7a9cc5;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.lobby-input {
    width: 100%;
    padding: 9px 13px;
    border-radius: 7px;
    border: 1px solid #1e3a6a;
    background: #0a1628;
    color: #e8f0ff;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lobby-input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255,215,0,0.12);
}

/* Decorative divider */
.lobby-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #2a4a7a;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 18px 24px 14px;
}

.lobby-divider::before, .lobby-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #1e3a6a);
}

.lobby-divider::after {
    background: linear-gradient(to left, transparent, #1e3a6a);
}

/* Troop list */
.troop-list {
    list-style: none;
    padding: 0 24px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.troop-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: #0a1f3a;
    border-radius: 8px;
    border: 1px solid #0f3460;
    font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}

.troop-item.is-ready {
    border-color: rgba(46,204,113,0.35);
    background: rgba(39,174,96,0.07);
}

/* CPU count selector */
.cpu-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cpu-count-btn {
    min-width: 52px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid #1e3a6a;
    background: #0a1f3a;
    color: #6a8aaa;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 4px 8px;
}

.cpu-count-btn.selected {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255,215,0,0.1);
}

.cpu-count-btn:hover:not(.selected) {
    border-color: #3a6aaa;
    color: #a0c0e0;
    background: rgba(74,127,204,0.1);
}

/* Ready / unready buttons */
.btn-lobby-ready {
    display: block;
    width: 100%;
    padding: 13px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #1a6b3a, #27ae60);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(39,174,96,0.25);
}

.btn-lobby-ready:hover {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(39,174,96,0.35);
}

.btn-lobby-unready {
    display: block;
    width: 100%;
    padding: 11px 20px;
    border-radius: 8px;
    border: 1px solid #2a3a4a;
    background: #1a2a3a;
    color: #6a8aaa;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-lobby-unready:hover {
    background: #222f3e;
    color: #aaa;
}

/* Battlefield cards (room list) */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 10px;
    padding: 0 24px;
    margin-bottom: 4px;
}

.battlefield-card {
    background: #0a1f3a;
    border: 1px solid #1e3a6a;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.battlefield-card:hover {
    border-color: #3a6aaa;
    box-shadow: 0 0 16px rgba(74,127,204,0.2);
    transform: translateY(-2px);
}

.battlefield-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #d8e8ff;
}

.battlefield-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #7a9cc5;
    flex-wrap: wrap;
}

.battlefield-empty {
    text-align: center;
    padding: 24px;
    color: #2a4a6a;
    font-style: italic;
    background: #0a1f3a;
    border: 1px dashed #1e3a6a;
    border-radius: 10px;
    font-size: 0.88rem;
    margin: 0 24px;
}

.lobby-form label {
    display: block;
    margin-bottom: 4px;
    color: #ccc;
    font-weight: 600;
}

.lobby-form input[type=text] {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #0f3460;
    background: #0a1628;
    color: #eee;
    font-size: 1rem;
    box-sizing: border-box;
}

.color-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.color-btn:hover:not(:disabled) {
    transform: scale(1.15);
}

.color-btn.selected {
    border-color: #fff;
    transform: scale(1.2);
}

.color-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.player-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.player-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #0f3460;
    font-size: 0.9rem;
}

.player-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-host {
    background: #ffd700;
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.badge-cpu {
    background: #555;
    color: #eee;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* ── Action buttons ─────────────────────────────────────────────────────── */

.btn-risk {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    width: 100%;
    margin-bottom: 6px;
    text-align: center;
}

.btn-risk:hover:not(:disabled) {
    opacity: 0.85;
    transform: translateY(-1px);
}

.btn-risk:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-attack  { background: #c0392b; color: #fff; }
.btn-move    { background: #2980b9; color: #fff; }
.btn-pass    { background: #7f8c8d; color: #fff; }
.btn-start   { background: #27ae60; color: #fff; font-size: 1.1rem; padding: 12px; }
.btn-reset   { background: #8e44ad; color: #fff; }
.btn-reset-subtle {
    background: none;
    border: 1px solid #444;
    color: #666;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 2px;
    transition: color 0.15s, border-color 0.15s;
}
.btn-reset-subtle:hover { color: #e74c3c; border-color: #e74c3c; }
.btn-send    { background: #0f3460; color: #fff; border: 1px solid #3498db; padding: 6px 14px; border-radius: 4px; cursor: pointer; }
.btn-send:hover { background: #3498db; }

/* ── Action log ─────────────────────────────────────────────────────────── */

.action-log {
    background: #0d1f3c;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.85rem;
    color: #d6e8ff;
    min-height: 50px;
    border: 1px solid #1e4080;
    word-break: break-word;
    line-height: 1.45;
}

/* ── Chat ───────────────────────────────────────────────────────────────── */

#chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 10px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-line {
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.chat-nick {
    font-weight: 700;
    white-space: nowrap;
}

.chat-time {
    color: #666;
    font-size: 0.7rem;
    white-space: nowrap;
}

.chat-msg {
    word-break: break-word;
    color: #ccc;
}

.chat-input-row {
    display: flex;
    gap: 6px;
    padding: 6px;
    border-top: 1px solid #0f3460;
}

.chat-input-row input {
    flex: 1;
    background: #0a1628;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #eee;
    padding: 5px 8px;
    font-size: 0.85rem;
}

/* ── Turn info / phase indicators ───────────────────────────────────────── */

.turn-info {
    font-size: 0.85rem;
    color: #aec6e8;
    line-height: 1.4;
}

.turn-info strong {
    color: #fff;
}

.phase-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.phase-playing  { background: #27ae60; }
.phase-lobby    { background: #f39c12; }
.phase-gameover { background: #c0392b; }

.winner-banner {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* ── Full-screen winner overlay ─────────────────────────────────────────── */

.winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-card {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 55%, #0f3460 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 50px 64px;
    text-align: center;
    box-shadow:
        0 0 50px rgba(255, 215, 0, 0.55),
        0 0 110px rgba(255, 140, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    animation: winnerPop 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    max-width: 480px;
    width: 88vw;
}

.winner-crown {
    display: block;
    font-size: 5rem;
    line-height: 1;
    margin-bottom: 14px;
    animation: winnerGlow 1.8s ease-in-out infinite;
}

.winner-name {
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 8px 0;
    animation: winnerGlow 1.8s ease-in-out infinite;
}

.winner-subtitle {
    font-size: 1rem;
    color: #aaa;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ── Error toast ────────────────────────────────────────────────────────── */

.error-toast {
    background: #c0392b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.82rem;
    margin-top: 4px;
}

/* ── Risk Cards ─────────────────────────────────────────────────────────── */

.card-hand {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.risk-card {
    width: 54px;
    border: 2px solid #0f3460;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    background: #16213e;
    flex-shrink: 0;
}

.risk-card:hover {
    border-color: #3498db;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.4);
}

.risk-card-selected {
    border-color: #ffd700 !important;
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(255,215,0,0.5);
}

.risk-card img {
    width: 100%;
    display: block;
    object-fit: cover;
    height: 72px;
}

.card-territory {
    font-size: 0.55rem;
    text-align: center;
    padding: 2px 2px;
    color: #aec6e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #0a1628;
    line-height: 1.2;
}

/* ── Misc ───────────────────────────────────────────────────────────────── */

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6699bb;
    margin-bottom: 4px;
}

.divider {
    border: none;
    border-top: 1px solid #0f3460;
    margin: 8px 0;
}
