/* Riskuj styles */
:root {
    --riskuj-player-cyan: #5fe7ff;
    --riskuj-player-purple: #a78bfa;
    --riskuj-player-pink: #fb7185;
    --riskuj-player-yellow: #fbbf24;
    --riskuj-player-green: #34d399;
    --riskuj-player-orange: #f97316;
    --riskuj-player-magenta: #e879f9;
    --riskuj-player-blue: #60a5fa;
    --riskuj-player-lime: #4ade80;
    --riskuj-player-rose: #f472b6;
}

main {
    width: min(100% - 32px, 1180px);
    margin: 0 auto;
    padding: 28px 0 76px;
}

.hero {
    display: block;
    min-height: 0;
    padding: 22px 0 30px;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.eyebrow::before {
    content: "❖";
    color: var(--accent);
    margin-right: 8px;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 0.98;
    margin: 9px 0 16px;
    letter-spacing: -0.04em;
}

.hero p,
.note,
.info-card p,
.info-card li {
    color: var(--muted);
    line-height: 1.65;
}

.hero p {
    max-width: 760px;
    font-size: 1.05rem;
}

.hero-actions,
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--accent);
    color: #031014;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.btn:hover {
    background: var(--accent-strong);
    transform: translateY(-1px);
}

.btn.secondary {
    background: var(--surface-strong);
    color: var(--text);
    border-color: var(--border);
}

.btn.secondary:hover {
    border-color: var(--border-strong);
    background: var(--surface);
}

.btn.success {
    background: color-mix(in srgb, #34d399 72%, var(--surface));
    border-color: color-mix(in srgb, #34d399 55%, var(--border));
    color: #03140d;
}

.btn.success:hover {
    background: #34d399;
}

.btn.danger {
    background: #632832;
    color: #fff;
}

.btn.danger:hover {
    background: #7b3040;
}

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

.info-grid,
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.info-grid {
    margin-top: 52px;
}

.info-card,
.panel,
.mode {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: left;
}

.info-card h2,
.mode h2 {
    margin: 0 0 12px;
    font-size: 1.8rem;
}

.info-card p {
    margin: 0 0 12px;
}

.mode .icon {
    font-size: 1.8rem;
}

.mode p {
    color: var(--muted);
    line-height: 1.55;
}

.hidden {
    display: none !important;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 700;
}

.field input,
.field select,
.topic-title input,
.q-row input {
    box-sizing: border-box;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    outline: none;
}

.field input:focus,
.field select:focus,
.topic-title input:focus,
.q-row input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field input[type="file"] {
    padding: 8px;
}

.setup-questions {
    margin-top: 22px;
    display: grid;
    gap: 12px;
}

.topic-block {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: left;
}

.topic-title {
    font-weight: 800;
    color: var(--accent-strong);
    margin-bottom: 10px;
}

.topic-title input {
    font-weight: 750;
    background: var(--surface-strong);
}

.q-row {
    display: grid;
    grid-template-columns: 1fr 1fr 90px;
    gap: 8px;
    margin: 8px 0;
}

.q-row input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.player-row {
    display: grid;
    grid-template-columns: 40px 1fr 34px;
    gap: 10px;
    align-items: center;
    margin: 8px 0;
}

.player-row input {
    box-sizing: border-box;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.player-row input::placeholder,
.topic-title input::placeholder,
.q-row input::placeholder {
    color: var(--muted);
    opacity: 1;
}

.player-row input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.player-color {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--player-color);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 14px color-mix(in srgb, var(--player-color) 35%, transparent);
}

.player-remove {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.player-remove:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.advanced-settings {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.advanced-settings summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
}

.advanced-settings summary::marker {
    color: var(--accent);
}

.advanced-settings-grid {
    display: grid;
    grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.check-setting {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-strong);
    cursor: pointer;
}

.check-setting input {
    margin-top: 3px;
    accent-color: var(--accent);
}

.check-setting span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.check-setting small {
    color: var(--muted);
    line-height: 1.45;
}

.board-wrap {
    overflow: auto;
}

.board {
    width: 100%;
    border-collapse: separate;
    border-spacing: 7px;
    min-width: 650px;
}

.board th {
    padding: 13px 8px;
    color: var(--accent-strong);
    font-size: 0.85rem;
}

.board td {
    height: 70px;
}

.cell-btn {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-strong);
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.cell-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #031014;
}

.cell-btn:disabled:not(.answered) {
    opacity: 0.28;
    cursor: not-allowed;
}

.cell-btn.answered {
    opacity: 1;
    cursor: default;
    box-shadow: none;
}

.cell-btn.answered.correct {
    background: color-mix(in srgb, var(--answered-color) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--answered-color) 35%, var(--border));
    color: color-mix(in srgb, var(--answered-color) 62%, var(--muted));
}

.cell-btn.answered.wrong {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    color: var(--muted);
    position: relative;
    overflow: hidden;
}

.cell-btn.answered.wrong::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent 0,
        transparent 8px,
        color-mix(in srgb, var(--answered-color) 28%, transparent) 8px,
        color-mix(in srgb, var(--answered-color) 28%, transparent) 10px
    );
    pointer-events: none;
}

.cell-btn.selected {
    outline: 2px solid var(--accent);
    box-shadow: 0 0 20px var(--glow);
}

.scorebar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 14px 0 0;
}

.score {
    position: relative;
    padding: 12px 12px 12px 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-strong);
    text-align: center;
    overflow: hidden;
}

.score::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: var(--player-color);
}

.score.active {
    border-color: var(--player-color);
    box-shadow: 0 0 22px color-mix(in srgb, var(--player-color) 48%, transparent);
}

.question-card {
    text-align: center;
    margin-top: 18px;
}

.question-value {
    color: var(--accent);
    font-weight: 900;
    letter-spacing: 0.08em;
}

.question-text {
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.35;
    margin: 14px auto;
    max-width: 850px;
}

.answer {
    padding: 13px;
    border-radius: var(--radius);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    margin: 12px auto;
    max-width: 760px;
}

.timer {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    min-height: 38px;
}

.winner {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.winner .btn {
    margin-top: 28px;
}

.decision-hint {
    margin-top: 8px;
    color: var(--muted);
}

.topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.topline h2 {
    margin: 0;
}

.setup-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 8px;
}

#decision-wheel {
    margin-top: 18px;
}

.tiebreak-card {
    padding: 24px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 20px 60px var(--shadow);
    text-align: center;
}

.tiebreak-card h3 {
    margin: 8px 0 10px;
    font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.tiebreak-card p {
    max-width: 720px;
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.6;
}

.wheel-stage {
    position: relative;
    width: min(360px, 80vw);
    aspect-ratio: 1;
    margin: 24px auto;
}

.wheel {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--wheel-gradient);
    border: 8px solid var(--surface-strong);
    box-shadow: 0 0 0 1px var(--border), 0 18px 50px var(--shadow);
    transform: rotate(0deg);
    overflow: hidden;
}

.wheel.spinning {
    transform: rotate(var(--spin-target));
    transition: transform 3.9s cubic-bezier(0.12, 0.78, 0.16, 1);
}

.wheel-pointer {
    position: absolute;
    z-index: 5;
    top: -2px;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 0;
    border-bottom: 23px solid var(--accent);
    transform: translateX(-50%);
    filter: drop-shadow(0 0 10px var(--glow));
}

.wheel-center {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    transform: translate(-50%, -50%);
    border: 6px solid var(--surface-strong);
    border-radius: 50%;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 900;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 4;
}

.wheel-label {
    position: absolute;
    width: 96px;
    padding: 6px 8px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: 900;
    font-size: 0.76rem;
    line-height: 1.1;
    text-align: center;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(3, 16, 20, 0.84);
    border: 1px solid color-mix(in srgb, var(--label-color) 78%, #fff);
    box-shadow: 0 0 12px color-mix(in srgb, var(--label-color) 25%, transparent);
    border-radius: 999px;
    z-index: 3;
}

.wheel-result {
    min-height: 30px;
    margin: 8px 0 16px;
    font-size: 1rem;
    color: var(--muted);
}

.results-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.question-preview {
    position: fixed;
    z-index: 80;
    left: 50%;
    top: 50%;
    width: min(480px, calc(100vw - 32px));
    padding: 22px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: 0 24px 80px var(--shadow);
    transform: translate(-50%, -50%);
}

.question-preview-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.question-preview-value {
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.question-preview-text {
    padding-right: 28px;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.4;
}

.question-preview-answer {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-soft);
    color: var(--muted);
}

.question-history-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(7px);
}

.question-history-dialog {
    width: min(920px, 100%);
    max-height: min(82vh, 900px);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.question-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.question-history-header h2 {
    margin: 6px 0 0;
}

.question-history-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
}

.question-history-content {
    max-height: calc(min(82vh, 900px) - 95px);
    overflow-y: auto;
    padding: 20px 24px 28px;
}

.question-history-topic {
    margin-bottom: 24px;
}

.question-history-topic:last-child {
    margin-bottom: 0;
}

.question-history-topic-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 10px;
}

.question-history-topic-header h3 {
    margin: 0;
}

.question-history-topic-header span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.question-history-list {
    display: grid;
    gap: 8px;
}

.question-history-item {
    position: relative;
    padding: 14px 52px 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-strong);
}

.question-history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.question-history-points {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.question-history-question {
    font-weight: 750;
    line-height: 1.45;
}

.question-history-answer {
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.question-status {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border-radius: 50%;
    font-weight: 900;
}

.question-status.correct {
    background: color-mix(in srgb, #34d399 20%, var(--surface));
    border: 1px solid color-mix(in srgb, #34d399 55%, var(--border));
    color: #34d399;
}

.question-status.wrong {
    background: color-mix(in srgb, #fb7185 18%, var(--surface));
    border: 1px solid color-mix(in srgb, #fb7185 55%, var(--border));
    color: #fb7185;
}

@media (max-width: 800px) {
    .info-grid,
    .mode-grid,
    .form-grid,
    .advanced-settings-grid {
        grid-template-columns: 1fr;
    }

    .q-row {
        grid-template-columns: 1fr;
    }

    .player-row {
        grid-template-columns: 34px 1fr 34px;
    }

    .wheel-label {
        width: 84px;
        font-size: 0.68rem;
        padding: 5px 7px;
    }

    .wheel-center {
        width: 54px;
        height: 54px;
    }

    .question-history-modal {
        padding: 12px;
    }

    .question-history-header,
    .question-history-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .question-history-topic-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
