/* Learn mode (PRD 11): path map, lesson player and game parts. Builds on styles.css tokens. */

.learn { --exam-paper: #FFFFFF; --exam-ink: #111827; --ok: #15803D; --ok-bg: #DCFCE7; --bad: #B91C1C; --bad-bg: #FEE2E2; --lock: #D1D5DB; --lock-ink: #6B7280; }
.learn.mode-dse { --ok: #4ADE80; --ok-bg: #12301F; --bad: #FCA5A5; --bad-bg: #3B1518; --lock: #334155; --lock-ink: #94A3B8; }
.learn { min-height: 100vh; overflow-x: hidden; }
:where(.learn) button { font: inherit; color: inherit; }
.ico { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }

/* Top bar */
.lbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.lbar .wrap { display: flex; align-items: center; gap: 8px; height: 60px; max-width: 1200px; }
.lbar .logo img { height: 24px; }
@media (max-width: 420px) { .lbar .logo img { height: 18px; } .lbar .wrap { gap: 4px; } .stat { padding: 6px 4px; } }
.form-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; min-height: 40px; }
.stats { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.stat { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 12px; font-weight: 700; font-size: 16px; background: none; border: 0; cursor: pointer; min-height: 40px; }
.stat:hover { background: var(--tint); }
.stat.streak { color: #C2410C; }
.mode-dse .stat.streak { color: #FB923C; }
.stat.streak.off { color: var(--lock-ink); }
.stat.gems { color: #0369A1; }
.mode-dse .stat.gems { color: #7DD3FC; }
.ring { width: 30px; height: 30px; }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--brand); transition: stroke-dashoffset .6s; }

/* Shell */
.lshell { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 24px; padding: 0 var(--gutter) 96px; }
.side, .aside { display: none; }
@media (min-width: 960px) {
  .lshell { grid-template-columns: 200px minmax(0, 1fr) 300px; padding-bottom: 40px; }
  .side, .aside { display: block; }
  .tabs { display: none !important; }
}
.side nav { position: sticky; top: 76px; display: grid; gap: 4px; padding-top: 16px; }
.navbtn { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; text-decoration: none; color: var(--ink); font-weight: 700; border: 2px solid transparent; }
.navbtn[aria-current="page"] { background: var(--tint); border-color: var(--brand); color: var(--brand); }
.navbtn .ico { width: 24px; height: 24px; }
.aside > div { position: sticky; top: 76px; display: grid; gap: 16px; padding-top: 16px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: space-around; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.tabs .navbtn { flex-direction: column; gap: 0; font-size: 12px; padding: 6px 2px; flex: 1 1 0; min-width: 0; max-width: 88px; border: 0; }
.tabs .navbtn[aria-current="page"] { background: none; }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h3 { font-size: 17px; margin-bottom: 8px; }

/* Form picker */
.picker-view { max-width: 760px; margin: 0 auto; padding: 24px 0; }
.forms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 8px 0 24px; }
@media (min-width: 640px) { .forms { grid-template-columns: repeat(6, 1fr); } }
.formbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 88px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); font-family: var(--font-head); font-size: 24px; cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.formbtn small { font-family: var(--font-body); font-size: 13px; color: var(--mute); }
.formbtn.open { border-color: var(--brand); box-shadow: 0 4px 0 var(--brand); }
.formbtn.open small { color: var(--brand); font-weight: 700; }
.formbtn:disabled { cursor: default; opacity: .75; box-shadow: none; border-style: dashed; }
.formbtn.open:hover { transform: translateY(-2px); }

/* Path map */
.path-view { padding: 16px 0; max-width: 560px; margin: 0 auto; width: 100%; }
.unit { margin-bottom: 8px; }
.unit-banner { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 16px; color: #fff; position: relative; overflow: hidden; }
.unit-banner::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(transparent 0 23px, rgba(255,255,255,.14) 23px 24px); pointer-events: none; }
.unit-banner h2 { font-size: 20px; margin: 0; color: inherit; }
.unit-banner p { margin: 0; font-size: 14px; opacity: .95; }
.unit-banner .num { font-size: 13px; font-weight: 700; background: rgba(0,0,0,.18); padding: 2px 10px; border-radius: 999px; }
.u0 { background: #15803D; } .u1 { background: #0369A1; } .u2 { background: #B45309; }
.mode-dse .u0 { background: #166534; } .mode-dse .u1 { background: #075985; } .mode-dse .u2 { background: #92400E; }
.nodes { position: relative; display: flex; flex-direction: column; align-items: center; gap: 34px; padding: 40px 0 36px; }
.node-wrap { position: relative; }
.node-wrap:has(.pop) { z-index: 20; } /* the open lesson card stays above the nodes below it */
.node-wrap:has(.start-tag) { margin-top: 30px; }
.node { width: 72px; height: 68px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; position: relative; background: var(--brand); color: var(--on-brand); box-shadow: 0 7px 0 #14532D; transition: transform .1s; }
.mode-dse .node { box-shadow: 0 7px 0 #166534; }
.node:active { transform: translateY(4px); box-shadow: 0 3px 0 #14532D; }
.node .ico { width: 34px; height: 34px; }
.node.locked { background: var(--lock); color: var(--lock-ink); box-shadow: 0 7px 0 #9CA3AF; cursor: pointer; }
.mode-dse .node.locked { box-shadow: 0 7px 0 #1E293B; }
.node.done { background: var(--sun); color: #713F12; box-shadow: 0 7px 0 #CA8A04; }
.node.current { animation: bob 1.6s ease-in-out infinite; }
.node.current::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--brand); opacity: .35; }
.node.chest { background: transparent; box-shadow: none; color: inherit; }
.node.chest.locked { filter: grayscale(1); opacity: .6; }
.node.chest .ico { width: 64px; height: 64px; }
.start-tag { position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%); background: var(--surface); color: var(--brand); border: 2px solid var(--line); font-weight: 700; font-size: 14px; border-radius: 10px; padding: 2px 10px; white-space: nowrap; pointer-events: none; }
.start-tag::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--line); }
@keyframes bob { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .node.current { animation: none; } }
.pop { position: absolute; z-index: 10; top: calc(100% + 16px); left: 50%; transform: translateX(-50%); width: min(280px, 82vw); background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.12); text-align: left; }
.pop h3 { font-size: 18px; margin: 0 0 2px; }
.pop p { margin: 0 0 10px; font-size: 15px; color: var(--mute); }
.pop .btn { width: 100%; }
.path-sprout { position: absolute; top: 40%; pointer-events: none; }

/* Lesson player */
.player { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.player-top { display: flex; align-items: center; gap: 12px; max-width: 760px; width: 100%; margin: 0 auto; padding: 14px var(--gutter) 6px; }
.x-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--mute); }
.x-btn:hover { background: var(--tint); }
div.bar { flex: 1; height: 16px; border-radius: 999px; background: var(--line); overflow: hidden; }
div.bar > i { display: block; height: 100%; width: 0; background: var(--brand-bright); border-radius: 999px; transition: width .4s; box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.player-body { overflow-y: auto; }
.qwrap { max-width: 760px; margin: 0 auto; padding: 8px var(--gutter) 28px; }
.qhead { display: flex; gap: 12px; align-items: flex-end; margin: 6px 0 16px; }
.qhead [data-sprout] { flex: none; }
.bubble { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 16px; font-size: 19px; line-height: 1.6; }
.bubble::before { content: ""; position: absolute; left: -10px; bottom: 18px; border: 8px solid transparent; border-right-color: var(--line); border-left: 0; }
.tagline { display: inline-block; font-size: 13px; font-weight: 700; color: var(--mute); margin-bottom: 4px; }
.review-tag { color: #B45309; } .mode-dse .review-tag { color: #FBBF24; }
.pic-row { display: flex; justify-content: center; margin: 4px 0 16px; overflow-x: auto; }
.pic { max-width: 100%; height: auto; }
.pic-box { fill: var(--tint); stroke: var(--line); stroke-width: 2; }
.pic-dot { fill: #E5484D; }
.part { fill: var(--surface); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.part.on { fill: var(--sun); }
.part.tap { cursor: pointer; }
.part.tap:hover { fill: #FFF4CC; }
.part.tap.on:hover { fill: #F5B301; }
.part:focus-visible { outline: none; stroke: var(--sky); stroke-width: 4; }
.ax-grid { stroke: var(--line); stroke-width: 1; }
.ax-axis { stroke: var(--ink); stroke-width: 2; }
.ax-label { fill: var(--ink); font: italic 700 15px var(--font-body); }
.ax-num { fill: var(--mute); font: 11px var(--font-body); }
.ax-curve { fill: none; stroke: var(--sky); stroke-width: 3; stroke-linecap: round; }
.ax-pt { fill: var(--red-pen); stroke: var(--surface); stroke-width: 2; }
.ax-cursor { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-dasharray: 4 3; }
.ax-ok { fill: var(--ok); }
/* Primary pictures (PRD 28) */
.pt { fill: var(--ink); font: 700 15px var(--font-body); } .pt.small { font-size: 13px; } .pt.tiny { font-size: 11px; font-weight: 600; } .pt.big { font-size: 26px; } .pt.halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.pl { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .pl.thin { stroke-width: 1.5; } .pl.dash { stroke-dasharray: 5 4; stroke-width: 1.5; } .pl.face { fill: var(--tint); }
.pic-dot2 { fill: var(--sun); } .pic-dot.gone { fill: #FCA5A5; } .pcross { stroke: var(--ink); stroke-width: 2; }
.blk { fill: #BFDBFE; stroke: #1D4ED8; stroke-width: 1.5; } .blk3 { fill: #93C5FD; stroke: #1D4ED8; stroke-width: 1.5; } .blkl { stroke: #1D4ED8; stroke-width: .6; }
.cu-f { fill: #BFDBFE; stroke: #1D4ED8; stroke-width: 1.2; stroke-linejoin: round; } .cu-t { fill: #DBEAFE; stroke: #1D4ED8; stroke-width: 1.2; stroke-linejoin: round; } .cu-r { fill: #93C5FD; stroke: #1D4ED8; stroke-width: 1.2; stroke-linejoin: round; }
.clk-face { fill: var(--surface); stroke: var(--ink); stroke-width: 3; } .clk-tick { stroke: var(--mute); stroke-width: 1; } .clk-tick5 { stroke: var(--ink); stroke-width: 2.5; }
.clk-num { fill: var(--ink); font: 700 14px var(--font-body); } .clk-h { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; } .clk-m { stroke: var(--red-pen); stroke-width: 3.5; stroke-linecap: round; } .clk-dot { fill: var(--ink); }
.dig { fill: #111827; } .dig-t { fill: #4ADE80; font: 700 30px ui-monospace, Menlo, monospace; }
.cal-mark { fill: var(--sun); stroke: var(--ink); stroke-width: 1; }
.obj { fill: var(--sun); stroke: var(--ink); stroke-width: 2; } .guide { stroke: var(--mute); stroke-width: 1.5; stroke-dasharray: 3 3; }
.rul { fill: #FEF3C7; stroke: #B45309; stroke-width: 1.5; } .rul-t { stroke: #78350F; stroke-width: 1.2; }
.water { fill: #7DD3FC; } .needle { stroke: var(--red-pen); stroke-width: 3; stroke-linecap: round; } .needle-h { fill: var(--red-pen); }
.coin-g { fill: #FCD34D; stroke: #B45309; stroke-width: 2; } .coin-s { fill: #E5E7EB; stroke: #6B7280; stroke-width: 2; } .coin-x { fill: #E5E7EB; stroke: #6B7280; stroke-width: 2; }
.coin-t { font-size: 11px; fill: #1F2937; } .note-in { fill: rgba(255,255,255,.55); } .note-t { font-size: 16px; fill: #111827; }
.note10 { fill: #C4B5FD; } .note20 { fill: #93C5FD; } .note50 { fill: #86EFAC; } .note100 { fill: #FCA5A5; } .note500 { fill: #D6A77A; } .note1000 { fill: #FDE68A; }
.tag { fill: #FFF7ED; stroke: #C2410C; stroke-width: 2; }
.place { fill: var(--surface); stroke: var(--line); stroke-width: 2; } .place.me { fill: var(--sun); stroke: var(--ink); }
.cell { fill: #BBF7D0; stroke: none; } .cell.b { fill: #BFDBFE; }
.bar { fill: #38BDF8; stroke: #0369A1; stroke-width: 1; } .bar2 { fill: #FBBF24; stroke: #B45309; stroke-width: 1; }
.gline { fill: none; stroke: #0369A1; stroke-width: 3; stroke-linejoin: round; } .gpt { fill: #0369A1; }
.gline2 { fill: none; stroke: #B45309; stroke-width: 3; stroke-linejoin: round; stroke-dasharray: 7 5; } .gpt2 { fill: #B45309; } .pt.prot-in { fill: #0369A1; } .needle.dash { stroke-dasharray: 7 5; stroke-width: 2.5; }
.sec { stroke: #fff; stroke-width: 2; } .sec.s0 { fill: #7DD3FC; } .sec.s1 { fill: #FCD34D; } .sec.s2 { fill: #86EFAC; } .sec.s3 { fill: #FCA5A5; } .sec.s4 { fill: #C4B5FD; }
.opts.wide .opt .pic { max-width: 150px; }
.tap-plane { cursor: crosshair; touch-action: manipulation; border-radius: 12px; }
.tap-plane:focus-visible { outline: 3px solid var(--sky); }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.2; margin: 0 .15em; }
.fr > span:first-child { border-bottom: 2px solid currentColor; padding: 0 .2em; }
.ov { text-decoration: overline; }
.blank-box { display: inline-block; margin: 0 .3em; color: var(--mute); }
.big { font-size: 28px; }

/* Exam paper look */
.paper { background: var(--exam-paper); color: var(--exam-ink); border: 1px solid #D1D5DB; border-radius: 6px; padding: 18px 20px 20px; box-shadow: 0 2px 0 #E5E7EB; font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif; position: relative; }
.paper .exam-src { position: absolute; top: -12px; left: 14px; background: #1F2937; color: #fff; font: 700 12px var(--font-body); padding: 2px 10px; border-radius: 4px; }
.paper .qno { font-weight: 700; margin-right: 6px; }
.paper .marks { float: right; font-size: 14px; color: #4B5563; margin-left: 8px; }
.paper .pic-box { fill: #F9FAFB; stroke: #D1D5DB; }
.paper .ax-grid { stroke: #E5E7EB; } .paper .ax-axis { stroke: #111827; } .paper .ax-num { fill: #4B5563; } .paper .ax-label { fill: #111827; }
.paper .ax-curve { stroke: #111827; stroke-width: 2.5; }
.paper .opt { background: #fff; color: #111827; border-color: #D1D5DB; box-shadow: none; border-radius: 6px; }
.paper .opt.sel { border-color: #1D4ED8; background: #EFF6FF; }
.paper .fill { color: #111827; background: #fff; border-color: #9CA3AF; }
.paper .pad button { background: #fff; color: #111827; border-color: #D1D5DB; box-shadow: 0 3px 0 #D1D5DB; font-family: var(--font-body); }
.paper .fill.right { background: #DCFCE7; border-color: #15803D; }
.paper .fill.wrong { background: #FEE2E2; border-color: #B91C1C; }
.paper .opt.right { background: #DCFCE7; border-color: #15803D; }
.paper .opt.wrong { background: #FEE2E2; border-color: #B91C1C; }
.paper .opt .key { border-color: #9CA3AF; color: #374151; }

/* Answers */
.opts { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opts.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opt { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 4px 0 var(--line); text-align: left; cursor: pointer; font-size: 19px; line-height: 1.4; }
.opt .key { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; font-weight: 700; color: var(--mute); font-family: var(--font-body); }
.opt.sel { border-color: var(--sky); background: rgba(79,182,255,.12); box-shadow: 0 4px 0 var(--sky); }
.opt.sel .key { border-color: var(--sky); color: var(--sky-ink); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 4px 0 var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); }
.opts.wide .opt { flex-direction: column; justify-content: center; }
.template { font-size: 22px; line-height: 2.4; text-align: center; }
.fill { width: 3.2em; height: 1.9em; font: inherit; font-size: 22px; text-align: center; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 10px; background: var(--surface); color: var(--ink); vertical-align: middle; padding: 0 4px; }
.fill.focus, .fill:focus { outline: none; border-color: var(--sky); }
.fill.right { border-color: var(--ok); background: var(--ok-bg); }
.fill.wrong { border-color: var(--bad); background: var(--bad-bg); }
.fr .fill { width: 2.4em; height: 1.6em; margin: 2px 0; }
.pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 420px; margin: 18px auto 0; }
.pad button { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); font-size: 20px; font-weight: 700; cursor: pointer; }
.pad button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tiles-ans { min-height: 64px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; margin-bottom: 18px; align-items: center; }
.tiles-ans:empty::before { content: "點選下面的卡片"; color: var(--mute); font-size: 15px; }
.tiles-bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { min-width: 48px; min-height: 48px; padding: 6px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); font-size: 20px; cursor: pointer; }
.tile.used { visibility: hidden; }
.shape-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.shape-wrap .pic { width: min(320px, 90%); }
.shape-wrap .pic.shape[viewBox="0 0 128 128"] { width: min(220px, 70%); }
.plane-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.plane-wrap .pic { width: min(340px, 100%); }
.hint { font-size: 14px; color: var(--mute); text-align: center; }

/* Scratch paper */
.scratch-btn { margin-top: 18px; background: none; border: 2px dashed var(--line); color: var(--mute); border-radius: 12px; padding: 6px 14px; cursor: pointer; min-height: 44px; }
.scratch { margin-top: 10px; border: 2px solid var(--line); border-radius: 12px; background: repeating-linear-gradient(var(--surface) 0 27px, var(--line) 27px 28px); position: relative; }
.scratch canvas { display: block; width: 100%; height: 220px; touch-action: none; }
.scratch button { position: absolute; top: 6px; right: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 2px 10px; cursor: pointer; font-size: 14px; }

/* Footer: check button and feedback sheet */
.player-foot { border-top: 2px solid var(--line); background: var(--bg); }
.player-foot .inner { max-width: 760px; margin: 0 auto; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.player-foot .btn { margin-left: auto; min-width: 150px; font-size: 18px; box-shadow: 0 4px 0 #14532D; }
.mode-dse .player-foot .btn { box-shadow: 0 4px 0 #166534; }
.player-foot .btn:disabled { background: var(--lock); color: var(--lock-ink); box-shadow: none; cursor: default; }
.player-foot.ok { background: var(--ok-bg); border-color: transparent; }
.player-foot.bad { background: var(--bad-bg); border-color: transparent; }
.fb { flex: 1 1 320px; display: flex; gap: 12px; align-items: flex-start; }
.fb .badge-ic { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.fb h3 { margin: 0 0 4px; font-size: 21px; }
.ok .fb h3 { color: var(--ok); } .bad .fb h3 { color: var(--bad); }
.fb p { margin: 0 0 4px; font-size: 16px; line-height: 1.6; }
.player-foot.bad .btn { background: var(--bad); color: #fff; box-shadow: 0 4px 0 #7F1D1D; }
.mode-dse .player-foot.bad .btn { color: #0F172A; }

/* Lesson complete */
.done-view { max-width: 520px; margin: 0 auto; padding: 32px var(--gutter); text-align: center; }
.done-view h2 { font-size: 30px; color: var(--brand); }
.tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.tstat { border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.tstat b { display: block; font-size: 13px; padding: 4px; color: #fff; }
.tstat span { display: block; font-size: 24px; font-weight: 700; padding: 8px 4px; }
.t-xp b { background: #B45309; } .t-acc b { background: #15803D; } .t-time b { background: #0369A1; }
.goal-line { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 8px 0; text-align: left; }
.new-badge { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--gold); background: var(--accent-bg); border-radius: 14px; padding: 10px 14px; margin: 10px 0; }
@media (prefers-reduced-motion: no-preference) {
  .pop-in { animation: popin .5s cubic-bezier(.2,1.6,.4,1) both; }
  @keyframes popin { from { transform: scale(.6); opacity: 0; } }
}

/* League, badges, shop, settings */
.page-view { padding: 20px 0; max-width: 640px; margin: 0 auto; width: 100%; }
.league-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.tier-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-bg); }
.lrows { list-style: none; padding: 0; margin: 0; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.lrow { display: grid; grid-template-columns: 32px 40px 1fr auto; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow .rk { font-weight: 700; text-align: center; color: var(--mute); }
.lrow.me { background: var(--tint); font-weight: 700; }
.lrow.me .rk { color: var(--brand); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; }
.av svg { width: 38px; height: 38px; }
.zone { padding: 4px 14px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.zone.up { color: var(--ok); background: var(--ok-bg); }
.zone.down { color: var(--bad); background: var(--bad-bg); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.bdg { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; background: var(--surface); }
.bdg .medal { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: #B45309; }
.bdg .medal .ico { width: 34px; height: 34px; }
.bdg.locked .medal { background: var(--line); color: var(--lock-ink); }
.bdg.locked { opacity: .8; }
.bdg h3 { font-size: 16px; margin: 0; }
.bdg p { font-size: 13px; color: var(--mute); margin: 0; line-height: 1.5; }
.shop-item { display: flex; align-items: center; gap: 14px; }
.shop-item .ico { width: 48px; height: 48px; color: #0369A1; }
.mode-dse .shop-item .ico { color: #7DD3FC; }
.settings label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.settings fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.settings legend { font-weight: 700; margin-bottom: 4px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { border: 2px solid var(--line); border-radius: 12px; padding: 4px 14px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--tint); }
.danger { color: var(--bad); border-color: var(--bad); }

/* Modal and toast */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.55); display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 24px; max-width: 380px; width: 100%; text-align: center; }
.modal-box h2 { font-size: 22px; }
.modal-box .btn { width: 100%; margin-top: 8px; }
.modal-box .ico.huge { width: 110px; height: 110px; }
.toast { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 90; background: #1F2937; color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 15px; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.mode-dse .toast { background: #F1F5F9; color: #0F172A; }

/* 個人 (PRD 22): the student's profile, like Duolingo's */
.phead { display: flex; align-items: center; gap: 16px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.phead h1 { font-size: clamp(26px, 6vw, 34px); margin: 0; overflow-wrap: anywhere; }
.phead p { margin: 0; }
.pav { flex: none; width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); border: 3px solid var(--brand-bright); overflow: hidden; }
.profile h2 { font-size: 20px; margin: 0 0 10px; }
.profile h3 { font-size: 16px; margin: 18px 0 2px; }
.pstats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pstat { display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.pstat .ico { flex: none; width: 28px; height: 28px; color: var(--brand); }
.pstat:nth-child(1) .ico { color: #F97316; }
.pstat:nth-child(2) .ico { color: #EAB308; }
.pstat:nth-child(4) .ico { color: #B45309; }
.pstat b { display: block; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.pstat span { font-size: 13px; color: var(--mute); }
.psec { margin-top: 16px; }
.plist { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.plist li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.pcode { font: 900 32px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .2em; color: var(--brand); background: var(--tint); border-radius: 12px; padding: 8px 16px; display: inline-block; margin: 4px 0 10px; }
.pcode[hidden], .perr[hidden] { display: none; }
.pform { display: grid; gap: 10px; margin: 8px 0; }
.pform label { display: grid; gap: 4px; font-weight: 700; }
.pform input { width: 100%; min-height: 46px; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px; }
.pform input:focus { outline: 3px solid var(--brand-bright); outline-offset: 1px; border-color: var(--brand); }
.pform.inline { display: flex; }
.pform.inline input { flex: 1; min-width: 0; }
.perr { color: var(--bad); font-weight: 700; margin: 0; }
.pfacts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 8px; }
.pfacts dt { font-weight: 700; color: var(--mute); }
.pfacts dd { margin: 0; overflow-wrap: anywhere; }
.profile details { margin: 8px 0 16px; }
.profile summary { cursor: pointer; font-weight: 700; color: var(--brand); min-height: 44px; display: flex; align-items: center; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 44px; }
.pjoin { text-align: center; padding: 8px 0 20px; }
.pjoin .btn { display: flex; width: 100%; max-width: 360px; margin: 10px auto 0; }
.plogout { width: 100%; }
/* 檢視帳戶: the admin is looking at this account, read only */
.viewbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; padding: 8px 16px; background: #FEF3C7; color: #78350F; font-weight: 700; border-bottom: 2px solid #F59E0B; font-size: 15px; }
.viewbar .btn { min-height: 40px; padding: 6px 16px; background: #78350F; color: #fff; }
.viewbar-acts { display: flex; gap: 8px; flex-wrap: wrap; }
/* 目錄 (PRD 30): every chapter of the year */
.unit { scroll-margin-top: 72px; }
.toc { list-style: none; margin: 8px 0 14px; padding: 0; max-height: 58vh; overflow-y: auto; text-align: left; }
.toc-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.toc-row:hover, .toc-row:focus-visible { background: var(--tint); }
.toc-code { flex: none; min-width: 42px; font-size: 13px; font-weight: 700; color: var(--mute); }
.toc-name { flex: 1; font-weight: 700; }
.toc-row small { flex: none; display: inline-flex; align-items: center; gap: 4px; color: var(--mute); }
.toc-row small .ico { width: 14px; height: 14px; }
.toc-row.locked .toc-name { color: var(--mute); }
/* 課程預覽 (PRD 30): the admin's tools in the lesson player */
.pvtools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 10px; border: 2px dashed #F59E0B; border-radius: 12px; background: #FFFBEB; color: #78350F; }
.pvtools code { flex: 1; min-width: 140px; font-size: 14px; overflow-wrap: anywhere; }
.pvtools .btn { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.pvtools .btn[aria-pressed="true"] { background: #78350F; color: #fff; border-color: #78350F; }
.pvans { margin: -4px 0 12px; padding: 8px 12px; border-radius: 12px; background: #FFFBEB; color: #78350F; border: 2px solid #F59E0B; }
.opt.hint { outline: 3px dashed #F59E0B; outline-offset: 3px; }
.pv-badge { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #FFFBEB; color: #78350F; border: 2px solid #F59E0B; pointer-events: none; }
.pv-APPROVED { background: #DCFCE7; color: #14532D; border-color: #16A34A; }
.pv-ISSUE { background: #FEE2E2; color: #7F1D1D; border-color: #DC2626; }
.pv-FIXED, .pv-CHANGED { background: #DBEAFE; color: #1E3A8A; border-color: #2563EB; }
.pv-DONE { background: #EDE9FE; color: #4C1D95; border-color: #7C3AED; } /* 待審核, PRD 36 */
.node-wrap[data-off="84"] .pv-badge, .node-wrap[data-off="56"] .pv-badge { left: auto; right: calc(100% + 10px); }
.pvreview { margin: 18px auto 0; max-width: 460px; text-align: left; padding: 14px 16px; border: 2px dashed #F59E0B; border-radius: 14px; background: #FFFBEB; color: #78350F; }
.pvreview h3 { margin: 0 0 6px; font-size: 22px; }
.pvreview h3:focus { outline: none; }
.pvreview summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.done-view .pvreview { margin: 14px auto 6px; }
.pvfoot .btn + .btn { margin-left: 0; }
.pvfoot .pv-issue { background: var(--surface); color: #B91C1C; border: 2px solid #DC2626; box-shadow: 0 4px 0 #7F1D1D; }
.pvreview fieldset, .pvcomment fieldset { border: 0; padding: 0; margin: 10px 0; min-width: 0; }
.pvreview fieldset[disabled] { opacity: .55; }
.pvreview legend, .pvcomment legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.pvreview legend small { font-weight: 400; margin-left: 6px; }
.pvchips { display: flex; flex-wrap: wrap; gap: 6px; }
.pvchips label { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 4px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; }
.pvchips label:has(input:checked) { border-color: #78350F; background: #FEF3C7; font-weight: 700; }
.pvfield { display: grid; gap: 4px; font-weight: 700; margin: 10px 0; }
.pvfield textarea { width: 100%; font: inherit; font-weight: 400; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.pvsaved { min-height: 1.4em; margin: 8px 0 0; font-weight: 700; }
.pvlist { text-align: left; padding-left: 18px; }
.pvlist li { margin-bottom: 8px; }
.pvlist .linkbtn { color: #B91C1C; } /* 撤回 a comment */
