/* Empire — dark, mobile-first party theme */

:root {
    --bg: #12101d;
    --bg-raised: #1c1930;
    --bg-inset: #0c0a14;
    --line: #2e2a4a;
    --text: #ece9f7;
    --text-dim: #9a94b8;
    --gold: #f2c14e;
    --gold-dim: #8a6d2a;
    --accent: #7c6cf2;
    --accent-press: #6353d6;
    --danger: #e4576b;
    --ok: #4ecb8f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

.shell {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

h1, h2, h3 { margin: 0; }
p { margin: 0; }

/* ---------- generic building blocks ---------- */

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card h2 { font-size: 1.05rem; letter-spacing: .02em; }

.muted { color: var(--text-dim); font-size: .9rem; }
.small { font-size: .8rem; }

.btn {
    appearance: none;
    border: none;
    border-radius: 14px;
    padding: 16px 18px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
    width: 100%;
    min-height: 54px;
    transition: transform .05s ease, background .1s ease;
    touch-action: manipulation;
}

.btn:active { transform: scale(.98); background: var(--accent-press); }
.btn:disabled { opacity: .4; cursor: default; }

.btn.gold { background: var(--gold); color: #241c05; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.btn.danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); font-weight: 600; }
.btn.slim { min-height: 44px; padding: 10px 14px; font-size: .95rem; width: auto; }

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
    color: var(--text);
    background: var(--bg-inset);
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
}

input:focus, select:focus { border-color: var(--accent); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--text-dim); }

label.toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: .95rem;
    color: var(--text);
    min-height: 44px;
}

label.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

.error-banner {
    background: rgba(228, 87, 107, .12);
    border: 1px solid var(--danger);
    color: #ffb3bf;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: .95rem;
}

/* ---------- header / room code ---------- */

.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.room-code {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: .35em;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.phase-tag {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    border: 1px solid var(--line);
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.brand {
    text-align: center;
    padding: 22px 0 6px;
}

.brand h1 { font-size: 2.4rem; letter-spacing: .12em; }
.brand .crown { font-size: 3rem; display: block; }

/* ---------- roster ---------- */

.roster { display: flex; flex-direction: column; gap: 8px; }

.roster-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-inset);
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 48px;
}

.roster-row .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex: none; }
.dot.on { background: var(--ok); }

.badge {
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    border-radius: 999px;
    padding: 3px 8px;
    flex: none;
}

.badge.dim { color: var(--text-dim); border-color: var(--line); }

.check { color: var(--ok); font-weight: 800; }

/* ---------- my word ---------- */

.my-word {
    background: var(--bg-inset);
    border: 1px dashed var(--gold-dim);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    cursor: pointer;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.my-word .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.my-word .value { font-size: 1.35rem; font-weight: 800; color: var(--gold); overflow-wrap: anywhere; }
.my-word .value.hidden-word { color: var(--text-dim); font-weight: 600; font-size: 1rem; }
.my-word.public { border-style: solid; border-color: var(--line); }
.my-word.public .value { color: var(--text); }

/* ---------- reveal screen ---------- */

.reveal-screen {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.countdown {
    text-align: center;
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.countdown-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-inset);
    overflow: hidden;
}

.countdown-bar > div {
    height: 100%;
    background: var(--gold);
    transition: width .25s linear;
}

.reveal-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    text-align: center;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    overflow: hidden;
}

.reveal-list .word {
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

/* ---------- empire map ---------- */

.empire-map { display: flex; flex-direction: column; gap: 10px; }

.empire-card {
    background: var(--bg-inset);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: merge-pop .7s ease;
}

@keyframes merge-pop {
    0% { transform: scale(1); border-color: var(--line); }
    30% { transform: scale(1.04); border-color: var(--gold); box-shadow: 0 0 22px rgba(242, 193, 78, .35); }
    100% { transform: scale(1); border-color: var(--line); }
}

.empire-card .emperor {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.05rem;
}

.empire-card .emperor .count { margin-left: auto; color: var(--text-dim); font-weight: 600; font-size: .85rem; }

.member-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    color: var(--text-dim);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: .82rem;
}

.chip .chip-word { color: var(--gold); font-weight: 700; }

.turn-banner {
    background: rgba(124, 108, 242, .14);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 12px 14px;
    text-align: center;
    font-weight: 700;
}

/* ---------- pickers / overlay ---------- */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 5, 12, .82);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.sheet {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 80dvh;
    overflow-y: auto;
}

/* ---------- victory ---------- */

.victory {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 18px;
}

.victory .crown { font-size: 4.2rem; animation: crown-drop .8s ease; }
.victory h2 { font-size: 1.8rem; color: var(--gold); }

@keyframes crown-drop {
    0% { transform: translateY(-40px) scale(.5); opacity: 0; }
    60% { transform: translateY(6px) scale(1.08); opacity: 1; }
    100% { transform: translateY(0) scale(1); }
}

.history { display: flex; flex-direction: column; gap: 6px; text-align: left; }

.history-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
    background: var(--bg-inset);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: .92rem;
}

.history-row .num { color: var(--text-dim); font-size: .78rem; min-width: 1.4em; }

.actions-row { display: flex; gap: 10px; }
.actions-row .btn { flex: 1; }

.center { text-align: center; }
.spacer { flex: 1; }

.count-big {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

/* Blazor error UI — keep it unobtrusive but visible */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    padding: 10px 16px;
    font-size: .9rem;
    z-index: 100;
    text-align: center;
}
