:root {
  color-scheme: light;
  --teal-900: #173f3a;
  --teal-800: #1d5149;
  --teal-700: #24695c;
  --teal-600: #2d7c6e;
  --teal-100: #dff0eb;
  --teal-050: #f1f8f6;
  --ink: #182321;
  --muted: #667572;
  --line: #dce6e3;
  --canvas: #f5f8f8;
  --surface: #ffffff;
  --sand: #b88945;
  --danger: #b73a3a;
  --shadow: 0 12px 30px rgba(21, 54, 49, 0.08);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 max(22px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: var(--teal-700);
  letter-spacing: 0.04em;
  font-size: 14px;
}
.brand-copy { font-size: 17px; }
.topbar-note, .quiet-link { color: var(--muted); font-size: 14px; }
.quiet-link:hover { color: var(--teal-700); }

.page-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 52px 0 140px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: var(--teal-700); font-size: 13px; font-weight: 750; letter-spacing: 0.12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(31px, 5vw, 48px); line-height: 1.15; letter-spacing: -0.035em; }
.intro-copy { max-width: 620px; margin-bottom: 0; color: var(--muted); font-size: 17px; }
.topic-total { flex: 0 0 auto; display: flex; align-items: baseline; gap: 7px; color: var(--muted); }
.topic-total strong { color: var(--teal-700); font-size: 36px; line-height: 1; }

.toolbar { display: flex; gap: 12px; margin-bottom: 18px; }
.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(21, 54, 49, 0.035);
}
.search-box:focus-within { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(36, 105, 92, 0.12); }
.search-box svg { width: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 16px; }
.search-box input::placeholder { color: #95a19f; }
.quiet-button, .text-button, .icon-button, .primary-button {
  border: 0;
  border-radius: 12px;
  transition: background-color 170ms ease, color 170ms ease, border-color 170ms ease, transform 170ms ease;
}
.quiet-button { padding: 0 17px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.quiet-button:hover { color: var(--teal-700); border-color: #aaccc4; }
.text-button { padding: 7px 10px; background: transparent; color: var(--teal-700); }
.text-button:hover { background: var(--teal-050); }
.primary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; background: var(--teal-700); color: white; font-weight: 700; }
.primary-button:hover { background: var(--teal-800); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.full-button { width: 100%; }

.category-tabs { display: flex; gap: 9px; overflow-x: auto; padding: 3px 1px 14px; scrollbar-width: thin; }
.category-tab { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.category-tab:hover { border-color: #aaccc4; color: var(--teal-700); }
.category-tab.active { background: var(--teal-700); border-color: var(--teal-700); color: white; }
.category-tab span { margin-left: 4px; opacity: 0.72; font-size: 13px; }

.topic-section { margin-top: 8px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 14px; }
.section-heading h2 { margin-bottom: 2px; font-size: 20px; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.topic-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.topic-card {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 13px;
  min-height: 112px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 3px 14px rgba(21, 54, 49, 0.035);
  cursor: pointer;
  transition: border-color 170ms ease, background-color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}
.topic-card:hover { transform: translateY(-1px); border-color: #aaccc4; box-shadow: var(--shadow); }
.topic-card.selected { background: var(--teal-050); border-color: var(--teal-600); }
.topic-card input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 24px; height: 24px; border: 1.5px solid #a8b6b3; border-radius: 7px; background: white; }
.topic-card.selected .checkmark { display: grid; place-items: center; border-color: var(--teal-700); background: var(--teal-700); color: white; }
.topic-card.selected .checkmark::after { content: "✓"; font-size: 15px; font-weight: 800; line-height: 1; }
.topic-copy { min-width: 0; }
.topic-copy h3 { margin: 0 0 10px; font-size: 16px; line-height: 1.55; font-weight: 650; }
.topic-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.category-label { color: var(--teal-700); }
.heat-label::before { content: "·"; margin-right: 8px; color: #b7c2bf; }
.empty-state { display: grid; place-items: center; gap: 4px; min-height: 220px; padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed #cbd8d5; border-radius: var(--radius); }
.empty-state strong { color: var(--ink); font-size: 18px; }

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  width: min(700px, calc(100% - 30px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px 12px 20px;
  color: white;
  background: var(--teal-900);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 20px 46px rgba(17, 48, 44, 0.28);
}
.selection-bar > div { display: flex; align-items: center; gap: 8px; }
.selection-bar .text-button { color: #b8d9d2; }
.selection-bar .text-button:hover { background: rgba(255,255,255,0.08); }
.selection-bar .primary-button { background: white; color: var(--teal-900); }

dialog { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 28px 70px rgba(14, 38, 35, 0.27); }
dialog::backdrop { background: rgba(10, 28, 25, 0.55); backdrop-filter: blur(3px); }
.success-dialog { padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; }
.dialog-heading h2, .success-dialog h2 { margin-bottom: 4px; font-size: 25px; }
.icon-button { width: 36px; height: 36px; background: #f1f4f3; color: var(--muted); font-size: 24px; line-height: 1; }
.dialog-summary { margin: 8px 0 22px; color: var(--muted); }
.password-form { padding: 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-actions .quiet-button { min-height: 46px; }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field span { font-size: 14px; font-weight: 650; }
.field b { color: var(--danger); }
.field input, .field textarea { width: 100%; padding: 12px 14px; color: var(--ink); background: white; border: 1px solid #cad8d5; border-radius: 12px; outline: 0; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(36, 105, 92, 0.12); }
.form-error { margin: 2px 0 14px; color: var(--danger); font-size: 14px; }
.success-dialog { text-align: center; }
.success-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 14px; color: white; background: var(--teal-700); border-radius: 50%; font-size: 28px; font-weight: 800; }
.success-dialog p { color: var(--muted); }
.receipt { display: block; margin: 14px 0 22px; color: var(--muted); font-size: 13px; }

.admin-body { background: #f2f6f5; }
.admin-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 90px; }
.login-card { width: min(440px, 100%); margin: 8vh auto 0; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 32px; }
.login-card > p:not(.eyebrow) { color: var(--muted); margin-bottom: 26px; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.admin-heading h1 { font-size: 38px; }
.admin-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.summary-card { padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.summary-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.summary-card strong { color: var(--teal-700); font-size: 30px; }
.submission-list { display: grid; gap: 14px; }
.submission-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.submission-card summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; cursor: pointer; }
.submission-card summary::-webkit-details-marker { display: none; }
.submission-card summary:hover { background: #fbfdfc; }
.submission-person { display: flex; align-items: center; gap: 14px; min-width: 0; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; background: var(--teal-100); color: var(--teal-800); font-weight: 800; }
.submission-person strong, .submission-person span { display: block; }
.submission-person span, .submission-meta { color: var(--muted); font-size: 13px; }
.submission-meta { text-align: right; }
.submission-count-badge { display: inline-flex; padding: 3px 9px; margin-bottom: 4px; border-radius: 999px; color: var(--teal-700); background: var(--teal-050); font-weight: 700; }
.submission-body { padding: 18px 22px 22px 78px; border-top: 1px solid var(--line); }
.contact-note { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; padding: 16px 0; color: var(--muted); font-size: 14px; }
.chosen-topics { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.chosen-topics li { padding: 11px 13px; border-left: 3px solid var(--teal-600); background: var(--teal-050); border-radius: 6px 10px 10px 6px; }
.chosen-topics small { display: block; margin-top: 3px; color: var(--muted); }

@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 16px; }
  .brand-copy { font-size: 16px; }
  .topbar-note { display: none; }
  .page-shell, .admin-shell { width: min(100% - 24px, 1120px); padding-top: 30px; }
  .intro { align-items: flex-start; }
  h1 { font-size: 32px; }
  .topic-total { display: none; }
  .toolbar { align-items: stretch; }
  .quiet-button { padding: 0 13px; }
  .topic-list { grid-template-columns: 1fr; }
  .topic-card { min-height: 0; padding: 16px; }
  .selection-bar { bottom: 12px; border-radius: 16px; }
  .selection-bar .primary-button { padding: 0 17px; }
  .success-dialog { padding: 22px; }
  .password-form { padding: 22px; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-heading h1 { font-size: 32px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { display: flex; align-items: center; justify-content: space-between; }
  .summary-card span { margin: 0; }
  .submission-card summary { align-items: flex-start; padding: 17px; }
  .submission-body { padding: 0 17px 18px; }
  .contact-note { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
