/* =========================================================
   Live-Voting – Global Styles
   Background: #0a0a0a  |  Text: #f0f0f0
   ========================================================= */

:root {
    --bg:          #0a0a0a;
    --fg:          #f0f0f0;
    --accent:      #e63946;
    --muted:       #555;
    --border:      #222;
    --radius:      10px;
    --tap-min:     48px;
    --transition:  0.35s ease;
}

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

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ──────────────────────────────────────────────── */

#app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

#phase-view {
    width: 100%;
    max-width: 560px;
}

/* ── Loading ─────────────────────────────────────────────── */

.loading {
    text-align: center;
    color: var(--muted);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

/* ── Countdown ───────────────────────────────────────────── */

.countdown-wrap {
    text-align: center;
    padding: 40px 0;
}

.countdown-label {
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.countdown-timer {
    font-size: clamp(3rem, 16vw, 6rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    line-height: 1;
}

/* ── Remaining time bar ──────────────────────────────────── */

.remaining-time {
    text-align: center;
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    margin-bottom: 28px;
    min-height: 2rem;
}

/* ── Voting form ─────────────────────────────────────────── */

.voting-wrap {
    width: 100%;
}

.voting-wrap fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.voting-wrap legend {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 0 8px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap-min);
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    user-select: none;
}

.radio-option:hover {
    border-color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

.radio-option input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--muted);
    border-radius: 50%;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
}

.radio-option input[type="radio"]:checked {
    border-color: var(--fg);
    background: var(--fg);
    box-shadow: inset 0 0 0 4px var(--bg);
}

.radio-option:has(input:checked) {
    border-color: var(--fg);
    background: rgba(255, 255, 255, 0.04);
}

.radio-label {
    font-size: 1.05rem;
    font-weight: 500;
}

.fight-groups-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 400;
    margin-top: 2px;
}

.error-msg {
    color: var(--accent);
    font-size: 0.9rem;
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}

.submit-btn {
    display: block;
    width: 100%;
    min-height: var(--tap-min);
    padding: 14px;
    background: var(--fg);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: opacity var(--transition);
}

.submit-btn:hover {
    opacity: 0.88;
}

.submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Thank you (Phase 3) ─────────────────────────────────── */

.thankyou-wrap {
    text-align: center;
    padding: 48px 0;
}

.thankyou-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 20px;
    color: #2a9d8f;
}

.thankyou-wrap h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.thankyou-hint {
    font-size: 1.1rem;
    color: var(--muted);
}

/* ── Closed / Results (Phase 4) ──────────────────────────── */

.closed-wrap {
    text-align: center;
    padding: 48px 0;
}

.closing-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.closed-hint {
    font-size: 1.1rem;
    color: var(--muted);
}

.results-wrap h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.result-section {
    margin-bottom: 32px;
}

.result-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 12px;
}

.result-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.result-rank {
    font-size: 0.9rem;
    color: var(--muted);
    min-width: 24px;
    font-weight: 600;
}

.result-label {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
}

.result-votes {
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
}

.total-votes {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 16px;
}

/* =========================================================
   Presenter Styles  (.presenter-body)
   ========================================================= */

.presenter-body {
    overflow: hidden;
    height: 100dvh;
}

.presenter-body #presenter-app {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 32px 40px;
    overflow: hidden;
}

.presenter-body #presenter-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── Presenter: Countdown ────────────────────────────────── */

.p-countdown-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.p-countdown-label {
    font-size: 1.2rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 24px;
}

.p-countdown-timer {
    font-size: clamp(6rem, 20vw, 14rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1;
}

/* ── Presenter: Results layout ───────────────────────────── */

.p-results-wrap {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    min-height: 0;
}

.p-category {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.p-category-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin-bottom: 16px;
    flex-shrink: 0;
}

/* ── Presenter: Remaining time ───────────────────────────── */

.p-remaining {
    text-align: center;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    margin-bottom: 12px;
    flex-shrink: 0;
    min-height: 1.6rem;
}

/* ── Presenter: Status message ───────────────────────────── */

.p-status-msg {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 16px;
    flex-shrink: 0;
    min-height: 2rem;
}

.p-status-msg.ready {
    color: #2a9d8f;
}

/* ── Presenter: Item list ────────────────────────────────── */

.p-list {
    position: relative;
    overflow: visible;
    padding: 0 6px;
}

.p-item {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    height: 64px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.p-item.reveal-enabled {
    cursor: pointer;
}

.p-item.focused {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 4px;
    border-radius: 6px;
}

.p-rank {
    font-size: 0.85rem;
    color: var(--muted);
    min-width: 28px;
    text-align: right;
    font-weight: 600;
}

.p-bar {
    height: 32px;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 6px;
    flex-shrink: 0;
}

.p-votes {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

.p-name {
    font-size: 1rem;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.p-name.hidden-name {
    color: var(--muted);
    font-style: italic;
}

.p-name.revealing {
    filter: blur(6px);
    transition: filter 0.4s ease;
}

.p-name.revealed-anim {
    filter: blur(0);
    transition: filter 0.5s ease;
}

.p-name-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
}

.p-name-col .p-name {
    flex: none;
}

.p-groups {
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
