/* ══════════════════════════════════════════════════════════
   Regulus · 共燃英語團 — 主樣式
   設計 DNA：手帳紙張 × 終端機資料層 × 獅子座 α 星
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&family=Kalam:wght@300;400;700&family=JetBrains+Mono:wght@300;400;500;700&family=Noto+Serif+TC:wght@300;400;500;700&family=Noto+Sans+TC:wght@300;400;500&display=swap');

:root {
  /* — paper palette — */
  --paper:        #f1ebdc;
  --paper-2:      #e8dfca;
  --paper-shade:  #d9cdb0;
  --ink:          #1a1510;
  --ink-2:        #3d342a;
  --ink-faint:    #8a7a60;
  --rule:         #c9bb9c;

  /* — accent: 獅子座 α 星 Regulus 是藍白色星，帶點球場綠 — */
  --star:         #5a7cff;
  --star-glow:    #8fa5ff;
  --field-green:  #2d5a2d;
  --highlight:    #f2c14e;   /* 螢光筆黃 */
  --red-mark:     #c4442d;   /* 紅筆批注 */

  /* — terminal — */
  --term-bg:      #0f0e0a;
  --term-fg:      #c8f07a;
  --term-dim:     #7a8a55;
  --term-line:    #2a2820;

  /* — fonts — */
  --f-hand:   'Caveat', 'Kalam', cursive;
  --f-hand-2: 'Kalam', cursive;
  --f-mono:   'JetBrains Mono', monospace;
  --f-serif:  'Noto Serif TC', serif;
  --f-sans:   'Noto Sans TC', sans-serif;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-serif);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* — paper texture: 細紋 + 些微斑點 — */
body {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(139, 115, 85, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 115, 85, 0.035) 0%, transparent 50%),
    repeating-linear-gradient(0deg,
      transparent 0px, transparent 31px,
      rgba(138, 122, 96, 0.08) 31px, rgba(138, 122, 96, 0.08) 32px),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  min-height: 100vh;
}

/* 紙張邊緣細微陰影 */
.paper-page {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 56px 120px;
}

/* 手寫字體 utility */
.hand   { font-family: var(--f-hand); font-weight: 600; }
.hand-2 { font-family: var(--f-hand-2); }
.mono   { font-family: var(--f-mono); }
.serif  { font-family: var(--f-serif); }
.sans   { font-family: var(--f-sans); }

/* ── TOP BAR ────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 28px;
  border-bottom: 1.5px solid var(--rule);
  position: relative;
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--rule);
  opacity: 0.5;
}
.brand {
  display: flex; align-items: baseline; gap: 14px;
}
.brand-title {
  font-family: var(--f-hand);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.topbar nav {
  display: flex; gap: 6px;
}
.nav-item {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  position: relative;
  transition: color 0.15s;
}
.nav-item:hover { color: var(--ink); }
.nav-item.active {
  color: var(--ink);
}
.nav-item.active::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px; bottom: 2px;
  height: 3px;
  background: var(--highlight);
  z-index: -1;
  opacity: 0.7;
  transform: skewX(-8deg);
}

/* ── SECTION HEADER ──────────────────────────── */
.section-head {
  margin: 56px 0 32px;
  position: relative;
}
.section-head .kicker {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.section-head h2 {
  font-family: var(--f-hand);
  font-size: 52px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -1px;
  color: var(--ink);
}
.section-head .zh {
  font-family: var(--f-serif);
  font-size: 14px;
  color: var(--ink-2);
  margin-top: 6px;
  font-weight: 300;
}

/* 手寫底線裝飾 */
.underline-hand {
  display: inline-block;
  position: relative;
  padding: 0 2px;
}
.underline-hand::after {
  content: '';
  position: absolute;
  left: -4px; right: -4px; bottom: -6px;
  height: 8px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'><path d='M1 5 Q 25 1, 50 4 T 99 3' stroke='%23c4442d' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>") no-repeat center;
  background-size: 100% 100%;
}
.hl-yellow {
  background: linear-gradient(180deg, transparent 55%, var(--highlight) 55%, var(--highlight) 92%, transparent 92%);
  padding: 0 2px;
}

/* ── CARDS ──────────────────────────────────── */
.card {
  background: rgba(255, 251, 240, 0.5);
  border: 1px solid var(--rule);
  padding: 20px;
  position: relative;
}
.card.pinned::before {
  content: '';
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red-mark);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ── TERMINAL BLOCK ──────────────────────────── */
.terminal {
  background: var(--term-bg);
  color: var(--term-fg);
  font-family: var(--f-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 18px 22px;
  border-radius: 2px;
  border: 1px solid #000;
  box-shadow:
    0 2px 0 var(--paper-shade),
    0 6px 18px rgba(40, 25, 10, 0.15);
  position: relative;
}
.terminal::before {
  content: '● ● ●';
  position: absolute;
  top: 8px; left: 12px;
  font-size: 10px;
  letter-spacing: 4px;
  color: #3a3a2a;
}
.terminal-body {
  padding-top: 18px;
}
.term-line { display: flex; gap: 10px; }
.term-prompt { color: var(--term-dim); user-select: none; }
.term-comment { color: var(--term-dim); font-style: italic; }
.term-val { color: #ffde7a; }
.term-key { color: #8fd4ff; }
.term-caret {
  display: inline-block;
  width: 8px; height: 14px;
  background: var(--term-fg);
  vertical-align: middle;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 18px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--field-green);
  border-color: var(--field-green);
}
.btn-ghost {
  border-color: var(--rule);
  color: var(--ink-2);
}
.btn-sm { padding: 6px 12px; font-size: 11px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255,251,240,0.6);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ── INPUT ──────────────────────────────────── */
input[type=text], textarea, select {
  font-family: var(--f-serif);
  font-size: 15px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ink-2);
  padding: 6px 4px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
input[type=text]:focus, textarea:focus {
  border-bottom-color: var(--red-mark);
}
input[type=text]::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

/* ── UTILITY ────────────────────────────────── */
.row { display: flex; gap: 16px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.sep {
  height: 1px;
  background: var(--rule);
  margin: 24px 0;
  opacity: 0.6;
}

/* 手寫箭頭 */
.arrow-hand {
  display: inline-block;
  width: 40px; height: 14px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 14'><path d='M2 7 Q 15 3, 30 7 L 25 3 M 30 7 L 25 11' stroke='%231a1510' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat center;
  vertical-align: middle;
}

/* 紙膠帶 */
.tape {
  position: absolute;
  width: 80px; height: 22px;
  background: rgba(242, 193, 78, 0.55);
  border-left: 1px dashed rgba(0,0,0,0.08);
  border-right: 1px dashed rgba(0,0,0,0.08);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transform: rotate(-3deg);
}

/* scroll style */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--ink-faint); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }

/* tweaks panel */
.tweaks-panel {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 260px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  padding: 14px 16px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  font-family: var(--f-mono);
  font-size: 12px;
}
.tweaks-panel h4 {
  font-family: var(--f-hand);
  font-size: 22px;
  margin-bottom: 8px;
  font-weight: 700;
}
.tweaks-panel label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule);
}
.tweaks-panel label:last-child { border: none; }
