:root {
    --bg: #f4efe5;
    --bg-strong: #efe3cb;
    --surface: rgba(255, 251, 244, 0.88);
    --surface-strong: #fffaf2;
    --surface-dark: #1f2937;
    --line: rgba(110, 57, 35, 0.16);
    --line-strong: rgba(110, 57, 35, 0.3);
    --text: #241916;
    --muted: #75655d;
    --brand: #9f1d20;
    --brand-strong: #7f1619;
    --brand-soft: #f4d9c4;
    --gold: #d4a64a;
    --gold-strong: #ae7b1d;
    --success: #1f7a55;
    --warn: #a12228;
    --shadow: 0 20px 50px rgba(74, 32, 19, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(212, 166, 74, 0.18), transparent 30%),
        linear-gradient(180deg, #f7f1e6 0%, #f1e7d5 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    background:
        linear-gradient(90deg, rgba(92, 15, 24, 0.96), rgba(134, 31, 28, 0.94)),
        #5d1217;
    color: #fff7eb;
    border-bottom: 1px solid rgba(255, 226, 188, 0.16);
    box-shadow: 0 12px 30px rgba(72, 17, 16, 0.28);
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-title-group strong {
    font-size: 18px;
    letter-spacing: 0.08em;
}

.back-button {
    min-width: 38px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 244, 224, 0.14);
    border: 1px solid rgba(255, 244, 224, 0.2);
}

main {
    padding: 28px;
    display: grid;
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

button {
    border: 0;
    border-radius: 14px;
    padding: 10px 16px;
    cursor: pointer;
    color: #fffaf2;
    background: linear-gradient(180deg, var(--brand), var(--brand-strong));
    box-shadow: 0 10px 20px rgba(122, 21, 25, 0.18);
}

.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    padding: 14px 18px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--warn);
}

.toast.info {
    border-left: 4px solid var(--brand);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
    transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(122, 21, 25, 0.22);
}

button.secondary {
    background: linear-gradient(180deg, #6b7280, #4b5563);
}

button.success {
    background: linear-gradient(180deg, #21805a, #176748);
}

button.warn {
    background: linear-gradient(180deg, #b1262d, #8f1d23);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 249, 240, 0.92);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(159, 29, 32, 0.18);
    border-color: rgba(159, 29, 32, 0.46);
}

textarea {
    min-height: 280px;
    resize: vertical;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 700;
    color: #43302b;
}

.grid {
    display: grid;
    gap: 14px;
}

.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.field-block {
    margin-top: 14px;
}

.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.menu {
    display: grid;
    gap: 10px;
    position: sticky;
    top: 94px;
}

.menu button {
    justify-content: flex-start;
    text-align: left;
    background: rgba(117, 45, 28, 0.06);
    color: var(--text);
    border: 1px solid rgba(117, 45, 28, 0.1);
    box-shadow: none;
}

.menu button.active {
    color: #fff9f0;
    background: linear-gradient(180deg, var(--brand), var(--brand-strong));
    border-color: transparent;
}

.menu-title {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-bottom: 4px;
}

.panel {
    display: none;
}

.panel.active {
    display: grid;
    gap: 18px;
}

.hero-card {
    display: grid;
    gap: 18px;
    background:
        linear-gradient(135deg, rgba(103, 12, 19, 0.96), rgba(143, 35, 30, 0.92)),
        #72171b;
    color: #fff7ec;
    border: 1px solid rgba(255, 224, 181, 0.18);
}

.hero-copy {
    display: grid;
    gap: 8px;
}

.hero-copy h2,
.hero-copy p {
    margin: 0;
}

.eyebrow {
    margin: 0;
    color: rgba(255, 228, 186, 0.88);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 12px;
}

.hero-actions {
    justify-content: flex-end;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head.compact {
    margin-bottom: 12px;
}

.section-head h3,
.section-head p {
    margin: 0;
}

.status-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(159, 29, 32, 0.1);
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 700;
}

.status-badge.subtle {
    background: rgba(212, 166, 74, 0.18);
    color: #704f17;
}

.card-list {
    padding: 10px;
    border-radius: 18px;
    background: rgba(255, 248, 238, 0.75);
    border: 1px solid rgba(109, 58, 35, 0.08);
}

.list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
}

.question-type-sequence-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 0;
    margin-bottom: 12px;
}

.question-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 251, 244, 0.94);
    border: 1.5px solid rgba(109, 58, 35, 0.16);
    border-radius: 18px;
    width: 170px;
    box-shadow: 0 4px 14px rgba(31, 23, 21, 0.04);
    transition: all 0.2s ease;
}

.question-type-card:hover {
    border-color: var(--brand);
    box-shadow: 0 8px 22px rgba(122, 21, 25, 0.08);
    transform: translateY(-2px);
}

.question-type-card .order-label {
    font-weight: 800;
    color: var(--brand-strong);
    font-size: 15px;
}

.question-type-card select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 14px;
    color: var(--text);
    outline: none;
}

.question-type-card select:focus {
    border-color: var(--brand);
}

.question-type-card .actions {
    display: flex;
    gap: 6px;
    width: 100%;
}

.question-type-card .actions button {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 8px;
    box-shadow: none;
}

.question-type-card .actions button.small-btn {
    min-height: 0;
}

.tall-list {
    max-height: 540px;
}

.list-item {
    display: grid;
    gap: 8px;
    padding: 14px;
    text-align: left;
    color: var(--text);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(109, 58, 35, 0.08);
    box-shadow: none;
}

.list-item.active {
    background: linear-gradient(180deg, rgba(159, 29, 32, 0.96), rgba(127, 22, 25, 0.96));
    color: #fff9f2;
}

.list-item.active .muted {
    color: rgba(255, 245, 230, 0.78);
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(92, 15, 24, 0.08);
    color: #6f2a24;
    font-size: 12px;
    font-weight: 700;
}

.pill.subtle {
    background: rgba(212, 166, 74, 0.14);
    color: #725215;
}

.inline-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.inline-control input {
    width: auto;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 16px;
    border-radius: 18px;
    background: #221816;
    color: #f6ede1;
    overflow: auto;
    line-height: 1.5;
}

a {
    color: var(--brand-strong);
}

.login-wrap {
    min-height: calc(100vh - 96px);
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
}

.team-chip-card {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 249, 239, 0.84);
    border: 1px solid rgba(109, 58, 35, 0.1);
}

.assignment-shell {
    display: grid;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    gap: 16px;
}

.assignment-pool,
.assignment-board {
    display: grid;
    gap: 14px;
}

.assignment-board {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    align-items: start;
}

.assignment-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 250, 242, 0.82);
    border: 1px solid rgba(109, 58, 35, 0.1);
}

.assignment-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.assignment-card h4,
.assignment-card p {
    margin: 0;
}

.assignment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.assignment-team-list {
    display: grid;
    gap: 10px;
}

.assignment-team-row {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(109, 58, 35, 0.08);
}

.assignment-team-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.assignment-row-tools {
    display: flex;
    gap: 6px;
}

.assignment-row-tools button {
    padding: 8px 10px;
    min-width: 42px;
}

.list-item.selected-pool {
    border-color: rgba(159, 29, 32, 0.4);
    background: rgba(159, 29, 32, 0.08);
}

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

.mode-card {
    display: grid;
    gap: 8px;
    padding: 18px;
    text-align: left;
    color: var(--text);
    background: rgba(255, 249, 239, 0.84);
    border: 1px solid rgba(109, 58, 35, 0.1);
    box-shadow: none;
}

.mode-card.active {
    color: #fff8ef;
    background: linear-gradient(180deg, var(--brand), var(--brand-strong));
}

.mode-card.active .mode-card-copy {
    color: rgba(255, 245, 230, 0.82);
}

.mode-card-label {
    font-size: 18px;
    font-weight: 800;
}

.mode-card-copy {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.mode-card.mode-card-compact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
}

.bank-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.bank-detail-table th,
.bank-detail-table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}
.bank-detail-table thead th {
    background: #f5f5f5;
    font-weight: 600;
}
.bank-detail-table tbody tr:nth-child(even) {
    background: #fafafa;
}
.bank-detail-options {
    line-height: 1.5;
}
.bank-detail-options span {
    display: inline-block;
    margin-right: 8px;
}

.screen-quick-bar {
    position: sticky;
    top: 0;
    z-index: 950;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    margin: 0 0 12px 0;
    background: rgba(255, 249, 239, 0.96);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(109, 58, 35, 0.12);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(31, 23, 21, 0.08);
}

.screen-quick-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.screen-quick-bar .quick-label {
    font-weight: 700;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.08em;
}

.screen-quick-bar button {
    padding: 6px 12px;
    font-size: 14px;
}

.screen-quick-bar .countdown-button {
    min-width: 52px;
}

.runtime-question-box {
    display: grid;
    gap: 10px;
}

.runtime-option-row {
    padding: 10px 12px;
    border: 1px solid rgba(109, 58, 35, 0.14);
    border-radius: 12px;
    background: rgba(255, 249, 239, 0.84);
}

.runtime-option-selected {
    background: rgba(159, 29, 32, 0.12);
    border-color: rgba(159, 29, 32, 0.34);
}

.option-button.active {
    background: linear-gradient(180deg, var(--brand), var(--brand-strong));
}

.runtime-result {
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
}

.runtime-result.correct {
    background: rgba(31, 122, 85, 0.14);
    color: #16563d;
}

.runtime-result.wrong {
    background: rgba(161, 34, 40, 0.14);
    color: #7f1619;
}

#rushActionBox {
    display: none;
    gap: 10px;
}

.screen-body {
    background:
        radial-gradient(circle at top, rgba(212, 166, 74, 0.14), transparent 26%),
        linear-gradient(180deg, #fffdf8 0%, #f7efe1 100%);
    color: #221916;
}

.screen-header {
    background: transparent;
    color: #221916;
    border-bottom: 0;
    box-shadow: none;
}

.screen-header-minimal {
    display: none;
}

.screen-main {
    box-sizing: border-box;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding: clamp(18px, 3vh, 40px) clamp(24px, 4vw, 72px);
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2vh, 24px);
    color: #1f1715;
}

.screen-stage {
    display: grid;
    gap: 10px;
    flex: 0 0 auto;
}

.screen-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 62px);
    line-height: 1.08;
    color: #6e1115;
    letter-spacing: 0.06em;
}

.screen-subtitle {
    margin: 0;
    font-size: clamp(16px, 1.6vw, 24px);
    color: #705750;
}

.screen-rush-team {
    display: none;
}

.screen-question {
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.screen-question-stem {
    padding: clamp(16px, 2vh, 26px);
    border-radius: 22px;
    background: rgba(255, 250, 242, 0.92);
    border: 1px solid rgba(109, 58, 35, 0.1);
    box-shadow: var(--shadow);
    font-size: clamp(22px, 2.8vw, 42px);
    line-height: 1.4;
}

.screen-question-option {
    padding: clamp(10px, 1.4vh, 18px) clamp(14px, 1.6vw, 22px);
    border-radius: 16px;
    background: rgba(255, 251, 244, 0.84);
    border: 1px solid rgba(109, 58, 35, 0.1);
    font-size: clamp(18px, 1.9vw, 30px);
}

.screen-question-option-selected {
    background: rgba(159, 29, 32, 0.1);
    border-color: rgba(159, 29, 32, 0.28);
    color: #7f1619;
    font-weight: 700;
}

.screen-required-hint {
    font-size: clamp(20px, 2.2vw, 32px);
    text-align: center;
}

.screen-required-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 14vw, 200px), 1fr));
    gap: clamp(10px, 1.4vw, 18px);
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.screen-required-group-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: clamp(10px, 1.5vh, 18px) clamp(8px, 1vw, 14px);
    border-radius: 16px;
    background: rgba(255, 251, 244, 0.94);
    border: 1px solid rgba(109, 58, 35, 0.16);
    box-shadow: 0 4px 14px rgba(31, 23, 21, 0.06);
    color: #4a2a1f;
}

.screen-required-group-card.used {
    background: rgba(220, 215, 210, 0.45);
    color: #998a82;
    text-decoration: line-through;
    opacity: 0.75;
}

.screen-required-group-card.active {
    background: linear-gradient(180deg, #ffd76a, #f5a623);
    color: #4a1d05;
    border-color: #c9871a;
    box-shadow: 0 10px 22px rgba(245, 166, 35, 0.32);
}

.screen-required-group-label {
    font-size: clamp(20px, 2vw, 32px);
    font-weight: 800;
}

.screen-required-group-meta {
    font-size: clamp(12px, 1.1vw, 18px);
    font-weight: 600;
}

.screen-required-group-badge {
    font-size: clamp(11px, 1vw, 14px);
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(74, 29, 5, 0.18);
    color: inherit;
}

.screen-result {
    display: grid;
    place-items: center;
    flex: 1 1 auto;
}

.screen-result-box {
    padding: clamp(12px, 1.6vh, 20px) clamp(16px, 1.8vw, 26px);
    border-radius: 18px;
    font-size: clamp(20px, 2vw, 32px);
    font-weight: 800;
}

.screen-result-box.correct {
    background: rgba(31, 122, 85, 0.12);
    color: #176248;
}

.screen-result-box.wrong {
    background: rgba(161, 34, 40, 0.12);
    color: #891a1e;
}

.screen-teams {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;
    align-content: start;
}

.screen-team-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 250, 242, 0.92);
    border: 1px solid rgba(109, 58, 35, 0.1);
}

.screen-team-card.current-answering {
    border: 2px solid var(--gold-strong);
    background: linear-gradient(180deg, rgba(255, 246, 222, 0.96), rgba(252, 239, 199, 0.94));
}

.screen-teams-ranking {
    display: block;
    width: min(720px, 90%);
    margin: 0 auto;
}

/* 超过 9 支队伍，自适应切为双列，纵向从上往下排列后换列 */
.screen-teams-ranking:has(> :nth-child(9)) {
    column-count: 2;
    column-gap: 30px;
    width: min(1320px, 95%);
}

/* 超过 16 支队伍，自适应切为三列 */
.screen-teams-ranking:has(> :nth-child(16)) {
    column-count: 3;
    column-gap: 24px;
    width: min(1500px, 96%);
}

.screen-team-card-ranking {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: clamp(16px, 1.8vh, 24px) clamp(20px, 1.8vw, 32px);
    break-inside: avoid;
    margin-bottom: 16px;
}

.screen-team-rank {
    font-size: clamp(14px, 1.2vw, 18px);
    color: #86685d;
}

.screen-team-card-ranking .screen-team-rank {
    font-weight: 800;
    color: #6d1014;
    font-size: clamp(18px, 1.6vw, 24px);
}

.screen-team-card-ranking .screen-team-rank:not(:empty) {
    min-width: 90px;
}


.screen-team-name {
    font-size: clamp(22px, 2.2vw, 32px);
    font-weight: 700;
}

.screen-team-meta {
    font-size: clamp(14px, 1.3vw, 18px);
    color: #6d5a54;
}

.screen-team-card-ranking .screen-team-meta {
    text-align: right;
    font-weight: 800;
    color: #6d1014;
    font-size: clamp(26px, 2.6vw, 36px);
}


@media (max-width: 980px) {
    .layout,
    .two-col,
    .three-col,
    .screen-mode-grid,
    .assignment-shell {
        grid-template-columns: 1fr;
    }

    .menu {
        position: static;
    }
}

@media (max-width: 760px) {
    header {
        padding: 14px 18px;
    }

    main {
        padding: 18px;
    }

    .section-head,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .screen-main {
        padding: 20px;
    }

    .screen-team-card-ranking {
        grid-template-columns: 1fr;
    }

    .screen-team-card-ranking .screen-team-meta {
        text-align: left;
    }
}

.question-type-sequence-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.question-type-sequence-row .question-type-sequence-select {
    min-width: 120px;
}

.question-type-sequence-row button {
    padding: 4px 10px;
}

.screen-countdown {
    position: fixed;
    top: clamp(16px, 3vh, 32px);
    right: clamp(20px, 3vw, 48px);
    z-index: 1100;
    padding: clamp(10px, 1.5vh, 18px) clamp(16px, 2vw, 28px);
    border-radius: 12px;
    background: rgba(15, 20, 30, 0.85);
    color: #fff8e7;
    text-align: center;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    min-width: clamp(120px, 12vw, 200px);
}

.screen-countdown-label {
    font-size: clamp(14px, 1.6vw, 20px);
    letter-spacing: 0.16em;
    opacity: 0.78;
    margin-bottom: 4px;
}

.screen-countdown-value {
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: #ffd76a;
}

.screen-countdown.warning .screen-countdown-value {
    color: #ff5b50;
    animation: screen-countdown-flash 0.9s steps(2, end) infinite;
}

.screen-countdown.zero {
    background: rgba(70, 8, 8, 0.92);
}

.screen-countdown.zero .screen-countdown-value {
    color: #ff5b50;
    animation: screen-countdown-flash 0.7s steps(2, end) infinite;
}

@keyframes screen-countdown-flash {
    from { opacity: 1; }
    to { opacity: 0.25; }
}

/* Custom Premium Modal Dialog Styles */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 23, 21, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.custom-modal-card {
    background: #fffcf7;
    border: 1px solid rgba(109, 58, 35, 0.16);
    border-radius: 20px;
    width: 95%;
    max-width: 500px;
    padding: 28px;
    box-shadow: 0 12px 36px rgba(31, 23, 21, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.custom-modal-overlay.active .custom-modal-card {
    transform: translateY(0);
}

.custom-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(109, 58, 35, 0.08);
    padding-bottom: 12px;
}

.custom-modal-icon {
    font-size: 24px;
}

.custom-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #6e1115;
}

.custom-modal-body {
    font-size: 15px;
    line-height: 1.6;
    color: #4a3832;
    margin-bottom: 24px;
}

.custom-modal-body ul {
    margin: 10px 0;
    padding-left: 20px;
}

.custom-modal-body li {
    margin-bottom: 6px;
}

.custom-modal-warning {
    color: #a12228;
    font-weight: 700;
    margin-top: 14px;
}

.custom-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.custom-modal-footer button {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.custom-modal-footer .btn-cancel {
    background: #e8e3d9;
    color: #4a3832;
}

.custom-modal-footer .btn-cancel:hover {
    background: #dbd5ca;
}

.custom-modal-footer .btn-confirm {
    background: linear-gradient(180deg, #d83b43, #a12228);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(161, 34, 40, 0.2);
}

.custom-modal-footer .btn-confirm:hover {
    background: linear-gradient(180deg, #e34c54, #b52930);
    box-shadow: 0 6px 16px rgba(161, 34, 40, 0.3);
}

#stateBox,
#resultBox {
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface-dark, #1f2937);
    color: #e5e7eb;
    padding: 14px 16px;
    border-radius: 12px;
    font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid rgba(0, 0, 0, 0.15);
    white-space: pre-wrap;
    word-break: break-all;
    margin: 10px 0 0 0;
}

