:root {
  --paper: #f7f2e8;
  --paper-strong: #fffaf0;
  --ink: #20251f;
  --muted: #6b6a60;
  --line: rgba(32, 37, 31, 0.14);
  --moss: #315f50;
  --clay: #b7634b;
  --sand: #ead6b8;
  --gold: #9c7837;
  --shadow: 0 14px 32px rgba(48, 43, 33, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(183, 99, 75, 0.16), transparent 24rem),
    radial-gradient(circle at 90% 8rem, rgba(49, 95, 80, 0.14), transparent 22rem),
    linear-gradient(145deg, #f4ead8 0%, var(--paper) 42%, #edf1e6 100%);
  font-family: "Microsoft YaHei", "Noto Sans SC", "PingFang SC", "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero {
  position: relative;
  z-index: 2;
  padding: 0.85rem 0.78rem 0.95rem;
  border-bottom: 1px solid rgba(32, 37, 31, 0.08);
  background: rgba(247, 242, 232, 0.9);
  backdrop-filter: blur(16px);
}

.topbar,
.intro,
.app-shell {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.78rem;
  min-width: 0;
}

.topbar > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.22rem;
  color: var(--clay);
  font-family: "Aptos", "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  max-width: 100%;
  font-size: clamp(1.28rem, 7vw, 3.5rem);
  line-height: 1.14;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.auth-locked {
  min-height: 100vh;
}

.auth-locked .hero,
.auth-locked .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.1rem;
}

.auth-ready .auth-screen {
  display: none;
}

.auth-card {
  width: min(100%, 25rem);
  border: 1px solid rgba(32, 37, 31, 0.13);
  border-radius: 1.35rem;
  padding: 1.15rem;
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.96), rgba(239, 232, 215, 0.92)),
    radial-gradient(circle at 12% 0%, rgba(183, 99, 75, 0.16), transparent 12rem);
  box-shadow: 0 24px 70px rgba(48, 43, 33, 0.18);
}

.auth-card h1 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.6rem, 8vw, 2.4rem);
  letter-spacing: -0.05em;
}

.auth-copy,
.auth-note {
  color: var(--muted);
  line-height: 1.7;
}

.auth-copy {
  margin-bottom: 1rem;
}

.auth-note {
  margin: 0.9rem 0 0;
  font-size: 0.78rem;
}

.auth-form {
  display: grid;
  gap: 0.45rem;
}

.auth-form label {
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 850;
}

.auth-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.auth-input-row input {
  min-width: 0;
  min-height: 3rem;
  border: 1px solid rgba(32, 37, 31, 0.16);
  border-radius: 0.9rem;
  padding: 0.82rem 0.9rem;
  outline: none;
  background: var(--paper-strong);
  color: var(--ink);
  letter-spacing: 0.08em;
}

.auth-input-row input:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(49, 95, 80, 0.14);
}

.auth-input-row button {
  min-height: 3rem;
  border: 0;
  border-radius: 0.9rem;
  padding: 0 1.05rem;
  background: var(--moss);
  color: #fffaf0;
  font-weight: 850;
  box-shadow: 0 12px 30px rgba(49, 95, 80, 0.22);
}

.auth-input-row button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.auth-error {
  min-height: 1.25rem;
  margin: 0.1rem 0 0;
  color: var(--clay);
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-form.is-error .auth-input-row {
  animation: authShake 260ms ease both;
}

.lang-toggle,
.ghost-button,
.filter-toggle,
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.78);
  color: var(--ink);
}

.lang-toggle {
  flex: 0 0 auto;
  min-width: 3rem;
  padding: 0.6rem 0.78rem;
  box-shadow: 0 10px 24px rgba(48, 43, 33, 0.14);
  font-family: "Aptos", "Segoe UI", sans-serif;
  font-weight: 850;
}

.intro {
  display: grid;
  gap: 0.68rem;
  margin-top: 0.82rem;
}

.intro p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.62;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: rgba(255, 250, 240, 0.64);
}

.stats span {
  min-width: 0;
  padding: 0.58rem 0.48rem;
  border-right: 1px solid var(--line);
}

.stats span:last-child {
  border-right: 0;
}

.stats strong,
.stats em {
  display: block;
}

.stats strong {
  font-family: "Aptos Display", "Segoe UI", sans-serif;
  font-size: 1.02rem;
}

.stats em {
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
}

.app-shell {
  padding: 0.72rem;
}

.control-panel,
.source-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  background: rgba(255, 250, 240, 0.72);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 0.45rem;
  z-index: 12;
  display: grid;
  gap: 0;
  max-height: none;
  overflow: visible;
  overscroll-behavior: contain;
  padding: 0.52rem;
  background: rgba(255, 250, 240, 0.92);
  backdrop-filter: blur(18px);
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.52rem;
  min-width: 0;
}

.search-box,
.filter-block,
.filter-grid,
.chips {
  min-width: 0;
}

.search-box {
  display: block;
  width: 100%;
  position: relative;
}

.search-box span,
.filter-block p {
  display: block;
  margin-bottom: 0.46rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.search-box input {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid rgba(32, 37, 31, 0.18);
  border-radius: 0.82rem;
  padding: 0.68rem 0.78rem;
  outline: none;
  background: var(--paper-strong);
  color: var(--ink);
}

.filter-toggle {
  min-height: 2.6rem;
  padding: 0.62rem 0.82rem;
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 850;
}

.filter-toggle::after {
  content: "⌄";
  display: inline-block;
  margin-left: 0.32rem;
  transition: transform 180ms ease;
}

.filters-open .filter-toggle::after {
  transform: rotate(180deg);
}

.filter-content {
  display: none;
}

.filters-open .filter-content {
  display: grid;
  gap: 0.78rem;
  max-height: min(42vh, 22rem);
  margin-top: 0.7rem;
  padding-top: 0.72rem;
  border-top: 1px solid var(--line);
  overflow-y: auto;
  animation: answerIn 180ms ease both;
}

.search-box input:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(49, 95, 80, 0.15);
}

.filter-grid {
  display: grid;
  gap: 0.78rem;
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.48rem;
  width: 100%;
}

.chip {
  width: 100%;
  max-width: 100%;
  padding: 0.54rem 0.72rem;
  font-size: 0.78rem;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.chip:hover {
  transform: translateY(-1px);
}

.chip.active {
  border-color: var(--moss);
  background: var(--moss);
  color: #fffaf0;
}

.result-bar {
  position: relative;
  top: auto;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.78rem 0;
  padding: 0.6rem 0.68rem;
  border: 1px solid rgba(32, 37, 31, 0.1);
  border-radius: 999px;
  background: rgba(247, 242, 232, 0.88);
  backdrop-filter: blur(14px);
}

.result-bar strong {
  font-family: "Aptos Display", "Segoe UI", sans-serif;
  font-size: 1.08rem;
}

.result-bar span {
  color: var(--muted);
  font-size: 0.78rem;
}

.ghost-button {
  flex: 0 0 auto;
  padding: 0.52rem 0.65rem;
  color: var(--moss);
  font-size: 0.76rem;
  font-weight: 760;
}

.question-list {
  display: grid;
  gap: 0.74rem;
}

.question-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.88rem;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 12px 28px rgba(48, 43, 33, 0.08);
  animation: rise 360ms ease both;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.question-card.is-open {
  border-color: rgba(183, 99, 75, 0.34);
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 16px 38px rgba(48, 43, 33, 0.14);
}

.card-head,
.tag-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.qid {
  font-family: "Aptos", "Segoe UI", sans-serif;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.module-pill,
.tag {
  border-radius: 999px;
  padding: 0.28rem 0.52rem;
  font-size: 0.68rem;
  line-height: 1.12;
}

.module-pill {
  background: var(--sand);
  color: #594022;
  font-weight: 850;
}

.question-text {
  margin: 0.62rem 0 0.78rem;
  font-size: 1.02rem;
  line-height: 1.52;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.tag {
  background: rgba(49, 95, 80, 0.1);
  color: var(--moss);
}

.answer-panel {
  margin-top: 0.86rem;
  border-top: 1px solid var(--line);
}

.answer-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 2.75rem;
  margin-top: 0.78rem;
  border-radius: 0.82rem;
  padding: 0.72rem 0.82rem;
  list-style: none;
  background: rgba(183, 99, 75, 0.1);
  color: var(--clay);
  font-weight: 850;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.answer-panel summary::-webkit-details-marker {
  display: none;
}

.answer-panel summary::after {
  content: "+";
  display: grid;
  place-items: center;
  flex: 0 0 1.35rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--paper-strong);
  color: var(--clay);
  font-family: "Aptos", "Segoe UI", sans-serif;
  line-height: 1;
  transition: transform 180ms ease;
}

.answer-panel[open] summary {
  background: var(--clay);
  color: #fffaf0;
}

.answer-panel[open] summary::after {
  content: "-";
  transform: rotate(180deg);
}

.answer-grid {
  display: grid;
  gap: 0.76rem;
  padding-top: 0.86rem;
  animation: answerIn 220ms ease both;
}

.answer-part {
  display: grid;
  gap: 0.24rem;
}

.answer-part h3 {
  margin: 0;
  color: var(--moss);
  font-size: 0.78rem;
}

.answer-part p {
  margin: 0;
  color: #31342f;
  line-height: 1.78;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.script-part {
  margin-top: 0.12rem;
  border-left: 3px solid var(--clay);
  border-radius: 0.82rem;
  padding: 0.75rem 0.82rem;
  background: rgba(183, 99, 75, 0.08);
}

.manager-note {
  border-left-color: var(--moss);
  background: rgba(49, 95, 80, 0.08);
}

.source-panel {
  display: grid;
  gap: 0.75rem;
  margin: 1.1rem 0 2rem;
  padding: 0.92rem;
}

.source-panel h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
}

.source-panel p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.68;
}

.source-panel ul {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-panel a {
  color: var(--moss);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.source-panel a:hover {
  text-decoration: underline;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 1rem;
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.58);
}

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

@keyframes answerIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes authShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@media (min-width: 760px) {
  .hero {
    position: sticky;
    top: 0;
    padding: 1.35rem 1.5rem 1.45rem;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 22rem;
    align-items: end;
    gap: 0.85rem;
  }

  .intro p {
    font-size: 0.98rem;
    line-height: 1.72;
  }

  .stats span {
    padding: 0.72rem;
  }

  .stats strong {
    font-size: 1.18rem;
  }

  .stats em {
    font-size: 0.72rem;
  }

  .app-shell {
    padding: 1.4rem 1.5rem;
  }

  .control-panel {
    top: 7.8rem;
    max-height: none;
    overflow: visible;
    grid-template-columns: minmax(16rem, 1.1fr) minmax(0, 1.6fr);
    gap: 1rem;
    align-items: start;
    padding: 1.25rem;
  }

  .filter-toolbar {
    display: block;
  }

  .filter-toggle {
    display: none;
  }

  .filter-content {
    display: grid;
    gap: 1rem;
    max-height: none;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    overflow: visible;
  }

  .search-box span {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

  .search-box input {
    min-height: 2.9rem;
    padding: 0.82rem 0.9rem;
  }

  .filter-grid {
    grid-template-columns: 1fr 1.2fr;
  }

  .chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    width: auto;
    flex: 0 0 auto;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .result-bar {
    position: sticky;
    top: 15.6rem;
    margin: 1rem 0;
    padding: 0.7rem 0.8rem;
  }

  .question-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .question-card {
    border-radius: 1.25rem;
    padding: 1.2rem;
  }

  .source-panel {
    grid-template-columns: 0.85fr 1.15fr;
    padding: 1.25rem;
  }
}

@media (min-width: 1040px) {
  .question-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-bar {
    top: 15rem;
  }
}
