:root {
    --ink: #2d2017;
    --ink-soft: #66513d;
    --paper-top: #f7efdc;
    --paper-bottom: #e2cdab;
    --panel: rgba(255, 248, 235, 0.86);
    --line: rgba(108, 72, 42, 0.22);
    --accent: #94522a;
    --accent-deep: #6a3417;
    --river: #5b7b82;
    --good: #2f6a4a;
    --warn: #8d6a2d;
    --shadow: 0 16px 34px rgba(63, 39, 21, 0.16);
}

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

button,
input {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.qsls-body {
    min-height: 100vh;
    color: var(--ink);
    font-family: "STKaiti", "KaiTi", "SimSun", serif;
    background:
        radial-gradient(circle at 10% 12%, rgba(169, 101, 52, 0.24) 0, transparent 35%),
        radial-gradient(circle at 88% 10%, rgba(83, 120, 130, 0.18) 0, transparent 34%),
        linear-gradient(180deg, var(--paper-top) 0%, var(--paper-bottom) 100%);
    position: relative;
}

.qsls-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.16;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 34px,
            rgba(118, 78, 47, 0.05) 35px
        );
}

.qsls-shell {
    width: min(1220px, calc(100% - 2rem));
    margin: 1rem auto 2rem;
    position: relative;
    z-index: 1;
}

.qsls-topbar {
    position: sticky;
    top: 0.8rem;
    z-index: 9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.72rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.qsls-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.qsls-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid rgba(116, 77, 45, 0.24);
    background: #fff5e2;
}

.qsls-brand strong {
    display: block;
    font-size: clamp(1.22rem, 2vw, 1.56rem);
    letter-spacing: 0.04em;
}

.qsls-brand small {
    display: block;
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
}

.qsls-nav {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.qsls-nav a {
    border-radius: 999px;
    padding: 0.35rem 0.78rem;
    border: 1px solid rgba(110, 75, 46, 0.24);
    color: #4b3627;
    background: rgba(255, 244, 223, 0.75);
    transition: transform 0.22s ease;
}

.qsls-nav a:hover {
    transform: translateY(-2px);
}

.qsls-hero {
    margin-top: 1rem;
    border-radius: 24px;
    padding: clamp(1.2rem, 3vw, 2.2rem);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 1rem;
    color: #f7f0e4;
    background:
        linear-gradient(115deg, rgba(57, 32, 18, 0.94) 0%, rgba(86, 120, 128, 0.86) 52%, rgba(67, 34, 17, 0.92) 100%),
        url("../Photo/展子虔游春图卷.jpg") center/cover no-repeat;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.qsls-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 228, 194, 0.28);
    border-radius: 24px;
    pointer-events: none;
}

.hero-kicker {
    font-size: 0.82rem;
    letter-spacing: 0.2em;
    opacity: 0.84;
}

.qsls-hero h1 {
    margin-top: 0.24rem;
    margin-bottom: 0.6rem;
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
    letter-spacing: 0.06em;
}

.hero-copy p {
    max-width: 52ch;
    line-height: 1.72;
}

.hero-tags {
    margin-top: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-tags span {
    border-radius: 999px;
    padding: 0.24rem 0.72rem;
    border: 1px solid rgba(255, 228, 195, 0.28);
    background: rgba(255, 241, 221, 0.1);
}

.hero-side {
    display: grid;
    gap: 0.55rem;
}

.hero-side article {
    border-radius: 12px;
    border: 1px solid rgba(255, 228, 194, 0.26);
    background: rgba(255, 244, 223, 0.08);
    padding: 0.72rem 0.82rem;
}

.hero-side span {
    display: block;
    font-size: 0.85rem;
    opacity: 0.84;
}

.hero-side strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.2rem;
}

.qsls-layout {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 1rem;
}

.qsls-sidebar,
.qsls-main {
    display: grid;
    gap: 1rem;
}

.status-card,
.track-card,
.rules-card,
.prompt-panel,
.feedback-panel,
.history-panel {
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 1rem;
}

.label {
    display: block;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.status-card strong {
    display: block;
    margin-top: 0.18rem;
    font-size: 2.6rem;
    line-height: 1.05;
    color: var(--accent-deep);
}

.status-card p {
    margin-top: 0.45rem;
    line-height: 1.62;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.stat-grid article {
    border-radius: 14px;
    border: 1px solid rgba(118, 78, 47, 0.2);
    background: rgba(255, 251, 244, 0.82);
    padding: 0.72rem;
    text-align: center;
}

.stat-grid span {
    display: block;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.stat-grid strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.42rem;
}

.action-group {
    display: grid;
    gap: 0.55rem;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
    border: 0;
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
    transform: translateY(-2px);
    filter: saturate(1.08);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled {
    cursor: not-allowed;
    transform: none;
    filter: none;
    opacity: 0.58;
}

.primary-btn {
    color: #fff8ee;
    background: linear-gradient(120deg, var(--accent-deep) 0%, var(--accent) 100%);
}

.secondary-btn {
    color: #4b3626;
    border: 1px solid rgba(110, 75, 46, 0.22);
    background: rgba(255, 244, 223, 0.76);
}

.ghost-btn {
    color: #4b3626;
    border: 1px dashed rgba(110, 75, 46, 0.3);
    background: transparent;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.section-head h2,
.section-head h3,
.feedback-panel h3 {
    font-size: 1.28rem;
    color: var(--accent-deep);
}

.section-head p,
.feedback-panel p,
.rules-card li {
    margin-top: 0.32rem;
    color: var(--ink-soft);
    line-height: 1.64;
}

.state-pill {
    flex: none;
    border-radius: 999px;
    padding: 0.24rem 0.72rem;
    color: #fff8ee;
    background: linear-gradient(120deg, var(--warn) 0%, #b38732 100%);
}

.state-pill.is-live {
    background: linear-gradient(120deg, #2d6849 0%, #3c8d65 100%);
}

.state-pill.is-finished {
    background: linear-gradient(120deg, #587379 0%, #789aa1 100%);
}

.cup-track {
    list-style: none;
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}

.cup-track li {
    position: relative;
    min-height: 64px;
    border-radius: 16px;
    border: 1px solid rgba(91, 123, 130, 0.26);
    background:
        linear-gradient(180deg, rgba(245, 250, 251, 0.94) 0%, rgba(219, 236, 240, 0.76) 100%);
    display: grid;
    place-items: center;
    color: #3f5b61;
    font-size: 0.92rem;
}

.cup-track li::before {
    content: "觞";
    font-size: 1.24rem;
    font-weight: 700;
}

.cup-track li.is-current {
    border-color: rgba(148, 82, 42, 0.5);
    color: var(--accent-deep);
    box-shadow: inset 0 0 0 2px rgba(148, 82, 42, 0.18);
}

.cup-track li.is-done {
    border-color: rgba(47, 106, 74, 0.32);
    background: linear-gradient(180deg, rgba(236, 250, 244, 0.92) 0%, rgba(225, 243, 234, 0.82) 100%);
    color: var(--good);
}

.cup-track li.is-skipped {
    border-color: rgba(141, 106, 45, 0.28);
    background: linear-gradient(180deg, rgba(250, 246, 233, 0.92) 0%, rgba(242, 233, 210, 0.82) 100%);
    color: var(--warn);
}

.rules-card ul {
    margin-left: 1.1rem;
    display: grid;
    gap: 0.4rem;
}

.prompt-panel {
    display: grid;
    gap: 0.82rem;
}

.prompt-badge {
    flex: none;
    border-radius: 999px;
    padding: 0.24rem 0.72rem;
    color: #fff8ee;
    background: linear-gradient(120deg, #587379 0%, #7a99a0 100%);
}

.prompt-scroll {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(116, 78, 47, 0.18);
    background:
        linear-gradient(180deg, rgba(252, 248, 239, 0.96) 0%, rgba(246, 238, 221, 0.92) 100%);
    padding: 1rem;
}

.prompt-scroll::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 50%, rgba(148, 82, 42, 0.08) 0, transparent 20%),
        radial-gradient(circle at 88% 46%, rgba(91, 123, 130, 0.08) 0, transparent 20%);
}

.prompt-label {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.prompt-scroll h3 {
    margin-top: 0.28rem;
    font-size: 1.72rem;
    color: var(--accent-deep);
}

.prompt-text {
    margin-top: 0.7rem;
    font-size: clamp(1.2rem, 2.6vw, 1.62rem);
    line-height: 1.7;
}

.prompt-hint {
    margin-top: 0.6rem;
    color: var(--ink-soft);
    line-height: 1.64;
}

.answer-box span {
    display: block;
    margin-bottom: 0.38rem;
    color: var(--ink-soft);
}

.answer-box input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(115, 77, 46, 0.22);
    background: rgba(255, 252, 246, 0.9);
    padding: 0.85rem;
    color: var(--ink);
    outline: none;
}

.answer-box input:focus {
    border-color: rgba(148, 82, 42, 0.5);
    box-shadow: 0 0 0 3px rgba(148, 82, 42, 0.08);
}

.answer-box input:disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background: rgba(242, 233, 219, 0.72);
}

.submit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.feedback-panel {
    border-radius: 14px;
    background: rgba(255, 251, 244, 0.84);
}

.feedback-panel.is-success {
    border-color: rgba(45, 108, 75, 0.28);
    background: rgba(238, 251, 244, 0.92);
}

.feedback-panel.is-error {
    border-color: rgba(166, 75, 29, 0.28);
    background: rgba(255, 243, 237, 0.92);
}

.history-list {
    list-style: none;
    margin-top: 0.8rem;
    display: grid;
    gap: 0.62rem;
}

.history-item,
.empty-history {
    border-radius: 14px;
    border: 1px solid rgba(118, 78, 47, 0.18);
    background: rgba(255, 251, 244, 0.84);
    padding: 0.72rem 0.8rem;
}

.history-item.is-success {
    border-left: 4px solid var(--good);
}

.history-item.is-error {
    border-left: 4px solid var(--accent);
}

.history-item.is-skip {
    border-left: 4px solid var(--warn);
}

.history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.history-line {
    margin-top: 0.34rem;
    font-size: 1.08rem;
    color: var(--ink);
}

.history-note {
    margin-top: 0.24rem;
    color: var(--ink-soft);
}

@media (max-width: 980px) {
    .qsls-topbar {
        position: static;
        flex-direction: column;
        align-items: flex-start;
    }

    .qsls-hero {
        grid-template-columns: 1fr;
    }

    .qsls-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .qsls-shell {
        width: calc(100% - 1rem);
        margin-top: 0.55rem;
    }

    .qsls-brand img {
        width: 48px;
        height: 48px;
    }

    .cup-track {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .section-head {
        flex-direction: column;
    }
}
