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

:root {
    --bg: #060d1b;
    --surface: #0d1829;
    --border: #1a2c45;
    --text: #d8e4f0;
    --text-muted: #6882a0;
    --accent: #4a8feb;
    --green: #22c55e;
    --red: #f85149;
    --yellow: #f0b72f;
    --purple: #a371f7;
    --radius: 12px;
    --font: 'Segoe UI', system-ui, sans-serif;
    --card-gradient: linear-gradient(135deg, #0d1829 0%, #060d1b 100%);
}

[data-theme="light"] {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --border: #d0d7de;
    --text: #1f2328;
    --text-muted: #57606a;
    --accent: #0969da;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #d97706;
    --purple: #8250df;
    --card-gradient: linear-gradient(135deg, #eef6ff 0%, #dbeafe 100%);
}

.mr-back-logo {
    height: 26px;
    width: auto;
    display: block;
}

[data-theme="light"] .mr-back-logo { content: url('/img/fritslabslogo-black1.png'); }

html, body {
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    transition: background-color 0.2s, color 0.2s;
}

/* ── HEADER ── */
.mr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mr-back {
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
    opacity: 0.85;
    transition: opacity 0.15s;
    white-space: nowrap;
    min-width: 160px;
}
.mr-back:hover { opacity: 1; }

.mr-header > span {
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
    text-align: center;
    padding: 0 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mr-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    justify-content: flex-end;
}

.mr-icon-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}
.mr-icon-btn:hover { border-color: var(--accent); }

/* ── SCREENS ── */
.mr-screen {
    max-width: 580px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.hidden { display: none !important; }

.mr-intro {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ── PERSON PANELS ── */
.mr-persons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.mr-person-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.mr-name-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    outline: none;
    transition: border-color 0.15s;
    text-align: center;
    margin-bottom: 14px;
}
.mr-name-input:focus { border-color: var(--accent); }

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

.mr-movie-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    transition: border-color 0.15s;
}
.mr-movie-row:focus-within { border-color: var(--accent); }

.mr-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
}

.mr-movie-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.88rem;
    min-width: 0;
}

/* ── BUTTONS ── */
.mr-btn-primary {
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.mr-btn-primary:hover:not(:disabled) { background: #388bfd; transform: translateY(-1px); }
.mr-btn-primary:disabled { opacity: 0.4; cursor: default; transform: none; }

.mr-btn-secondary {
    width: 100%;
    background: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-top: 10px;
}
.mr-btn-secondary:hover { border-color: var(--accent); color: var(--text); }

/* ── RESULT CARD ── */
.mr-result-eyebrow {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.mr-result-card {
    background: var(--card-gradient);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 44px 28px;
    text-align: center;
    margin-bottom: 24px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: border-color 0.3s;
}

.mr-result-card.rolling {
    border-color: var(--accent);
    animation: mr-pulse 0.2s ease infinite alternate;
}

.mr-result-card.revealed {
    border-color: var(--green);
    animation: mr-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mr-pulse {
    from { box-shadow: 0 0 0 rgba(47,129,247,0); }
    to   { box-shadow: 0 0 28px rgba(47,129,247,0.35); }
}

@keyframes mr-pop {
    from { transform: scale(0.94); }
    to   { transform: scale(1); }
}

.mr-result-title {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.25;
    word-break: break-word;
}

.mr-result-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── VETO ── */
.mr-veto-section {
    margin-bottom: 16px;
}

.mr-veto-label {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.mr-veto-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mr-veto-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mr-veto-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.mr-veto-vs {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}

.mr-veto-btn {
    width: 100%;
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.35);
    color: var(--red);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: background 0.15s;
}
.mr-veto-btn:hover:not(:disabled) { background: rgba(248, 81, 73, 0.18); }
.mr-veto-btn:disabled {
    opacity: 0.4;
    cursor: default;
    border-style: dashed;
    color: var(--text-muted);
}

.mr-veto-count {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
}

/* ── HISTORY ── */
.mr-section-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.mr-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mr-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 16px;
}

.mr-history-movie { font-size: 0.92rem; font-weight: 600; }
.mr-history-date { font-size: 0.78rem; color: var(--text-muted); flex-shrink: 0; margin-left: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    .mr-persons-grid { grid-template-columns: 1fr; }
    .mr-result-title { font-size: 1.4rem; }
    .mr-back { min-width: 100px; font-size: 0.95rem; }
    .mr-header-right { min-width: 80px; }
}
