/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:         #0f172a;
    --bg2:        #1e293b;
    --bg3:        #263347;
    --border:     #334155;
    --text:       #e2e8f0;
    --text-dim:   #94a3b8;
    --accent:     #f59e0b;
    --green:      #10b981;
    --green-dark: #059669;
    --red:        #ef4444;
    --red-dark:   #dc2626;
    --blue:       #3b82f6;
    --ice:        #67e8f9;
    --gold:       #fbbf24;
    --radius:     10px;
    --shadow:     0 4px 24px rgba(0,0,0,.45);
}

html { font-size: 16px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;   /* prevent horizontal scroll from fixed keyboard */
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: .35rem; padding: .5rem 1.1rem; border-radius: 7px;
    font-size: .9rem; font-weight: 600; cursor: pointer;
    border: none; transition: background .15s, transform .1s, opacity .15s;
    text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover   { background: #2563eb; }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover   { background: var(--green-dark); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #31445c; }
.btn-ghost     { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover     { background: var(--bg3); color: var(--text); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover    { background: var(--red-dark); }

.btn-lg  { padding: .7rem 1.8rem; font-size: 1rem; }
.btn-sm  { padding: .35rem .8rem; font-size: .82rem; }
.btn-xs  { padding: .2rem .55rem; font-size: .75rem; }

.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.btn-row-gap { margin-top: 1.2rem; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .6rem;
    border-radius: 999px; font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.badge-playing     { background: #1d4ed8; color: #bfdbfe; }
.badge-stayed      { background: #374151; color: #d1d5db; }
.badge-busted      { background: var(--red-dark); color: #fecaca; }
.badge-frozen      { background: #0e7490; color: var(--ice); }
.badge-flip7       { background: #92400e; color: var(--gold); }
.badge-secondchance{ background: #065f46; color: #6ee7b7; font-size: .7rem; }

/* ── Alert ────────────────────────────────────────────────────── */
.alert { padding: .75rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; }
.alert-error { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }
.alert-top { margin: .75rem 1rem 0; }

.hint { color: var(--text-dim); font-size: .83rem; margin-top: .6rem; }
.muted { color: var(--text-dim); }

/* ── INDEX PAGE ───────────────────────────────────────────────── */
.page-index { background: radial-gradient(ellipse at top, #1a2f4b 0%, var(--bg) 60%); }

.index-wrap { max-width: 700px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.hero { text-align: center; padding: 3rem 1rem 2rem; }
.logo-big { font-size: 4rem; margin-bottom: .5rem; }
.hero-title { font-size: 3.5rem; font-weight: 900; letter-spacing: -.02em; color: var(--text); }
.hero-title .accent { color: var(--accent); }
.hero-sub { color: var(--text-dim); font-size: 1.05rem; margin-top: .4rem; }

.card-section {
    background: var(--bg2); border-radius: 14px; border: 1px solid var(--border);
    padding: 1.5rem 1.75rem; margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card-section h2 { font-size: 1.1rem; font-weight: 700; color: var(--accent); margin-bottom: 1rem; }

.resume-info { font-size: 1rem; color: var(--text); display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }

.players-input { display: flex; flex-direction: column; gap: .6rem; }
.player-row { display: flex; gap: .5rem; align-items: center; }
.input-player {
    flex: 1; padding: .55rem 1rem; border-radius: 7px;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); font-size: .95rem; outline: none; transition: border .15s;
}
.input-player:focus { border-color: var(--blue); }
.input-player::placeholder { color: var(--text-dim); }
.btn-remove {
    background: none; border: 1px solid var(--border); color: var(--text-dim);
    width: 2rem; height: 2rem; border-radius: 6px; cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
}
.btn-remove:hover { background: var(--red); color: #fff; border-color: var(--red); }

.history-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.history-table th { color: var(--text-dim); font-weight: 600; padding: .4rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.history-table td { padding: .5rem .6rem; border-bottom: 1px solid #1e2e42; }
.history-table tr:last-child td { border-bottom: none; }
.game-actions-cell { display: flex; gap: .35rem; align-items: center; }

.footer-links { text-align: center; margin-top: 2rem; }
.footer-links a { color: var(--text-dim); font-size: .8rem; }

/* ── TOP BAR ──────────────────────────────────────────────────── */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1.5rem; background: var(--bg2);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.topbar-logo { font-size: 1.2rem; font-weight: 900; color: var(--accent); text-decoration: none; }
.topbar-center { font-size: 1rem; font-weight: 700; }
.topbar-round { color: var(--text); }
.topbar-round.finished { color: var(--gold); }

/* ── GAME MAIN ────────────────────────────────────────────────── */
.game-main { max-width: 1300px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

.section-title {
    font-size: 1rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-dim); margin-bottom: 1rem;
}

/* ── WINNER BANNER ────────────────────────────────────────────── */
.winner-banner {
    background: linear-gradient(135deg, #92400e, #b45309);
    border: 2px solid var(--gold); border-radius: 16px;
    padding: 2.5rem; text-align: center; margin-bottom: 1.5rem;
    box-shadow: 0 0 40px rgba(245,158,11,.3);
}
.winner-crown { font-size: 3.5rem; margin-bottom: .5rem; }
.winner-text  { font-size: 2rem; font-weight: 900; color: var(--gold); }
.winner-score { font-size: 1.2rem; color: #fde68a; margin-top: .3rem; }

/* ── SCOREBOARD ───────────────────────────────────────────────── */
.scoreboard { background: var(--bg2); border-radius: 14px; border: 1px solid var(--border); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }

.score-row { display: flex; gap: 1rem; flex-wrap: wrap; }

.score-card {
    flex: 1; min-width: 140px; background: var(--bg3); border-radius: 10px;
    border: 1px solid var(--border); padding: 1rem;
    transition: border-color .2s;
}
.score-card-winner { border-color: var(--gold); background: #1c1100; }

.score-rank { font-size: 1.4rem; margin-bottom: .25rem; }
.score-name { font-weight: 700; font-size: .95rem; margin-bottom: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-pts  { font-size: 1.8rem; font-weight: 900; color: var(--accent); line-height: 1; }
.score-pts small { font-size: .7rem; color: var(--text-dim); margin-left: .15rem; }
.score-bar-wrap {
    position: relative; background: var(--border); border-radius: 999px;
    height: 6px; margin: .6rem 0 .2rem; overflow: hidden;
}
.score-bar { height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }
.score-bar-label { font-size: .7rem; color: var(--text-dim); }
.score-target { font-size: .72rem; color: var(--text-dim); }

/* ── ROUND SECTION ────────────────────────────────────────────── */
.round-section { background: var(--bg2); border-radius: 14px; border: 1px solid var(--border); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }

.round-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem; }

.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

/* ── PLAYER CARD ──────────────────────────────────────────────── */
.player-card {
    background: var(--bg3); border-radius: 12px; border: 2px solid var(--border);
    padding: 1rem; display: flex; flex-direction: column; gap: .65rem;
    transition: border-color .2s, box-shadow .2s;
}
.player-card.status-playing { border-color: #1d4ed8; box-shadow: 0 0 0 1px #1d4ed822 inset; }
.player-card.status-flip7   { border-color: var(--gold); box-shadow: 0 0 24px rgba(251,191,36,.25); }
.player-card.status-busted  { border-color: var(--red); opacity: .85; }
.player-card.status-frozen  { border-color: #0891b2; }
.player-card.status-stayed  { border-color: #374151; }

.pc-header { display: flex; justify-content: space-between; align-items: center; }
.pc-name   { font-weight: 800; font-size: 1rem; }

.pc-cards  { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 2.2rem; }
.no-cards  { color: var(--text-dim); font-size: .83rem; align-self: center; }

/* ── CARD CHIPS ───────────────────────────────────────────────── */
.card {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.8rem; border-radius: 6px; font-size: .9rem;
    font-weight: 800; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,.4);
    user-select: none; border: 1px solid rgba(255,255,255,.1);
}
.card-number { background: #fff; color: #1e293b; }
.card-bonus  { background: #065f46; color: #6ee7b7; }
.card-x2     { background: #92400e; color: var(--gold); }
.card-action { background: #1e3a8a; color: #93c5fd; }
.card-bust   { background: var(--red-dark); color: #fff; position: relative; }
.bust-x      { font-size: .7rem; position: absolute; top: 1px; right: 2px; opacity: .8; }

/* ── SCORE INFO ───────────────────────────────────────────────── */
.pc-score-info { display: flex; flex-direction: column; gap: .25rem; font-size: .83rem; }
.round-score { color: var(--text); }
.round-score-bust  { color: var(--red); font-weight: 700; }
.round-score-flip7 { color: var(--gold); font-weight: 700; }
.projected-total { color: var(--text-dim); }
.projected-total strong { color: var(--accent); font-weight: 800; }

/* ── PC ACTIONS ───────────────────────────────────────────────── */
.pc-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.pc-undo    { margin-top: .2rem; }

/* ── ROUND DONE ───────────────────────────────────────────────── */
.round-done-notice {
    margin-top: 1.25rem; padding: .9rem 1.25rem;
    background: #052e16; border: 1px solid var(--green); border-radius: 8px;
    color: #86efac; font-size: .93rem;
}

/* ── LOG SECTION ──────────────────────────────────────────────── */
.log-section {
    background: var(--bg2); border-radius: 14px; border: 1px solid var(--border);
    padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; position: relative;
}
.log-live-badge {
    position: absolute; top: 1.1rem; right: 1.5rem;
    font-size: .75rem; color: var(--green); font-weight: 600;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.log-scroll {
    max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem;
    padding-right: .25rem;
}
.log-scroll::-webkit-scrollbar { width: 4px; }
.log-scroll::-webkit-scrollbar-track { background: var(--bg); }
.log-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.log-entry {
    display: flex; gap: .7rem; align-items: flex-start;
    font-size: .84rem; padding: .3rem .5rem; border-radius: 5px;
}
.log-entry:hover { background: var(--bg3); }
.log-bust   { background: rgba(220,38,38,.1); }
.log-flip7  { background: rgba(245,158,11,.12); }
.log-win    { background: rgba(245,158,11,.18); }
.log-freeze { background: rgba(6,182,212,.08); }
.log-stay   { background: rgba(55,65,81,.35); }
.log-round  { background: rgba(59,130,246,.08); }

.log-time { color: var(--text-dim); font-size: .75rem; white-space: nowrap; padding-top: .1rem; }
.log-msg  { color: var(--text); }

/* ── DANGER ZONE ──────────────────────────────────────────────── */
.danger-zone {
    background: var(--bg2); border: 1px solid #7f1d1d; border-radius: 10px; padding: 1rem 1.25rem;
}
.danger-zone summary { cursor: pointer; color: var(--red); font-size: .88rem; font-weight: 600; }
.danger-zone > form  { margin-top: .75rem; }

/* ── MODALS ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(3px);
    z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay:not([hidden]) { pointer-events: auto; }
.modal-visible { opacity: 1 !important; }

.modal-box {
    background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
    transform: translateY(10px); transition: transform .2s;
}
.modal-visible .modal-box { transform: translateY(0); }
.modal-box-sm { max-width: 360px; }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 1rem;
}
.modal-close {
    background: none; border: none; color: var(--text-dim); font-size: 1.1rem;
    cursor: pointer; padding: .25rem .5rem; border-radius: 5px;
}
.modal-close:hover { background: var(--bg3); color: var(--text); }

.modal-section { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-section:last-child { border-bottom: none; }
.modal-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-dim); margin-bottom: .65rem; font-weight: 600; }

.card-picker { display: flex; gap: .45rem; flex-wrap: wrap; }

.pick-card {
    width: 3.1rem; height: 3.8rem; border-radius: 8px; border: 2px solid var(--border);
    font-weight: 800; font-size: .95rem; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: border-color .12s, transform .1s, background .12s;
}
.pick-card:hover   { transform: scale(1.08); border-color: var(--blue); }
.pick-selected     { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(59,130,246,.35); }
.pick-number       { background: #fff; color: #1e293b; }
.pick-modifier     { background: #065f46; color: #6ee7b7; }
.pick-x2           { background: #92400e; color: var(--gold); }
.pick-action       { background: #1e3a8a; color: #93c5fd; min-width: 5rem; width: auto; padding: 0 .75rem; height: 3.2rem; font-size: .82rem; }

.modal-confirm { padding: 1rem 1.25rem; }
.confirm-preview { font-size: 1rem; margin-bottom: .6rem; }
.bust-warning { background: #450a0a; border: 1px solid var(--red); border-radius: 6px; padding: .5rem .75rem; color: #fca5a5; font-size: .88rem; margin-bottom: .75rem; }
.modal-btns { display: flex; gap: .6rem; justify-content: flex-end; margin-top: .75rem; }

.modal-hint  { color: var(--text-dim); font-size: .9rem; margin: .75rem 1.25rem; }
.freeze-targets { display: flex; gap: .6rem; flex-wrap: wrap; padding: 0 1.25rem 1rem; }
.freeze-target-btn { flex: 1; min-width: 100px; }

/* ── MODE TABS ────────────────────────────────────────────────── */
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1.5rem; }

.mode-tab {
    background: var(--bg3); border: 2px solid var(--border); border-radius: 10px;
    padding: .9rem 1rem; cursor: pointer; text-align: left; display: flex;
    flex-direction: column; gap: .25rem; transition: border-color .15s, background .15s;
}
.mode-tab:hover { border-color: var(--blue); background: #263347; }
.mode-tab-active { border-color: var(--blue); background: #1a2f4b; }

.mode-tab-icon  { font-size: 1.5rem; }
.mode-tab-label { font-weight: 700; font-size: .95rem; color: var(--text); }
.mode-tab-sub   { font-size: .78rem; color: var(--text-dim); line-height: 1.3; }

.multi-create-info {
    background: var(--bg3); border-radius: 8px; padding: .75rem 1rem;
    font-size: .88rem; color: var(--text-dim); line-height: 1.5;
}
.multi-create-info strong { color: var(--text); }

/* ── JOIN SECTION (index.php) ─────────────────────────────────── */
.join-section { text-align: center; }

/* ── JOIN PAGE (join.php) ─────────────────────────────────────── */
.field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .05em; }
.input-code {
    font-family: 'Courier New', monospace;
    font-size: 1.8rem; font-weight: 900;
    letter-spacing: .3em; text-align: center;
    text-transform: uppercase;
}

/* ── WAITING ROOM ─────────────────────────────────────────────── */
.waiting-room {
    background: var(--bg2); border: 1px solid #0e7490; border-radius: 14px;
    padding: 1.75rem; margin-bottom: 1.25rem; text-align: center;
}
.waiting-header { margin-bottom: 1.5rem; }
.waiting-label  { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: #67e8f9; font-weight: 700; margin-bottom: .25rem; }
.waiting-hint   { font-size: .88rem; color: var(--text-dim); }

.join-code-display {
    font-family: 'Courier New', monospace;
    font-size: 3.5rem; font-weight: 900; letter-spacing: .35em;
    color: #fff; background: #0e7490;
    display: inline-block; padding: .5rem 1.5rem .5rem 2rem;
    border-radius: 12px; margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.join-url-row { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.join-url-text { font-size: .78rem; color: var(--text-dim); word-break: break-all; }

.waiting-players { text-align: left; max-width: 280px; margin: 0 auto 1rem; }
.waiting-players-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: .6rem; }
.waiting-player-row { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.waiting-player-row:last-child { border-bottom: none; }
.waiting-player-icon { font-size: 1rem; }
.waiting-player-name { font-weight: 600; flex: 1; }
.waiting-min-notice  { color: var(--text-dim); font-size: .88rem; margin-top: 1rem; }

/* ── MY PLAYER INDICATOR ──────────────────────────────────────── */
.my-player-indicator {
    font-size: .75rem; color: var(--blue); font-weight: 700;
    margin-top: .35rem; letter-spacing: .03em;
}

/* ── CARD KEYBOARD (fixed bottom) ─────────────────────────────── */
.card-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;          /* explicit – some mobile browsers need this */
    max-width: 100%;
    box-sizing: border-box;
    z-index: 500;
    background: #111827;
    border-top: 2px solid var(--blue);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -6px 30px rgba(0,0,0,.7);
    user-select: none;
    -webkit-user-select: none;
}
.ck-header {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem .75rem;
    background: var(--bg3); border-bottom: 1px solid var(--border);
}
.ck-header-forced { border-bottom-color: #a855f7; background: #1e0a2e; }
.ck-icon  { font-size: 1.1rem; }
.ck-pname { font-weight: 800; font-size: .95rem; color: #fff; }
.ck-txt   { font-size: .78rem; color: var(--text-dim); }

.ck-body  { padding: 4px 3px 3px; }

.ck-row {
    display: flex; gap: 3px; margin-bottom: 3px;
}
.ck-row-sf      { margin-top: 2px; gap: 4px; }
.ck-row-targets { flex-wrap: wrap; gap: 4px; }

.ck-btn {
    flex: 1; height: 52px; border-radius: 6px; border: none;
    font-weight: 900; font-size: 1.15rem; cursor: pointer;
    transition: filter .08s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1;
}
.ck-btn:active { filter: brightness(.75); }
.ck-btn:disabled { opacity: .35; }

.ck-num    { background: #e2e8f0; color: #0f172a; font-size: 1.25rem; }
.ck-mod    { background: #065f46; color: #6ee7b7; font-size: 1rem; }
.ck-x2     { background: #92400e; color: var(--gold); }
.ck-action { background: #1e3a8a; color: #93c5fd; font-size: .9rem; font-weight: 700; }
.ck-stay   { background: #1e293b; color: var(--text); border: 1px solid var(--border) !important; font-size: 1rem; }
.ck-freeze { background: #0e7490; color: #cffafe; font-size: 1rem; }
.ck-back   { background: #1e293b; color: var(--text-dim); flex: 0 0 auto; padding: 0 1rem; font-size: .9rem; }
.ck-f3-btn { background: #5b21b6; color: #e9d5ff; font-size: .95rem; }

.ck-bust {
    background: #450a0a !important; color: #fca5a5 !important;
    outline: 2px solid #ef4444; outline-offset: -2px;
    font-size: 1.1rem !important;
}

.ck-f3-panel {
    background: #1e0a2e; border-radius: 6px;
    margin: 0 0 3px; padding: 6px 3px 4px;
}
.ck-f3-label {
    font-size: .78rem; color: #e9d5ff; font-weight: 700;
    margin-bottom: 4px; padding-left: 2px;
}

/* ── FORCED DRAW BANNER (Flip Three) ─────────────────────────── */
.forced-draw-banner {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    background: #3b0764; border: 1px solid #a855f7;
    border-radius: 8px; padding: .6rem 1rem;
    font-size: .95rem; color: #e9d5ff; margin-bottom: 1rem;
}
.forced-draw-banner strong { color: #fff; }

.flip3-targets { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.flip3-target-btn { flex: 1; min-width: 100px; }

/* ── TURN INDICATOR ───────────────────────────────────────────── */
.turn-indicator {
    display: flex; align-items: center; gap: .5rem;
    background: #1e3a5f; border: 1px solid #3b82f6;
    border-radius: 8px; padding: .55rem 1rem;
    font-size: .95rem; font-weight: 600; margin-bottom: 1rem;
    color: #bfdbfe;
}
.turn-arrow { color: var(--blue); font-size: 1rem; }
.turn-name  { color: #fff; }
.turn-you   { color: var(--gold); margin-left: .25rem; }

/* ── CURRENT TURN PLAYER CARD ─────────────────────────────────── */
.player-card.current-turn {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,.25), 0 4px 20px rgba(59,130,246,.15) !important;
}

/* ── BUST WARNING ON CARD PICKER ──────────────────────────────── */
.pick-would-bust {
    border-color: var(--red) !important;
    background: #450a0a !important;
    color: #fca5a5 !important;
    position: relative;
}
.pick-would-bust::after {
    content: '!';
    position: absolute; top: 2px; right: 3px;
    font-size: .6rem; font-weight: 900; color: var(--red);
}

/* ── REORDER BUTTONS ──────────────────────────────────────────── */
.reorder-btns { display: flex; flex-direction: column; gap: 1px; }
.reorder-btn {
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text-dim); font-size: .65rem; padding: 0 .3rem; line-height: 1.4;
    border-radius: 3px; cursor: pointer; display: block;
}
.reorder-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.reorder-btn-ghost { display: inline-block; width: 1.4rem; height: 1.2rem; }

/* Sortable player row in index.php */
.sortable-row { display: flex; align-items: center; gap: .5rem; }
.sortable-row .input-player { flex: 1; }

.ck-draw        { background: var(--blue); color: #fff; font-size: 1.1rem; height: 64px; }
.ck-draw-forced { background: #6d28d9; color: #e9d5ff; }

/* ── DEBUG DECK ───────────────────────────────────────────────── */
.debug-deck {
    background: var(--bg2); border: 1px solid #334155; border-radius: 10px;
    padding: .75rem 1.25rem; margin-bottom: 1.25rem; font-size: .83rem;
}
.debug-deck summary { cursor: pointer; color: var(--text-dim); font-weight: 600; }
.debug-deck-body { margin-top: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.debug-group { display: flex; flex-direction: column; gap: .35rem; }
.debug-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); font-weight: 600; }
.debug-cards { display: flex; flex-wrap: wrap; gap: .3rem; }
.debug-cards .card sup { font-size: .55rem; vertical-align: super; margin-left: 1px; opacity: .8; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Topbar */
    .topbar { padding: .5rem .75rem; }
    .topbar-logo { font-size: 1rem; }
    .topbar-round { font-size: .9rem; }
    .btn-ghost.btn-sm { padding: .3rem .6rem; font-size: .75rem; }

    /* Hero (index) */
    .hero-title { font-size: 2.5rem; }
    .index-wrap { padding: 1rem .75rem 3rem; }

    /* Scoreboard: horizontal scroll row */
    .scoreboard { padding: .75rem; }
    .score-row { flex-wrap: nowrap; overflow-x: auto; gap: .5rem; padding-bottom: .25rem; }
    .score-card { min-width: 110px; flex: 0 0 110px; padding: .6rem .75rem; }
    .score-pts  { font-size: 1.4rem; }
    .score-target { display: none; }

    /* Player grid: 1 column */
    .player-grid { grid-template-columns: 1fr; gap: .6rem; }
    .round-section { padding: .75rem; }
    .card { width: 1.9rem; height: 2.4rem; font-size: .8rem; }

    /* Log: smaller */
    .log-section { padding: .75rem; }
    .log-scroll  { max-height: 140px; }

    /* Turn indicator: compact */
    .turn-indicator { padding: .4rem .75rem; font-size: .85rem; }

    /* Sections: less padding */
    .card-section { padding: 1rem; }
    .game-main    { padding: .75rem .5rem; }
}
