/* CTQ 思維學習 — 沿用 mj-360 視覺語言 */
:root {
  --brand: #E8590C;
  --brand-dark: #C2410C;
  --brand-soft: #FFF0E6;
  --ink: #2B2320;
  --ink-soft: #6F6058;
  --card: #FFFFFF;
  --line: #F0E3D8;
  --ok: #2F9E44;
  --warn: #E03131;
  --blue: #1971C2;
  --blue-soft: #E7F1FB;
  --teal: #0CA678;
  --teal-soft: #E6F7F1;
  --orange: #E8590C;
  --orange-soft: #FFF0E6;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(190, 110, 50, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: linear-gradient(180deg, #FFF9F3 0%, #FAF5EF 45%, #F7F0E8 100%);
  min-height: 100vh;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
  padding-bottom: 90px;
}

/* ── 頂部導覽 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: flex; align-items: center; gap: 10px;
  height: 66px;
  overflow-x: auto;
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--blue), #145A97);
  color: #fff; font-weight: 900; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -0.5px;
}
.topbar .logo {
  font-weight: 900; font-size: 19px; color: var(--ink);
  margin-right: auto; white-space: nowrap;
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.topbar a.nav {
  text-decoration: none; color: var(--ink-soft);
  font-size: 15.5px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
}
.topbar a.nav:hover { color: var(--brand-dark); }
.topbar a.nav.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.wrap.narrow { max-width: 900px; }

/* ── Hero ── */
.hero-grid {
  display: grid; grid-template-columns: 1.9fr 1fr; gap: 22px;
  margin-bottom: 30px; align-items: stretch;
}
.hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF6EE 100%);
  border: 1px solid var(--line); border-radius: 26px;
  padding: 40px 44px; box-shadow: var(--shadow);
}
.hero-tag { font-size: 14px; color: var(--ink-soft); letter-spacing: 2px; font-weight: 700; }
.hero-title {
  font-size: 38px; font-weight: 900; letter-spacing: 1px;
  line-height: 1.3; margin: 6px 0 10px;
}
.hero-sub { font-size: 17px; color: var(--ink-soft); }
.hero-stats { display: flex; gap: 28px; margin-top: 24px; flex-wrap: wrap; }
.hero-stat .n { font-size: 34px; font-weight: 900; }
.hero-stat .l { font-size: 14px; color: var(--ink-soft); }

.side-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 26px; padding: 26px 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: center; gap: 14px;
}
.side-card .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.side-card .row .l { font-size: 15px; color: var(--ink-soft); font-weight: 600; }
.side-card .row .v { font-size: 24px; font-weight: 900; }

/* ── 區塊標題 ── */
.section-head { margin: 30px 0 14px; }
.section-head .en { font-size: 12.5px; letter-spacing: 3px; color: var(--brand); font-weight: 800; }
.section-head h2 { font-size: 25px; font-weight: 900; letter-spacing: .5px; }
.section-head p { font-size: 15px; color: var(--ink-soft); margin-top: 2px; }

/* ── 視角卡 ── */
.persp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.persp-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 26px 22px;
  box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  border-top: 6px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.persp-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(190,110,50,.14); }
.persp-card.blue { border-top-color: var(--blue); }
.persp-card.teal { border-top-color: var(--teal); }
.persp-card.orange { border-top-color: var(--orange); }
.persp-card .en { font-size: 12px; letter-spacing: 2.5px; font-weight: 800; color: var(--ink-soft); }
.persp-card.blue .en { color: var(--blue); }
.persp-card.teal .en { color: var(--teal); }
.persp-card.orange .en { color: var(--orange); }
.persp-card h3 { font-size: 22px; font-weight: 900; }
.persp-card .meta { font-size: 14.5px; color: var(--ink-soft); }
.bar { height: 10px; background: #F3EAE0; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.bar.blue > i { background: var(--blue); }
.bar.teal > i { background: var(--teal); }
.bar.orange > i { background: var(--orange); }
.persp-card .pct { font-size: 15px; font-weight: 800; margin-top: 4px; }
.persp-card .go {
  margin-top: 12px; align-self: flex-start;
  font-size: 15px; font-weight: 800; color: var(--brand-dark);
  background: var(--brand-soft); padding: 8px 18px; border-radius: 999px;
}

/* ── 通用卡片 ── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 26px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.pill {
  display: inline-block; font-size: 13px; font-weight: 800;
  padding: 4px 12px; border-radius: 999px;
}
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.orange { background: var(--orange-soft); color: var(--brand-dark); }
.pill.gray { background: #F3EFE9; color: var(--ink-soft); }

/* ── 學習頁 ── */
.learn-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--ink-soft);
  padding: 8px 18px; border-radius: 999px; text-decoration: none;
  font-family: inherit;
}
.chip.on.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.on.teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.on.orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.mode-toggle { margin-left: auto; display: flex; gap: 6px; background: #F3EFE9; padding: 5px; border-radius: 999px; }
.mode-toggle button {
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 800; color: var(--ink-soft);
  padding: 7px 16px; border-radius: 999px;
}
.mode-toggle button.on { background: #fff; color: var(--brand-dark); box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.qnav { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.qnav button {
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: #fff; font-family: inherit;
  font-size: 15px; font-weight: 800; color: var(--ink-soft);
}
.qnav button.done { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.qnav button.cur { outline: 3px solid var(--brand); outline-offset: 1px; color: var(--brand-dark); }
.qnav button.due { border-color: var(--warn); color: var(--warn); }

.qcard { border-radius: 26px; padding: 34px 36px; }
.qcard .qhead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.qcard .qnum {
  font-size: 15px; font-weight: 900; color: #fff;
  padding: 5px 16px; border-radius: 999px;
}
.qcard .qnum.blue { background: var(--blue); }
.qcard .qnum.teal { background: var(--teal); }
.qcard .qnum.orange { background: var(--orange); }
.qtext { font-size: 21px; font-weight: 800; line-height: 1.7; white-space: pre-line; }

.block { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 18px; }
.block > .bt {
  font-size: 14px; font-weight: 900; letter-spacing: 2px;
  color: var(--brand); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.hint-text { white-space: pre-line; font-size: 16.5px; color: #4A3F38; }

.term { border: 1.5px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; background: #FFFDFA; }
.term .tq { font-size: 16.5px; font-weight: 800; margin-bottom: 8px; }
.term textarea {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-family: inherit; font-size: 15.5px; line-height: 1.6;
  background: #fff; color: var(--ink);
}
.term textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.term .ta-note { font-size: 13px; color: var(--ink-soft); margin: 4px 0 8px; }
.term .reveal-btn {
  border: 0; cursor: pointer; font-family: inherit;
  background: var(--blue-soft); color: var(--blue);
  font-size: 14px; font-weight: 800; padding: 7px 16px; border-radius: 999px;
}
.term .ans {
  display: none; margin-top: 10px; padding: 12px 14px;
  background: var(--blue-soft); border-radius: 12px;
  font-size: 15.5px; white-space: pre-line;
}
.term.revealed .ans { display: block; }
.term .noans { color: var(--ink-soft); font-style: italic; }

details.extra { margin-top: 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #FFFDFA; }
details.extra > summary {
  cursor: pointer; list-style: none; padding: 14px 18px;
  font-size: 15.5px; font-weight: 800; color: var(--brand-dark);
}
details.extra > summary::before { content: "▸ "; }
details.extra[open] > summary::before { content: "▾ "; }
details.extra .body { padding: 0 18px 16px; white-space: pre-line; font-size: 15.5px; color: #4A3F38; }
details.extra .body .xt { font-weight: 800; color: var(--ink); margin-top: 10px; }

/* 掌握度與完成 */
.master { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.stars { display: flex; gap: 4px; }
.stars button {
  border: 0; background: transparent; cursor: pointer;
  font-size: 30px; line-height: 1; color: #E4D8CC; padding: 2px;
}
.stars button.on { color: #F59F00; }
.done-btn {
  border: 0; cursor: pointer; font-family: inherit;
  background: var(--ok); color: #fff;
  font-size: 16px; font-weight: 900; padding: 12px 28px; border-radius: 999px;
}
.done-btn:disabled { background: #D8CFC5; cursor: not-allowed; }
.done-btn.redo { background: #fff; color: var(--ok); border: 2px solid var(--ok); }
.done-note { font-size: 14px; color: var(--ink-soft); }
.done-note.warn { color: var(--warn); font-weight: 700; }

.pager { display: flex; justify-content: space-between; margin-top: 18px; gap: 10px; }
.pager button {
  border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-family: inherit;
  font-size: 15.5px; font-weight: 800; color: var(--ink);
  padding: 12px 24px; border-radius: 999px;
}
.pager button:disabled { opacity: .35; cursor: default; }

.history { margin-top: 12px; font-size: 14.5px; color: var(--ink-soft); }
.history .h-item { padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* ── 思維地圖 ── */
.concept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.concept-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 0; box-shadow: var(--shadow); overflow: hidden;
}
.concept-card summary {
  cursor: pointer; list-style: none; padding: 16px 18px;
  font-size: 16.5px; font-weight: 800;
}
.concept-card summary::after { content: " ＋"; color: var(--brand); font-weight: 900; }
.concept-card[open] summary::after { content: " －"; }
.concept-card .body { padding: 0 18px 16px; font-size: 15px; color: #4A3F38; white-space: pre-line; }

.ref-item { border-left: 5px solid var(--blue); padding: 14px 18px; background: var(--card); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
.ref-item .rt { font-weight: 900; font-size: 16.5px; margin-bottom: 4px; }
.ref-item .rc { font-size: 15px; color: #4A3F38; white-space: pre-line; }

/* ── 進度頁 ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.stat-card .n { font-size: 32px; font-weight: 900; }
.stat-card .l { font-size: 14px; color: var(--ink-soft); font-weight: 600; }

.due-item {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.due-item:hover { border-color: var(--brand); }
.due-item .dq { font-size: 15.5px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-item .dd { font-size: 13.5px; color: var(--warn); font-weight: 800; white-space: nowrap; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; font-size: 16px; }

.footer-note { text-align: center; font-size: 13px; color: var(--ink-soft); margin-top: 40px; }

/* ── RWD ── */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { padding: 28px 26px; }
  .hero-title { font-size: 29px; }
  .persp-grid { grid-template-columns: 1fr; }
  .qcard { padding: 24px 20px; }
  .qtext { font-size: 19px; }
  .wrap { padding: 20px 16px; }
  .mode-toggle { margin-left: 0; }
}
