/*定义 CSS 变量，统一管理*/
:root {
    /* Surface & Background */
    --page-bg: #f4efe6;
    --panel-bg: #fffaf2;
    --panel-border: #d8c9b3;

    /*text*/
    --text-main: #1d1b16;
    --text-muted: #6c583a;


    /*强调*/
    --accent: #a33d2e;
    /*弱强调*/
    --accent-soft: #f0d6be;

    /*网格与针*/
    --grid-line: #b9ac98;
    --needle-hit: #b7342d;
    --needle-miss: #1f6c77;
    --shadow: 0 18px 40px rgba(48, 38, 20, 0.12);
}


* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Georgia","Times New Roman", serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 35%),
        linear-gradient(180deg, #efe6d7 0%, var(--page-bg) 100%);
    min-height: 100vh;
}

a {
    color: inherit;
}

.site-header {
    padding: 2rem 1.5rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.site-header h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3.25rem);
    letter-spacing: 0.02em;
}

.site-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-nav a {
    text-decoration: none;
    padding: 0.5rem 0.85rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-muted);
}

/*自动高亮当前页面*/
.site-nav a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(163, 61, 46, 0.18);
}

.demo-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

.content-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem;
}

.content-hero,
.content-section {
    margin-bottom: 1.5rem;
}

.content-hero h2,
.content-section h2 {
    margin-top: 0;
}

.content-section p {
    line-height: 1.7;
}

.content-list {
    padding-left: 1.35rem;
    line-height: 1.7;
}

.content-list li + li {
    margin-top: 0.5rem;
}

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.member-card {
    padding: 1rem 1.1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(216, 201, 179, 0.85);
}

.member-card h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--accent);
}

.member-card p {
    margin: 0.45rem 0;
}

.placeholder-text {
    color: var(--text-muted);
}

/* tbl.html Comment Card*/
.gained-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.gained-card {
    position: relative;
    padding: 1.2rem 1.2rem 1.1rem;
    border-radius: 20px;
    background: rgba(255, 242, 145, 0.96);
    border: 1px solid rgba(216, 201, 179, 0.95);
    box-shadow: 0 14px 28px rgba(48, 38, 20, 0.1);
    transform: rotate(-3.8deg);
}

.gained-card:nth-child(2) {
    transform: rotate(1.6deg);
}

.gained-card:nth-child(3) {
    transform: rotate(-0.5deg);
}


.gained-card::before {
    content: "";
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    background: rgb(255, 0, 0);
    box-shadow: 0 2px 4px rgba(48, 38, 20, 0.08);
    transform: rotate(8deg);
}

.gained-card h3 {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 1.1rem;
}

.gained-card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.demo-guide {
    margin-bottom: 1.5rem;
}

.demo-guide details {
    display: block;
}

.demo-guide summary {
    list-style: none;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.demo-guide summary::-webkit-details-marker {
    display: none;
}

.demo-guide summary::after {
    content: "+";
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
}

.demo-guide details[open] summary::after {
    content: "-";
}

.instructions {
    margin-top: 1rem;
    color: var(--text-main);
}

.instructions p {
    margin: 0 0 0.75rem;
}

.instructions ol {
    margin: 0;
    padding-left: 1.4rem;
}

.instructions li + li {
    margin-top: 0.5rem;
}

.demo-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.panel,
.control-panel,
.display-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.panel h2,
.control-panel h2,
.display-panel h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.35rem;
}

.field-grid {
    display: grid;
    gap: 0.9rem;
}

.field {
    display: grid;
    gap: 0.35rem;
}

.field span {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.field input {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    font: inherit;
    background: #fff;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.button-row button {
    border: 0;
    border-radius: 999px;
    padding: 0.8rem 1.1rem;
    font: inherit;
    cursor: pointer;
    background: var(--accent);
    color: #fffaf2;
}

.button-row button:nth-child(2) {
    background: #2f5d62;
}

.button-row button:nth-child(3) {
    background: #6c685f;
}

.status-message {
    min-height: 1.5rem;
    margin: 1rem 0 0;
    color: var(--text-muted);
}

#simulation-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    background:
        linear-gradient(180deg, rgba(255, 251, 244, 0.96), rgba(248, 240, 229, 0.96));
}

.stats-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.85rem;
}

.stat-card {
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(216, 201, 179, 0.85);
}

.stat-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-card strong {
    font-size: 1.1rem;
}


/*Responsive Design*/
@media (max-width: 920px) {
    .demo-layout {
        grid-template-columns: 1fr;
    }

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

    .gained-card,
    .gained-card:nth-child(2),
    .gained-card:nth-child(3) {
        transform: rotate(0deg);
    }
}

.theory-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1.5rem 2.5rem;
}

.theory-hero,
.theory-section {
    margin-bottom: 1.5rem;
}

.theory-hero h2,
.theory-section h2 {
    margin-top: 0;
}

.theory-section h3 {
    margin: 1.6rem 0 0.75rem;
    color: var(--accent);
}

.theory-section p {
    line-height: 1.7;
}

.theory-quote {
    margin: 1rem 0;
    padding: 1rem 1.2rem;
    border-left: 4px solid var(--accent);
    background: rgba(240, 214, 190, 0.45);
    color: var(--text-main);
}

.theory-list {
    padding-left: 1.35rem;
    line-height: 1.7;
}


.theory-list li + li {
    margin-top: 0.75rem;
}

.math-inline {
    white-space: nowrap;
}

.math-display {
    margin: 1rem 0 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(216, 201, 179, 0.9);
    background: rgba(255, 255, 255, 0.7);
    overflow-x: auto;
}

/* ==========================================
   jumpToDemo button
========================================== */
.jumpToDemo  {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    background:var(--accent);
    border: 1px solid rgb(110, 4, 4);
    color: #fffaf2;

    padding: 14px 26px;
    border-radius: 999px; /* 胶囊按钮 */
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;

    backdrop-filter: blur(8px); /*glassmorphism-lite*/
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.12);

    transition: all 0.25s ease;
}

/* Hover：轻微浮起 + 更亮 */
.scroll-down:hover {
    background: var(--accent);
    color: #fffaf2;
    box-shadow: 0 12px 24px rgba(163, 61, 46, 0.22);
    transform: translateY(-3px);
    box-shadow: 0 0 24px rgba(138, 129, 129, 0.22);
}

/* 箭头图标 */
.scroll-icon {
    display: inline-block;
    font-size: 1.1rem;
    animation: floatArrow 1.8s ease-in-out infinite;
}



.jumpToDemo:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(163, 61, 46, 0.28);
}

.jumpToDemo:active {
    transform: translateY(0);
}

.scroll-icon {
    display: inline-block;
    font-size: 1.2rem;
    animation: demo-arrow-sway 2s ease-in-out infinite;
}

@keyframes demo-arrow-sway {
    0%,
    100% {
        transform: translateX(-4px);
    }

    50% {
        transform: translateX(6px);
    }
}