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

:root {
    /* Pulled from logo.png — dark navy brand with gold accent */
    --bg:        #0b1422;
    --panel:     #101d30;
    --card:      #162338;
    --border:    #1f3350;
    --accent:    #c9a84c;   /* warm gold  */
    --accent2:   #4a8fd4;   /* sky blue   */
    --green:     #4dbb7e;
    --red:       #e05c6b;
    --yellow:    #c9a84c;
    --text:      #6a8daf;
    --text-bold: #bdd4ec;
    --radius:    12px;
}

html { font-size: 16px; }

body {
    background: var(--bg);
    color: var(--text-bold);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

/* ── HEADER ───────────────────────────────────────────────────── */
.site-header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.4);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 960px;
    margin: 0 auto;
}

.site-logo {
    height: 46px;
    width: auto;
    /* invert dark navy logo to white for dark background */
    filter: brightness(0) invert(1);
    opacity: 0.92;
    flex-shrink: 0;
}

.header-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
    flex-shrink: 0;
}

.header-text { display: flex; flex-direction: column; gap: 1px; }

.header-text h1 {
    font-size: clamp(1rem, 3.5vw, 1.25rem);
    color: var(--accent);
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.site-sub {
    color: var(--text);
    font-size: 0.76rem;
}

/* ── LAYOUT ───────────────────────────────────────────────────── */
.layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 14px 32px;
    gap: 20px;
}

@media (min-width: 700px) {
    .layout {
        flex-direction: row;
        align-items: flex-start;
        padding: 28px 24px 40px;
        gap: 28px;
    }
    .wheel-section   { flex: 0 0 auto; width: 420px; }
    .controls-section { flex: 1; min-width: 0; }
}

/* ── WHEEL SECTION ────────────────────────────────────────────── */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.wheel-wrap {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1;
    position: relative;
}

#wheel {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    filter: drop-shadow(0 8px 32px rgba(0,0,0,0.6));
    transition: filter 0.2s;
}

#wheel:hover  { filter: drop-shadow(0 8px 40px rgba(201,168,76,0.2)); }
#wheel:active { transform: scale(0.99); }

/* ── SPIN BUTTON ──────────────────────────────────────────────── */
.spin-row { width: 100%; max-width: 420px; }

.btn-spin {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: #0b1422;
    border: none;
    border-radius: var(--radius);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(201,168,76,0.3);
}

.btn-spin:hover {
    background: #d9b85a;
    box-shadow: 0 4px 28px rgba(201,168,76,0.45);
}
.btn-spin:active { transform: scale(0.97); }
.btn-spin:disabled {
    background: var(--border);
    color: var(--text);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── WINNER BANNER ────────────────────────────────────────────── */
.winner-banner {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #c9a84c, #e8c96a);
    color: #0b1422;
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: pop-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 24px rgba(201,168,76,0.4);
}

.winner-banner.hidden { display: none; }

.winner-label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.65;
    flex-shrink: 0;
}

.winner-name {
    font-size: 1.1rem;
    font-weight: 900;
    flex: 1;
    word-break: break-word;
}

.btn-dismiss {
    background: rgba(0,0,0,0.15);
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    color: #0b1422;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pop-in {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── CONTROLS ─────────────────────────────────────────────────── */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.card-title {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

/* ── INPUT ────────────────────────────────────────────────────── */
.input-row { display: flex; gap: 8px; }

.name-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-bold);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
}

.name-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

.name-input::placeholder { color: var(--text); opacity: 0.5; }

.btn { cursor: pointer; border: none; border-radius: 8px; font-weight: 700; transition: opacity 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.96); }

.btn-add {
    padding: 10px 18px;
    background: var(--green);
    color: #0b1422;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.btn-add:hover { opacity: 0.85; }

/* ── NAMES LIST ───────────────────────────────────────────────── */
.names-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.names-header .card-title { margin-bottom: 0; }

.btn-link {
    background: none;
    border: none;
    color: var(--red);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn-link:hover { opacity: 0.75; }

.names-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 2px;
}

.names-list::-webkit-scrollbar { width: 4px; }
.names-list::-webkit-scrollbar-track { background: transparent; }
.names-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.names-empty {
    color: var(--text);
    font-size: 0.85rem;
    padding: 8px 0;
    font-style: italic;
}

.name-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    animation: slide-in 0.2s ease;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.name-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.name-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-bold);
    word-break: break-word;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.btn-remove:hover { color: var(--red); }

/* ── OPTIONS ──────────────────────────────────────────────────── */
.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.option-row + .option-row {
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 12px;
}

.opt-label {
    font-size: 0.88rem;
    color: var(--text);
}

/* ── TOGGLE ───────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── TABS ─────────────────────────────────────────────────── */
.header-inner { flex-wrap: wrap; }

.tab-nav {
    display: flex;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
    font-family: inherit;
}
.tab-btn:hover  { border-color: var(--accent); color: var(--accent); }
.tab-btn.active { background: var(--accent); border-color: var(--accent); color: #0b1422; }

.tab-content        { display: none; }
.tab-content.active { display: flex; }

/* ── SHARED GAME LAYOUT ───────────────────────────────────── */
.layout-center { flex-direction: column; align-items: center; }

@media (min-width: 700px) {
    .layout-center { flex-direction: column; }
}

.game-section {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.game-card-header .card-title { margin-bottom: 0; }

/* ── DICE ROLLER ──────────────────────────────────────────── */
.dice-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-die {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 18px;
    color: var(--text-bold);
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    letter-spacing: 0.04em;
}
.btn-die:hover  { border-color: var(--accent); color: var(--accent); }
.btn-die:active { transform: scale(0.95); }

.dice-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    align-items: center;
}

.tray-empty {
    color: var(--text);
    font-size: 0.85rem;
    font-style: italic;
}

.die-chip {
    background: var(--accent);
    color: #0b1422;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.82rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.15s, transform 0.1s;
}
.die-chip:hover  { opacity: 0.75; }
.die-chip:active { transform: scale(0.93); }

.dice-results {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.die-result {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    min-width: 58px;
}
.die-result-label {
    font-size: 0.68rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.die-result-value {
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--accent);
    line-height: 1.15;
}

.dice-total {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bold);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ── COIN FLIP ────────────────────────────────────────────── */
.coin-scene {
    perspective: 600px;
    display: flex;
    justify-content: center;
    padding: 20px 0 8px;
}

.coin {
    width: 140px;
    height: 140px;
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
}

.coin-face {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 900;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 4px solid rgba(0,0,0,0.15);
    user-select: none;
}
.coin-face::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.28) 0%, transparent 55%);
    pointer-events: none;
}

.coin-heads {
    background: radial-gradient(circle at 40% 38%, #f0d875, #c9a84c, #9a7820);
    color: rgba(0,0,0,0.45);
}
.coin-tails {
    background: radial-gradient(circle at 40% 38%, #7ab8f0, #4a8fd4, #2860a8);
    color: rgba(0,0,0,0.45);
    transform: rotateY(180deg);
}

.coin-result {
    font-size: 1.8rem;
    font-weight: 900;
    text-align: center;
    padding: 4px 0 8px;
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.coin-result.hidden { display: none; }

.coin-stats { width: 100%; }

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
}
.stat-row + .stat-row { border-top: 1px solid var(--border); }

.stat-label { font-size: 0.88rem; color: var(--text); }
.stat-value { font-size: 1.1rem; font-weight: 800; color: var(--text-bold); }
.stat-gold  { color: var(--accent); }
.stat-blue  { color: var(--accent2); }

/* ── RANDOM NUMBER ────────────────────────────────────────── */
.number-display-wrap {
    display: flex;
    justify-content: center;
    padding: 12px 0;
}

.number-display {
    font-size: clamp(4.5rem, 18vw, 8rem);
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
    letter-spacing: -0.02em;
    text-shadow: 0 0 48px rgba(201,168,76,0.28);
}

.number-display.pop { animation: pop-in 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

.range-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.range-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.range-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.range-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-bold);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}
.range-input::-webkit-inner-spin-button,
.range-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.range-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,168,76,0.12); }

.range-sep {
    color: var(--text);
    font-size: 1.3rem;
    font-weight: 300;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.num-history {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.num-history-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bold);
    animation: slide-in 0.2s ease;
}
