/* === The Void Between - Core Styles === */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    /* Domain Colors */
    --void-color: #6b21a8;
    --void-glow: #a855f7;
    --blood-color: #7f1d1d;
    --blood-glow: #dc2626;
    --shadow-color: #1f2937;
    --shadow-glow: #6b7280;
    --body-color: #b45309;
    --body-glow: #f59e0b;
    --will-color: #6d28d9;
    --will-glow: #c4b5fd;

    /* UI Colors */
    --bg-darkest: #0a0a0f;
    --bg-dark: #12121a;
    --bg-medium: #1a1a2e;
    --bg-light: #242440;
    --text-primary: #e2e0e7;
    --text-secondary: #9895a5;
    --text-dim: #5a5770;
    --accent: #7c3aed;
    --accent-glow: #a78bfa;
    --health-color: #dc2626;
    --sanity-color: #8b5cf6;
    --essence-color: #f59e0b;
    --border-subtle: #2a2a3e;
    --border-glow: rgba(124, 58, 237, 0.3);

    /* Card sizing: scales with the window. Board cards get whatever height is
       left after the fixed rows (~360px) and the hand. */
    --hand-card-w: clamp(110px, min(11vw, 17vh), 210px);
    --hand-card-h: calc(var(--hand-card-w) * 1.42);
    --board-card-h: clamp(130px, calc((100vh - 360px - var(--hand-card-h)) / 2), 260px);
    --board-card-w: calc(var(--board-card-h) / 1.4);
}

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

body {
    font-family: 'Crimson Text', Georgia, serif;
    background-color: var(--bg-darkest);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
}

h1, h2, h3, .player-name, .action-btn, #current-phase {
    font-family: 'Cinzel', serif;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Player Info Bars */
.player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-subtle);
}

#player-area .player-info {
    border-bottom: none;
    border-top: 1px solid var(--border-subtle);
}

.player-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.player-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 600;
}

.stat-icon {
    font-size: 1.2rem;
}

.stat.health .stat-icon { color: var(--health-color); }
.stat.sanity .stat-icon { color: var(--sanity-color); }
.stat.essence-count .stat-icon { color: var(--essence-color); }
.stat.madness .stat-icon { color: var(--void-glow); }

/* HP and Sanity bars */
.stat-bar {
    position: relative;
    width: clamp(90px, 11vw, 170px);
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.stat-bar > div {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
}

/* After a loss, the trail lingers briefly so you can see how much was lost */
.bar-trail {
    background: rgba(254, 243, 199, 0.75);
    transition: width 0.7s ease-in 0.6s;
}

.bar-fill {
    transition: width 0.35s ease-out;
    box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.3), inset 0 2px 2px rgba(255, 255, 255, 0.2);
}

.stat.health .bar-fill {
    background: linear-gradient(90deg, #7f1d1d, #dc2626 60%, #f87171);
}

.stat.sanity .bar-fill {
    background: linear-gradient(90deg, #4c1d95, #7c3aed 60%, #c4b5fd);
}

/* Madness creeps in from the left over the Sanity bar; the mind breaks when it reaches the fill's end */
.bar-madness {
    z-index: 1;
    background: repeating-linear-gradient(135deg, rgba(190, 24, 93, 0.95) 0 5px, rgba(76, 5, 25, 0.95) 5px 10px);
    border-right: 2px solid #f9a8d4;
    transition: width 0.35s ease-out;
}

.bar-madness[style*="width: 0%"] {
    border-right: none;
}

/* Running low: a colored rim on the bar fades in and out (opacity only, so no repainting) */
.stat-bar.low::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px #f87171, inset 0 0 6px rgba(248, 113, 113, 0.8);
    animation: glow-breathe 1.2s ease-in-out infinite;
}

.stat.sanity .stat-bar.low::after {
    box-shadow: inset 0 0 0 1px #c084fc, inset 0 0 6px rgba(192, 132, 252, 0.8);
}

/* Players who ask their system for less motion get no endless pulsing */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-iteration-count: 1 !important; }
}

/* Lucid / Unhinged label beside Madness */
.mind-state {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid;
}

.mind-state.lucid {
    color: var(--will-glow);
    border-color: var(--will-color);
}

.mind-state.uneasy {
    color: #a09cb0;
    border-color: #4a4860;
}

.mind-state.unhinged {
    color: #fca5a5;
    border-color: var(--health-color);
    background: rgba(220, 38, 38, 0.15);
    position: relative;
}

.mind-state.unhinged::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.6);
    animation: glow-breathe 1.6s ease-in-out infinite;
}

/* Embrace choice */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 115; /* above the ending screen (100) and deck builder (105) */
}

.modal {
    width: 360px;
    padding: 20px 24px;
    background: var(--bg-dark);
    border: 1px solid var(--accent);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.35);
}

.modal-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-text {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.modal-note {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.action-btn.embrace-btn {
    border-color: var(--health-color);
}

.action-btn.embrace-btn:hover:not(:disabled) {
    background: var(--blood-color);
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}

.action-btn.subtle-btn {
    border-color: var(--border-subtle);
    margin-left: auto;
}

/* "Don't ask again" checkbox in dialogs */
.modal-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    cursor: pointer;
}

.modal-checkbox input {
    accent-color: var(--accent);
}

/* Essence payment dialog */
.payment-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.payment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-left: 3px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
}

.payment-row.domain-body { border-left-color: var(--body-glow); }
.payment-row.domain-will { border-left-color: var(--will-glow); }
.payment-row.domain-void { border-left-color: var(--void-glow); }
.payment-row.domain-blood { border-left-color: var(--blood-glow); }
.payment-row.domain-shadow { border-left-color: #9ca3af; }

.payment-domain {
    flex: 1;
    font-weight: 600;
}

.payment-step {
    width: 26px;
    height: 26px;
    background: var(--bg-medium);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.payment-step:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.payment-count {
    min-width: 18px;
    text-align: center;
    font-weight: 700;
}

.payment-left {
    min-width: 72px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* === End-of-game splash === */
.ending-overlay {
    --ending-color: var(--accent-glow);
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-darkest);
    background-size: cover;
    background-position: center;
    animation: ending-in 1.2s ease-out;
}

/* Placeholder backgrounds until splash art exists (art replaces these via background-image) */
.ending-overlay.ending-body { --ending-color: #f59e0b; background-image: radial-gradient(ellipse at 50% 40%, rgba(185, 28, 28, 0.45), transparent 65%); }
.ending-overlay.ending-mind { --ending-color: #c4b5fd; background-image: radial-gradient(ellipse at 50% 40%, rgba(109, 40, 217, 0.5), transparent 65%); }
.ending-overlay.ending-madness { --ending-color: #f9a8d4; background-image: radial-gradient(ellipse at 50% 40%, rgba(157, 23, 77, 0.5), rgba(76, 29, 149, 0.25) 45%, transparent 70%); }
.ending-overlay.ending-deckout { --ending-color: #d1d5db; background-image: radial-gradient(ellipse at 50% 40%, rgba(75, 85, 99, 0.45), transparent 65%); }
.ending-overlay.ending-defeat { --ending-color: #f87171; }

/* With splash art, keep the image's subject (upper area) clear: a compact panel
   over a dark fade at the bottom */
.ending-overlay.has-art {
    align-items: flex-end;
    padding-bottom: 4vh;
}

.ending-overlay.has-art::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgba(5, 5, 10, 0.85) 85%);
    pointer-events: none;
}

.ending-overlay.has-art .ending-panel {
    position: relative;
    max-width: 760px;
    padding: 14px 28px;
    background: rgba(10, 10, 15, 0.55);
}

.ending-overlay.has-art .ending-title {
    font-size: 2rem;
    margin: 2px 0 6px;
}

.ending-overlay.has-art .ending-text {
    font-size: 1rem;
    margin-bottom: 10px;
}

.ending-overlay.has-art .ending-stats {
    font-size: 0.8rem;
}

.ending-overlay.has-art .ending-turns {
    margin-bottom: 10px;
}

.ending-overlay.has-art .action-btn.ending-again {
    padding: 8px 24px;
}

@keyframes ending-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ending-panel {
    max-width: 560px;
    padding: 32px 40px;
    text-align: center;
    background: rgba(10, 10, 15, 0.78);
    border: 1px solid color-mix(in srgb, var(--ending-color) 45%, transparent);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    animation: ending-rise 1.4s ease-out;
}

@keyframes ending-rise {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
}

.ending-glyph {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--ending-color);
    text-shadow: 0 0 30px var(--ending-color);
}

.ending-kicker {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.ending-title {
    font-family: 'Cinzel', serif;
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--ending-color);
    margin: 6px 0 12px;
    text-shadow: 0 0 24px color-mix(in srgb, var(--ending-color) 50%, transparent);
}

.ending-text {
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.ending-stats {
    display: inline-grid;
    gap: 2px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.ending-stats-row {
    display: grid;
    grid-template-columns: 130px repeat(3, 70px);
    text-align: center;
}

.ending-stats-row:first-child {
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.ending-stats-row span:first-child {
    text-align: left;
    color: var(--text-secondary);
}

.ending-turns {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.action-btn.ending-again {
    font-size: 1rem;
    padding: 12px 30px;
}

.stat-value {
    min-width: 24px;
    text-align: center;
}

/* Right edge of the battlefield: cast queue on top, action buttons below */
#side-panel {
    position: absolute;
    top: 10px;
    bottom: 10px;
    right: 20px;
    width: 190px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

#cast-queue {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--border-subtle);
    padding: 8px;
}

.queue-heading {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 8px 0 4px;
}

.queue-heading:first-child {
    margin-top: 0;
}

.queue-empty {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-dim);
}

.cast-entry {
    --entry-color: var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    margin-bottom: 4px;
    border-left: 3px solid var(--entry-color);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
    line-height: 1.2;
}

.cast-entry.domain-void { --entry-color: var(--void-glow); }
.cast-entry.domain-blood { --entry-color: var(--blood-glow); }
.cast-entry.domain-shadow { --entry-color: #9ca3af; }
.cast-entry.domain-body { --entry-color: var(--body-glow); }
.cast-entry.domain-will { --entry-color: var(--will-glow); }

.cast-entry.last-turn {
    opacity: 0.5;
}

.cast-entry.embraced {
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.6);
}

.cast-entry.fresh {
    animation: queue-in 0.4s ease-out;
}

@keyframes queue-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: none; }
}

.cast-entry-name {
    flex: 1;
    min-width: 0;
}

.cast-entry-note {
    display: block;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* A card being cast: pops up in the middle of the battlefield, then fades */
#cast-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
}

#cast-flash.show {
    animation: cast-flash 1.3s ease-out forwards;
}

@keyframes cast-flash {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
    25%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

#cast-flash .card.card-large {
    --card-w: 190px;
}

.flash-caption {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--will-glow);
    text-shadow: 0 0 8px #000, 0 0 16px #000;
}

#cast-flash.opponent .flash-caption {
    color: #fca5a5;
}

#action-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--bg-medium);
    color: var(--text-primary);
    border: 1px solid var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--accent);
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--border-subtle);
}

.action-btn:disabled:hover {
    background: var(--bg-medium);
    box-shadow: none;
}

/* Game Log: left edge of the battlefield, clear of the hand */
#game-log {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    width: 210px;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid var(--border-subtle);
    padding: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
    z-index: 10;
}

#game-log { cursor: pointer; }

/* Card names in the log: hover or tap to see the card */
.log-card { color: #c4b5fd; text-decoration: underline dotted rgba(196, 181, 253, 0.5); text-underline-offset: 2px; cursor: help; }
.log-modal-list .log-card { cursor: pointer; }

/* The full battle log (UI.showLog) */
.log-modal-list {
    width: min(560px, 85vw);
    max-height: 60vh;
    overflow-y: auto;
    margin: 10px 0;
    padding: 8px 12px;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid var(--border-subtle);
}

#game-log::-webkit-scrollbar {
    width: 4px;
}

#game-log::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
}

.log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(42, 42, 62, 0.3);
}

.log-entry:last-child {
    border-bottom: none;
}

/* Phase Indicator */
#phase-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 6px;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
}

#current-phase {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-glow);
}

#phase-hint {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--text-secondary);
}

#turn-counter {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darkest);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
}

/* Animations */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fade-in 0.3s ease forwards;
}

/* Going second: choose a card to put on the bottom of the deck */
.modal:has(.bottom-choice) { width: auto; max-width: 95vw; max-height: 92vh; overflow-y: auto; }
.bottom-choice { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 12px 0; padding-top: 8px; }
.bottom-choice .card { --card-w: min(120px, 14vw); }
.bottom-choice-card { cursor: pointer; transition: transform 0.15s; }
.bottom-choice-card:hover { transform: translateY(-4px); }
.bottom-choice-card.selected { outline: 3px solid #d4a843; outline-offset: 2px; transform: translateY(-6px); }

/* Coin flip before the game */
.coin-overlay {
    position: fixed; inset: 0; z-index: 1000; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
    background: rgba(5, 3, 12, 0.85); perspective: 900px;
}
.coin-overlay.has-backdrop { background: #05030c; }
.coin-backdrop { position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: 0.55; }
.coin { width: 150px; height: 150px; position: relative; transform-style: preserve-3d; }
.coin.lands-seeker { animation: coin-spin-seeker 1.6s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.coin.lands-unknown { animation: coin-spin-unknown 1.6s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.coin-face {
    position: absolute; inset: 0; border-radius: 50%; backface-visibility: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-family: 'Cinzel', serif; border: 4px solid #d4a843;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 24px rgba(212, 168, 67, 0.35);
}
.coin-seeker { background: radial-gradient(circle at 35% 30%, #f6e3a1, #b8862b 70%); color: #3a2608; }
.coin-unknown { background: radial-gradient(circle at 35% 30%, #8b5cf6, #2e1065 70%); color: #ede9fe; transform: rotateY(180deg); }
.coin-symbol { font-size: 56px; line-height: 1; }
.coin-name { font-size: 15px; font-weight: 700; margin-top: 6px; }
.coin-result {
    font-family: 'Cinzel', serif; font-size: 1.3rem; color: #f3e8ff; text-align: center; max-width: 520px;
    opacity: 0; transform: translateY(8px); transition: opacity 0.4s, transform 0.4s;
}
.coin-overlay.show-result .coin-result { opacity: 1; transform: none; }
@keyframes coin-spin-seeker {
    0% { transform: translateY(0) rotateY(0); }
    40% { transform: translateY(-90px) rotateY(1080deg); }
    100% { transform: translateY(0) rotateY(1800deg); }
}
@keyframes coin-spin-unknown {
    0% { transform: translateY(0) rotateY(0); }
    40% { transform: translateY(-90px) rotateY(1080deg); }
    100% { transform: translateY(0) rotateY(1980deg); }
}

/* Splash screen: first game of a session, and "Switch Players" */
/* Hot-seat hand-over: fully opaque, so the next player can't see the last one's hand */
.handoff-overlay {
    position: fixed; inset: 0; z-index: 950;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #1e1236 0%, #07050d 75%);
}
.handoff-panel { width: min(480px, 92vw); text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.handoff-title { font-family: 'Cinzel', serif; font-size: clamp(1.6rem, 5vw, 2.4rem); color: #f3e8ff; }
.handoff-text { color: #c4b5fd; }
.splash-overlay {
    position: fixed; inset: 0; z-index: 900; overflow-y: auto;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at center, #1e1236 0%, #07050d 75%);
}
.splash-panel { width: min(520px, 92vw); padding: 32px 0; text-align: center; }
.splash-title {
    font-family: 'Cinzel', serif; font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700;
    color: #f3e8ff; letter-spacing: 0.06em; text-shadow: 0 0 24px rgba(167, 139, 250, 0.6);
}
.splash-tagline { color: #a09cb0; font-style: italic; margin: 8px 0 26px; }
.splash-players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.splash-player {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; cursor: pointer;
    background: var(--bg-medium); color: var(--text-primary); border: 1px solid #333;
    border-radius: 6px; font: inherit;
}
.splash-player:hover { border-color: var(--accent-glow); }
.splash-player.selected { border-color: var(--accent-glow); box-shadow: 0 0 14px rgba(124, 58, 237, 0.5); }
.splash-player .portrait { width: 44px; height: 44px; }
.splash-player-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.splash-player-name { font-family: 'Cinzel', serif; font-weight: 700; }
.splash-player-record { font-size: 0.8rem; color: #a09cb0; }
.splash-player-guest { font-size: 0.72rem; color: #f59e0b; }
.splash-account {
    text-align: left; margin-bottom: 22px; padding: 12px 14px; font-size: 0.85rem;
    background: rgba(26, 26, 46, 0.7); border: 1px solid #333; border-radius: 6px;
}
.splash-account-status { font-weight: 700; margin-bottom: 6px; }
.splash-account-prompt { margin-bottom: 8px; }
.splash-account-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.provider-buttons { display: contents; }
.splash-account-row input { flex: 1; }
.splash-account-notes { margin: 6px 0 0; padding-left: 18px; color: #a09cb0; font-size: 0.78rem; }
.splash-account-notes li { margin: 3px 0; }
.splash-new { align-self: center; }
.splash-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.splash-start { font-size: 1.2rem; padding: 12px 40px; }
/* Play as: Seeker / Unknown */
.splash-side { display: flex; align-items: center; gap: 8px; }
.splash-side-label { font-size: 0.8rem; color: #a09cb0; }
.splash-side-btn { opacity: 0.6; }
.splash-side-btn.selected { opacity: 1; border-color: var(--accent-glow); box-shadow: 0 0 10px rgba(124, 58, 237, 0.5); }
.splash-hint { margin-top: 14px; font-size: 0.75rem; color: #a09cb0; }
.profile-stat { font-size: 0.85rem; margin: 4px 0; }
/* Recent games: a Won / Lost tag, then the details */
.match-mark { display: inline-block; min-width: 3.2em; font-weight: 700; }
.match-won .match-mark { color: #86efac; }
.match-lost .match-mark { color: #fca5a5; }

/* Table mood (music.js): glows that fade in by opacity only, behind everything */
#mood-layer { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
/* Always its own GPU layer, so a mood fading in doesn't force the whole board to be redrawn */
#mood-layer .mood { position: absolute; inset: 0; opacity: 0; transition: opacity 3s ease; will-change: opacity; }
#mood-layer .mood.on { opacity: 1; }

/* The Unknown is close to losing. Body: warm gold rises from the Seeker's side.
   Mind: pale silver light. Both: gold below, silver above. */
#mood-layer .mood-seeker-body {
    background: radial-gradient(ellipse at 50% 110%, rgba(245, 190, 80, 0.3) 0%, transparent 60%);
}
#mood-layer .mood-seeker-mind {
    background:
        radial-gradient(ellipse at 50% 110%, rgba(190, 215, 255, 0.22) 0%, transparent 60%),
        radial-gradient(ellipse at 50% -10%, rgba(200, 220, 255, 0.14) 0%, transparent 55%);
}
#mood-layer .mood-seeker-both {
    background:
        radial-gradient(ellipse at 50% 110%, rgba(245, 190, 80, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at 50% -10%, rgba(200, 220, 255, 0.16) 0%, transparent 55%);
}

/* The Seeker is close to losing. Body: blood red bleeds down from the horror's side.
   Mind: a violet haze closes in from the edges. Both: red above, violet at the edges. */
#mood-layer .mood-void-body {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(170, 20, 35, 0.4) 0%, transparent 60%),
        radial-gradient(ellipse at center, transparent 55%, rgba(50, 0, 10, 0.6) 100%);
}
#mood-layer .mood-void-mind {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(110, 40, 180, 0.3) 0%, transparent 60%),
        radial-gradient(ellipse at center, transparent 40%, rgba(35, 0, 55, 0.8) 100%);
}
#mood-layer .mood-void-both {
    background:
        radial-gradient(ellipse at 50% -10%, rgba(170, 20, 35, 0.4) 0%, transparent 60%),
        radial-gradient(ellipse at center, transparent 40%, rgba(40, 0, 50, 0.8) 100%);
}

/* Reduce effects (a setting): no endless animations, no table glow, no combat effects */
body.reduce-effects #mood-layer { display: none; }
body.reduce-effects .fx-effect,
body.reduce-effects #fx-vignette { display: none !important; }
/* Combat jolts: shaking the whole screen redraws every card, so it goes too */
body.reduce-effects #game-container.fx-screen-shake,
body.reduce-effects .card.fx-card-hit,
body.reduce-effects .stat.fx-stat-hit,
body.reduce-effects .stat.fx-stat-heal,
body.reduce-effects .relic-medallion.fx-relic-fire .relic-medallion-art { animation: none !important; }
body.reduce-effects *, body.reduce-effects *::before, body.reduce-effects *::after {
    animation-iteration-count: 1 !important;
}
body.reduce-effects .relic-medallion-art::after,
body.reduce-effects .stat-bar.low::after,
body.reduce-effects .mind-state.unhinged::after,
body.reduce-effects .card.target-valid::after,
body.reduce-effects .card.block-target::after { animation: none !important; opacity: 0.6; }

/* Music on/off, always reachable (above the splash and coin flip) */
.corner-tools {
    position: fixed; right: 14px; bottom: 14px; z-index: 1100;
    display: flex; align-items: center; gap: 8px;
}
.corner-btn {
    height: 34px; padding: 0 12px; border-radius: 17px; cursor: pointer;
    font-family: 'Cinzel', serif; font-size: 0.75rem; font-weight: 700;
    background: rgba(18, 18, 26, 0.85); color: #e2e0e7; border: 1px solid var(--accent);
}
.corner-btn:hover { border-color: var(--accent-glow); }
.music-toggle {
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1;
    background: rgba(18, 18, 26, 0.85); color: #e2e0e7; border: 1px solid var(--accent);
}
.music-toggle:hover { border-color: var(--accent-glow); }
.music-toggle.muted { color: #6b6880; border-color: #3a3a4a; }
/* Music volume, beside the music button */
.music-volume {
    width: 90px; height: 34px; padding: 0 10px; cursor: pointer;
    border-radius: 17px; border: 1px solid var(--accent);
    background: rgba(18, 18, 26, 0.85);
    accent-color: var(--accent-glow);
}
.music-volume.muted { opacity: 0.5; border-color: #3a3a4a; }

/* How to Play and Card Gallery windows (help.js): over the menu or the running game */
.help-overlay {
    position: fixed; inset: 0; z-index: 1050;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5, 3, 12, 0.72);
}
.help-panel {
    width: min(1100px, 94vw); max-height: 90vh; display: flex; flex-direction: column;
    background: var(--bg-dark); border: 1px solid var(--accent); border-radius: 8px;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.35);
}
.help-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #2a2a3e; }
.help-title { font-family: 'Cinzel', serif; font-size: 1.3rem; font-weight: 700; }
.help-running {
    padding: 8px 20px; font-size: 0.85rem; color: #fcd34d;
    background: rgba(245, 158, 11, 0.12); border-bottom: 1px solid rgba(245, 158, 11, 0.35);
}
.help-body { overflow-y: auto; padding: 16px 22px 22px; }
.help-rules { max-width: 760px; margin: 0 auto; line-height: 1.5; }
.help-rules h3 { font-family: 'Cinzel', serif; color: var(--accent-glow); margin: 18px 0 6px; }
.help-rules h3:first-child { margin-top: 0; }
.help-rules ul, .help-rules ol { padding-left: 22px; margin: 4px 0; }
.help-rules li { margin: 3px 0; }
.help-rules td { padding: 3px 14px 3px 0; vertical-align: top; }
body.help-open #card-preview { display: none !important; }

.gallery { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.gallery-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.gallery-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-chip {
    padding: 4px 10px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 0.8rem;
    background: var(--bg-medium); color: var(--text-primary); border: 1px solid #333;
}
.gallery-chip.active { border-color: var(--accent-glow); background: rgba(124, 58, 237, 0.25); }
.gallery-search { width: 200px; }
.gallery-count { font-size: 0.8rem; color: #a09cb0; margin-left: auto; }
.gallery-main { display: flex; gap: 16px; min-height: 0; flex: 1; }
.gallery-grid {
    flex: 1; overflow-y: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px;
    padding: 4px; --hand-card-w: 120px;
}
.gallery-detail { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: center; }
@media (max-width: 760px) { .gallery-detail { display: none; } }
.splash-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Dialogs opened from the splash (Hot-seat, Play Online, Rejoin) go above it */
.splash-overlay ~ .modal-overlay { z-index: 960; }

/* AI difficulty dropdowns (AI.levelSelect: start screen, battle settings, Players screen) */
.ai-level-select {
    background: var(--bg-dark); color: #e9e3f5; border: 1px solid var(--border-subtle);
    border-radius: 4px; padding: 3px 6px; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.ai-level-select:hover, .ai-level-select:focus { border-color: #7c3aed; outline: none; }
.splash-level { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }

/* ===== Online PvP (online-ui.js) ===== */
.online-choices { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 8px 0 14px; }
.online-or { color: var(--text-secondary); font-style: italic; }
.online-join { display: flex; gap: 8px; }
.online-code-input { width: 7.5em; text-align: center; letter-spacing: 0.25em; text-transform: uppercase; }
.online-code { text-align: center; margin: 6px 0 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.online-code-label { font-size: 0.8rem; color: var(--text-secondary); }
.online-code-value { font-family: 'Cinzel', serif; font-size: 2rem; letter-spacing: 0.3em; color: #f3e8ff; user-select: all; }
.online-status { min-height: 1.3em; text-align: center; color: #c4b5fd; margin-bottom: 8px; }
.online-status.online-error { color: #fca5a5; }
.online-banner {
    position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 980;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
    max-width: 92vw; padding: 8px 16px; border-radius: 8px;
    background: rgba(20, 12, 36, 0.95); border: 1px solid #7c3aed; color: #f3e8ff;
}
#turn-timer { font-variant-numeric: tabular-nums; color: #c4b5fd; }
#turn-timer.urgent { color: #fca5a5; font-weight: 700; }
