/* =========================================================
   K12 学习计划生成器 · 黑金高奢主题
   近黑底 + 金色点缀 · 细金线 · 低调光泽 · 衬线大字
   ========================================================= */

:root {
  --c-primary: #c4ca68;        /* 主色 · 金 */
  --c-secondary: #a7ba5a;      /* 辅助色 */
  --c-accent: #77da6c;         /* 强调色 CTA */
  --c-bg: #15150e;             /* 页面背景 */
  --c-surface: #23231a;        /* 卡片 / 表面 */
  --c-surface-2: #1c1c15;
  --c-text: #f1f2ee;           /* 正文 */
  --c-muted: #adae98;          /* 次要文字 */
  --c-border: #3f4030;         /* 描边 */

  --font-head: 'Noto Serif SC', 'Songti SC', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;

  --radius: 6px;
  --radius-lg: 10px;
  --gold-grad: linear-gradient(135deg, #e6e2a6 0%, #c4ca68 38%, #8f9a41 72%, #a7ba5a 100%);
  --gloss: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 55%);

  --shadow-soft: 0 18px 50px rgba(0,0,0,0.45);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 18% -10%, rgba(196,202,104,0.07), transparent 60%),
    radial-gradient(900px 520px at 88% 8%, rgba(119,218,108,0.05), transparent 55%),
    var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(196,202,104,0.28); color: #fff; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

button { font-family: inherit; }

/* ================= 顶栏 ================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(21,21,14,0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px; gap: 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--c-text); }

.brand-mark {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--gold-grad);
  position: relative;
  box-shadow: 0 0 18px rgba(196,202,104,0.35);
}
.brand-mark::after {
  content: "K";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #15150e; font-weight: 900;
  font-family: var(--font-head); font-size: 18px;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
}
.brand-sub {
  display: block; font-size: 10px; letter-spacing: 3px;
  color: var(--c-muted); text-transform: uppercase;
}

.header-nav { display: flex; gap: 4px; }

.nav-link {
  background: none; border: 1px solid transparent; cursor: pointer;
  color: var(--c-muted);
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 14px; letter-spacing: 1px;
  transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.nav-link:hover { color: var(--c-text); border-color: var(--c-border); }
.nav-link.is-active {
  color: var(--c-primary);
  border-color: rgba(196,202,104,0.5);
  background: linear-gradient(180deg, rgba(196,202,104,0.10), rgba(196,202,104,0.03));
}

.gold-line {
  height: 1px; width: 100%;
  background: var(--gold-grad);
  opacity: 0.55;
}

/* ================= 视图容器 ================= */
.view { display: none; padding: 56px 0 72px; animation: fadeUp .5s var(--ease); }
.view.is-active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.page-head { margin-bottom: 34px; }
.head-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}

.eyebrow {
  font-size: 12px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--c-primary); margin: 0 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-primary));
}
.eyebrow::after {
  content: ""; flex: 1; max-width: 60px; height: 1px;
  background: linear-gradient(90deg, var(--c-primary), transparent);
}

.page-title {
  font-family: var(--font-head);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 900; line-height: 1.25; margin: 0 0 12px;
  letter-spacing: 2px;
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-desc { color: var(--c-muted); margin: 0; max-width: 640px; }

.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ================= 表单卡片 ================= */
.form-card {
  background:
    var(--gloss),
    var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.form-card::before {
  content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196,202,104,0.65), transparent);
}

.form-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 28px;
}
.field-span { grid-column: 1 / -1; }

.field-label {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px;
  font-size: 13px; letter-spacing: 1.5px; color: var(--c-muted);
  margin-bottom: 10px;
}

.field-hint { font-size: 12.5px; color: #84856f; margin: 8px 0 0; }

.time-readout { color: var(--c-primary); font-family: var(--font-head); font-size: 16px; font-weight: 700; }
.time-readout output { font-size: 20px; }

.input {
  width: 100%;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  padding: 12px 14px;
  font-size: 15px; font-family: var(--font-body);
  outline: none;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
  appearance: none;
}
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--c-primary) 50%),
    linear-gradient(135deg, var(--c-primary) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(196,202,104,0.15); }

/* 滑块 */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-secondary) 60%, var(--c-border) 60%);
  outline: none; cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold-grad);
  border: 2px solid var(--c-bg);
  box-shadow: 0 0 0 1px var(--c-primary), 0 0 12px rgba(196,202,104,0.5);
  transition: transform .2s var(--ease);
}
.range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold-grad); border: 2px solid var(--c-bg);
  box-shadow: 0 0 0 1px var(--c-primary);
}
.range-scale { display: flex; justify-content: space-between; font-size: 11px; color: #6d6e5a; margin-top: 8px; }

/* 科目选择 chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px; cursor: pointer;
  transition: all .22s var(--ease);
  user-select: none;
}
.chip:hover { border-color: rgba(196,202,104,0.5); color: var(--c-text); }
.chip.is-on {
  border-color: var(--c-primary);
  color: #1a1a10;
  background: var(--gold-grad);
  box-shadow: 0 0 14px rgba(196,202,104,0.25);
  font-weight: 600;
}

/* 分段控件 */
.seg { display: inline-flex; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.seg button {
  background: none; border: none; cursor: pointer;
  color: var(--c-muted); padding: 9px 20px; font-size: 14px;
  transition: all .22s var(--ease);
}
.seg button + button { border-left: 1px solid var(--c-border); }
.seg button:hover { color: var(--c-text); }
.seg button.is-active {
  background: linear-gradient(180deg, rgba(196,202,104,0.16), rgba(196,202,104,0.04));
  color: var(--c-primary);
}

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 24px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-muted);
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.switch input:checked + .track { background: rgba(196,202,104,0.25); border-color: var(--c-primary); }
.switch input:checked + .track::after {
  transform: translateX(22px);
  background: var(--gold-grad);
}

/* 按钮 */
.btn {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface-2);
  color: var(--c-text);
  padding: 12px 26px;
  font-size: 15px; letter-spacing: 1px;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: all .25s var(--ease);
}
.btn::after {
  content: ""; position: absolute; top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.14), transparent);
  transform: skewX(-20deg);
  transition: left .6s var(--ease);
}
.btn:hover::after { left: 140%; }
.btn:hover { border-color: var(--c-primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gold-grad);
  border-color: transparent;
  color: #17170d;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(196,202,104,0.22);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(196,202,104,0.34); }

.btn-ghost {
  background: transparent;
  color: var(--c-primary);
  border-color: rgba(196,202,104,0.45);
}

.form-actions { margin-top: 30px; text-align: right; }
.settings-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 6px; }

.card-title {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
  color: var(--c-text); margin: 0 0 20px; letter-spacing: 1px;
}
.card-title::after {
  content: ""; display: block; width: 44px; height: 1px; margin-top: 10px;
  background: var(--gold-grad);
}

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.settings-grid .form-card:nth-child(3) { grid-column: 1 / -1; }

/* ================= 计划展示 ================= */
.empty-state {
  text-align: center; padding: 80px 24px;
  border: 1px dashed var(--c-border); border-radius: var(--radius-lg);
  background: rgba(35,35,26,0.4);
}
.empty-seal {
  width: 84px; height: 84px; margin: 0 auto 22px;
  border: 1px solid var(--c-primary); border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-head); font-size: 34px; font-weight: 900;
  color: var(--c-primary);
  box-shadow: inset 0 0 24px rgba(196,202,104,0.18), 0 0 30px rgba(196,202,104,0.12);
}
.empty-state h2 { font-family: var(--font-head); font-size: 24px; margin: 0 0 10px; }
.empty-state p { color: var(--c-muted); margin: 0 0 26px; }

.plan-wrap { margin-top: 8px; }

.plan-sheet {
  background:
    var(--gloss),
    var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-soft);
  position: relative;
}
.plan-sheet::after {
  content: ""; position: absolute; inset: 10px;
  border: 1px solid rgba(196,202,104,0.18);
  border-radius: var(--radius-lg - 2px);
  pointer-events: none;
}

.sheet-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 22px; margin-bottom: 22px;
  border-bottom: 1px solid var(--c-border);
}
.sheet-header h2 { font-family: var(--font-head); font-size: 28px; font-weight: 900; margin: 0 0 8px; letter-spacing: 1px; }
.sheet-meta { color: var(--c-muted); font-size: 13.5px; margin: 0; }
.sheet-seal {
  border: 1.5px solid var(--c-primary); border-radius: 50%;
  width: 76px; height: 76px;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; letter-spacing: 4px;
  color: var(--c-primary); font-size: 15px;
  transform: rotate(-8deg);
  box-shadow: 0 0 24px rgba(196,202,104,0.15);
}

.sheet-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 26px; }
.stat-tile {
  flex: 1; min-width: 130px;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--c-surface-2);
}
.stat-tile .stat-num {
  font-family: var(--font-head); font-size: 26px; font-weight: 700;
  color: var(--c-primary); line-height: 1.2;
}
.stat-tile .stat-label { font-size: 12px; letter-spacing: 1.5px; color: var(--c-muted); text-transform: uppercase; }

.sheet-body { display: grid; gap: 18px; }

.day-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  background: var(--c-surface-2);
  overflow: hidden;
  position: relative;
}
.day-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--c-border);
  background: linear-gradient(90deg, rgba(196,202,104,0.10), transparent 55%);
}
.day-name { font-family: var(--font-head); font-size: 17px; font-weight: 700; letter-spacing: 2px; }
.day-name em { font-style: normal; color: var(--c-primary); font-size: 12px; letter-spacing: 1px; margin-left: 8px; }
.day-total { font-size: 12.5px; color: var(--c-muted); }
.day-body { padding: 12px 16px 14px; display: grid; gap: 8px; }

.timeblock {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease);
  animation: fadeUp .4s var(--ease) both;
}
.timeblock:hover {
  border-color: var(--c-primary);
  transform: translateX(4px);
  background: linear-gradient(90deg, rgba(196,202,104,0.07), var(--c-surface));
}

.tb-time {
  font-family: var(--font-head); font-size: 15px; color: var(--c-primary);
  width: 88px; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.tb-tag {
  flex-shrink: 0; font-size: 12px; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid;
}
.tb-tag.preview   { color: #d8dcaa; border-color: rgba(196,202,104,0.5); }
.tb-tag.review    { color: #b8c0e8; border-color: rgba(150,160,220,0.45); }
.tb-tag.practice  { color: #bfe6c4; border-color: rgba(119,218,108,0.4); }
.tb-tag.rest      { color: #e3b08a; border-color: rgba(227,176,138,0.45); }
.tb-subject { font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.tb-detail { margin-left: auto; font-size: 12.5px; color: var(--c-muted); flex-shrink: 0; }

.timeblock.is-rest { cursor: default; opacity: 0.78; }
.timeblock.is-rest:hover { border-color: var(--c-border); transform: none; background: var(--c-surface); }
.timeblock.is-rest .tb-time { color: var(--c-muted); }

.plan-tip { margin-top: 16px; font-size: 12.5px; color: #84856f; text-align: center; }

/* ================= 弹层 ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8,8,5,0.72); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  animation: pop .3s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.modal-panel .field + .field { margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.modal-actions .btn-ghost:first-child { margin-right: auto; }

/* ================= 轻提示 ================= */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--gold-grad); color: #17170d;
  padding: 11px 24px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  opacity: 0; pointer-events: none; z-index: 200;
  box-shadow: 0 12px 34px rgba(0,0,0,0.5);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================= 页脚 ================= */
.site-footer {
  border-top: 1px solid var(--c-border); padding: 26px 0;
  color: var(--c-muted); font-size: 13px; letter-spacing: 1px;
}
.footer-inner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.footer-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--c-primary); }

/* ================= 打印 ================= */
@media print {
  .site-header, .head-actions, .site-footer, .plan-tip, .nav-link,
  .toast, .modal, #plan-empty, .form-actions { display: none !important; }
  body { background: #ffffff; color: #111; }
  .plan-sheet { box-shadow: none; border-color: #999; background: #fff; }
  .plan-sheet::after { display: none; }
  .view { padding: 0; }
  .view.is-active { display: block; }
  .sheet-header h2, .page-title { -webkit-text-fill-color: #111; color: #111; background: none; }
  .timeblock { border-color: #bbb; background: #fafafa; page-break-inside: avoid; }
  .day-card { page-break-inside: avoid; border-color: #bbb; }
  .day-name em, .tb-time, .tb-tag.preview, .stat-tile .stat-num { color: #000; }
  .tb-tag { color: #000; border-color: #999; }
  .eyebrow { color: #555; }
  .sheet-meta, .tb-detail, .day-total, .stat-tile .stat-label { color: #555; }
  .sheet-stats, .sheet-body { display: grid; }
}

/* ================= 响应式 ================= */
@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .form-card:nth-child(3) { grid-column: auto; }
  .head-row { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span { grid-column: auto; }
}

@media (max-width: 620px) {
  .header-inner { justify-content: center; }
  .header-nav { order: 3; width: 100%; justify-content: center; }
  .form-card { padding: 22px 18px; }
  .plan-sheet { padding: 20px 14px; }
  .sheet-seal { width: 60px; height: 60px; font-size: 12px; }
  .tb-time { width: auto; }
  .timeblock { flex-wrap: wrap; }
  .tb-detail { margin-left: 0; width: 100%; }
  .stat-tile { min-width: 108px; }
  .seg button { padding: 9px 14px; }
}
