/* ==========================================
   WORDCRACKER - Stylez
   ========================================== */

:root {
    --bg: #0b0e1a;
    --surface: #151933;
    --surface-2: #404880;
    --surface-3: #282d54;
    --border: #4a5090;
    --text: #e2e8f0;
    --text-muted: #a8b2d0;
    --p1: #00d4ff;
    --p1-dim: #00d4ff33;
    --p1-glow: #00d4ff55;
    --p2: #ff6b35;
    --p2-dim: #ff6b3533;
    --p2-glow: #ff6b3555;
    --accent: #a855f7;
    --accent-dim: #a855f733;
    --success: #22c55e;
    --danger: #ef4444;
    --danger-dim: #ef444433;
    --tile-bg: #323870;
    --tile-border: #5a62a0;
    --radius: 8px;
    --radius-lg: 12px;
    --tile-w: 52px;
    --tile-h: 58px;
    --tile-fs: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    height: 100%;
    overflow: hidden;
    position: relative;
}
.screen.active {
    display: flex;
    flex-direction: column;
}

/* ===== SETUP SCREEN ===== */
.setup-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 1.5rem 0.5rem;
    gap: 0.5rem;
    overflow: hidden;
}
.setup-container.scrollable {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    min-height: 0;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
}

.game-logo {
    width: 70vw;
    max-width: 420px;
    height: auto;
    flex-shrink: 1;
    min-height: 0;
}

.version-stamp {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Beta testing icon — subtle, discoverable */
.beta-icon {
    font-size: 1.4rem;
    color: #e53935;
    opacity: 0.5;
    cursor: pointer;
    padding: 0.3rem;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.3s;
}
.beta-icon:active {
    opacity: 0.6;
}
.beta-mode-tabs {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}
.beta-mode-tab {
    flex: 1;
}
.beta-mode-tab.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.beta-join-section {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}
.beta-join-section .input-group {
    flex: 1;
}
.waiting-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin: 0.25rem 0;
}
.beta-rules-box {
    border-color: #26c6da;
}
.beta-rules-box .settings-label {
    color: #26c6da;
}
.beta-info-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--text-muted);
    background: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 4px;
}
.beta-info-btn:active {
    background: var(--surface-2);
}
.beta-info-popup {
    position: relative;
    background: var(--surface-2);
    border: 1px solid #26c6da;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}
.beta-info-close {
    position: absolute;
    top: 0.3rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.beta-info-title {
    font-weight: 700;
    color: #26c6da;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}
.beta-info-desc {
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.4;
}

.name-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.input-group label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.input-group:first-child label {
    color: var(--p1);
}
.input-group:last-child label {
    color: var(--p2);
}

.input-group input {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem 0.75rem;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    width: 180px;
    transition: border-color 0.2s;
}
.input-group input:focus {
    border-color: var(--p1);
}
.input-group:last-child input:focus {
    border-color: var(--p2);
}

.vs-divider {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    padding-top: 0.75rem;
    line-height: 1;
}

/* ===== BUTTONS ===== */
.btn {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--p1);
    color: #000;
}
.btn-primary:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-lg {
    padding: 0.7rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-top: 1rem;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 220px;
}
.btn-mode {
    width: 100%;
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}

.btn-ghost {
    background: var(--surface-2);
    color: var(--danger);
    border: 1px solid var(--danger-dim);
    font-weight: 700;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--danger-dim);
    border-color: var(--danger);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--danger);
    border: 1px solid var(--danger-dim);
    font-weight: 700;
}
.btn-secondary:hover:not(:disabled) {
    background: var(--danger-dim);
    border-color: var(--danger);
}

.btn-action {
    background: var(--surface-2);
    color: var(--p1);
    border: 1px solid var(--p1-dim);
    font-weight: 700;
}
.btn-action:hover:not(:disabled) {
    background: var(--p1-dim);
    border-color: var(--p1);
}

.btn-special {
    background: var(--surface-2);
    color: var(--accent);
    border: 1px solid var(--accent-dim);
    font-weight: 700;
}
.btn-special:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent);
}
.btn-special.used {
    opacity: 0.4;
}

.btn-concede {
    background: var(--surface-2);
    color: var(--danger);
    border: 1px solid var(--danger-dim);
    font-weight: 700;
}
.btn-concede:hover:not(:disabled) {
    background: var(--danger-dim);
    border-color: var(--danger);
}

.btn-undo {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.8em;
}
.btn-undo:not(:disabled):active {
    background: var(--border);
}

.btn-sm {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}

/* ===== MISSION LABEL ===== */
.mission-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--surface);
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
}

/* ===== GAME HEADER ===== */
.game-header {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 0.25rem;
}
.header-top-row {
    text-align: center;
}
.header-main-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
}
.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.opponent-face-center {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--p2);
    background: #000;
}

.player-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 2px solid transparent;
    transition: border-color 0.1s, background-color 0.1s;
}
.p1-panel {
    justify-self: start;
    align-items: flex-start;
}
.p2-panel {
    grid-column: 3;
    justify-self: end;
    align-items: flex-end;
    position: relative;
}
.player-panel.active-player {
    border-color: var(--p1);
    background: var(--p1-dim);
}
.p2-panel.active-player {
    border-color: var(--p2);
    background: var(--p2-dim);
}

.player-name {
    font-weight: 700;
    font-size: 1rem;
}
.p1-panel .player-name { color: var(--p1); }
.p2-panel .player-name { color: var(--p2); }

.ai-diff-badge {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    line-height: 1;
    position: absolute;
    top: -0.9rem;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    display: inline-block;
    color: #fff;
    background: var(--text-dim);
}
.ai-diff-badge[data-diff="easy"] { background: #66bb6a; }
.ai-diff-badge[data-diff="medium"] { background: #42a5f5; }
.ai-diff-badge[data-diff="hard"] { background: #ef5350; }
.ai-diff-badge[data-diff="extreme"] { background: #ffd700; color: #1a1a2e; }

/* Legacy face styles kept for compat */
.opponent-face-panel {
    display: none;
}
/* Small opponent face inside P2 panel (desktop only, hidden by default) */
.opponent-face-p2 {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--p2);
    background: #000;
    align-self: flex-end;
}

.score-dots {
    display: flex;
    gap: 0.3rem;
}
.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border);
    transition: all 0.3s;
}
.p1-panel .dot.filled {
    background: var(--p1);
    border-color: var(--p1);
    box-shadow: 0 0 6px var(--p1-glow);
}
.p2-panel .dot.filled {
    background: var(--p2);
    border-color: var(--p2);
    box-shadow: 0 0 6px var(--p2-glow);
}

.special-indicator {
    font-size: 0.7rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.special-indicator .ind-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}
.special-indicator .ind-svg {
    width: 14px;
    height: 14px;
}
.special-indicator .ind-label {
    font-weight: 600;
}
.special-indicator.used {
    opacity: 0.5;
    color: var(--text-muted);
}
.special-indicator.used .ind-icon-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to top right,
        transparent 40%,
        var(--text-muted) 40%,
        var(--text-muted) 60%,
        transparent 60%
    );
    pointer-events: none;
}

.round-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
}
.round-badge {
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.round-badge-top {
    padding: 0.15rem 0.75rem;
    font-size: 0.65rem;
}

/* ===== TURN INDICATOR ===== */
.turn-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0;
}
.turn-indicator {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: color 0.1s;
}
.turn-indicator.p1-turn { color: var(--p1); }
.turn-indicator.p2-turn { color: var(--p2); }

/* Opponent face inline with turn indicator */
.opponent-face-inline {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: cover;
    border: 2px solid var(--p2);
}

.turn-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem 0.6rem;
    min-width: 3.5rem;
    text-align: center;
}
.turn-timer.timer-danger {
    color: var(--danger);
    border-color: var(--danger);
    animation: pulse-danger 1s infinite;
}
@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===== BOARD ===== */
.board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    min-height: 120px;
}

.board {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    justify-content: center;
}

.tile {
    width: var(--tile-w);
    height: var(--tile-h);
    min-width: 0;
    flex-shrink: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--tile-fs);
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: var(--tile-bg);
    border: 2px solid var(--tile-border);
    border-radius: var(--radius);
    color: var(--text);
    user-select: none;
    transition: all 0.2s;
    animation: tileIn 0.3s ease-out;
}
.tile.swappable {
    cursor: pointer;
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-dim);
}
.tile.swappable:hover {
    background: var(--accent-dim);
    transform: translateY(-2px);
}
.tile.swap-selected {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 12px var(--accent-dim);
    animation: pulse 1s ease-in-out infinite;
}
.tile.swap-hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 14px var(--accent-dim);
    transform: scale(1.1);
}

@keyframes tileIn {
    from { transform: scale(0.5) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===== DROP ZONE (empty board) ===== */
.drop-zone {
    width: 100px;
    height: 70px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: all 0.2s;
}
.board-dragging .drop-zone {
    border-color: var(--p1);
    background: var(--p1-dim);
    box-shadow: 0 0 12px var(--p1-glow);
}

/* ===== DRAG SHAKE + GAP ===== */
.board-dragging .tile {
    animation: tileShake 0.3s ease-in-out infinite;
    transition: translate 0.15s ease-out;
}

@keyframes tileShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-2deg); }
    75% { transform: rotate(2deg); }
}

.board-dragging .tile.shift-left {
    translate: calc(var(--drag-gap, 14px) / -2);
}
.board-dragging .tile.shift-right {
    translate: calc(var(--drag-gap, 14px) / 2);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px var(--p1-glow); }
    50% { box-shadow: 0 0 20px var(--p1-glow); }
}

/* ===== SHUFFLE MODE ===== */
.board.shuffle-mode {
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 0;
    min-height: 0;
    background: transparent;
    overflow: hidden;
    transition: min-height 0.25s ease-out, padding 0.25s ease-out;
}
.board.shuffle-mode.has-tiles {
    padding: 0.5rem 0.75rem;
    min-height: calc(var(--tile-h, 58px) + 1rem);
}
.shuffle-mode .tile:not(.empty-slot) {
    animation: tileShake 0.3s ease-in-out infinite;
    cursor: grab;
}
.shuffle-mode .tile:not(.empty-slot):active {
    cursor: grabbing;
}

.shuffle-box {
    display: flex;
    gap: 2px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0.5rem 0.75rem;
    min-height: calc(var(--tile-h, 58px) + 1rem);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin: 0.75rem 0 0 0;
    background: var(--surface);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, margin 0.25s ease-out;
}
.shuffle-box.has-tiles {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.shuffle-box.has-room:not(.has-tiles) {
    border-color: var(--p1);
    border-style: dashed;
    background: var(--p1-dim);
    box-shadow: 0 0 12px var(--p1-glow);
}
.shuffle-box .tile {
    cursor: grab;
    flex-shrink: 1;
    min-width: 0;
    animation: none;
    transition: translate 0.15s ease-out;
}
.shuffle-box .tile:active {
    cursor: grabbing;
}
.shuffle-box .tile.drag-source {
    opacity: 0;
    pointer-events: none;
}
.shuffle-box .tile.shift-left {
    translate: calc(var(--drag-gap, 14px) / -2);
}
.shuffle-box .tile.shift-right {
    translate: calc(var(--drag-gap, 14px) / 2);
}
.shuffle-box.dragging .tile {
    animation: tileShake 0.3s ease-in-out infinite;
    transition: none;
}
.shuffle-box-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    user-select: none;
}

/* ===== STATUS MESSAGE ===== */
.status-msg {
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.status-msg.error {
    color: var(--danger);
    font-weight: 600;
    animation: headShake 0.5s;
}

@keyframes headShake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-4px); }
    30%, 60%, 90% { transform: translateX(4px); }
}

/* ===== BETA MOVES PANEL ===== */
.beta-moves {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
}
.beta-move-btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #26c6da;
    background: rgba(38, 198, 218, 0.1);
    color: #26c6da;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.beta-move-btn:active:not(:disabled) {
    transform: scale(0.95);
    background: rgba(38, 198, 218, 0.25);
}
.beta-move-btn:disabled {
    opacity: 0.3;
    border-color: var(--border);
    color: var(--text-muted);
    background: transparent;
    cursor: default;
}

/* Blind: "?" tiles for blinded player */
.tile.tile-blind {
    color: var(--text-muted) !important;
    text-shadow: none !important;
    background: var(--surface) !important;
    border-color: var(--border) !important;
    opacity: 0.6;
}

/* Insight: safe/danger highlights on keyboard */
.key.beta-safe {
    background: rgba(102, 187, 106, 0.35) !important;
    border-color: #66bb6a !important;
    color: #fff !important;
}
.key.beta-danger {
    background: rgba(239, 83, 80, 0.35) !important;
    border-color: #ef5350 !important;
    color: #fff !important;
}

/* ===== ACTION BUTTONS ===== */
.actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
}

/* ===== KEYBOARD ===== */
.keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 1rem;
    transition: opacity 0.3s;
    width: 100%;
    box-sizing: border-box;
}
.keyboard.dimmed {
    opacity: 0.55;
}
.keyboard.blocked {
    pointer-events: none;
}

.kb-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.key {
    width: 38px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    background: #4a5298;
    border: 1px solid #6a72b0;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
}
@media (hover: hover) {
    .key:hover:not(:disabled) {
        background: var(--p1-dim);
        border-color: var(--p1);
        color: var(--p1);
        transform: translateY(-1px);
    }
}
.key:active:not(:disabled) {
    transform: translateY(1px);
}
.key:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.kb-cancel-row {
    justify-content: center;
    padding: 0.5rem 0;
}

/* ===== HISTORY ===== */
.history-section {
    padding: 0.5rem 1.5rem calc(1rem + env(safe-area-inset-bottom, 1.5rem));
}

.history-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    width: 100%;
}
.history-toggle.open {
    margin-bottom: 0.5rem;
}

/* Player avatar (Google profile photo) in local 2P mode */
.player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--p2);
    background: #000;
}
.p1-panel .player-avatar { border-color: var(--p1); }
.p2-panel .player-avatar { border-color: var(--p2); }

#game-screen {
    transition: transform 0.4s ease;
}
#game-screen.rotated {
    transform: rotate(180deg);
}

/* Allow game screen to scroll when history is open */
#game-screen.history-open {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    background: var(--surface);
    border-left: 3px solid var(--border);
}
.history-item.p1-accent { border-left-color: var(--p1); }
.history-item.p2-accent { border-left-color: var(--p2); }

.history-num {
    color: var(--text-muted);
    font-size: 0.75rem;
    min-width: 1.5em;
}
.history-name {
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 5em;
}
.history-item.p1-accent .history-name { color: var(--p1); }
.history-item.p2-accent .history-name { color: var(--p2); }

.history-action {
    color: var(--text-muted);
    flex: 1;
}
.history-result {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.05em;
}
.special-badge {
    color: var(--accent);
    font-size: 0.75rem;
}

.history-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding: 0.5rem;
}

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.active {
    display: flex;
}
.dict-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 1rem;
    margin-top: 0.4rem;
}
.modal-overlay.modal-top {
    align-items: flex-start;
    padding-top: 2.5rem;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    animation: modalIn 0.25s ease-out;
}
.modal-wide {
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.modal-body {
    margin-bottom: 1.5rem;
    line-height: 1.6;
    color: var(--text-muted);
}
.modal-body p { margin-bottom: 0.75rem; }

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* On-screen keyboard for local 2P defend modal */
.defend-keyboard {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.defend-kb-row {
    display: flex;
    gap: 3px;
    justify-content: center;
}
.defend-kb-key {
    min-width: 28px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
}
.defend-kb-key:active {
    background: var(--p1);
    color: #000;
}
.defend-kb-wide {
    min-width: 60px;
    font-size: 1rem;
}

/* Result display in modals */
.result-winner {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--success);
}
.result-reason {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text);
}
.score-update, .final-scores {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.final-score {
    padding: 0.25rem 0;
    font-weight: 600;
}

/* ===== VICTORY CELEBRATION ===== */
.victory-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, rgba(11,14,26,0.92) 0%, rgba(11,14,26,0.98) 100%);
    animation: victoryFadeIn 0.5s ease;
}
@keyframes victoryFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.victory-lights {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.victory-light {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: lightFloat linear infinite;
    opacity: 0;
}
@keyframes lightFloat {
    0% { opacity: 0; transform: translateY(-20vh) scale(0.5); }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translateY(100vh) scale(1.2); }
}
.victory-content {
    text-align: center;
    z-index: 1;
    animation: victoryBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}
@keyframes victoryBounce {
    from { transform: scale(0.3); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.victory-crown {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    animation: crownPulse 2s ease-in-out infinite;
}
@keyframes crownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.victory-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #ffd700, #ffaa00, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: victoryShimmer 3s linear infinite;
    background-size: 200% auto;
    margin-bottom: 0.5rem;
}
@keyframes victoryShimmer {
    to { background-position: 200% center; }
}
.victory-winner-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.victory-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.victory-reason {
    font-size: 1.05rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.08);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    margin-bottom: 1.5rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}
.victory-scores {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 2rem;
}
.victory-score-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.5rem;
    text-align: center;
}
.victory-score-card.winner {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}
.victory-score-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.victory-score-val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
}
.victory-score-card.winner .victory-score-val {
    color: #ffd700;
}
.victory-btn {
    padding: 0.75rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}
.victory-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}
@media (max-width: 600px) {
    .victory-title { font-size: 1.8rem; }
    .victory-winner-name { font-size: 1.4rem; }
    .victory-crown { font-size: 3rem; }
}

/* Defeat screen (loser in online/AI) */
.victory-overlay.defeat {
    background: radial-gradient(ellipse at center, rgba(11,14,26,0.95) 0%, rgba(11,14,26,0.99) 100%);
}
.defeat-title {
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.defeat-message {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.defeat-reason {
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}
.defeat-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.victory-overlay.defeat .victory-btn {
    background: var(--surface-2);
    color: var(--text);
    box-shadow: none;
    border: 1px solid var(--border);
}
.victory-overlay.defeat .victory-btn:hover {
    background: var(--border);
    box-shadow: none;
}

/* Rules body */
.rules-body h3 {
    color: var(--text);
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}
.rules-body h3:first-child { margin-top: 0; }
.rules-body ul {
    padding-left: 1.2rem;
    margin-bottom: 0.5rem;
}
.rules-body li {
    margin-bottom: 0.35rem;
}
.rules-body code {
    background: var(--surface-2);
    padding: 0.1em 0.4em;
    border-radius: 3px;
    font-size: 0.95em;
}
.rules-draft-header {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

/* ===== BOARD SHAKE ===== */
.board.shake {
    animation: boardShake 0.4s;
}
@keyframes boardShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 200;
    gap: 1rem;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--p1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===== ONLINE SETUP PANELS ===== */
.setup-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    max-width: 360px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
#setup-mode-select {
    flex: 1;
}
.setup-submenu {
    max-width: 280px;
}
#setup-2p-menu {
    gap: 0.6rem;
}
#setup-2p-menu .join-inline {
    margin-top: 0.5rem;
}

/* Local view mode picker */
.local-view-cards {
    display: flex;
    gap: 0.6rem;
    width: 100%;
    max-width: 320px;
    justify-content: center;
}
.local-view-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 0.4rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text);
}
.local-view-card svg {
    width: 72px;
    height: 58px;
    color: var(--muted);
    transition: color 0.2s;
}
.local-view-card.selected {
    border-color: var(--p1);
    background: rgba(0,212,255,0.08);
}
.local-view-card.selected svg {
    color: var(--p1);
}
.local-view-card .card-label {
    font-weight: 700;
    font-size: 0.85rem;
}
.local-view-card .card-sub {
    font-size: 0.65rem;
    color: var(--muted);
    text-align: center;
    line-height: 1.2;
}

.settings-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    max-width: 240px;
}
.settings-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.setting-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.setting-row-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 2.5rem;
}
.setting-row-buttons {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}
.btn-setting {
    flex: 1;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-setting.selected {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-online {
    background: var(--accent);
    color: #fff;
}
.btn-online:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-ai {
    background: #2ecc71;
    color: #fff;
}
.btn-ai:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.difficulty-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-diff {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-diff:hover {
    border-color: var(--accent);
}
.btn-diff.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.input-group:has(.rounds-selector) {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}
.rounds-selector {
    display: inline-flex;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 0;
    width: auto;
}
.btn-rounds {
    min-width: 48px;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}
.btn-rounds:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
.btn-rounds.selected {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.thinking-dots::after {
    content: '';
    animation: thinking 1.5s infinite;
}

@keyframes thinking {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

.btn-back {
    margin-top: 0.1rem;
}

/* Room code display */
.room-code-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    margin: 0.75rem 0;
}
.room-code-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.room-code {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.3em;
    color: var(--accent);
}
.btn-share-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.btn-share-link:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.room-code-input {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem !important;
    font-weight: 700;
    width: 160px !important;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    text-align: center;
}

/* Waiting state */
.waiting-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Connection status text in setup panels */
.connection-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-height: 1.5rem;
    text-align: center;
}
.connection-status.error {
    color: var(--danger);
}
.connection-status.success {
    color: var(--success);
}

/* ===== CONNECTION BAR (in-game) ===== */
.connection-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.conn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    flex-shrink: 0;
}
.conn-dot.disconnected {
    background: var(--danger);
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== DISABLED STATE (opponent's turn in online mode) ===== */
.game-screen-disabled .board-area,
.game-screen-disabled .actions {
    pointer-events: none;
    opacity: 0.55;
    transition: opacity 0.3s;
}
.game-screen-disabled .keyboard {
    pointer-events: none;
}

/* ===== DRAG AND DROP ===== */
.drag-letter {
    position: fixed;
    z-index: 1000;
    width: var(--tile-w);
    height: var(--tile-h);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--tile-fs);
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: var(--surface-2);
    border: 2px solid var(--p1);
    border-radius: var(--radius);
    color: var(--p1);
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 20px var(--p1-glow);
    opacity: 0.92;
}

body.dragging {
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}


/* ===== PREVIEW MODE ===== */
.tile.tile-preview {
    border-color: var(--p1);
    background: var(--p1-dim);
    color: var(--p1);
    animation: previewPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 12px var(--p1-glow);
}
.tile.tile-wrong {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.4);
    animation: wrongPulse 1s ease-in-out infinite;
}
@keyframes wrongPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 0 16px rgba(231, 76, 60, 0.6); }
}

@keyframes previewPulse {
    0%, 100% { box-shadow: 0 0 8px var(--p1-glow); opacity: 1; }
    50% { box-shadow: 0 0 20px var(--p1-glow); opacity: 0.85; }
}

.confirm-bar {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.2rem 0;
    position: relative;
    z-index: 2;
}
.confirm-btn:not(:disabled) {
    animation: confirmPulse 1.2s ease-in-out infinite;
}
@keyframes confirmPulse {
    0%, 100% { box-shadow: 0 0 4px 2px rgba(0, 212, 255, 0.3); transform: scale(1); }
    50% { box-shadow: 0 0 24px 10px rgba(0, 212, 255, 0.5), 0 0 48px 16px rgba(0, 212, 255, 0.15); transform: scale(1.07); }
}

.turn-timer.timer-paused {
    opacity: 0.5;
    border-style: dashed;
}

.keyboard {
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* ===== DRAFT MODE BUTTON ===== */
.btn-draft {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
}
.btn-draft:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

/* ===== DRAFT SCREEN ===== */
.draft-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    gap: 1rem;
}

.draft-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.1em;
}

.draft-turn-indicator {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    min-height: 1.5rem;
}

.draft-players {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.draft-player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.draft-player-area.active-drafter {
    filter: brightness(1.2);
}

.draft-player-label {
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.draft-player-label.p1-color { color: var(--p1); }
.draft-player-label.p2-color { color: var(--p2); }

.draft-drop-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    min-height: 65px;
    padding: 8px 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: all 0.2s;
}
.active-drafter .draft-drop-box {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}
.draft-drop-box.drop-hover {
    border-color: var(--p1);
    background: var(--p1-dim);
    box-shadow: 0 0 16px var(--p1-glow);
    transform: scale(1.02);
}
.draft-box-letter {
    width: 36px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: var(--tile-bg);
    border: 2px solid var(--tile-border);
    border-radius: var(--radius);
    color: var(--text);
    animation: tileIn 0.3s ease-out;
}
.draft-box-placeholder {
    width: 36px;
    height: 42px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    opacity: 0.3;
}

.draft-vowels-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}
.draft-vowels-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.draft-vowels-display {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: #f59e0b;
}

.draft-consonants-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.draft-consonant-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-width: 260px;
}

.draft-consonant-tile {
    width: 44px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    background: var(--tile-bg);
    border: 2px solid var(--tile-border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
    touch-action: none;
}
.draft-consonant-tile:hover:not(.picked) {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 0 8px var(--accent-dim);
}
.draft-consonant-tile:active:not(.picked) {
    cursor: grabbing;
}
.draft-consonant-tile.picked {
    opacity: 0.15;
    cursor: not-allowed;
    pointer-events: none;
}
.draft-consonant-tile.draft-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* draft-drop-target removed — now using draft-drop-box */

/* ===== DRAFT KEYBOARD IN-GAME ===== */
.draft-keyboard {
    gap: 2px;
}

.draft-kb-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-top: 0.35rem;
    margin-bottom: -0.1rem;
}
.draft-kb-label.p1-color { color: var(--p1); }
.draft-kb-label.p2-color { color: var(--p2); }
.draft-kb-label.vowel-label { color: #f59e0b; }

.draft-kb-group {
    gap: 5px;
}

.key.draft-unavailable {
    opacity: 0.5;
    pointer-events: none;
    border-style: dashed;
}
.key.draft-vowel {
    border-color: #f59e0b;
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}
.key.draft-consumed {
    opacity: 0.2;
    pointer-events: none;
    text-decoration: line-through;
}

/* ===== PWA INSTALL BANNER ===== */
.pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 90;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.pwa-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pwa-banner-text strong {
    font-size: 0.95rem;
    color: var(--text);
}
.pwa-banner-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pwa-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.pwa-dismiss:hover {
    color: var(--text);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* ===== OFFLINE INDICATOR ===== */
/* Only visible on setup screen — hidden during gameplay */
.offline-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface);
    border-bottom: 1px solid var(--danger-dim);
    z-index: 95;
    animation: slideDown 0.3s ease-out;
}
body:has(#game-screen.active) .offline-bar,
body:has(#draft-screen.active) .offline-bar,
body:has(#campaign-screen.active) .offline-bar,
body:has(#tutorial-screen.active) .offline-bar {
    display: none !important;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.offline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    animation: blink 1s infinite;
    flex-shrink: 0;
}

/* ===== UPDATE NOTICE ===== */
.update-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--accent);
    color: var(--text-muted);
    font-size: 0.85rem;
    z-index: 91;
    animation: slideUp 0.3s ease-out;
}

.update-notice .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

/* ===== EXIT BUTTON ===== */
.game-footer {
    padding: 1rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.btn-quest-back {
    display: block;
    margin: 0.5rem auto 0;
    font-size: 0.85rem;
    color: #4fc3f7;
    opacity: 0.8;
    transition: all 0.2s;
}
.btn-quest-back:hover {
    opacity: 1;
    color: #81d4fa;
}
.btn-exit-home {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.7;
    transition: all 0.2s;
}
.btn-exit-home:hover {
    opacity: 1;
    color: var(--danger);
}

.draft-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== SETUP SPACER (equal gap: logo→buttons = buttons→how-to-play) ===== */
.setup-spacer {
    flex: 1;
    max-height: 2.5rem;
}

/* Active Games List */
.active-games-list {
    width: 100%;
    max-width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.resume-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.25rem;
}
.resume-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
    gap: 0.5rem;
}
.resume-row:hover {
    background: var(--surface-2);
}
.resume-info {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.resume-mode {
    color: var(--accent);
    font-weight: 600;
}
.resume-my-turn {
    background: linear-gradient(90deg, var(--p1-dim), transparent);
    border-left: 3px solid var(--p1);
    animation: row-glow 2s ease-in-out infinite;
}
@keyframes row-glow {
    0%, 100% { box-shadow: inset 0 0 8px rgba(0, 212, 255, 0.15); }
    50% { box-shadow: inset 0 0 16px rgba(0, 212, 255, 0.35); }
}
.resume-my-turn:hover {
    background: linear-gradient(90deg, var(--p1-glow), transparent);
}
.resume-your-turn {
    color: var(--p1);
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}
.resume-your-turn::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--p1);
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: 0 0 6px var(--p1);
    animation: turn-pulse 1.5s ease-in-out infinite;
}
@keyframes turn-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.resume-their-turn {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-style: italic;
}
.resume-abandoned {
    background: linear-gradient(90deg, var(--danger-dim), transparent);
    border-left: 3px solid var(--danger);
    opacity: 0.7;
}
.resume-abandoned:hover {
    opacity: 0.85;
}
.resume-abandoned .resume-mode {
    color: var(--danger);
}
.resume-abandoned .resume-info {
    white-space: nowrap;
}
.resume-abandoned-msg {
    color: var(--danger);
    font-weight: 600;
}
.resume-trash {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}
.resume-trash svg {
    width: 100%;
    height: 100%;
}
.resume-trash:hover {
    color: var(--danger);
    background: var(--danger-dim);
}
.resume-quickmatch {
    border-left: 3px solid #a855f7;
    background: linear-gradient(90deg, rgba(168,85,247,0.08), transparent);
}
.resume-quickmatch:hover {
    background: linear-gradient(90deg, rgba(168,85,247,0.15), transparent);
}
.resume-quickmatch .resume-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #a855f7;
}
.resume-quickmatch .loading-spinner-sm {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
    border-top-color: #a855f7;
}

/* Install App Button */
.btn-install {
    background: linear-gradient(135deg, var(--success)22, var(--surface-2));
    color: var(--success);
    border: 1px solid var(--success)66;
    font-weight: 700;
}
.btn-install:hover:not(:disabled) {
    filter: brightness(1.2);
    border-color: var(--success);
}
.install-details {
    display: none;
}

.loading-spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.15em;
    margin-right: 0.4em;
    flex-shrink: 0;
}
.btn-icon-sm {
    width: 1em;
    height: 1em;
}

.btn-tutorial {
    background: var(--surface-2);
    color: var(--p1);
    border: 1px solid var(--p1-dim);
    font-weight: 600;
    margin-top: 0.75rem;
}
.btn-tutorial:hover:not(:disabled) {
    background: var(--p1-dim);
    border-color: var(--p1);
    transform: translateY(-1px);
}

.btn-rules-mode {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-weight: 600;
}
.btn-rules-mode:hover:not(:disabled) {
    border-color: var(--text-muted);
    color: var(--text);
}
.btn-htp-rules {
    background: var(--surface);
    color: #fff;
    border: 2px solid #22c55e;
    font-weight: 700;
}
.btn-htp-rules:hover:not(:disabled) {
    border-color: #4ade80;
}
.btn-htp-tutorial {
    background: var(--surface);
    color: #fff;
    border: 2px solid #00d4ff;
    font-weight: 700;
}
.btn-htp-tutorial:hover:not(:disabled) {
    border-color: #67e8f9;
}

/* ===== TUTORIAL ===== */
#tutorial-screen.screen.active {
}
.tutorial-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1rem;
    gap: 0.5rem;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
    overflow-y: hidden;
    box-sizing: border-box;
    min-height: 0;
}

.tutorial-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    overflow: visible;
}

.tut-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}
.tut-title-row span {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.tut-toc {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.25rem 0;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}
.tut-toc::-webkit-scrollbar { display: none; }
.tut-toc-item {
    flex-shrink: 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 10px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.tut-toc-item:hover {
    border-color: var(--accent);
    color: var(--text);
}
.tut-toc-item.current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.tut-toc-item.completed {
    border-color: var(--success);
    color: var(--success);
}

/* Coach */
.coach-area {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 1;
    min-height: 0;
    overflow: hidden;
}
.coach-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.coach-face {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.coach-bubble {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.75rem;
    flex: 1;
    min-width: 0;
    min-height: 3rem;
    overflow-y: auto;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text);
    animation: bubbleIn 0.3s ease-out;
    box-sizing: border-box;
}
.coach-bubble.coach-thinking {
    border-left: 3px solid var(--accent);
}
.word-hint {
    color: var(--accent);
    font-weight: 700;
}
.coach-bubble::before {
    display: none;
}
.coach-bubble::after {
    display: none;
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tutorial feedback */
.tutorial-feedback {
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 1.3rem;
    text-align: center;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.tutorial-feedback.success { color: var(--success); }
.tutorial-feedback.error { color: var(--danger); animation: headShake 0.5s; }
.tutorial-feedback.info { color: var(--accent); }

/* Tutorial board area */
.tutorial-board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    min-height: 60px;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 1;
}
#tutorial-board {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: hidden;
}
#tutorial-board:has(.tut-draft-players) {
    flex-wrap: wrap;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}
#tutorial-board .tile {
    flex: 0 1 var(--tile-w);
    min-width: 0;
    transition: translate 0.15s ease-out;
    animation: none;
}
#tutorial-board.tut-board-compact .tile {
    flex: 0 1 40px;
    height: 46px;
    font-size: 1.1rem;
}

.tutorial-board-area.word-found .tile {
    border-color: var(--danger);
    background: var(--danger-dim);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}
.tutorial-board-area.word-success .tile {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
    animation: celebrate 0.5s ease-out;
}

@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}


/* Tutorial highlight — pulsing glow */
.tutorial-highlight {
    animation: tutHighlight 1s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes tutHighlight {
    0%, 100% { box-shadow: 0 0 6px rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 0 18px rgba(168, 85, 247, 0.7); }
}

/* Tutorial actions */
.tutorial-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

/* Tutorial board drag: tile shifting matches main game */
#tutorial-board.board-dragging {
    overflow: visible;
}
#tutorial-board.board-dragging .tile {
    animation: tileShake 0.3s ease-in-out infinite;
}
#tutorial-board.board-dragging .tile.shift-left {
    translate: calc(var(--drag-gap, 14px) / -2);
}
#tutorial-board.board-dragging .tile.shift-right {
    translate: calc(var(--drag-gap, 14px) / 2);
}

/* Confirm bar hint in tutorial */
.tut-confirm-hint {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    width: 100%;
    text-align: center;
}

/* Safe board state for swap/shuffle reveals */
.tutorial-board-area.safe-board .tile {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
    animation: celebrate 0.5s ease-out;
}

/* Celebration feedback */
.tutorial-feedback.celebration {
    color: #ffd700;
    font-weight: 700;
    animation: celebrateText 0.5s ease-out;
}
@keyframes celebrateText {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Celebration particles */
.tut-celebration-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    bottom: 10%;
    pointer-events: none;
    animation: tutCelebFloat 1.5s ease-out forwards;
}
@keyframes tutCelebFloat {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(0); opacity: 0; }
}

/* Defense form */
.tut-defend-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}
.tut-defend-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
.tut-defend-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-dim);
}
.tut-defend-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

/* Choice keys */
.tut-choice-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}
.tut-choice-key {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.tut-choice-key:hover:not(.tut-choice-wrong) {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.tut-choice-wrong {
    opacity: 0.3;
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    cursor: not-allowed;
    pointer-events: none;
}

/* Blocked keys in tutorial */
#tutorial-keyboard .key.tut-blocked {
    opacity: 0.3;
    pointer-events: none;
}

/* Tutorial recap */
.tutorial-recap {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}
.tutorial-recap li {
    padding: 0.35rem 0;
    padding-left: 1.2rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.4;
}
.tutorial-recap li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

.tut-nav {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
    margin-top: auto;
    flex-shrink: 0;
    padding-top: 0.25rem;
}
.tut-next-pulse {
    animation: confirmPulse 1.2s ease-in-out infinite;
}
#tutorial-keyboard {
    padding: 0.5rem 0.5rem;
    flex-shrink: 0;
}
#tutorial-back, #tutorial-forward {
    font-size: 0.8rem;
    opacity: 0.7;
    min-width: 70px;
}
#tutorial-back {
    text-align: left;
}
#tutorial-forward {
    text-align: right;
}
#tutorial-next {
    min-width: 100px;
}
#tutorial-next.tut-hidden {
    visibility: hidden;
    pointer-events: none;
}
#tutorial-back:hover, #tutorial-forward:hover {
    opacity: 1;
}
#tutorial-back:disabled, #tutorial-forward:disabled {
    opacity: 0.25;
    pointer-events: none;
}

/* ===== TUTORIAL DRAFT GRID ===== */
.tut-draft-players {
    display: flex;
    gap: 1rem;
    justify-content: center;
    width: 100%;
    margin-bottom: 0.75rem;
}
.tut-draft-player-area {
    flex: 1;
    max-width: 160px;
    text-align: center;
}
.tut-draft-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.tut-draft-box {
    display: flex;
    gap: 3px;
    justify-content: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem;
    min-height: 36px;
}
.tut-draft-letter {
    width: 24px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tile-bg);
    border: 1px solid var(--tile-border);
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text);
}
.tut-draft-letter.tut-draft-highlight {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}
.tut-draft-placeholder {
    width: 24px;
    height: 28px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    opacity: 0.4;
}
.tut-draft-vowel-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.tut-draft-vowel-label {
    font-size: 0.7rem;
    color: #f59e0b;
    font-weight: 600;
}
.tut-draft-vowel {
    width: 22px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.7rem;
    color: #f59e0b;
}
.tut-draft-grid-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
    text-align: center;
    font-weight: 600;
}
.tut-draft-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
    max-width: 260px;
    margin: 0 auto;
}
.tut-draft-tile {
    width: 28px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text);
    transition: all 0.2s;
}
.tut-draft-tile.picked {
    opacity: 0.3;
}
.tut-draft-tile.picked-p1 {
    border-color: var(--p1);
    color: var(--p1);
}
.tut-draft-tile.picked-p2 {
    border-color: var(--p2);
    color: var(--p2);
}
.dimmed-key {
    opacity: 0.3;
    pointer-events: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .game-logo { width: 70vw; }
    .name-inputs { flex-direction: column; gap: 0.2rem; }
    .vs-divider { padding-top: 0; }
    .input-group input { width: 100%; }

    .game-header { padding: 0.35rem 0.5rem 0.5rem; gap: 0.2rem; }
    .header-main-row { gap: 0.4rem; }
    .opponent-face-center { width: 96px; height: 96px; }
    .player-panel { min-width: 80px; padding: 0.35rem 0.5rem; }
    .player-name { font-size: 0.85rem; }
    .dot { width: 10px; height: 10px; }
    .special-indicator { font-size: 0.6rem; }
    .special-indicator .ind-svg { width: 12px; height: 12px; }
    .special-indicator .ind-icon-wrap { width: 14px; height: 14px; }

    .key { width: 32px; height: 38px; font-size: 0.9rem; }
    .confirm-bar { gap: 0.35rem; }

    .actions { gap: 0.35rem; }
    .btn { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
    .btn-mode { padding: 0.75rem 1rem; font-size: 1rem; }
    .btn-lg { padding: 0.6rem 2rem; font-size: 1.15rem; }

    .draft-players { gap: 1rem; }
    .draft-drop-box { min-width: 160px; min-height: 55px; }
    .draft-box-letter { width: 30px; height: 36px; font-size: 0.9rem; }
    .draft-consonant-tile { width: 38px; height: 44px; font-size: 1rem; }
    .draft-consonant-grid { max-width: 220px; }
}

/* ===== BULLET READY-UP ===== */
.bullet-ready-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.bullet-ready-overlay.active {
    opacity: 1;
}

.bullet-ready-panel {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
}

.bullet-ready-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px var(--danger-dim), 0 0 40px var(--danger-dim);
    animation: bulletPulse 0.8s ease-in-out infinite alternate;
}

@keyframes bulletPulse {
    from { transform: scale(1); opacity: 0.9; }
    to { transform: scale(1.05); opacity: 1; }
}

.bullet-ready-sub {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

.bullet-ready-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.bullet-ready-btn {
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--accent);
    cursor: pointer;
    transition: all 0.15s;
}
.bullet-ready-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-dim);
}
.bullet-ready-btn.p1-btn {
    background: var(--p1);
    border-color: var(--p1);
}
.bullet-ready-btn.p1-btn:hover {
    box-shadow: 0 4px 16px var(--p1-glow);
}
.bullet-ready-btn.p2-btn {
    background: var(--p2);
    border-color: var(--p2);
}
.bullet-ready-btn.p2-btn:hover {
    box-shadow: 0 4px 16px var(--p2-glow);
}
.bullet-ready-btn.bullet-locked {
    opacity: 0.6;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* ==========================================
   CAMPAIGN
   ========================================== */

/* Campaign button on home screen */
.btn-campaign {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #000;
    font-weight: 800;
    position: relative;
    margin-bottom: 0.35rem;
}
.btn-campaign:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.campaign-btn-progress {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.8;
    margin-top: 2px;
    text-transform: none;
    letter-spacing: 0;
}

/* Gauntlet button on home screen */
.mode-buttons-bottom {
    margin-top: 0;
}
.btn-gauntlet {
    background: var(--surface);
    color: #fff;
    font-weight: 800;
    border: 2px solid #ef4444;
    flex-direction: column;
    gap: 0;
    padding: 0.65rem 1rem 0.5rem;
}
.btn-gauntlet:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    border-color: #f87171;
    transform: translateY(-1px);
}
.gauntlet-row-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    width: 100%;
}
.gauntlet-hearts { font-size: 0.8em; letter-spacing: 0.1em; color: #ef4444; }
.gauntlet-row-stars {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
}
.g-star-won { color: #ffd700; }
.g-star-empty { color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.5); }

/* Gauntlet progress tracker */
.gauntlet-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.gauntlet-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-muted);
}
.gauntlet-dot-won {
    background: #22c55e;
    border-color: #22c55e;
    color: #fff;
}
.gauntlet-dot-current {
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}
.gauntlet-dot-next {
    border-color: var(--accent);
    color: var(--accent);
    animation: gauntletPulse 1.5s ease-in-out infinite;
}
@keyframes gauntletPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(99, 102, 241, 0.3); }
    50% { box-shadow: 0 0 12px rgba(99, 102, 241, 0.6); }
}

/* Campaign screen */
#campaign-screen {
    overflow: hidden;
}
#campaign-screen.active {
    display: flex;
    flex-direction: column;
}
.campaign-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.campaign-top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
    flex-shrink: 0;
    position: relative;
}
.campaign-name-input {
    margin-left: 0;
    width: 7rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid;
    border-color: var(--surface-light);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: center;
    caret-color: transparent;
}
.campaign-name-input::placeholder { color: var(--text-dim); opacity: 1; }
.campaign-name-input:focus { outline: none; border-color: var(--accent); caret-color: auto; }
.campaign-name-input:focus::placeholder { opacity: 0; }
.campaign-name-input.pulse-hint {
    animation: campaignNamePulse 1.5s ease-in-out infinite;
    border-width: 2px;
}
.campaign-name-input.pulse-hint:focus {
    animation: none;
    border-width: 1px;
}
@keyframes campaignNamePulse {
    0%, 100% { border-color: rgba(168, 85, 247, 0.4); box-shadow: 0 0 4px rgba(168, 85, 247, 0.2); background: var(--surface); transform: scale(1); }
    50% { border-color: #a855f7; box-shadow: 0 0 16px rgba(168, 85, 247, 0.8), 0 0 30px rgba(168, 85, 247, 0.4); background: rgba(168, 85, 247, 0.15); transform: scale(1.03); }
}

.campaign-back-btn {
    position: absolute;
    left: 1rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.campaign-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 1rem calc(4rem + env(safe-area-inset-bottom, 0px));
}

/* Campaign header */
.campaign-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.75rem 0;
}
.campaign-quest-title {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}
.campaign-header-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    position: absolute;
    right: 0;
}
.campaign-stars-total {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.95rem;
    font-weight: 700;
}
.campaign-stars-max {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.campaign-word-iq {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.word-iq-value {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent);
}
.word-iq-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Star icon */
.star-icon {
    color: var(--surface-2);
    font-size: 1em;
}
.star-icon.filled {
    color: #ffd700;
}

/* Star gate progress */
.campaign-gate-progress {
    margin-bottom: 0.75rem;
}
.gate-bar-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.gate-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.gate-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    text-align: center;
}

/* Rank sections */
.campaign-rank-section {
    margin-bottom: 0.5rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.campaign-rank-section.locked {
    opacity: 0.5;
}
.rank-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.rank-section-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.rank-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rank-section-title {
    font-size: 0.9rem;
    font-weight: 700;
}
.rank-lock-icon {
    font-size: 0.75rem;
}
.rank-section-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.rank-star-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.rank-chevron {
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.rank-chevron.open {
    transform: rotate(180deg);
}
.rank-missions {
    display: none;
    padding: 0 0.5rem 0.5rem;
}
.rank-missions.expanded {
    display: block;
}

/* Mission cards */
.mission-card {
    background: var(--surface-3);
    border-radius: var(--radius);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.mission-card:hover {
    background: var(--surface-2);
}
.mission-card.completed {
    border-left-color: var(--success);
}
.mission-card.next-mission {
    border: 2px solid #ffd700;
    background: linear-gradient(135deg, #ffd700, #ffb800, #ffc929, #ffe066);
    color: #1a1000;
    box-shadow: 0 0 24px rgba(255, 215, 0, 0.7), 0 0 48px rgba(255, 180, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    animation: nextMissionPulse 1.8s ease-in-out infinite;
}
.mission-card.next-mission .mission-title,
.mission-card.next-mission .mission-number,
.mission-card.next-mission .mission-flavor {
    color: #1a1000;
}
.mission-card.next-mission .star-icon {
    color: rgba(0, 0, 0, 0.2);
}
.mission-card.next-mission .star-icon.filled {
    color: #6b3a00;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}
@keyframes nextMissionPulse {
    0%, 100% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.7), 0 0 48px rgba(255, 180, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 36px rgba(255, 215, 0, 0.9), 0 0 64px rgba(255, 180, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6); }
}
.mission-card.locked {
    cursor: default;
    opacity: 0.6;
}
.mission-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mission-number {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    background: var(--surface-2);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    min-width: 1.4em;
    text-align: center;
}
.mission-title {
    font-size: 0.85rem;
    font-weight: 700;
    flex: 1;
}
.mission-stars {
    font-size: 0.85rem;
    display: flex;
    gap: 1px;
}
.mission-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.25rem;
}
.mission-flavor {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mission-badges {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.mission-badge {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-medium { background: #42a5f533; color: #42a5f5; }
.badge-hard { background: #ef535033; color: #ef5350; }
.badge-extreme { background: #ffd70033; color: #ffd700; }
.badge-bullet { background: #ffa72633; color: #ffa726; }
.badge-timed { background: #ab47bc33; color: #ab47bc; }
.badge-draft { background: #66bb6a33; color: #66bb6a; }
.badge-puzzle { background: #7e57c233; color: #b39ddb; }
.badge-boss { background: linear-gradient(135deg, #ffd70044, #ff8c0044); color: #ffd700; font-weight: 700; }
.badge-rounds { background: var(--surface-2); color: var(--text-muted); }

/* Campaign footer buttons */
.campaign-footer-btns {
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.btn-reset-quest {
    margin-top: 1.5rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    cursor: pointer;
    opacity: 0.6;
}
.btn-reset-quest:hover {
    opacity: 1;
    color: #e74c3c;
    border-color: #e74c3c;
}
.btn-danger {
    background: #e74c3c !important;
    color: #fff !important;
    border: none;
}
.btn-campaign-stats {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
}

/* Mission detail overlay */
.mission-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.mission-detail-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.mission-detail-panel {
    background: var(--bg);
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1.5rem 1.5rem;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease;
}
.mission-detail-overlay.active .mission-detail-panel {
    transform: translateY(0);
}
.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}
.detail-mission-num {
    font-size: 1.1rem;
    font-weight: 800;
}
.detail-close {
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
}
/* Opponent face on mission detail panel */
.detail-opponent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.detail-opponent-face {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--p2);
}
.detail-opponent-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--p2);
}

.detail-flavor {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.75rem;
}
.detail-objectives {
    margin-bottom: 0.75rem;
}
.detail-star-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.detail-star-row .star-icon {
    font-size: 1.1rem;
}
.detail-star-row.earned {
    color: var(--success);
}
.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* In-game mission indicator + objectives */
.mission-indicator {
    padding: 0.25rem 0.75rem;
    margin: 0 auto;
    max-width: 340px;
}
.obj-title {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.15rem;
}
.obj-list {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.obj-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    line-height: 1.2;
}
.obj-icon {
    width: 1em;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.obj-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.obj-pending {
    color: rgba(255, 255, 255, 0.85);
}
.obj-earned {
    color: var(--success);
}
.obj-earned .obj-icon {
    font-weight: 700;
}
.obj-failed {
    color: var(--danger);
}
.obj-failed .obj-icon {
    font-weight: 700;
}

/* AI special move toast — between board and buttons */
.ai-special-toast {
    display: block;
    text-align: center;
    background: #0a0a12;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 1.2rem;
    border-radius: 8px;
    border: 2px solid var(--p2);
    box-shadow: 0 0 10px var(--p2-glow), 0 2px 8px rgba(0, 0, 0, 0.5);
    margin: 0.25rem auto;
    width: fit-content;
    max-width: 80%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.ai-special-toast.show {
    opacity: 1;
}

/* Puzzle star-cost indicator on special buttons */
.star-cost {
    font-size: 0.7em;
    color: #ffd54f;
    margin-left: 2px;
    vertical-align: middle;
}

/* Puzzle Solutions Modal */
.puzzle-sol-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}
.puzzle-sol-panel {
    background: var(--surface);
    border-radius: 12px;
    width: 94%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.puzzle-sol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border);
}
.puzzle-sol-body {
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}
.puzzle-sol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82em;
}
.puzzle-sol-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    background: var(--surface);
}
.puzzle-sol-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.puzzle-sol-table tr:last-child td { border-bottom: none; }
.puzzle-sol-board {
    font-weight: 700;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.05em;
}
.puzzle-sol-traps { color: var(--danger); }
.puzzle-sol-escapes { color: var(--success); font-size: 0.9em; }

/* Campaign hint slot — reserved space between board and status/actions */
.board-area:has(+ .campaign-hint-slot) {
    padding-bottom: 0.5rem;
}
.campaign-hint-slot {
    height: 3.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.75rem;
    margin-bottom: 0.6rem;
    flex-shrink: 0;
    overflow: visible;
    z-index: 1;
}

/* Campaign hint bar — inside slot, opacity-only transition */
.campaign-hint-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #1e3a5f, #2a5298);
    border: 1px solid #4fc3f7;
    border-radius: var(--radius-lg);
    padding: 0.45rem 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.25);
    cursor: pointer;
}
.campaign-hint-bar.show {
    opacity: 1;
    animation: hintPulse 2s ease-in-out infinite;
}
/* Important hint variant — red border + pulse */
.campaign-hint-bar.hint-important {
    background: linear-gradient(135deg, #3a1e1e, #522a2a);
    border-color: #ef5350;
    box-shadow: 0 4px 16px rgba(239, 83, 80, 0.25);
}
.campaign-hint-bar.hint-important.show {
    animation: hintPulseRed 2s ease-in-out infinite;
}
@keyframes hintPulseRed {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(239, 83, 80, 0.3);
        border-color: #ef5350;
        background: linear-gradient(135deg, #3a1e1e, #522a2a);
    }
    50% {
        box-shadow: 0 0 20px rgba(239, 83, 80, 0.8), 0 0 40px rgba(239, 83, 80, 0.4), 0 0 60px rgba(239, 83, 80, 0.2);
        border-color: #ef9a9a;
        background: linear-gradient(135deg, #4a2828, #6b3535);
    }
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(79, 195, 247, 0.3);
        border-color: #4fc3f7;
        background: linear-gradient(135deg, #1e3a5f, #2a5298);
    }
    50% {
        box-shadow: 0 0 20px rgba(79, 195, 247, 0.8), 0 0 40px rgba(79, 195, 247, 0.4), 0 0 60px rgba(79, 195, 247, 0.2);
        border-color: #81d4fa;
        background: linear-gradient(135deg, #264b73, #3566b8);
    }
}
.hint-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
}
.hint-text {
    font-size: 0.88rem;
    line-height: 1.35;
    color: #e3f2fd;
    flex: 1;
    font-weight: 500;
}
.hint-dismiss {
    background: none;
    border: none;
    color: #90caf9;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    flex-shrink: 0;
    opacity: 0.7;
    line-height: 1;
}
.hint-dismiss:hover {
    opacity: 1;
}

/* Word-complete shake: board turns red and shakes when AI finishes a word */
.board.word-complete .tile {
    color: #ff3333;
    border-color: #ff3333;
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.4);
    animation: wordCompleteShake 0.6s ease-in-out;
}
@keyframes wordCompleteShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px) rotate(-2deg); }
    30% { transform: translateX(5px) rotate(1.5deg); }
    45% { transform: translateX(-4px) rotate(-1deg); }
    60% { transform: translateX(3px) rotate(0.5deg); }
    75% { transform: translateX(-2px); }
}

/* Scripted keyboard states */
.key.scripted-disabled {
    opacity: 0.15;
    pointer-events: none;
}
.key.scripted-active {
    animation: scriptedKeyPulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(79, 195, 247, 0.6);
    border-color: #4fc3f7;
}
@keyframes scriptedKeyPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(79, 195, 247, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 16px rgba(79, 195, 247, 0.7); }
}
.btn-challenge.scripted-pulse {
    animation: challengePulse 1s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}
@keyframes challengePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 18px rgba(255, 215, 0, 0.6); }
}

/* Hint-triggered button highlight */
.hint-highlight {
    animation: hintHighlight 2s ease-in-out infinite !important;
    box-shadow: 0 0 12px rgba(79, 195, 247, 0.5) !important;
}
@keyframes hintHighlight {
    0%, 100% { box-shadow: 0 0 8px rgba(79, 195, 247, 0.4); }
    50% { box-shadow: 0 0 20px rgba(79, 195, 247, 0.8), 0 0 40px rgba(79, 195, 247, 0.3); }
}

/* "Start here!" quest hint tooltip */
.quest-start-hint {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.5rem);
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1e3a5f, #2a5298);
    border: 1px solid #4fc3f7;
    color: #e3f2fd;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    white-space: nowrap;
    animation: hintPulse 2s ease-in-out infinite;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(79, 195, 247, 0.25);
    pointer-events: none;
}
.quest-start-hint::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #4fc3f7;
}

/* Campaign results overlay */
.campaign-results-content {
    text-align: center;
}
.campaign-result-mission {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}
.campaign-result-header {
    font-size: 2rem;
    font-weight: 900;
    color: #ffd700;
    margin-bottom: 0.5rem;
}
.campaign-result-flavor {
    font-size: 1.1rem;
    color: #e3f2fd;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0;
    animation: bonusReveal 0.5s ease forwards;
}
.campaign-result-header.defeat-header {
    color: var(--danger);
}
.campaign-defeat-reason {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.campaign-defeat-msg {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Star reveal animation */
.star-reveal-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.star-reveal-star {
    font-size: 2.5rem;
    opacity: 0;
    transform: scale(0);
    animation: starReveal 0.5s ease forwards;
}
.star-reveal-star.empty {
    color: var(--surface-2);
}
.star-reveal-star.earned {
    color: #ffd700;
}
@keyframes starReveal {
    0% { opacity: 0; transform: scale(0) rotate(-30deg); }
    60% { opacity: 1; transform: scale(1.3) rotate(5deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Bonus reveal */
.bonus-reveal-container {
    margin-bottom: 1rem;
}
.bonus-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    opacity: 0;
    animation: bonusReveal 0.4s ease forwards;
}
.bonus-reveal.earned {
    color: var(--success);
}
.bonus-reveal.missed {
    color: var(--text-muted);
}
.bonus-reveal-check {
    font-size: 1rem;
}
@keyframes bonusReveal {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* IQ change animation */
.iq-change {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: bonusReveal 0.4s ease forwards;
}
.iq-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Rank up reveal */
.rank-up-reveal {
    margin: 0.75rem 0;
    opacity: 0;
    animation: rankUpReveal 0.6s ease forwards;
}
.rank-up-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.rank-up-title {
    font-size: 1.5rem;
    font-weight: 900;
}
@keyframes rankUpReveal {
    0% { opacity: 0; transform: scale(0.5); }
    60% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* 3-Star Perfect Celebration */
.campaign-results-overlay.perfect {
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.15) 0%, rgba(0,0,0,0.85) 70%);
}
.perfect-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.6), rgba(255, 255, 255, 0.3));
    animation: perfectFlash 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 0;
}
@keyframes perfectFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
.perfect-header {
    font-size: 2.8rem !important;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: linear-gradient(135deg, #ffd700, #ffaa00, #fff4b0, #ffd700);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: perfectTextShimmer 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}
@keyframes perfectTextShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.perfect-burst {
    width: 200px;
    height: 200px;
    margin: -2rem auto 0;
    position: relative;
    pointer-events: none;
    animation: perfectBurst 1.5s ease-out 0.2s both;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 70%);
    border-radius: 50%;
}
@keyframes perfectBurst {
    0% { opacity: 0; transform: scale(0.3); }
    40% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(2); }
}
.perfect .star-reveal-star.earned {
    font-size: 4.5rem;
    filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.8));
}
.perfect .star-reveal-container {
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Campaign result actions */
.campaign-result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.5rem;
    align-items: center;
}
.campaign-result-btn {
    min-width: 200px;
}

/* Achievement toasts */
.achievement-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.achievement-toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid #ffd700;
    border-radius: var(--radius-lg);
    padding: 0.6rem 1rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
    max-width: 280px;
}
.achievement-toast.show {
    opacity: 1;
    transform: translateX(0);
}
.achievement-toast-icon {
    font-size: 1.4rem;
}
.achievement-toast-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffd700;
}
.achievement-toast-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Stats panel overlay */
.stats-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.stats-panel-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.stats-panel {
    background: var(--bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.stats-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.stats-panel-title {
    font-size: 1rem;
    font-weight: 800;
}
.stats-panel-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 1rem 1.5rem;
}
.stats-section {
    margin-bottom: 1rem;
}
.stats-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.stats-iq-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.stats-iq-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
}
.stats-iq-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 0.5rem;
}
.stat-val {
    font-size: 1.1rem;
    font-weight: 800;
}
.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Achievement grid */
.stats-ach-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}
.stats-ach-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 0.75rem;
}
.stats-ach-item.locked {
    opacity: 0.4;
}
.stats-ach-item.unlocked {
    border: 1px solid #ffd70055;
}
.stats-ach-icon {
    font-size: 1rem;
}
.stats-ach-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   MODE UNLOCK CELEBRATION
   ========================================== */
.mode-unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, rgba(0,40,80,0.97) 0%, rgba(8,8,16,0.99) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mu-fade-in 0.4s ease-out;
}
.mode-unlock-overlay.mode-unlock-fade-out {
    animation: mu-fade-out 0.5s ease-in forwards;
}
.mode-unlock-content {
    text-align: center;
    color: #fff;
}
.mode-unlock-header {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffd700;
    text-shadow: 0 0 24px rgba(255,215,0,0.5), 0 0 48px rgba(255,215,0,0.2);
    margin-bottom: 2.5rem;
    animation: mu-glow 2s ease-in-out infinite;
}
.mode-unlock-icons {
    display: flex;
    gap: 3rem;
    justify-content: center;
    margin-bottom: 2rem;
}
.mode-unlock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    animation: mu-pop 0.5s ease-out both;
}
.mode-unlock-item:nth-child(2) {
    animation-delay: 0.2s;
}
.mode-unlock-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid;
}
.mode-unlock-icon-wrap svg {
    width: 36px;
    height: 36px;
}
.mode-unlock-icon-wrap.mu-green {
    border-color: #2ecc71;
    color: #2ecc71;
    box-shadow: 0 0 20px rgba(46,204,113,0.4), inset 0 0 12px rgba(46,204,113,0.15);
}
.mode-unlock-icon-wrap.mu-blue {
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 20px rgba(0,212,255,0.4), inset 0 0 12px rgba(0,212,255,0.15);
}
.mode-unlock-icon-wrap.mu-gold {
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.4), inset 0 0 12px rgba(255,215,0,0.15);
}
.mode-unlock-label {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.mode-unlock-subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.05em;
}
@keyframes mu-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes mu-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes mu-pop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes mu-glow {
    0%, 100% { text-shadow: 0 0 24px rgba(255,215,0,0.5), 0 0 48px rgba(255,215,0,0.2); }
    50% { text-shadow: 0 0 32px rgba(255,215,0,0.7), 0 0 64px rgba(255,215,0,0.35); }
}

/* ==========================================
   WELCOME SCREEN (Mission 1 intro)
   ========================================== */
.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a0a12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    transition: opacity 0.6s ease;
}
.welcome-overlay.welcome-fade-out {
    opacity: 0;
    pointer-events: none;
}
.welcome-skip-hint {
    position: absolute; bottom: 2rem; width: 100%; text-align: center;
    color: var(--text-muted); font-size: 0.85rem; opacity: 0;
    animation: welcomeSkipFadeIn 0.5s ease 2s forwards; pointer-events: none;
}
@keyframes welcomeSkipFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.welcome-small {
    font-size: 1.3rem;
    color: rgba(255, 215, 0, 0.8);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    animation: welcomeFadeIn 1s ease 0.3s forwards;
}

.welcome-title-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffd700;
    white-space: nowrap;
    opacity: 0;
    animation:
        welcomeFadeIn 0.6s ease 0.5s forwards,
        welcomeGlow 2s ease-in 1.0s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15);
}
.welcome-title.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

/* SVG crack overlay */
.welcome-cracks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}
.welcome-cracks.hide {
    opacity: 0;
    transition: opacity 0.05s;
}

.crack-line {
    stroke: transparent;
    stroke-width: 0.5;
    fill: none;
    stroke-linecap: round;
}
.welcome-cracks.growing .crack-line {
    stroke: rgba(90, 70, 30, 0.6);
    animation: crackGrow 1.5s ease-out forwards;
}
.welcome-cracks.glowing .crack-line {
    stroke: rgba(255, 210, 60, 0.95);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 8px rgba(255, 170, 0, 0.5));
    transition: stroke 0.4s, stroke-width 0.3s, filter 0.4s;
}

/* Shard fragments */
.welcome-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    color: #ffd700;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.9),
        0 0 50px rgba(255, 215, 0, 0.5),
        0 0 80px rgba(255, 170, 0, 0.3);
    animation: shardFly 1.5s ease-out forwards;
    will-change: transform, opacity;
}

/* Light burst behind shatter */
.welcome-light-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255,255,255,0.95) 0%,
        rgba(255,230,100,0.6) 20%,
        rgba(255,215,0,0.3) 40%,
        rgba(255,170,0,0.1) 60%,
        transparent 80%);
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}
.welcome-light-burst.active {
    animation: lightBurst 1.8s ease-out forwards;
}

/* Keyframes */
@keyframes welcomeFadeIn {
    to { opacity: 1; }
}

@keyframes welcomeGlow {
    0% {
        text-shadow:
            0 0 10px rgba(255, 215, 0, 0.3),
            0 0 20px rgba(255, 215, 0, 0.15);
    }
    50% {
        text-shadow:
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 40px rgba(255, 215, 0, 0.35),
            0 0 60px rgba(255, 170, 0, 0.2);
    }
    100% {
        text-shadow:
            0 0 40px rgba(255, 215, 0, 1),
            0 0 80px rgba(255, 215, 0, 0.7),
            0 0 120px rgba(255, 170, 0, 0.5),
            0 0 180px rgba(255, 140, 0, 0.3);
    }
}

@keyframes crackGrow {
    to { stroke-dashoffset: 0; }
}

@keyframes shardFly {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--shard-tx), var(--shard-ty)) rotate(var(--shard-r));
        opacity: 0;
    }
}

@keyframes lightBurst {
    0% {
        width: 0;
        height: 0;
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    100% {
        width: 250vmax;
        height: 250vmax;
        opacity: 0;
    }
}

/* --- Screen 2: Rule screen --- */
.rule-line {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem);
    font-weight: 700;
    color: rgba(255, 215, 0, 0.85);
    text-align: center;
    padding: 0 1rem;
    margin-bottom: 0.6rem;
    opacity: 0;
    animation: welcomeFadeIn 0.8s ease 0.2s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15);
}

.rule-lose-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rule-lose {
    font-size: clamp(2.4rem, 10vw, 3.8rem);
    font-weight: 900;
    color: #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    opacity: 0;
    animation:
        welcomeFadeIn 0.6s ease 0.5s forwards,
        welcomeGlow 2s ease-in 0.8s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15);
}
.rule-lose.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.rule-lose-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2.4rem, 10vw, 3.8rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    color: #ffd700;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.9),
        0 0 50px rgba(255, 215, 0, 0.5);
    animation: shardFly 1.2s ease-out forwards;
    will-change: transform, opacity;
}

.rule-burst {
    top: 50%;
    left: 50%;
}

/* --- Screen 3: "Let's see how this works..." --- */
.letsgo-text {
    font-family: 'Georgia', 'Times New Roman', 'Palatino', serif;
    font-size: clamp(1.6rem, 6vw, 2.6rem);
    font-weight: 700;
    font-style: italic;
    color: #c0202a;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 0 1.5rem;
    line-height: 1.4;
    opacity: 0;
    animation: welcomeFadeIn 1s ease 0.2s forwards;
    text-shadow:
        0 0 15px rgba(192, 32, 42, 0.4),
        0 0 30px rgba(192, 32, 42, 0.2);
}

.letsgo-text.letsgo-fading {
    animation: letsgoFadeOut 1.5s ease forwards;
}

@keyframes letsgoFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* ==========================================
   PUZZLE INTRO SCREEN (first puzzle encounter)
   ========================================== */
.puzzle-intro-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd700;
    white-space: nowrap;
    opacity: 0;
    animation:
        welcomeFadeIn 0.5s ease 0.3s forwards,
        welcomeGlow 1.5s ease-in 0.6s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15);
}
.puzzle-intro-title.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.puzzle-intro-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: #ffd700;
    text-shadow:
        0 0 20px rgba(255, 215, 0, 0.9),
        0 0 50px rgba(255, 215, 0, 0.5),
        0 0 80px rgba(255, 170, 0, 0.3);
    animation: shardFly 1.3s ease-out forwards;
    will-change: transform, opacity;
}

/* ==========================================
   RANK INTRO SCREEN (new chapter unlocked)
   ========================================== */
.rank-intro-header {
    position: absolute;
    top: 28%;
    left: 0;
    right: 0;
    text-align: center;
    font-size: clamp(1rem, 4vw, 1.4rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    opacity: 0;
    animation: welcomeFadeIn 0.5s ease 0.2s forwards;
    z-index: 2;
}
.rank-intro-header.hide {
    opacity: 0 !important;
    transition: opacity 0.15s;
}

.rank-intro-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rank-color, #ffd700);
    white-space: nowrap;
    opacity: 0;
    animation:
        welcomeFadeIn 0.5s ease 0.3s forwards,
        welcomeGlow 1.5s ease-in 0.6s forwards;
    text-shadow:
        0 0 10px color-mix(in srgb, var(--rank-color, #ffd700) 30%, transparent),
        0 0 20px color-mix(in srgb, var(--rank-color, #ffd700) 15%, transparent);
}
.rank-intro-title.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.rank-intro-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    color: var(--rank-color, #ffd700);
    text-shadow:
        0 0 20px color-mix(in srgb, var(--rank-color, #ffd700) 90%, transparent),
        0 0 50px color-mix(in srgb, var(--rank-color, #ffd700) 50%, transparent),
        0 0 80px color-mix(in srgb, var(--rank-color, #ffd700) 30%, transparent);
    animation: shardFly 1.3s ease-out forwards;
    will-change: transform, opacity;
}

/* ==========================================
   BOSS INTRO SCREEN
   ========================================== */
.boss-intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0a0a12;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    transition: opacity 0.6s ease;
}
.boss-intro-overlay.welcome-fade-out {
    opacity: 0;
    pointer-events: none;
}

.boss-intro-content-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 90vw;
    max-width: 500px;
    min-height: 340px;
}

.boss-intro-text {
    font-size: clamp(4rem, 15vw, 7rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd700;
    white-space: nowrap;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15),
        0 0 40px rgba(255, 170, 0, 0.1);
    opacity: 0;
}
.boss-intro-text.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.boss-intro-boss {
    animation: bossSlideFromLeft 0.75s ease-out 0.75s forwards;
}

.boss-intro-battle {
    opacity: 0;
    animation: bossSlideFromRight 0.75s ease-out 2.25s forwards;
}

.boss-intro-avatar {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    opacity: 0;
    animation: bossAvatarSlideUp 1.5s ease-out 3.5s forwards;
}
.boss-intro-avatar.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.boss-intro-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.2));
    animation: shardFly 1.3s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes bossSlideFromLeft {
    0% { transform: translateX(-120vw); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes bossSlideFromRight {
    0% { transform: translateX(120vw); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes bossAvatarSlideUp {
    0% { transform: translateY(100vh); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.puzzle-intro-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 0 1.5rem;
    text-align: center;
}

.puzzle-intro-header {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    font-weight: 800;
    color: #ffd700;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: welcomeFadeIn 0.8s ease 0.2s forwards;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.2);
}

.puzzle-intro-hint {
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    max-width: 28ch;
    opacity: 0;
    animation: welcomeFadeIn 0.8s ease 0.6s forwards;
}

.puzzle-intro-star-hint {
    color: rgba(255, 215, 0, 0.7);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    animation-delay: 1.0s;
}

.puzzle-intro-btn {
    margin-top: 1rem;
    padding: 0.8rem 2.4rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0a0a12;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 0.04em;
    opacity: 0;
    animation: welcomeFadeIn 0.6s ease 1.4s forwards;
    box-shadow:
        0 0 15px rgba(255, 215, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}
.puzzle-intro-btn:active {
    transform: scale(0.96);
    box-shadow:
        0 0 8px rgba(255, 215, 0, 0.2),
        0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   DRAFT INTRO SCREEN (first draft encounter)
   ========================================== */
.draft-intro-title {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #ffd700;
    white-space: nowrap;
    opacity: 0;
    animation:
        welcomeFadeIn 0.5s ease 0.3s forwards,
        welcomeGlow 1.5s ease-in 0.6s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15);
}
.draft-intro-title.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

.draft-intro-draft {
    font-size: clamp(4rem, 15vw, 7rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffd700;
    white-space: nowrap;
    opacity: 0;
    animation: draftSlideUp 1s ease-out 2s forwards;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.15),
        0 0 40px rgba(255, 170, 0, 0.1);
}
.draft-intro-draft.hide {
    opacity: 0 !important;
    transition: opacity 0.05s;
}

@keyframes draftSlideUp {
    0% { transform: translateY(100vh); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.draft-intro-shard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 140, 0, 0.2));
    animation: shardFly 1.3s ease-out forwards;
    will-change: transform, opacity;
}

/* ==========================================
   DESKTOP
   ========================================== */
@media (min-width: 600px) {
    /* Hide install prompts on desktop */
    #pwa-install-banner,
    #btn-install-app {
        display: none !important;
    }

    /* Shrink logo on desktop so it isn't vertically distorted */
    .game-logo {
        max-width: 280px;
    }

    /* === Desktop layout: avatar next to AI name === */
    .opponent-face-center { display: none !important; }

    /* P2 panel: grid with avatar on left, info on right */
    .p2-panel {
        display: grid;
        grid-template-columns: auto auto;
        gap: 0.1rem 0.5rem;
        padding: 0.35rem 0.5rem;
    }
    .opponent-face-p2 {
        display: block !important;
        width: 110px;
        height: 110px;
        grid-column: 1;
        grid-row: 1 / span 5;
        align-self: center;
        justify-self: center;
    }
    .p2-panel .player-name,
    .p2-panel .score-dots,
    .p2-panel .special-indicator {
        grid-column: 2;
        justify-self: end;
    }

    /* Wider center column for turn info + objectives */
    .header-main-row { grid-template-columns: auto 1fr auto; }

    /* Tighten header */
    .game-header { padding: 0.25rem 0.75rem 0.15rem; gap: 0.1rem; }
    .player-panel { padding: 0.25rem 0.5rem; }
    .header-top-row { font-size: 0.6rem; }

    /* Turn row inside header: compact */
    .header-center .turn-row {
        padding: 0.1rem 0;
    }

    /* Mission indicator inside header: compact */
    .header-center .mission-indicator {
        padding: 0.1rem 0.5rem;
        margin: 0;
        max-width: none;
    }

    /* === Tighten campaign results screen === */
    .campaign-result-mission { margin-bottom: 0.25rem; }
    .campaign-result-header { font-size: 1.6rem; margin-bottom: 0.25rem; }
    .perfect-header { font-size: 2rem !important; }
    .campaign-result-flavor { margin-bottom: 0.5rem; }
    .star-reveal-container { margin-bottom: 0.5rem; }
    .star-reveal-star { font-size: 2rem; }
    .perfect .star-reveal-star.earned { font-size: 3rem; }
    .perfect .star-reveal-container { gap: 0.5rem; margin-bottom: 0.75rem; }
    .perfect-burst { width: 120px; height: 120px; margin: -1rem auto 0; }
    .bonus-reveal-container { margin-bottom: 0.5rem; }
    .bonus-reveal { padding: 0.15rem 0; font-size: 0.8rem; }
    .iq-change { margin-bottom: 0.25rem; }
    .campaign-result-actions { margin-top: 0.75rem; gap: 0.35rem; }
    .campaign-result-actions .btn { padding: 0.4rem 1.2rem; }

    /* === Tighten rest of game screen === */
    .board-area { padding: 0.75rem 1rem; }
    .status-msg { height: 1.5rem; padding: 0.25rem 1rem; font-size: 0.85rem; }
    .actions { padding: 0.25rem 1rem; }
    .keyboard { padding: 0.5rem 1rem; }
    .history-section { padding: 0.25rem 1.5rem 0.5rem; }
    .btn-quest-back { margin: 0.25rem auto 0; }
}

/* ==========================================
   LEADERBOARD
   ========================================== */
.leaderboard-my-rank {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border-radius: 8px;
    border-left: 3px solid #ffd700;
    margin-bottom: 1rem;
}
.leaderboard-my-rank .lb-rank {
    font-weight: 800;
    font-size: 1.1rem;
    color: #ffd700;
    flex-shrink: 0;
}
.leaderboard-my-rank .lb-name {
    flex: 1;
    font-weight: 600;
}
.leaderboard-my-rank .lb-stars {
    font-weight: 700;
    white-space: nowrap;
}
.leaderboard-list {
    display: flex;
    flex-direction: column;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--surface-2);
}
.lb-row-me {
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}
.lb-you {
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(255, 215, 0, 0.25);
    color: #f0c030;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.3rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.lb-pos {
    width: 2rem;
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.9rem;
}
.lb-name {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}
.lb-rank-title {
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}
.lb-stars {
    font-weight: 700;
    white-space: nowrap;
    font-size: 0.85rem;
}
.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.leaderboard-signin-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
}
.btn-google-signin {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--surface-3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
}
.btn-google-signin .btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.signin-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.btn-campaign-leaderboard {
    background: var(--surface-2);
    border: 1px solid var(--surface-3);
}

/* ===== QUICK MATCH ===== */
.btn-quickmatch {
    background: linear-gradient(135deg, #00d4ff 0%, #a855f7 100%);
    color: #fff;
    font-weight: 700;
}
.btn-quickmatch:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}
.quickmatch-searching {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 2rem 0;
}
.quickmatch-status {
    color: var(--text);
    font-size: 1.05rem;
    text-align: center;
}

/* ===== INLINE JOIN (2P menu) ===== */
.join-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-sizing: border-box;
}
.join-inline-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.join-inline-input {
    width: 72px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.25rem;
    outline: none;
    letter-spacing: 0.15em;
}
.join-inline-input:focus {
    border-color: var(--accent);
}
.join-inline-input.shake {
    animation: shake 0.4s ease;
}
.btn-inline-go {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.btn-inline-go:hover:not(:disabled) {
    filter: brightness(1.15);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ===== CHALLENGE DRAMA OVERLAY (Feature 4) ===== */
.challenge-drama-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.challenge-dimmer {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
}
.challenge-drama-overlay.active .challenge-dimmer {
    background: rgba(0, 0, 0, 0.7);
}
.challenge-banner {
    position: relative;
    z-index: 1;
    text-align: center;
    transform: scale(0.3);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.challenge-drama-overlay.active .challenge-banner {
    transform: scale(1);
    opacity: 1;
}
.challenge-drama-overlay.dismiss .challenge-banner {
    transform: scale(1.2);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.challenge-drama-overlay.dismiss .challenge-dimmer {
    background: rgba(0, 0, 0, 0);
}
.challenge-bang {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 68, 68, 0.6), 0 0 60px rgba(255, 68, 68, 0.3);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.challenge-subtext {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    opacity: 0.9;
}

/* ===== CHALLENGE OUTCOME OVERLAY (Feature 4) ===== */
.challenge-outcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.challenge-outcome-overlay.active {
    opacity: 1;
}
.challenge-outcome-overlay.dismiss {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.challenge-outcome {
    text-align: center;
    transform: scale(0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.challenge-outcome-overlay.active .challenge-outcome {
    transform: scale(1);
}
.challenge-outcome-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.challenge-outcome-text {
    font-size: 1.4rem;
    font-weight: 700;
}
/* Legacy classes kept for safety */
.challenge-outcome.success .challenge-outcome-text {
    color: var(--success);
}
.challenge-outcome.fail .challenge-outcome-text {
    color: var(--danger);
}

/* ===== CHALLENGE DEFENSE VARIANT ===== */
.challenge-banner.defense .challenge-bang {
    color: #ff9800;
    text-shadow: 0 0 30px rgba(255, 152, 0, 0.6), 0 0 60px rgba(255, 152, 0, 0.3);
}
.challenge-face {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #ff9800;
    margin: 0 auto 0.5rem;
    display: block;
    object-fit: cover;
}

/* ===== CHALLENGE OUTCOME SCENARIOS ===== */
.challenge-outcome.offense-win .challenge-outcome-text {
    color: var(--success);
}
.challenge-outcome.defense-win .challenge-outcome-text {
    color: var(--p1);
}
.challenge-outcome.offense-loss .challenge-outcome-text {
    color: var(--danger);
}
.challenge-outcome.offense-loss {
    animation: challengeShake 0.4s ease;
}
.challenge-outcome.defense-loss .challenge-outcome-text {
    color: var(--danger);
    opacity: 0.85;
}
@keyframes challengeShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}

/* ===== ROUND INSIGHT (Feature 9) ===== */
.round-insight {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text);
    text-align: left;
    line-height: 1.4;
}
.insight-icon {
    margin-right: 0.25rem;
}

/* ===== SHARE BUTTON (Feature 1) ===== */
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}
.share-btn:active {
    transform: scale(0.95);
}
.share-copied {
    color: var(--success) !important;
}

/* ===== SOUND TOGGLE (Feature 10) ===== */
.sound-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.2s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.sound-toggle-btn:hover {
    opacity: 1;
}

/* ===== STREAK DISPLAY (Feature 3) ===== */
.gauntlet-streak {
    font-size: 0.75rem;
    color: #ffa500;
    margin-top: 0.25rem;
    text-align: center;
}
.gauntlet-streak-display {
    font-size: 1.1rem;
    color: #ffa500;
    margin: 0.5rem 0;
}

/* ===== DAILY CRACK ===== */
.btn-daily-crack {
    background: var(--surface);
    color: #fff;
    font-weight: 800;
    border: 2px solid #a855f7;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 1rem 0.5rem;
}
.btn-daily-crack:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.1);
    border-color: #c084fc;
    transform: translateY(-1px);
}
.dc-btn-icon { font-size: 1.2rem; }
.dc-btn-label { font-weight: 800; }
.dc-btn-sub { font-size: 0.75rem; opacity: 0.7; font-weight: 400; }
.dc-streak {
    font-size: 0.75rem;
    color: #ffa500;
    margin-top: 0.25rem;
    text-align: center;
}

/* Daily Crack Calendar */
.dc-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    max-width: 320px;
    margin: 0 auto;
}
.dc-cal-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    opacity: 0.5;
    padding: 0.2rem 0;
}
.dc-cal-cell {
    text-align: center;
    padding: 0.25rem 0.1rem;
    border-radius: 4px;
    min-height: 2.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}
.dc-cal-empty { visibility: hidden; }
.dc-cal-today { background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.4); }
.dc-cal-day { font-size: 0.75rem; font-weight: 600; }
.dc-cal-stars { font-size: 0.55rem; letter-spacing: 0.05em; }
.dc-star-gold { color: #ffd700; }
.dc-star-silver { color: #94a3b8; }
.dc-star-miss { color: #ef4444; }
.dc-star-none { opacity: 0.2; font-size: 0.6rem; }

/* ===== FADE IN UP KEYFRAME ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
