/* =====================================================================
   style.css — global UI: login/lobby cards, HUD, cursors, banners and
   the ending. Colours + fonts come from theme.css.
   ===================================================================== */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--night);
    color: var(--papyrus);
    font-family: var(--ui-font);
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

#game-container {
    position: fixed;
    inset: 0;
}
#game-container canvas { display: block; touch-action: none; }

/* ── Login / lobby / code cards ─────────────────────────────────── */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    background:
        radial-gradient(ellipse at center, rgba(18, 12, 7, 0.35), rgba(18, 12, 7, 0.9)),
        url('../assets/tx/e8d3432a9334.webp') center / cover no-repeat,
        var(--night);
}

.auth-card {
    position: relative;
    width: min(480px, 100%);
    margin: auto;
    padding: 36px 40px 32px;
    text-align: center;
    color: var(--ink);
    background:
        linear-gradient(rgba(241, 227, 194, 0.94), rgba(229, 209, 166, 0.96));
    border: 1px solid var(--papyrus-dark);
    border-radius: 6px;
    box-shadow: var(--shadow-deep), inset 0 0 60px rgba(120, 80, 30, 0.25);
}
.auth-card-wide { width: min(640px, 100%); }
.auth-card::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(90, 68, 36, 0.35);
    border-radius: 3px;
    pointer-events: none;
}

.auth-title {
    margin: 0 0 18px;
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--ink-soft);
    line-height: 1.3;
}
.auth-title span {
    display: block;
    font-family: var(--title-font);
    font-size: clamp(30px, 7vw, 44px);
    letter-spacing: 1px;
    color: var(--blood);
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.35);
}
.auth-title-small { font-size: 22px; color: var(--blood); }

.auth-subtitle {
    margin: 22px 0 10px;
    font-family: var(--heading-font);
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.auth-optional { font-family: var(--ui-font); text-transform: none; letter-spacing: 0; opacity: 0.7; }

.auth-body {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
}
.auth-body-dim { opacity: 0.75; font-size: 14px; }

.auth-input {
    width: 100%;
    padding: 13px 16px;
    font-family: var(--ui-font);
    font-size: 18px;
    color: var(--ink);
    background: rgba(255, 250, 238, 0.85);
    border: 2px solid var(--papyrus-dark);
    border-radius: 4px;
    outline: none;
}
.auth-input:focus { border-color: var(--ink-soft); }
.auth-input::placeholder { color: rgba(43, 29, 14, 0.45); }

.auth-btn {
    margin-top: 18px;
    padding: 13px 30px;
    font-family: var(--heading-font);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--papyrus);
    background: linear-gradient(#7a2417, #5a180e);
    border: 1px solid #3a0f08;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.auth-btn:hover:not(:disabled) { background: linear-gradient(#8f2c1c, #6a1d11); }
.auth-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.auth-err { min-height: 18px; margin-top: 10px; color: var(--blood); font-size: 14px; }

.player-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    font-size: 16px;
}
.player-entry { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.player-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.player-you { color: var(--ink-soft); font-size: 13px; }

/* Role picker (lobby) */
.role-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.role-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 6px;
    font-family: var(--heading-font);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    background: rgba(43, 29, 14, 0.08);
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}
.role-option img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
@media (max-width: 480px) {
    .auth-card { padding: 26px 16px 22px; }
    .role-picker { gap: 6px; }
    .role-option { font-size: 11px; padding: 5px 3px 4px; }
}
.role-option:hover { border-color: var(--papyrus-dark); }
.role-option.selected { border-color: var(--blood); background: rgba(156, 42, 28, 0.12); }
.role-option.taken { opacity: 0.65; }
.role-owner { font-family: var(--ui-font); font-weight: 400; font-size: 11px; color: var(--ink-soft); min-height: 13px; }

/* ── HUD ────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
#status-msg { display: none; }

/* ── Remote cursors ─────────────────────────────────────────────── */
.remote-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.cursor-pointer {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 12px solid currentColor;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8));
    margin-left: -8px;
    transform: rotate(-30deg);
    transform-origin: 8px 0;
}
.cursor-label {
    margin: 4px 0 0 6px;
    padding: 2px 8px;
    font-family: var(--ui-font);
    font-size: 11px;
    white-space: nowrap;
    color: #fff;
    background: rgba(18, 12, 7, 0.8);
    border: 1px solid currentColor;
    border-radius: 3px;
}
.cursor-context {
    display: none;
    margin: 2px 0 0 6px;
    padding: 1px 6px;
    font-family: var(--ui-font);
    font-size: 10px;
    white-space: nowrap;
    color: var(--gold);
    background: var(--chrome-pill-bg);
    border-radius: 2px;
}

/* ── Phase banner ───────────────────────────────────────────────── */
#phase-banner {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 3000;
    transform: translate(-50%, -140%);
    transition: transform 0.6s cubic-bezier(.2, .9, .3, 1.2);
    pointer-events: none;
}
#phase-banner.visible { transform: translate(-50%, 0); }
.phase-banner-inner {
    padding: 14px 34px;
    text-align: center;
    color: var(--ink);
    background: linear-gradient(var(--papyrus), var(--papyrus-dark));
    border: 1px solid var(--ink-soft);
    border-radius: 4px;
    box-shadow: var(--shadow-deep);
}
.phase-banner-title { font-family: var(--heading-font); font-weight: 700; font-size: 20px; letter-spacing: 2px; color: var(--blood); }
.phase-banner-sub { margin-top: 4px; font-size: 14px; }

/* ── Final ending ───────────────────────────────────────────────── */
#final-ending {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(ellipse at center, rgba(40, 24, 8, 0.75), rgba(10, 6, 2, 0.95));
    opacity: 0;
    transition: opacity 1.2s ease;
}
#final-ending.visible { opacity: 1; }
.ending-inner {
    width: min(620px, 100%);
    padding: 40px 44px;
    text-align: center;
    color: var(--gold-bright);
    background: linear-gradient(#3b2a17, #24180b);
    border: 1px solid var(--panel-edge);
    border-radius: 6px;
    box-shadow: var(--shadow-deep);
}
.ending-title {
    margin: 0 0 16px;
    font-family: var(--title-font);
    font-size: clamp(28px, 6vw, 42px);
    color: var(--gold-bright);
    text-shadow: var(--glow-gold);
}
.ending-body { font-size: 18px; line-height: 1.6; color: var(--papyrus); }
.ending-stats { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; font-family: var(--heading-font); letter-spacing: 2px; text-transform: uppercase; color: var(--papyrus-dark); }
.ending-stats strong { font-family: var(--ui-font); font-size: 34px; color: var(--gold-bright); letter-spacing: 1px; }
