:root {
  --j-paper: #f3f4ee;
  --j-surface: #fffefa;
  --j-forest: #23382f;
  --j-forest-deep: #1d3029;
  --j-ink: #25342d;
  --j-muted: #5d6d63;
  --j-line: #dbe2d7;
  --j-gold: #c4a572;
  --j-gold-deep: #8e7044;
}

body.home-page, body.score-page {
  background: var(--j-paper);
  color: var(--j-ink);
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}
body.home-page a:focus-visible, body.score-page a:focus-visible,
body.home-page button:focus-visible, body.score-page button:focus-visible,
body.score-page select:focus-visible, body.score-page input:focus-visible {
  outline: 3px solid var(--j-gold);
  outline-offset: 3px;
}

/* Homepage: one clear primary task, with the game palette used only as an accent. */
.home-page .container { max-width: 1240px; padding: clamp(14px, 2.2vw, 28px); }
.home-page .site-hero {
  position: relative;
  overflow: hidden;
  text-align: left;
  padding: clamp(22px, 3.1vw, 40px) clamp(24px, 4.8vw, 62px) 0;
  background: radial-gradient(circle at 86% 42%, #46604c 0, transparent 36%), linear-gradient(140deg, #1c302a, #2d4338);
  color: #f7f3e8;
  border: 1px solid #30483b;
  border-radius: 18px;
  box-shadow: 0 16px 40px #203b2d1a;
  margin-bottom: 18px;
}
.hero-topline { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.site-brand { display: inline-flex; align-items: center; gap: 12px; color: #f7f3e8; text-decoration: none; font-weight: 700; letter-spacing: .04em; line-height: 1.2; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #bfa370; color: #e0c58f; font-family: 'Songti SC', 'SimSun', serif; font-size: 21px; font-weight: 400; }
.brand-sub { display: block; margin-top: 4px; color: #bdcbbd; font-size: 11px; font-weight: 500; letter-spacing: .16em; }
.hero-nav { display: flex; gap: clamp(14px, 2.2vw, 29px); }
.hero-nav a { color: #e5e9dc; text-decoration: none; font-size: 13px; border-bottom: 1px solid transparent; padding: 5px 0; }
.hero-nav a:hover { border-color: var(--j-gold); color: #f6e7c1; }
.hero-nav .hero-game-nav { color: #f0d7a4; border-bottom-color: #b99d65; font-weight: 700; }
.hero-content { max-width: 800px; padding: clamp(45px, 6.6vw, 90px) 0 clamp(44px, 5.8vw, 72px); }
.hero-eyebrow, .section-kicker { color: var(--j-gold); font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.home-page .site-hero h1 {
  margin: 13px 0 19px;
  color: #f7f3e8;
  font: 700 clamp(2.2rem, 4.45vw, 4.6rem)/1.23 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif;
  letter-spacing: .01em;
}
.home-page .site-hero .subtitle { max-width: 660px; margin: 0; color: #d4ded1; font-size: clamp(14px, 1.27vw, 16px); line-height: 1.9; }
.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 29px; }
.hero-actions a { display: inline-flex; align-items: center; justify-content: space-between; gap: 26px; min-height: 48px; padding: 11px 18px; border-radius: 7px; text-decoration: none; font-weight: 700; font-size: 14px; transition: transform .2s ease, background .2s ease; }
.hero-actions a:hover { transform: translateY(-2px); }
.hero-primary { background: #d3b583; color: #20322a; }
.hero-primary:hover { background: #e4c994; }
.hero-secondary { border: 1px solid #8aa08d; color: #f2efe3; }
.hero-secondary:hover { background: #3b5546; }
.hero-game-link { border: 1px solid #c3a76f; color: #f4dca9; background: #344536; }
.hero-game-link:hover { background: #455b45; }
.hero-footnotes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-top: 1px solid #71847575; padding: 15px 0 17px; color: #d3ddcf; font-size: 12px; }
.hero-footnotes span { border-left: 1px solid #788d7a66; padding-left: 13px; }
.hero-footnotes span:first-child { border-left: 0; padding-left: 0; }
.hero-footnotes strong { color: #efd8a8; margin-right: 3px; font-size: 14px; }
.home-page .ad-slot { background: transparent !important; box-shadow: none !important; padding: 0 !important; margin: 10px 0 18px !important; max-width: 100%; overflow-x: clip; }

.home-page .score-summary, .home-page .time-section, .home-page .cta-section, .home-page .categories-section {
  background: var(--j-surface);
  color: var(--j-ink);
  border: 1px solid var(--j-line);
  border-radius: 14px;
  box-shadow: 0 5px 24px #1d30290d;
  padding: clamp(22px, 3vw, 36px);
  margin-bottom: 18px;
}
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 18px; }
.section-heading h2, .home-page .time-section h2, .home-page .cta-section h2, .home-page .categories-section h2 {
  color: var(--j-forest);
  text-align: left;
  font: 700 clamp(1.55rem, 2.1vw, 2rem)/1.3 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif;
  margin: 5px 0 0;
}
.score-note { color: var(--j-muted); font-size: 13px; line-height: 1.55; text-align: right; max-width: 390px; }
.score-table { border: 1px solid var(--j-line); border-radius: 8px !important; }
.score-table thead th { background: #e7ede5 !important; color: #30463a !important; border-bottom: 1px solid #cbd8cb; }
.score-table tbody tr { background: #fffefa !important; }
.score-table tbody tr:nth-child(even) { background: #f4f6ef !important; }
.score-table tbody td { color: var(--j-ink) !important; }
.score-table tbody tr:first-child td:first-child .ui-icon { color: #a77f42; }
.score-table tbody tr:nth-child(2) td:first-child .ui-icon,
.score-table tbody tr:nth-child(3) td:first-child .ui-icon { color: #7e9391; }
.score-table tbody td:last-child { color: #7f6236 !important; font-weight: 800; }
.home-page .score-summary > p:last-child { color: var(--j-muted) !important; opacity: 1 !important; }
.year-round-panel { display: flex; justify-content: space-between; align-items: center; gap: 25px; padding: clamp(22px, 3vw, 35px); margin-bottom: 18px; background: #e8eee5; border: 1px solid #cbd9ca; border-radius: 14px; }
.year-round-panel > div { max-width: 760px; }
.year-round-panel .section-kicker { color: var(--j-gold-deep); }
.year-round-panel h2 { color: var(--j-forest); font: 700 clamp(1.35rem, 2vw, 1.8rem)/1.4 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif; margin: 5px 0 9px; }
.year-round-panel p:not(.section-kicker) { color: var(--j-muted); font-size: 14px; line-height: 1.7; }
.year-round-panel a { flex: none; display: inline-flex; align-items: center; gap: 22px; padding: 12px 17px; background: var(--j-forest); color: #f8f4e9; border-radius: 6px; font-weight: 700; font-size: 14px; text-decoration: none; }
.year-round-panel a:hover { background: #365446; }

.home-page .time-section h2, .home-page .cta-section h2, .home-page .categories-section h2 { margin-bottom: 22px; }
.home-page .timeline::before { background: #a9bbaa; border-radius: 0; width: 2px; }
.home-page .timeline-item::before { background: var(--j-gold); box-shadow: 0 0 0 3px #e8eee5; border: 2px solid var(--j-surface); }
.home-page .timeline-date { color: #496450; }
.home-page .timeline-content { color: var(--j-muted); }
.home-page .highlight { background: #f6f1e4; border-left-color: var(--j-gold); color: #574b32; }
.home-page .highlight a { color: #345a47; }
.home-page .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; text-align: left; }
.home-page .step { width: auto; max-width: none; min-width: 0; border: 1px solid var(--j-line); background: #f6f8f2; padding: 20px; border-radius: 9px; }
.home-page .step-number { width: auto; height: auto; display: block; margin: 0 0 16px; background: none; color: var(--j-gold-deep); font: 700 13px/1.2 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.home-page .step-number::before { content: 'STEP '; letter-spacing: .12em; }
.home-page .step-title { color: var(--j-forest); font-size: 16px; }
.home-page .step-desc { color: var(--j-muted); line-height: 1.7; }
.home-page .btn-primary { background: var(--j-forest); border-radius: 7px; font-size: 15px; box-shadow: none; padding: 12px 22px; }
.home-page .btn-primary:hover { background: #3c5848; box-shadow: 0 7px 20px #1d30291a; }
.home-page .categories-grid { grid-template-columns: repeat(5, 1fr); gap: 9px; }
.home-page .category-tag { background: #f0f4ec; border: 1px solid #e0e7dd; color: #385546; font-size: 13px; }
.home-page .category-tag:hover { background: #e2ebdf; color: var(--j-forest); transform: none; }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.quick-link { display: block; background: var(--j-surface); border: 1px solid var(--j-line); border-radius: 12px; padding: 25px 28px; color: var(--j-ink); text-decoration: none; transition: border-color .2s ease, transform .2s ease; }
.quick-link:hover { border-color: #809a82; transform: translateY(-2px); }
.sql-learning { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin: 24px 0; padding: 25px 30px; background: #e9eee7; border: 1px solid #cbd8ca; border-radius: 14px; }
.sql-learning-label { color: #6f765f; font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.sql-learning h2 { margin: 5px 0 7px; color: var(--j-forest); font: 700 23px/1.4 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif; }
.sql-learning p { max-width: 650px; margin: 0; color: var(--j-muted); font-size: 14px; line-height: 1.7; }
.sql-learning-link { flex: none; padding: 12px 18px; color: #fffefa; background: var(--j-forest); border-radius: 6px; text-decoration: none; font-size: 14px; font-weight: 700; }
.sql-learning-link:hover { background: #3b5948; }
.quick-link-number { color: var(--j-gold-deep); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.quick-link h3 { margin: 9px 0 6px; color: var(--j-forest); font: 700 21px/1.4 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif; }
.quick-link h3 span { float: right; font: 18px sans-serif; }
.quick-link p { color: var(--j-muted); font-size: 14px; line-height: 1.6; }
.home-page footer { background: transparent; box-shadow: none; border-radius: 0; padding: 15px 0 25px; }
.home-page footer p { color: var(--j-muted); }
.home-page footer a { color: #41654f; }

/* The query tool shares the palette, while its controls and data remain the focus. */
.score-page .container { max-width: 1400px; padding: clamp(12px, 2vw, 28px); }
.score-page .card { background: var(--j-surface); border: 1px solid var(--j-line); border-radius: 14px; box-shadow: 0 8px 30px #203b2d12; padding: clamp(20px, 3vw, 38px); }
.score-page .back-link { display: inline-block; margin-bottom: 16px; color: #4f6b58; text-decoration: none; font-size: 13px; font-weight: 700; }
.score-page .back-link:hover { text-decoration: underline; }
.score-page h1 { color: var(--j-forest); text-align: left; font: 700 clamp(1.7rem, 2.7vw, 2.7rem)/1.3 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif; }
.score-page .subtitle { text-align: left; color: var(--j-muted); margin-bottom: 22px; }
.score-page .controls { background: #f2f5ef; border: 1px solid var(--j-line); border-radius: 9px; gap: 12px; padding: 17px; }
.score-page .control-group label { color: #40594a; }
.score-page select, .score-page input { border: 1px solid #bfcfc0; background: #fffefa; color: var(--j-ink); border-radius: 6px; min-height: 43px; }
.score-page select:focus, .score-page input:focus { border-color: #4a7257; }
.score-page .btn { background: var(--j-forest); border-radius: 6px; min-height: 43px; box-shadow: none; }
.score-page .btn:hover { background: #3b5948; }
.score-page .btn-quiet { background: #e6ece3; color: var(--j-forest); border: 1px solid #c9d6c8; }
.score-page .btn-quiet:hover { background: #d9e5d8; }
.score-page .info-text { color: var(--j-muted); }
.score-page .highlight-score { color: #7d6138; }
.score-page .cat-tag.active { background: var(--j-forest); color: #f6f3e8; }
.score-page .cat-tag:not(.active) { background: #edf2ea; color: #365546; }
.score-page .cat-tag:hover { background: #dce8d9; color: var(--j-forest); }
.score-page .table-wrap { border: 1px solid var(--j-line); border-radius: 8px; }
.score-page thead th { background: var(--j-forest); color: #fffefa; }
.score-page tbody td { border-bottom: 1px solid #e7ece4; }
.score-page tbody tr:hover { background: #edf3eb !important; }
.score-page tbody tr.score-row { background: #f7f3e9; }
.score-page tbody tr.score-row td { color: #876b45; }
.score-page .found-row, .score-page tbody tr.found-row:hover { background: #efe4c7 !important; animation: none; outline: 2px solid #c8a76b; outline-offset: -2px; }
.score-page footer { color: var(--j-muted); }
.score-page footer a { color: #3d5f49; }

@media (max-width: 800px) {
  .home-page .site-hero { padding: 22px 24px 0; }
  .hero-topline { align-items: flex-start; flex-wrap: wrap; }
  .hero-content { padding: 42px 0 44px; }
  .hero-footnotes { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
  .hero-footnotes span:nth-child(3) { border-left: 0; padding-left: 0; }
  .section-heading, .year-round-panel { align-items: flex-start; flex-direction: column; }
  .score-note { text-align: left; }
  .home-page .steps { grid-template-columns: 1fr; }
  .home-page .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-links { grid-template-columns: 1fr; }
  .sql-learning { align-items: flex-start; flex-direction: column; }
  .score-page .controls { flex-direction: row; }
}
@media (max-width: 520px) {
  .hero-nav { width: 100%; justify-content: space-between; gap: 8px; }
  .hero-content { padding-top: 37px; }
  .home-page .site-hero h1 { font-size: clamp(2.1rem, 10vw, 2.9rem); }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions a { width: 100%; }
  .hero-footnotes { font-size: 11px; }
  .score-table { min-width: 520px; }
  .home-page .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .home-page .category-tag { padding: 11px 8px; }
  .score-page .controls { display: grid; grid-template-columns: 1fr 1fr; }
  .score-page .control-group { min-width: 0; }
  .score-page .control-group:nth-child(3) { grid-column: 1 / -1; }
  .score-page select, .score-page input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .home-page *, .score-page * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
