/* === 朵拉教學共用樣式 === */

@font-face { font-family: 'JB Fluffy'; src: url('fonts/justinbeaverfont-fluffy-proportional.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'JB Fluffy Mono'; src: url('fonts/justinbeaverfont-fluffy-monospaced.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'JB Slim'; src: url('fonts/justinbeaverfont-slim-proportional.ttf') format('truetype'); font-display: swap; }

:root {
  --dora-yellow: #FCE89A;
  --dora-blue: #8DD3E8;
  --dora-mint: #8FCFC8;
  --dora-pink: #E89BAE;
  --dora-yellow-soft: #FEF4D0;
  --dora-blue-soft: #C9EBF5;
  --dora-mint-soft: #CCE9E5;
  --dora-pink-soft: #F4CFD9;
  --dora-red: #E85A4F;        /* 學習單活頁邊框紅 */
  --dora-red-soft: #F8D0CC;
  --ink: #4A4A4A;
  --ink-soft: #8A8A8A;
  --ink-faint: #B8B8B8;
  --bg: #FAF8F3;
  --paper: #FFFFFF;
  --line: #EAE6DC;
  --shadow: 0 4px 20px rgba(74, 74, 74, 0.06);
  --shadow-lg: 0 12px 40px rgba(74, 74, 74, 0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink); background: var(--bg);
  line-height: 1.7; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.jb-fluffy { font-family: 'JB Fluffy', sans-serif; }
.jb-fluffy-mono { font-family: 'JB Fluffy Mono', sans-serif; }
.jb-slim { font-family: 'JB Slim', sans-serif; }
.cinzel { font-family: 'Cinzel', serif; letter-spacing: 0.15em; }

/* === Nav 共用 === */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 248, 243, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.topbar .inner {
  max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand img { height: 34px; }
.topbar .brand .name {
  font-family: 'Cinzel', serif; font-weight: 500;
  font-size: 15px; letter-spacing: 0.18em;
}
.topbar .links { display: flex; gap: 28px; }
.topbar .links a { color: var(--ink-soft); font-size: 14px; transition: color 0.2s; }
.topbar .links a:hover, .topbar .links a.active { color: var(--ink); font-weight: 500; }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--paper); border-radius: 999px;
  border: 1px solid var(--line);
}
.topbar .user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--dora-pink); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
}
.topbar .user .name-text { font-size: 13px; color: var(--ink); }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--dora-pink); color: white; }
.btn-primary:hover { box-shadow: 0 6px 16px rgba(232, 155, 174, 0.4); }
.btn-secondary { background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); }
.btn-secondary:hover { border-color: var(--ink-soft); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--bg); }
.btn-dark { background: var(--ink); color: white; }
.btn-yellow { background: var(--dora-yellow); color: var(--ink); }
.btn-mint { background: var(--dora-mint); color: white; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-icon-only { padding: 10px; }

/* === Tags === */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px;
  font-size: 12px;
}
.tag-y { background: var(--dora-yellow-soft); color: #8A6B00; }
.tag-b { background: var(--dora-blue-soft); color: #1F5C73; }
.tag-m { background: var(--dora-mint-soft); color: #2D6660; }
.tag-p { background: var(--dora-pink-soft); color: #8A2F47; }
.tag-r { background: var(--dora-red-soft); color: #8A2A22; }
.tag-gray { background: var(--bg); color: var(--ink-soft); }

/* === Page label / title === */
.section-label {
  font-family: 'Cinzel', serif;
  font-size: 11px; letter-spacing: 0.35em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.page-title {
  font-family: 'JB Fluffy', sans-serif;
  font-size: clamp(40px, 5.5vw, 64px);
  line-height: 1.1; color: var(--ink);
}
.page-subtitle {
  font-size: 16px; color: var(--ink-soft);
  line-height: 1.8; max-width: 640px;
}

/* === Worksheet 學習單模板（朵拉風）=== */
.worksheet-paper {
  background: var(--paper); border-radius: var(--radius);
  padding: 0; box-shadow: var(--shadow-lg);
  overflow: hidden; position: relative;
  border: 6px solid var(--dora-red);
}
.worksheet-paper::before {
  content: ''; position: absolute;
  left: 16px; top: 24px; bottom: 24px; width: 6px;
  background: repeating-linear-gradient(to bottom, var(--paper) 0 6px, var(--ink-faint) 6px 12px);
  border-radius: 3px; opacity: 0.4;
}
.worksheet-paper .deco-shape {
  position: absolute; opacity: 0.85; pointer-events: none;
}
.worksheet-paper .ds-c1 { top: 16px; right: 70px; width: 14px; height: 14px; background: var(--dora-yellow); border-radius: 50%; }
.worksheet-paper .ds-c2 { top: 120px; right: 24px; width: 16px; height: 16px; background: var(--dora-blue); border-radius: 50%; }
.worksheet-paper .ds-c3 { bottom: 100px; left: 50px; width: 12px; height: 12px; background: var(--dora-mint); border-radius: 50%; }
.worksheet-paper .ds-c4 { bottom: 30px; right: 100px; width: 18px; height: 18px; background: var(--dora-pink); border-radius: 50%; }
.worksheet-paper .ds-t1 { top: 30px; right: 200px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 14px solid var(--dora-pink); transform: rotate(20deg); }
.worksheet-paper .ds-t2 { bottom: 150px; right: 40px; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--dora-yellow); transform: rotate(-15deg); }
.worksheet-paper .ds-t3 { bottom: 60px; left: 80px; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid var(--dora-blue); }
.worksheet-paper .ds-h1 { top: 200px; right: 60px; width: 20px; height: 10px; background: var(--dora-mint); border-radius: 20px 20px 0 0; }
.worksheet-paper .ds-h2 { bottom: 200px; left: 60px; width: 18px; height: 9px; background: var(--dora-yellow); border-radius: 20px 20px 0 0; }

.worksheet-inner {
  position: relative; z-index: 1;
  padding: 36px 44px 36px 60px;
}
.ws-header {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 28px; padding-bottom: 16px;
  border-bottom: 2px dashed var(--line);
}
.ws-instruction {
  font-family: 'JB Fluffy', sans-serif;
  font-size: 22px; color: var(--ink);
  line-height: 1.4;
}
.ws-book-title {
  font-family: 'Cinzel', serif; font-weight: 600;
  font-size: 13px; letter-spacing: 0.15em;
  color: var(--ink-soft); text-transform: uppercase;
  text-align: right; white-space: nowrap;
}

/* Word Mat */
.word-mat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.word-mat-cell {
  background: var(--paper); border: 2.5px solid var(--ink);
  border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column;
}
.word-mat-img {
  aspect-ratio: 1; padding: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.word-mat-cell:nth-child(6n+1) .word-mat-img { background: var(--dora-pink-soft); }
.word-mat-cell:nth-child(6n+2) .word-mat-img { background: var(--dora-yellow-soft); }
.word-mat-cell:nth-child(6n+3) .word-mat-img { background: var(--dora-mint-soft); }
.word-mat-cell:nth-child(6n+4) .word-mat-img { background: var(--dora-blue-soft); }
.word-mat-cell:nth-child(6n+5) .word-mat-img { background: var(--dora-yellow-soft); }
.word-mat-cell:nth-child(6n+6) .word-mat-img { background: var(--dora-pink-soft); }
.word-mat-label {
  background: var(--dora-yellow);
  padding: 6px 8px; text-align: center;
  font-weight: 700; font-size: 14px;
  color: var(--ink);
  border-top: 2.5px solid var(--ink);
}

/* Q&A list */
.qa-list { display: flex; flex-direction: column; gap: 16px; }
.qa-item {
  font-family: 'JB Slim', sans-serif; font-size: 17px;
  color: var(--ink); line-height: 1.6;
  padding-left: 4px;
}
.qa-item .qnum {
  font-weight: 700; color: var(--dora-pink); margin-right: 8px;
}
.qa-item .options {
  display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap;
}
.qa-option {
  width: 56px; height: 56px; border: 2px solid var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; background: var(--paper);
}
.qa-option.opt-y { background: var(--dora-yellow-soft); }
.qa-option.opt-b { background: var(--dora-blue-soft); }
.qa-option.opt-p { background: var(--dora-pink-soft); }
.qa-option.opt-m { background: var(--dora-mint-soft); }

/* Number circles */
.num-circles {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  margin-top: 8px;
}
.num-bubble {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--dora-yellow);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JB Fluffy', sans-serif; font-size: 32px;
  color: var(--ink); border: 2px solid var(--ink);
}

/* Matching lines */
.match-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px;
  align-items: center;
}
.match-col { display: flex; flex-direction: column; gap: 12px; }
.match-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--bg);
  border-radius: 10px; border: 1.5px dashed var(--line);
  font-family: 'JB Slim', sans-serif;
}
.match-dots {
  display: flex; flex-direction: column; gap: 30px;
  font-family: monospace; color: var(--ink-faint);
}

/* === Card 共用 === */
.card {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}
.card-hover { cursor: pointer; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card-pad { padding: 24px; }

/* === Empty state === */
.empty {
  text-align: center; padding: 60px 24px;
  background: var(--paper); border-radius: var(--radius);
  border: 2px dashed var(--line);
}
.empty .icon {
  font-family: 'JB Fluffy', sans-serif;
  font-size: 48px; color: var(--ink-faint); margin-bottom: 12px;
}
.empty h4 {
  font-family: 'JB Fluffy', sans-serif;
  font-size: 22px; margin-bottom: 6px;
}
.empty p { color: var(--ink-soft); font-size: 14px; }

/* === Form === */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--line);
  border-radius: var(--radius-xs); padding: 12px 14px;
  font-size: 14px; color: var(--ink);
  background: var(--paper); outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--dora-pink);
}
.field textarea { resize: vertical; min-height: 80px; }

/* === Avatar === */
.avatar-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: white;
}
.avatar-pink { background: var(--dora-pink); }
.avatar-blue { background: var(--dora-blue); color: white; }
.avatar-mint { background: var(--dora-mint); color: white; }
.avatar-yellow { background: var(--dora-yellow); color: var(--ink); }

@media (max-width: 900px) {
  .topbar .links { display: none; }
  .container { padding: 0 20px; }
}
