/* ============ 知识奇遇岛 · 设计基座 ============ */
:root {
  --paper: #f5eedf;
  --paper-deep: #ece0c9;
  --card: #fffdf6;
  --card-warm: #fff9ea;
  --ink: #263542;
  --ink-2: #576874;
  --ink-3: #83919a;
  --line: #263542;
  --line-soft: rgba(38, 53, 66, 0.14);
  --teal: #1f8a70;
  --teal-deep: #12604e;
  --teal-soft: #dcefe7;
  --coral: #e86a4f;
  --coral-soft: #fbe5df;
  --gold: #eaa93c;
  --gold-soft: #fdf0d2;
  --sky: #2c86b5;
  --violet: #6a61c7;
  --pink: #c4647e;
  --danger: #c74f45;

  --sub-chinese: #d9664b;
  --sub-chinese-soft: #fbe7e0;
  --sub-math: #2c86b5;
  --sub-math-soft: #e0f0f8;
  --sub-english: #6a61c7;
  --sub-english-soft: #eae7fa;

  --shadow: 5px 5px 0 rgba(38, 53, 66, 0.16);
  --shadow-sm: 3px 3px 0 rgba(38, 53, 66, 0.18);
  --shadow-lg: 8px 8px 0 rgba(38, 53, 66, 0.14);
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Heiti SC", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(38, 53, 66, 0.075) 1px, transparent 1.2px),
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(234, 169, 60, 0.18), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 20%, rgba(31, 138, 112, 0.1), transparent 70%);
  background-size: 18px 18px, auto, auto;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: rgba(234, 169, 60, 0.35);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  font-weight: 900;
  letter-spacing: 0.01em;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--teal-deep);
}

img,
svg {
  display: block;
  max-width: 100%;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid rgba(234, 169, 60, 0.65);
  outline-offset: 3px;
}

.i {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.18em;
  flex: none;
}

/* ---------- 布局 ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 72px;
  flex: 1;
}

.stack {
  display: grid;
  gap: 18px;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.muted {
  color: var(--ink-2);
}

.tiny {
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ---------- 卡片 ---------- */
.panel {
  position: relative;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel.flat {
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2,
.panel-head h3 {
  font-size: 21px;
}

.panel-head .sub {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

.panel-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--teal-deep);
  text-transform: uppercase;
}

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--card);
  --btn-fg: var(--ink);
  height: 48px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 800;
  font-size: 15.5px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 rgba(38, 53, 66, 0.2);
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(38, 53, 66, 0.22);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn .i {
  font-size: 1.05em;
}

.btn.primary {
  --btn-bg: var(--teal);
  --btn-fg: #fffdf6;
}

.btn.coral {
  --btn-bg: var(--coral);
  --btn-fg: #fffdf6;
}

.btn.gold {
  --btn-bg: var(--gold);
  --btn-fg: #3b2a0d;
}

.btn.ghost {
  --btn-bg: transparent;
  box-shadow: none;
  border-color: rgba(38, 53, 66, 0.35);
}

.btn.ghost:hover:not(:disabled) {
  --btn-bg: rgba(255, 253, 246, 0.7);
  box-shadow: var(--shadow-sm);
}

.btn.soft {
  --btn-bg: var(--teal-soft);
  border-color: rgba(38, 53, 66, 0.28);
  box-shadow: none;
}

.btn.lg {
  height: 56px;
  padding: 0 28px;
  font-size: 17px;
  border-radius: 16px;
}

.btn.sm {
  height: 38px;
  padding: 0 14px;
  font-size: 13.5px;
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(38, 53, 66, 0.18);
}

.btn.wide {
  width: 100%;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 2px solid rgba(38, 53, 66, 0.3);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(38, 53, 66, 0.13);
  transition: transform 0.14s ease, background 0.14s ease;
  flex: none;
}

.icon-btn:hover {
  background: var(--card-warm);
  transform: translate(-1px, -1px);
}

.icon-btn:active {
  transform: translate(1px, 1px);
}

.icon-btn .i {
  font-size: 19px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-2);
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
}

.text-btn:hover {
  color: var(--ink);
}

/* ---------- 标签 / 胶囊 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1.5px solid rgba(38, 53, 66, 0.24);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.7);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}

.chip.solid {
  background: var(--teal-soft);
  border-color: rgba(31, 138, 112, 0.3);
  color: var(--teal-deep);
}

.chip.gold {
  background: var(--gold-soft);
  border-color: rgba(234, 169, 60, 0.4);
  color: #7a5510;
}

.chip.coral {
  background: var(--coral-soft);
  border-color: rgba(232, 106, 79, 0.35);
  color: #943726;
}

.chip .i {
  font-size: 14px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}

/* ---------- 表单 ---------- */
.field {
  display: grid;
  gap: 7px;
}

.field > label,
.field-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}

.input,
.textarea {
  width: 100%;
  border: 2px solid rgba(38, 53, 66, 0.28);
  border-radius: 12px;
  background: #fffef9;
  padding: 11px 14px;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 46px;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(31, 138, 112, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 2px solid rgba(38, 53, 66, 0.28);
  border-radius: 999px;
  background: var(--paper);
}

.segmented button {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: #fffdf6;
}

.segmented.teal button[aria-pressed="true"] {
  background: var(--teal);
}

/* ---------- 进度 / 星星 ---------- */
.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 15px;
  letter-spacing: 1px;
  color: #d8c9a8;
}

.stars .on {
  color: var(--gold);
  text-shadow: 0 1px 0 rgba(122, 85, 16, 0.25);
}

.stars.lg {
  font-size: 20px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(38, 53, 66, 0.1);
  overflow: hidden;
  border: 1px solid rgba(38, 53, 66, 0.08);
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 0.35s ease;
}

/* ---------- 皮肤 ---------- */
.subject-chinese {
  --sub: var(--sub-chinese);
  --sub-soft: var(--sub-chinese-soft);
}

.subject-math {
  --sub: var(--sub-math);
  --sub-soft: var(--sub-math-soft);
}

.subject-english {
  --sub: var(--sub-english);
  --sub-soft: var(--sub-english-soft);
}

/* ---------- 空状态/提示 ---------- */
.toast-root {
  position: fixed;
  left: 50%;
  top: 76px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 520px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--ink);
  color: #fffdf6;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  animation: toast-in 0.28s ease both;
}

.toast .i {
  color: var(--gold);
}

.fx-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 80;
  overflow: hidden;
}

/* ---------- 分隔 ---------- */
.rule {
  height: 1.5px;
  background: repeating-linear-gradient(90deg, rgba(38, 53, 66, 0.24) 0 6px, transparent 6px 12px);
  border: 0;
  margin: 18px 0;
}

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

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }
  .screen {
    padding: 14px 14px 56px;
  }
  .panel {
    padding: 18px;
    border-radius: 18px;
    box-shadow: 4px 4px 0 rgba(38, 53, 66, 0.14);
  }
  .panel-head h2 {
    font-size: 19px;
  }
  .btn {
    height: 46px;
    padding: 0 18px;
  }
  .btn.lg {
    height: 52px;
    padding: 0 22px;
    font-size: 16px;
  }
}
