/* ── Base ──────────────────────────────────────────────────────────────── */
html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: #0d0d0d;
    color: #e8e0d5;
    min-height: 100vh;
    min-height: 100dvh;   /* dvh excludes the mobile address bar; vh above is the fallback */
    -webkit-text-size-adjust: 100%;   /* stop iOS inflating text on rotate */
}

h1:focus { outline: none; }

/* ── Blazor plumbing ──────────────────────────────────────────────────── */
#blazor-error-ui {
    color-scheme: light only;
    background: #b32121;
    color: #fff;
    bottom: 0; left: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.4);
    box-sizing: border-box;
    display: none;
    padding: .6rem 1.25rem .7rem;
    position: fixed;
    width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.loading-progress {
    position: absolute; display: block;
    width: 8rem; height: 8rem;
    inset: 20vh 0 auto 0; margin: 0 auto;
}
.loading-progress circle {
    fill: none; stroke: #333;
    stroke-width: .6rem; transform-origin: 50% 50%; transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: #c0922a;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray .05s ease-in-out;
}
.loading-progress-text {
    position: absolute; text-align: center; font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto .2rem;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ── App shell ────────────────────────────────────────────────────────── */
/* Sticky footer: the credit sits at the bottom of the viewport on short pages
   and below the content on long ones, without the landing hero — which used to
   claim a full 100dvh of its own — pushing it off-screen. */
.page {
    display: flex; flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
.page > main { flex: 1 0 auto; display: flex; flex-direction: column; }
.page > main > .content { flex: 1 0 auto; display: flex; flex-direction: column; }

/* ── Landing page ─────────────────────────────────────────────────────── */
.betrayers-hero {
    flex: 1 0 auto;              /* fill the space above the footer, not the whole viewport */
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2rem 1rem 3rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(150, 80, 20, 0.15) 0%, transparent 60%),
        #0d0d0d;
}

.betrayers-title {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    letter-spacing: .2em;
    color: #c0922a;
    text-shadow: 0 0 40px rgba(192, 146, 42, 0.4), 0 2px 8px rgba(0,0,0,.8);
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.betrayers-subtitle {
    font-size: clamp(.85rem, 2.5vw, 1.1rem);
    color: #8a7a6a;
    letter-spacing: .3em;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
}

/* ── Auth cards ───────────────────────────────────────────────────────── */
.auth-panel {
    width: 100%; max-width: 480px;
    background: #181818;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.7);
}

.auth-credentials {
    padding: 1.75rem 1.75rem 1.25rem;
    border-bottom: 1px solid #2a2a2a;
}

.auth-credentials-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #6a6058;
    margin-bottom: 1rem;
}

.auth-actions {
    padding: 1.25rem 1.75rem 1.75rem;
}

.auth-divider {
    display: flex; align-items: center; gap: .75rem;
    margin: 1.25rem 0;
    color: #4a4040;
    font-size: .75rem; letter-spacing: .1em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1;
    height: 1px; background: #2a2a2a;
}

/* ── Form controls ────────────────────────────────────────────────────── */
.form-label {
    font-size: .8rem; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: #8a7a6a; margin-bottom: .4rem;
}

.form-control {
    background: #111 !important;
    border: 1px solid #2e2e2e !important;
    color: #e8e0d5 !important;
    border-radius: 3px !important;
    padding: .65rem .9rem;
    transition: border-color .15s;
}
.form-control:focus {
    border-color: #c0922a !important;
    box-shadow: 0 0 0 2px rgba(192,146,42,.2) !important;
}
.form-control::placeholder { color: #3e3830 !important; }

.input-group .form-control { border-radius: 3px 0 0 3px !important; }
.input-group .btn { border-radius: 0 3px 3px 0 !important; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-betrayers-primary {
    background: #c0922a;
    border: none; color: #0d0d0d;
    font-weight: 700; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase;
    padding: .75rem 1.5rem;
    border-radius: 3px;
    width: 100%;
    transition: background .15s, box-shadow .15s;
}
.btn-betrayers-primary:hover { background: #d4a535; color: #0d0d0d; box-shadow: 0 0 20px rgba(192,146,42,.3); }

.btn-betrayers-secondary {
    background: transparent;
    border: 1px solid #3a3028;
    color: #8a7a6a;
    font-weight: 600; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase;
    padding: .65rem 1.25rem;
    border-radius: 3px;
    transition: border-color .15s, color .15s;
}
.btn-betrayers-secondary:hover { border-color: #c0922a; color: #c0922a; }

.btn-betrayers-join {
    background: #1e1e1e;
    border: 1px solid #3a3028;
    color: #c0922a;
    font-weight: 700; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase;
    padding: .75rem 1.5rem;
    border-radius: 0 3px 3px 0;
    transition: background .15s;
    white-space: nowrap;
}
.btn-betrayers-join:hover { background: #2a2018; color: #d4a535; border-color: #c0922a; }

/* ── Phase help button (the ? in the game room card header) ──────────── */
.phase-help-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem;
    background: rgba(192,146,42,.15);
    border: 1px solid rgba(192,146,42,.35);
    border-radius: 50%;
    color: #c0922a;
    font-size: .8rem; font-weight: 700;
    cursor: pointer; line-height: 1;
    transition: background .15s, border-color .15s;
    flex-shrink: 0;
    position: relative;
}
/* Expand the tap area to ~44px without changing the visual size of the circle. */
.phase-help-btn::after {
    content: ''; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px;
}
.phase-help-btn:hover { background: rgba(192,146,42,.3); border-color: #c0922a; }

/* ── How to Play button ───────────────────────────────────────────────── */
.btn-how-to-play {
    background: transparent; border: none;
    color: #5a5048; font-size: .8rem; letter-spacing: .15em; text-transform: uppercase;
    cursor: pointer; padding: .5rem 1rem;
    transition: color .15s;
    text-decoration: none;
}
.btn-how-to-play:hover { color: #c0922a; }

/* ── PIN hint ─────────────────────────────────────────────────────────── */
.pin-hint {
    font-size: .75rem; color: #5a5048;
    margin-top: .4rem; line-height: 1.4;
}
.pin-hint strong { color: #7a6a5a; }

/* ── Room code badge ──────────────────────────────────────────────────── */
/* Used as a <button> on the landing page, so reset the browser's default font
   (buttons don't inherit font-family) and give it a comfortable tap height. */
.room-code-badge {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    background: #1a1510; border: 1px solid #3a2e1a;
    color: #c0922a; border-radius: 3px;
    font-family: inherit;
    font-size: .7rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
    padding: .55rem .9rem; margin-top: .5rem;
    min-height: 38px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.room-code-badge:hover { background: #241c12; border-color: #c0922a; color: #d4a535; }

/* ── Error / alert ────────────────────────────────────────────────────── */
.auth-error {
    background: rgba(150,30,30,.15);
    border: 1px solid rgba(200,50,50,.3);
    color: #e07070; border-radius: 3px;
    font-size: .85rem; padding: .65rem .9rem;
    margin-top: 1rem;
}

/* ── How to Play overlay ──────────────────────────────────────────────── */
.htp-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0,0,0,.85);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.htp-modal {
    background: #161412;
    border: 1px solid #2a2218;
    border-radius: 4px;
    width: 100%; max-width: 680px;
    box-shadow: 0 30px 80px rgba(0,0,0,.8);
    padding: 2.5rem;
    position: relative;
}

.htp-close {
    position: absolute; top: .5rem; right: .75rem;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;              /* full-size tap target on touch screens */
    background: none; border: none;
    color: #5a5048; font-size: 1.75rem; cursor: pointer; line-height: 1;
    transition: color .15s;
    z-index: 1;
}
.htp-close:hover { color: #c0922a; }

.htp-title {
    font-size: 1.6rem; font-weight: 900;
    letter-spacing: .2em; text-transform: uppercase;
    color: #c0922a; margin-bottom: .25rem;
}

.htp-tagline {
    color: #6a5a4a; font-size: .8rem; letter-spacing: .2em;
    text-transform: uppercase; margin-bottom: 2rem;
}

/* Opening pitch — sits above the rules, so it reads brighter and warmer than body copy. */
.htp-lede {
    border-left: 2px solid #c0922a;
    background: linear-gradient(90deg, rgba(192,146,42,.07), transparent 70%);
    border-radius: 0 3px 3px 0;
    padding: 1rem 1.15rem;
    margin-bottom: 2rem;
    color: #b3a08c;
    font-size: .95rem;
    line-height: 1.65;
}
.htp-lede p { margin-bottom: .7rem; }
.htp-lede p:last-child { margin-bottom: 0; }
.htp-lede strong { color: #d4a535; }

.htp-section { margin-bottom: 1.75rem; }

.htp-section-title {
    font-size: .75rem; font-weight: 700;
    letter-spacing: .2em; text-transform: uppercase;
    color: #c0922a; margin-bottom: .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid #2a2218;
}

.htp-body {
    color: #a09080; font-size: .92rem; line-height: 1.7;
}
.htp-body p { margin-bottom: .6rem; }
.htp-body ul { padding-left: 1.25rem; margin-bottom: .6rem; }
.htp-body li { margin-bottom: .35rem; }
.htp-body strong { color: #c8b08a; }

.htp-flow {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
    margin: .5rem 0;
}
.htp-flow-step {
    background: #1e1a16; border: 1px solid #3a3020;
    color: #c0922a; border-radius: 2px;
    font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    padding: .3rem .6rem;
}
.htp-flow-arrow { color: #4a3a2a; font-size: .9rem; }

/* ── Animations ───────────────────────────────────────────────────────── */
.pulse { animation: pulse-anim 3s ease-in-out infinite; }

@keyframes pulse-anim {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* ── Game room overrides (keep existing Bootstrap dark styles working) ── */
.btn-primary   { background-color: #c0922a; border-color: #c0922a; color: #0d0d0d; }
.btn-primary:hover { background-color: #d4a535; border-color: #d4a535; color: #0d0d0d; }
.btn:focus, .btn:active:focus, .form-control:focus {
    box-shadow: 0 0 0 2px rgba(192,146,42,.3);
}

/* ── Utility ──────────────────────────────────────────────────────────── */
.text-gold  { color: #c0922a; }
.border-gold { border-color: #c0922a !important; }

/* ── Site credit (global footer, rendered by MainLayout) ──────────────── */
.site-credit {
    flex-shrink: 0;
    padding: 1.5rem 1rem 1.75rem;
    text-align: center;
    font-size: .72rem;
    letter-spacing: .1em;
    color: #4a4038;
    line-height: 1.6;
}
.site-credit a {
    color: #5a5048;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
    word-break: break-word;      /* the address is long — never overflow a phone */
}
.site-credit a:hover { color: #c0922a; border-bottom-color: rgba(192,146,42,.4); }

/* ── Game room header wordmark ────────────────────────────────────────── */
.room-brand {
    display: inline-block;
    font-size: 1rem; font-weight: 900; letter-spacing: .28em;
    text-transform: uppercase;
    color: #c0922a; text-decoration: none;
    text-shadow: 0 0 18px rgba(192,146,42,.35);
    transition: color .15s;
}
.room-brand:hover { color: #d4a535; }

/* ── Mobile ───────────────────────────────────────────────────────────── */
/* Phones are the primary way this gets played — everyone is holding one at the
   Round Table. Below 768px the two-column headers stack and the generous
   desktop padding is pulled in so content isn't squeezed into the middle third. */
@media (max-width: 767.98px) {

    /* The phase title shares a row with the ROOM CODE badge; at 2rem the longer
       names ("The Final Embers", "Final Round Table") overflow a 375px screen. */
    .card-header h2 { font-size: 1.35rem; }

    .card-body  { padding: 1rem .85rem; }
    .container  { padding-left: .75rem; padding-right: .75rem; }

    /* Reclaim the ~21% of a 375px screen the desktop padding was eating. */
    .htp-modal   { padding: 2rem 1.25rem 1.5rem; }
    .htp-overlay { padding: 1rem .5rem; align-items: flex-start; }
    .htp-title   { font-size: 1.25rem; letter-spacing: .15em; }
    .htp-tagline { margin-bottom: 1.25rem; }
    .htp-section { margin-bottom: 1.35rem; }
    .htp-lede    { padding: .85rem .95rem; margin-bottom: 1.5rem; font-size: .9rem; }
    .htp-body    { font-size: .9rem; line-height: 1.65; }

    .auth-credentials { padding: 1.35rem 1.15rem 1rem; }
    .auth-actions     { padding: 1rem 1.15rem 1.35rem; }
    .betrayers-hero    { padding: 1.5rem .75rem 2rem; }
    .betrayers-subtitle { margin-bottom: 1.75rem; }

    /* Comfortable thumb targets for the vote and target lists. */
    .list-group-item { padding-top: .8rem; padding-bottom: .8rem; }

    .room-brand { font-size: .85rem; letter-spacing: .2em; }
}

/* iOS zooms the page in when a focused input's font-size is below 16px.
   Pin the controls to 16px on touch devices to prevent that jump. */
@media (max-width: 767.98px) {
    .form-control, .input-group .form-control { font-size: 16px; }
}
