:root {
    --ink: #2d2017;
    --ink-soft: #64513f;
    --paper-top: #f8efdd;
    --paper-bottom: #e3cfaa;
    --panel: rgba(255, 248, 233, 0.84);
    --line: rgba(108, 72, 42, 0.22);
    --shadow: 0 16px 34px rgba(63, 39, 21, 0.16);
    --accent: #9b461c;
    --accent-strong: #6c2d11;
    --good: #2d6c4b;
    --warn: #8d6a2a;
}

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

button,
textarea {
    font: inherit;
}

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

.fhl-body {
    min-height: 100vh;
    color: var(--ink);
    font-family: "STKaiti", "KaiTi", "SimSun", serif;
    background:
        radial-gradient(circle at 10% 12%, rgba(179, 114, 63, 0.24) 0, transparent 35%),
        radial-gradient(circle at 88% 10%, rgba(92, 53, 29, 0.22) 0, transparent 34%),
        linear-gradient(180deg, var(--paper-top) 0%, var(--paper-bottom) 100%);
    position: relative;
}

.fhl-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 34px,
            rgba(120, 82, 50, 0.05) 35px
        );
}

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

.fhl-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);
}

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

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

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

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

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

.fhl-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: all 0.22s ease;
}

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

.fhl-hero {
    margin-top: 1rem;
    border-radius: 24px;
    padding: clamp(1.2rem, 3vw, 2.2rem);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 1rem;
    color: #f7f0e4;
    background:
        linear-gradient(112deg, rgba(56, 31, 18, 0.94) 0%, rgba(117, 54, 24, 0.88) 56%, rgba(48, 28, 16, 0.9) 100%),
        url("../Photo/仇英汉宫春晓图.jpg") center/cover no-repeat;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    animation: rise-in 0.72s ease both;
}

.fhl-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;
}

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

.fhl-hero-copy p {
    max-width: 50ch;
    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.08);
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.hero-tags span.is-current {
    transform: translateY(-2px);
    border-color: rgba(255, 239, 211, 0.7);
    background: rgba(255, 241, 221, 0.2);
}

.hero-tags span.is-done {
    opacity: 0.45;
}

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

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

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

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

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

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

.keyword-card,
.hint-panel,
.rules-panel,
.answer-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;
}

.keyword-card strong {
    display: block;
    margin-top: 0.18rem;
    font-size: 4.2rem;
    line-height: 1;
    color: var(--accent-strong);
}

.keyword-card p {
    margin-top: 0.45rem;
    line-height: 1.6;
}

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

.stats-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;
}

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

.stats-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-strong) 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;
}

.hint-panel h3,
.rules-panel h3,
.answer-head h2,
.history-head h2,
.feedback-box h3 {
    font-size: 1.28rem;
    color: var(--accent-strong);
}

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

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

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

.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%);
}

.answer-box {
    display: block;
    margin-top: 0.8rem;
}

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

.answer-box textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    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 textarea:focus {
    border-color: rgba(155, 70, 28, 0.5);
    box-shadow: 0 0 0 3px rgba(155, 70, 28, 0.08);
}

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

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

.feedback-box {
    margin-top: 0.8rem;
    padding: 0.8rem;
    border-radius: 14px;
    border: 1px solid rgba(117, 78, 47, 0.18);
    background: rgba(255, 251, 244, 0.82);
}

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

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

.history-head p {
    margin-top: 0.18rem;
}

.history-list {
    margin-top: 0.8rem;
    list-style: none;
    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-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.12rem;
    color: var(--ink);
}

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

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

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

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .answer-head,
    .history-head {
        flex-direction: column;
    }
}
