/* wk-school：WeKen 第二曲線學院
   Design read：會員制新人訓練（登入頁＋上課介面），給 28 到 40 歲、剛開店的快電商夥伴，
   溫暖、俐落、有自信的語氣，原生 CSS＋Noto Sans TC＋克制的 GSAP／Lenis。
   Dials：VARIANCE 5／MOTION 4／DENSITY 4（產品介面，不是落地頁，版面穩定優先）
   放掉 taste 的兩條：6.C 深色模式（週末哥規定一律淺色）、3.A React／Tailwind（他規定不用建置工具） */
:root {
  --accent: #F5C518;
  --accent-deep: #8A6A00;     /* 黃色上的字、連結用，對白底 4.8:1 */
  --accent-ink: #1A1A1A;
  --bg: #F7F7F5;
  --surface: #FFFFFF;
  --ink: #161616;
  --ink-2: #4A4A47;
  --ink-3: #6E6E69;
  --line: #E4E4DF;
  --ok: #1F7A4D;
  --warn: #B4431F;
  --r: 14px;
  --r-sm: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  --font: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --shadow: 0 1px 2px rgba(60, 52, 20, .06), 0 8px 24px rgba(60, 52, 20, .06);
  color-scheme: light;
}
html { color-scheme: light; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.7;
  line-break: strict; text-wrap: pretty; overflow-x: clip; font-size: 16px; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; margin: 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: var(--accent-deep); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }
.ic svg { width: 100%; height: 100%; fill: currentColor; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: var(--gutter); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none;
  border: 0; cursor: pointer; white-space: nowrap; transition: transform .15s ease, box-shadow .15s ease; }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { background: #EDEBE3; color: var(--ink-3); cursor: not-allowed; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); }
.btn.small { min-height: 40px; padding: 6px 16px; font-size: 15px; }
.btn.line { background: #06C755; color: #fff; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .85; }
.btn[aria-busy="true"]::before, .spin { content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html.lenis { scroll-behavior: auto; } }

/* ── 登入頁 ── */
.landing-nav { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.brand-mark .ic { width: 20px; height: 20px; }
.hero { display: grid; gap: 40px; align-items: center; padding-block: clamp(24px, 6vw, 72px) clamp(48px, 8vw, 96px); min-height: calc(100dvh - 68px); }
@media (min-width: 900px) { .hero { grid-template-columns: 1.05fr 1fr; } }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.01em; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent) 62%); padding-inline: 2px; }
.hero .lead { margin-top: 18px; font-size: clamp(16px, 2vw, 18px); color: var(--ink-2); max-width: 30em; }
.hero .cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.login-msg { margin-top: 20px; padding: 14px 16px; border-radius: var(--r-sm); background: #FFF3EE; color: var(--warn); max-width: 30em; display: flex; gap: 10px; }
.login-msg a { color: var(--warn); font-weight: 700; }
.collage { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr); aspect-ratio: 1 / .92; }
.collage figure { margin: 0; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); background: #ddd; }
.collage img { width: 100%; height: 100%; object-fit: cover; }
.collage .a { grid-area: 1 / 1 / 4 / 5; }
.collage .b { grid-area: 3 / 3 / 7 / 7; }
.collage .c { grid-area: 4 / 1 / 7 / 3; }
.path { padding-block: clamp(48px, 8vw, 96px); border-top: 1px solid var(--line); }
.path h2 { font-size: clamp(24px, 3.4vw, 34px); }
.path .sub { margin-top: 10px; color: var(--ink-2); }
.steps { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 0; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .dot { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; font-weight: 700; }
.steps li.final .dot { background: var(--accent); box-shadow: none; }
.steps h3 { font-size: 18px; }
.steps p { color: var(--ink-2); margin-top: 2px; }
.foot { padding-block: 28px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }

/* ── 上課介面 ── */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.top nav { display: none; gap: 4px; margin-left: 12px; }
.top nav a { text-decoration: none; color: var(--ink-2); padding: 8px 14px; border-radius: 999px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.top nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #e6e3d8; flex: none; }
.avatar.sm { width: 28px; height: 28px; }
.me .out { color: var(--ink-3); display: inline-flex; padding: 8px; border-radius: 50%; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; font-size: 12px; color: var(--ink-3); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabs a[aria-current="page"] .ic { color: var(--accent-deep); }
.tabs .ic { width: 24px; height: 24px; }
main.app { padding-block: 24px 110px; }
@media (min-width: 860px) {
  .top nav { display: flex; }
  .tabs { display: none; }
  main.app { padding-bottom: 64px; }
}
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h1 { font-size: clamp(24px, 3.6vw, 32px); }
.page-h p { color: var(--ink-2); margin-top: 4px; }
.muted { color: var(--ink-3); }

/* 首頁：繼續上課 */
.resume { display: grid; gap: 0; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit; }
@media (min-width: 720px) { .resume { grid-template-columns: 1.1fr 1fr; } }
.resume .thumb { aspect-ratio: 16 / 9; background: #e6e3d8 center / cover; position: relative; }
.resume .thumb .ic { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; color: #fff; filter: drop-shadow(0 2px 8px rgba(0,0,0,.35)); }
.resume .body { padding: 22px; display: grid; gap: 10px; align-content: center; }
.resume .kicker { color: var(--accent-deep); font-weight: 700; font-size: 14px; }
.resume h2 { font-size: clamp(20px, 2.6vw, 26px); }
.one { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: #FFF8DA; color: #4A3B00; }
.one .ic { color: var(--accent-deep); margin-top: 2px; }
.stat { display: flex; gap: 20px; margin: 26px 0 8px; flex-wrap: wrap; }
.stat b { font-size: 28px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-3); margin-left: 4px; }
.unit { margin-top: 34px; }
.unit h2 { font-size: 19px; margin-bottom: 10px; }
.lessons { display: grid; gap: 8px; }
.lesson-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--surface); text-decoration: none; color: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.lesson-row .t { font-weight: 500; }
.lesson-row .s { font-size: 13px; color: var(--ink-3); }
.lesson-row.done .state { color: var(--ok); }
.lesson-row.locked { background: transparent; color: var(--ink-3); }
.lesson-row.current { box-shadow: inset 0 0 0 2px var(--accent); }
.lesson-row .go { color: var(--ink-3); }

/* 單堂課 */
.crumb { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); text-decoration: none; margin-bottom: 14px; }
.lesson-h h1 { font-size: clamp(22px, 3.4vw, 30px); }
.lesson-h .one { margin-top: 14px; }
.player { margin-top: 18px; aspect-ratio: 16 / 9; background: #111; border-radius: var(--r); overflow: hidden; }
.player iframe, .player > div { width: 100%; height: 100%; border: 0; display: block; }
.watch { margin-top: 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.watch .bar { flex: 1 1 160px; height: 6px; border-radius: 99px; background: #E9E7DF; overflow: hidden; }
.watch .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; width: 0; transition: width .4s ease; }
.watch.ok { color: var(--ok); font-weight: 700; }
.content { margin-top: 28px; max-width: 70ch; }
.content p { margin-top: 12px; }
.content img { border-radius: var(--r-sm); margin-top: 14px; max-height: 520px; width: auto; box-shadow: inset 0 0 0 1px var(--line); }
.content a { word-break: break-all; }
.copy { position: relative; margin-top: 14px; background: var(--surface); border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--line); }
.copy pre { margin: 0; padding: 14px 16px 56px; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 15px; line-height: 1.75; }
.copy .btn { position: absolute; right: 10px; bottom: 10px; }
.task { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.task h2 { font-size: 21px; display: flex; gap: 8px; align-items: center; }
.task .req { margin-top: 10px; color: var(--ink-2); }
.done-banner { margin-top: 18px; padding: 14px 16px; border-radius: var(--r-sm); background: #E8F4EC; color: var(--ok); display: flex; gap: 10px 12px; align-items: center; flex-wrap: wrap; }

.next { margin-top: 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* 貼文 */
.composer { margin-top: 16px; background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); padding: 16px; display: grid; gap: 12px; }
.composer label { font-weight: 700; font-size: 15px; }
.composer textarea { width: 100%; min-height: 110px; resize: vertical; border: 1px solid #CFCDC4; border-radius: var(--r-sm); padding: 12px; font: inherit; background: #fff; color: var(--ink); }
.composer textarea:focus-visible, .composer input:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 1px; border-color: var(--accent-deep); }
.composer .row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.composer .help { font-size: 13px; color: var(--ink-3); }
.composer .err { color: var(--warn); font-size: 14px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs figure { margin: 0; position: relative; width: 84px; height: 84px; border-radius: var(--r-sm); overflow: hidden; background: #eee; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(20,20,20,.7); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumbs button .ic { width: 14px; height: 14px; }
.pick { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.feed { margin-top: 20px; display: grid; gap: 14px; }
.post { background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); padding: 16px; }
.post.pinned { box-shadow: inset 0 0 0 2px var(--accent); }
.post.rejected { background: #FFF6F2; }
.post header { display: flex; gap: 10px; align-items: center; }
.post header .who { font-weight: 700; }
.post header .when { font-size: 13px; color: var(--ink-3); }
.post .text { margin-top: 10px; white-space: pre-wrap; word-break: break-word; }
.post .imgs { margin-top: 12px; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.post .imgs a { display: block; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: #eee; }
.post .imgs img { width: 100%; height: 100%; object-fit: cover; }
.post .acts { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.act { display: inline-flex; gap: 6px; align-items: center; background: transparent; border: 0; padding: 8px 12px; border-radius: 999px; color: var(--ink-2); cursor: pointer; min-height: 40px; }
.act:hover { background: #F0EEE7; }
.act.on { color: #C2410C; }
.act.admin { color: var(--warn); }
.note { margin-top: 10px; font-size: 14px; color: var(--warn); }
.comments { margin-top: 8px; display: grid; gap: 8px; padding-left: 12px; border-left: 2px solid var(--line); }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: 8px; font-size: 15px; }
.comment b { margin-right: 6px; }
.cform { display: flex; gap: 8px; margin-top: 8px; }
.cform input { flex: 1; min-width: 0; min-height: 44px; border: 1px solid #CFCDC4; border-radius: 999px; padding: 0 16px; font: inherit; background: #fff; }
.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); }
.empty .ic { width: 36px; height: 36px; color: var(--accent-deep); margin: 0 auto 8px; display: block; }
.skel { background: linear-gradient(90deg, #ECEAE3, #F5F4EF, #ECEAE3); background-size: 200% 100%; animation: sh 1.2s linear infinite; border-radius: var(--r-sm); }
@keyframes sh { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 50; max-width: calc(100% - 32px); font-size: 15px; }
@media (min-width: 860px) { .toast { bottom: 32px; } }

/* 管理 */
.seg { display: inline-flex; background: #ECEAE3; border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--surface); font-weight: 700; box-shadow: var(--shadow); }
.users { margin-top: 16px; display: grid; gap: 8px; }
.urow { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--r-sm); padding: 12px 14px; box-shadow: inset 0 0 0 1px var(--line); }
.urow .n { font-weight: 700; }
.urow .d { font-size: 13px; color: var(--ink-3); }
.urow .d .late { color: var(--warn); font-weight: 700; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; white-space: nowrap; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent-deep); }
.search { width: 100%; min-height: 46px; border: 1px solid #CFCDC4; border-radius: 999px; padding: 0 18px; font: inherit; background: #fff; margin-top: 14px; }
/* 格線裡的子元素預設最小寬度是內容寬，長字串會把貼文撐出畫面（320px 實測撐到 357px） */
.feed > *, .comment > div, .post header > div, .lessons > *, .users > * { min-width: 0; }
.comment > div, .post .text, .note { overflow-wrap: anywhere; }
/* 標題分兩段，只在段落之間換行（避免「走」一個字掉在行尾） */
.seg-l { display: inline-block; }
.collage .a img { object-position: left top; }
.done-banner .btns { margin-left: auto; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.watch .gap { display: inline-flex; align-items: center; gap: 8px; color: var(--warn); font-weight: 500; flex-wrap: wrap; }
.admin-sec { margin-top: 40px; }
.admin-sec h2 { font-size: 20px; }
.admin-sec > p { color: var(--ink-2); margin-top: 4px; }
.switch.wrap-ok { white-space: normal; align-items: flex-start; }
.switch.wrap-ok input { margin-top: 3px; flex: none; }
@media (max-width: 374px) { .seg button { padding: 8px 11px; } }
