:root {
  color-scheme: light;
  --paper: #fffdfc;
  --card: #ffffff;
  --ink: #292427;
  --dim: #60565a;
  --line: #ebe4e5;
  --line-strong: #d8ced1;
  --accent: #b13d58;
  --accent-hover: #94324a;
  --accent-pressed: #78273c;
  --deep: #292427;
  --wash: #fcf2f4;
  --selected: #f7e4e9;
  --field-line: #897d82;
  --hover-surface: #faf5f6;
  --press-surface: #f2e8eb;
  --line-hover: #b4a0a7;
  --accent-line: #dfadb9;
  --control-radius: 7px;
  --ease-out: cubic-bezier(.2,.7,.25,1);
  --control-height: 44px;
  --control-compact: 38px;
  --error: #9c201b;
  --serif: 'Hiragino Mincho ProN', 'Yu Mincho', 'YuMincho', 'Songti TC', 'Noto Serif TC', 'Noto Serif JP', serif;
  --sans: 'DM Sans', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}
* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 20px;
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body > main { flex: 1 0 auto; min-width: 0; }
body > header, body > footer { flex: none; }
main[tabindex="-1"]:focus { outline: none; }
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
a,
button {
  touch-action: manipulation;
}
button {
  border: 0;
  background: none;
}
h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}
h1,
h2,
h3,
h4 {
  font-family: var(--sans);
  font-weight: 600;
  line-height: 1.35;
}
h1 {
  font-size: clamp(38px, 5vw, 64px);
  letter-spacing: 0.045em;
}
h2 {
  font-size: clamp(30px, 3.3vw, 43px);
  letter-spacing: 0.06em;
}
h3 {
  font-size: 23px;
}
p {
  color: var(--dim);
}
svg.icon {
  width: 1.15em;
  height: 1.15em;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.17em;
  flex: none;
}
.wrap {
  width: min(1232px, calc(100% - 112px));
  margin-inline: auto;
}
.top {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.top-in,
.brand,
.top-actions,
nav,
.member,
.foot,
.foot > div,
.btn,
.text-link,
.label,
.filters,
.meta,
.actions,
.tools,
.byline,
.tag,
.section-end {
  display: flex;
  align-items: center;
}
.top-in {
  height: 78px;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  gap: 12px;
  flex: none;
}
.brand .mark {
  width: auto;
  height: 36px;
}
.brand span {
  display: grid;
  gap: 5px;
}
.brand .wordmark {
  display: block;
  width: auto;
  height: 21px;
}
.brand small {
  font: 500 10px/1.2 var(--serif);
  letter-spacing: .34em;
  color: var(--dim);
}
nav {
  gap: clamp(2px, .5vw, 8px);
  height: 100%;
}
nav a {
  position: relative;
  align-self: stretch;
  font-size: 14px;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--dim);
  white-space: nowrap;
  display: grid;
  align-items: center;
  min-height: 44px;
  padding-inline: clamp(12px, 1.2vw, 18px);
}
nav a [data-icon] { display: none; }
nav a[aria-current] {
  color: var(--accent);
  font-weight: 650;
}
.tab-marker {
  display: none;
  position: absolute;
  pointer-events: none;
  z-index: 1;
  background: var(--accent);
  transform-origin: top left;
}
:is([aria-current="page"], [aria-pressed="true"]) > .tab-marker { display: block; }
nav a > .tab-marker {
  inset-block-end: -1px;
  inset-inline: 0;
  margin-inline: auto;
  width: 24px;
  height: 2px;
}
.member {
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  font-size: 13px;
  font-weight: 600;
}
.menu {
  display: none;
}
.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  background: white;
  padding: 10px;
  z-index: 4;
}
.skip:focus {
  top: 10px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.label {
  color: var(--accent);
  font: 600 12px/1.5 var(--sans);
  letter-spacing: 0.08em;
}
.actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 27px;
}
.btn {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--control-radius);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--accent);
}
.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.small {
  padding: 7px 13px;
  font-size: 13px;
}
.text-link {
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.catalog {
  border-top: 1px solid var(--line);
  padding: 36px 0 54px;
}
.section-end {
  justify-content: space-between;
  gap: 20px;
  align-items: end;
}
.section-end h2,
.intro h1,
.blocktitle h2 {
  margin-top: 9px;
}
.tab-strip {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: calc(var(--control-radius) + 4px);
  background: var(--card);
  isolation: isolate;
}
.filters {
  width: fit-content;
  max-width: 100%;
  padding: 5px 0;
  border-inline: 0;
  border-block-color: var(--line-strong);
  border-radius: 0;
  background: var(--paper);
}
#results { min-block-size: min(var(--results-reserve, 0px), 100dvh); }
.tab-strip > button {
  position: relative;
  min-height: var(--control-compact);
  min-width: 0;
  max-width: 100%;
  padding: 6px 14px;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tab-ink {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: inherit;
  pointer-events: none;
  user-select: none;
  color: white;
  clip-path: inset(0 100% 0 0);
}
.tab-strip > button > .tab-ink { display: grid; place-items: center; }
:is([aria-current="page"], [aria-pressed="true"]) > .tab-ink { clip-path: inset(0); }
.tab-strip .tab-marker {
  inset: 0;
  border-radius: inherit;
  background: var(--ink);
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
/* The slot keeps the pointer target steady while the card lifts. */
.card-slot { display: grid; min-width: 0; }
.course {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.cover {
  position: relative;
  aspect-ratio: 1.9;
  overflow: hidden;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.badge {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgb(255 255 255 / 90%);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 3px 10px;
  font: 600 11px/1.5 var(--sans);
  letter-spacing: .04em;
  color: var(--ink);
}
.course-in {
  padding: 18px 20px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.category {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.07em;
}
.course h3 {
  margin: 6px 0 10px;
  letter-spacing: 0.03em;
}
.meta,
.byline {
  gap: 7px;
  color: var(--dim);
  font-size: 13px;
}
.course-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 18px -20px 0;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line);
}
.price {
  font-family: var(--mono);
  font-weight: 650;
  color: var(--accent);
  font-size: 18px;
}
.course-bottom .icon {
  width: 19px;
  height: 19px;
}
.quiet {
  font-size: 13px;
  color: var(--dim);
}
/* A bilingual lesson opener, set as a facing page and a desk photograph. */
.welcome {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
  padding-block: clamp(36px, 4.8vw, 76px);
}
.salutation {
  display: flex;
  align-items: center;
  gap: 13px;
  font: 500 clamp(16px, 1.3vw, 20px)/1.6 var(--serif);
  letter-spacing: .1em;
  color: var(--ink);
}
.salutation::before { content: ''; width: 32px; height: 1px; background: var(--accent); }
.welcome h1 {
  font-size: clamp(42px, 4.6vw, 70px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .025em;
  margin: .28em 0 .32em;
}
.welcome h1 em { color: var(--accent); font-style: normal; }
.welcome-intro { max-width: 28em; font-size: clamp(16px, 1.15vw, 18px); line-height: 1.85; }
.desk { overflow: hidden; border-radius: 10px; background: var(--wash); }
.desk img { display: block; width: 100%; aspect-ratio: 1.63; object-fit: cover; }
.home-note { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 6vw, 88px); align-items: center; padding-block: var(--section-space); }
.home-note h2 { font-size: clamp(25px, 2.8vw, 38px); }
.home-note p { margin-block: .65em .4em; }
.teacher-lead { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(20px, 3.8vw, 56px); }
.teacher-lead:has(+ .faculty) { padding-bottom: var(--section-space); border-bottom: 1px solid var(--line); }
.teacher-symbol { width: clamp(72px, 9vw, 108px); }
.teacher-symbol img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.teacher-lead h2 span { font: 500 14px/1.5 var(--sans); color: var(--dim); letter-spacing: .06em; margin-left: 14px; }
.teacher-lead p { max-width: 35em; margin-top: 10px; }
.teacher-facts { display: flex; gap: clamp(25px, 4vw, 60px); flex-wrap: wrap; padding-top: 15px; margin: 18px 0 6px; border-top: 1px solid var(--line); }
.teacher-facts dt { font-size: 13px; color: var(--dim); }
.teacher-facts dd { margin: 3px 0; font-weight: 550; }
.teacher-lead .text-link { color: var(--accent); }
.faculty-heading { font-size: clamp(24px, 2.25vw, 32px); margin: 34px 0 20px; }
.classroom-story { max-width: 1060px; margin-inline: auto; }
.story-intro { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(28px, 5vw, 72px); margin-bottom: var(--section-space); }
.story-intro .intro { margin-bottom: 18px; }
.story-intro p { max-width: 32em; line-height: 1.9; }
.story-intro img { width: 100%; display: block; aspect-ratio: 1.7; object-fit: cover; border-radius: 8px; }
.classroom-story h2 { font-size: clamp(24px, 2.2vw, 32px); letter-spacing: .025em; }
.classroom-story .text-link { color: var(--accent); margin-top: 6px; }
.study-guide { margin: 22px 0 0; border-top: 1px solid var(--line); }
.study-guide > div { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.study-guide dt { font-weight: 600; }
.study-guide dd { margin: 0; color: var(--dim); line-height: 1.85; }
.study-guide dd a { display: flex; width: fit-content; }
@media (max-width: 740px) {
  .welcome { grid-template-columns: 1fr; padding-block: 30px; gap: 24px; }
  .welcome h1 { font-size: clamp(41px, 8.3vw, 58px); }
  .desk img { aspect-ratio: 2; }
  .story-intro { grid-template-columns: 1fr; gap: 18px; }
  .story-intro img { aspect-ratio: 2.3; }
  .study-guide > div { grid-template-columns: 1fr; gap: 6px; padding-block: 17px; }
}
@media (max-width: 490px) {
  .teacher-lead { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .teacher-symbol { width: 90px; }
}
footer {
  border-top: 1px solid var(--line);
}
.foot {
  justify-content: space-between;
  gap: 18px;
  min-height: 85px;
}
.foot .brand {
  gap: 9px;
}
.foot .brand .mark {
  width: auto;
  height: 24px;
}
.foot .brand .wordmark {
  height: 15px;
}
.foot > div {
  gap: 22px;
  font-size: 13px;
}
.page {
  padding-block: 38px 65px;
}
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 13px;
  margin-bottom: 25px;
}
.intro {
  margin-bottom: 26px;
  max-width: 820px;
}
.intro h1 {
  font-size: clamp(34px, 4.3vw, 55px);
}
.intro p {
  margin-top: 13px;
}
.tools {
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}
.search {
  max-width: 270px;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.75fr);
  gap: 25px;
  align-items: start;
}
.panel,
.thread,
.teacher-card {
  --panel-pad: clamp(19px, 2.4vw, 32px);
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: var(--panel-pad);
}
.panel h2,
.blocktitle h2 {
  font-size: 29px;
  margin-bottom: 12px;
}
.panel h3 {
  margin-bottom: 11px;
}
.panel + .panel,
.thread + .thread,
.topic-list,
.spacer {
  margin-top: 20px;
}
.details-art {
  width: 100%;
  aspect-ratio: 2.4;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 19px;
}
.lesson,
.admin-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.lesson:last-child,
.admin-row:last-child {
  border: 0;
}
.lesson > span:first-child {
  display: flex;
  gap: 12px;
  align-items: center;
}
.number {
  color: var(--accent);
  font: 12px var(--mono);
}
.tag {
  display: inline-flex;
  font-size: 12px;
  color: var(--accent-hover);
  background: var(--wash);
  border-radius: 4px;
  padding: 2px 8px;
}
.teacher-card .avatar,
.avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #0002;
  border-radius: 50%;
  font: 600 24px var(--serif);
  color: #fff;
  background: #437160;
}
.avatar.rose {
  background: #99533d;
}
.avatar.blue {
  background: #475f90;
}
.teacher-card .teacher-name {
  font-size: 27px;
  margin: 15px 0 3px;
}
.teacher-card h4 {
  font: 600 15px var(--sans);
  margin: 20px 0 6px;
}
.teacher-card p {
  font-size: 14px;
}
.about {
  max-width: 780px;
}
.about .feature {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 6px;
  margin: 10px 0 22px;
}
.about p + p {
  margin-top: 16px;
}
.topic-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.thread h3 {
  margin: 10px 0;
}
.thread p,
.reply p,
.admin-row,
.lesson {
  overflow-wrap: anywhere;
}
.reply {
  border-left: 2px solid var(--line-strong);
  padding-left: 16px;
  margin-top: 19px;
}
.thread form {
  margin-top: 20px;
}
.empty {
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 12px;
  color: var(--dim);
  margin: 18px 0;
}
.form {
  display: grid;
  gap: 14px;
}
label.field {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 600;
}
input,
select,
textarea {
  border: 1px solid var(--field-line);
  background: var(--card);
  border-radius: 4px;
  padding: 9px 11px;
  width: 100%;
  font-size: 15px;
  line-height: 1.5;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
input[type='checkbox'] {
  width: auto;
}
fieldset {
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 4px;
  min-width: 0;
}
legend {
  font-weight: 650;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form .btn {
  justify-self: start;
}
.form[data-form='claimOwner'] summary {
  cursor: pointer;
  color: var(--accent);
}
.form[data-form='claimOwner'] details[open] .field {
  margin-top: 8px;
}
.form[data-form='claimOwner'] input[name='code'] {
  -webkit-text-security: disc;
}
.form-error {
  color: var(--error);
  font-size: 14px;
}
.inline-options {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.note {
  background: var(--wash);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin: 16px 0;
}
.account-tabs {
  display: flex;
  margin: 18px 0;
}
.account-tabs button {
  flex: 1;
}
dialog {
  width: min(470px, calc(100% - 28px));
  max-height: 90dvh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop {
  background: #1d1a1b59;
}
dialog:has(#auth-form) {
  --auth-top: clamp(12px, 10dvh, 96px);
  margin-block: var(--auth-top) auto;
  max-block-size: calc(100dvh - var(--auth-top) - 12px);
  scrollbar-gutter: stable;
}
dialog h2 {
  font-size: 28px;
}
.close {
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 25px;
  line-height: 1.2;
  width: 34px;
  height: 34px;
}
.video {
  width: 100%;
  background: var(--ink);
  aspect-ratio: 16/9;
  border-radius: 5px;
  display: block;
}
.video-title {
  margin-top: 15px;
}
.credits {
  display: grid;
  gap: 10px;
}
.credits a,
.inside-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lesson-edit {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.manage-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.admin-row .actions {
  margin: 0;
}
.demo-tools {
  margin-top: 28px;
}
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--deep);
  color: white;
  border-radius: 6px;
  padding: 9px 18px;
  z-index: 5;
  max-width: 90%;
  pointer-events: none;
}
#toast:empty {
  display: none;
}
@media (max-width: 990px) {
  .wrap {
    width: calc(100% - 56px);
  }
  .top-in {
    gap: 12px;
  }
  nav {
    gap: 2px;
  }
  nav a {
    font-size: 13px;
  }
  .grid {
    gap: 13px;
  }
  .course h3 {
    font-size: 21px;
  }
  .actions {
    gap: 9px;
  }
  .btn {
    padding: 10px 16px;
  }
}
@media (max-width: 740px) {
  .wrap {
    width: calc(100% - 36px);
  }
  .top-in {
    height: 65px;
  }
  .brand {
    gap: 10px;
  }
  .brand .mark {
    width: auto;
    height: 32px;
  }
  .brand .wordmark {
    height: 18px;
  }
  .brand small {
    font-size: 9.5px;
    letter-spacing: .28em;
  }
  .member {
    padding: 6px 10px;
    font-size: 12px;
  }
  .top-actions {
    gap: 7px;
  }
  .menu {
    display: grid;
    place-items: center;
    padding: 7px;
  }
  .top {
    position: relative;
    z-index: 3;
  }
  nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 65px;
    height: auto;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 4px 18px 10px;
    box-shadow: 0 12px 24px #1d1a1b12;
  }
  nav.open {
    display: grid;
    gap: 0;
  }
  nav a { display: flex; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
  nav a > .tab-marker { inset-inline-start: 34px; margin-inline: 0; }
  nav a [data-icon] { display: inline-flex; font-size: 16px; }
  .actions {
    margin-top: 18px;
  }
  .catalog {
    padding: 27px 0 35px;
  }
  .section-end {
    gap: 8px;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section-end .text-link {
    font-size: 12px;
  }
  .filters {
    margin: 16px 0;
  }
  .home-note { gap: 20px; padding-block: 32px; }
  .foot {
    flex-wrap: wrap;
    justify-content: start;
    gap: 12px 25px;
    padding-block: 15px;
  }
  .foot > div {
    gap: 13px;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .page {
    padding-top: 25px;
  }
  .intro h1 {
    font-size: 36px;
  }
  .tools .search {
    width: 100%;
    max-width: none;
  }
}
@media (max-width: 490px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .course .cover {
    aspect-ratio: 2.1;
  }
  .home-note .teacher-symbol { width: 74px; }
  .two {
    grid-template-columns: 1fr;
  }
  .admin-row {
    align-items: start;
    flex-wrap: wrap;
  }
  .section-end h2 {
    font-size: 30px;
  }
  .topic-head {
    align-items: start;
  }
  .label {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Public headings echo the Mincho wordmark. Controls and the teaching studio use sans. */
.welcome h1, .intro h1, .section-end h2, .home-note h2 {
  font-family: var(--serif);
  letter-spacing: .025em;
}

/* Shared reading rhythm and controls */
:root {
  --gutter: clamp(18px, 4.4vw, 72px);
  --section-space: clamp(32px, 4vw, 64px);
}
::selection { color: var(--ink); background: var(--selected); }
:focus-visible { outline-color: var(--accent); }
input, select, textarea { caret-color: var(--accent); min-width: 0; }
input::placeholder, textarea::placeholder { color: #716e69; opacity: 1; }
body { overflow-wrap: break-word; }
.wrap { width: min(1264px, calc(100% - 2 * var(--gutter))); }
.page { padding-block: var(--section-space) clamp(52px, 7vw, 96px); }
.intro { margin-bottom: clamp(24px, 3vw, 42px); }
.intro p, .about p { line-height: 1.85; max-width: 43em; }
h1, h2, h3 { text-wrap: balance; }
.intro h1 { line-height: 1.25; }
.btn, .member, .menu { min-height: var(--control-height); }
.btn.small { min-height: var(--control-compact); }
.text-link { display: inline-flex; min-height: 40px; }
.badge, .tag, .number, .price, .progress, .result-count { font-variant-numeric: tabular-nums; }
.foot { padding-block: 20px; }
.foot > div { flex-wrap: wrap; }
.foot > div a { display: inline-flex; align-items: center; min-height: 40px; }

/* Course browsing */
.catalog { padding-block: var(--section-space); }
.filters { margin-block: 22px; }
.grid { gap: clamp(16px, 2vw, 28px); }
.panel, .thread, .teacher-card, .empty { border-radius: 16px; }
.course h3 { font-size: clamp(19px, 1.55vw, 22px); letter-spacing: .02em; margin-block: 6px 8px; }
.course .category { color: var(--dim); }
.card-description {
  font-size: 14.5px; line-height: 1.75; margin-bottom: 16px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course .meta { margin-top: auto; flex-wrap: wrap; }
.course-title::after { content: ''; position: absolute; inset: 0; }
.course:has(.course-title:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.course-title:focus-visible { outline: none; color: var(--accent-hover); }
.trial-link { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-compact); padding: 0 12px; border: 1px solid var(--selected); border-radius: var(--control-radius); background: var(--wash); color: var(--accent-hover); font-weight: 600; font-size: 13px; white-space: nowrap; }

.card-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.course .price { font: 650 17px/1.5 var(--sans); color: var(--ink); }
.tools { padding-block: 4px; }
.tools .filters { margin: 0; }
.search-box { display: flex; align-items: center; position: relative; width: min(320px,100%); }
.search-box > .icon { position: absolute; left: 13px; pointer-events: none; color: var(--dim); }
.search-box input[type=search] { padding: 11px 14px 11px 42px; max-width: none; appearance: none; }
.search-box:focus-within > .icon { color: var(--accent); }
.result-count { font-size: 14px; margin-block: 17px; }
.empty { background: var(--card); padding: clamp(22px, 3vw, 38px); }
.empty h3 { color: var(--ink); margin-bottom: 8px; }
.empty .btn { margin-top: 14px; }

/* Reading, enrollment and playback */
.course-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .85fr);
  grid-template-rows: auto 1fr;
  gap: 22px;
  align-items: start;
}
.course-layout > .card-slot:has(> .syllabus) { grid-row: 1 / 3; }

.enrollment .price { font: 650 clamp(27px, 3vw, 36px)/1.4 var(--sans); color: var(--ink); margin-block: 4px 10px; }
.course-teacher h2 { margin: 6px 0 10px; }
.course-teacher h3 { font: 600 15px/1.5 var(--sans); margin: 18px 0 4px; }
.syllabus { overflow: hidden; }
.syllabus .details-art {
  width: calc(100% + 2 * var(--panel-pad));
  max-width: none;
  margin: calc(-1 * var(--panel-pad)) calc(-1 * var(--panel-pad)) 22px;
  border-radius: 0;
}
.enrollment .quiet + .quiet { margin-top: 6px; }
.lesson { min-height: 54px; padding: 12px 8px; }
.lesson[aria-current="step"] { color: var(--accent-hover); background: var(--wash); border-radius: 8px; font-weight: 650; }
.lesson-state { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; flex: none; color: var(--dim); }
.lesson[aria-current="step"] .lesson-state { color: var(--accent-hover); }
.player-next { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 16px; padding: clamp(16px, 2vw, 24px); border-radius: 12px; border: 1px solid var(--line); }
.player-next > div { flex: 1 1 180px; min-width: 0; }
.player-next h2 { font-size: 22px; margin-block: 4px; }
.player-next p { font-size: 14px; }
.player-help { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 8px; }
.player-help .text-link { min-height: 44px; padding: 0; }
.video { border: 0; border-radius: 10px; }
.progress { display: grid; gap: 6px; font-size: 13px; color: var(--dim); margin-block: 8px 14px; }
.progress progress { appearance: none; width: 100%; height: 5px; border: 0; border-radius: 9px; background: var(--line); overflow: hidden; }
.progress progress::-webkit-progress-bar { background: var(--line); }
.progress progress::-webkit-progress-value { background: var(--accent); }
.progress progress::-moz-progress-bar { background: var(--accent); }
.classroom-row {
  display: grid; grid-template-columns: clamp(100px, 14vw, 184px) minmax(0, 1fr) auto;
  align-items: center; gap: clamp(18px, 3vw, 44px); padding-block: 22px; border-top: 1px solid var(--line);
}
.classroom-row img { width: 100%; aspect-ratio: 1.55; object-fit: cover; border-radius: 8px; }
.classroom-row h3 { margin: 7px 0; }
.classroom-row .progress { max-width: 330px; }
.account-settings { border-top: 1px solid var(--line); padding-block: 22px; }
summary { cursor: pointer; }
.teacher-card {
  --panel-pad: clamp(18px, 1.6vw, 26px);
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 1.8vw, 26px);
}
.faculty .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.teacher-heading, .course-teacher-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.teacher-portrait {
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 4px;
  background: var(--wash);
}
.teacher-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.teacher-heading:has(.teacher-portrait) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.teacher-heading.vertical-name { grid-template-columns: minmax(0, 1fr) 4.6rem; align-items: start; }
.teacher-identity { min-width: 0; overflow-wrap: anywhere; }
.teacher-identity .teacher-name { margin: 0; font: 600 clamp(24px, 2.3vw, 34px)/1.25 var(--serif); }
.teacher-identity small, .course-teacher-heading small { font-size: 13px; color: var(--dim); }
.vertical-name .teacher-identity {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  padding-top: 6px;
}
.vertical-name :is(.teacher-name, small) { writing-mode: vertical-rl; }
.vertical-name .teacher-name { letter-spacing: .09em; }
.vertical-name small { letter-spacing: .07em; }
.teacher-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.teacher-copy h4:first-child { margin-top: 0; font: 600 19px/1.5 var(--serif); }
.course-teacher-heading { margin-bottom: 16px; }
.course-teacher-heading:has(.teacher-portrait) { grid-template-columns: clamp(76px, 8vw, 110px) minmax(0, 1fr); }
.course-teacher-heading h2 { margin: 3px 0; }
.teacher-card p, .thread p { font-size: 16px; line-height: 1.85; }
.teacher-card .spacer { display: grid; justify-items: start; gap: 3px; margin-top: auto; padding-top: 20px; }
@media (max-width: 960px) {
  .faculty .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 600px) and (max-width: 960px) {
  .teacher-card:has(.teacher-portrait) {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    align-items: start;
    gap: clamp(24px, 4vw, 40px);
  }
  .teacher-card .teacher-copy { align-self: stretch; }
}
@media (max-width: 599px) {
  .teacher-heading.vertical-name { grid-template-columns: minmax(0, 1fr) minmax(4.6rem, .55fr); }
  .vertical-name .teacher-identity { align-self: center; padding-top: 0; }
}
.about { margin-inline: auto; }
.about .feature { height: auto; aspect-ratio: 2.35; border-radius: 10px; }
.topic-head { align-items: end; padding-block: 12px 20px; border-bottom: 1px solid var(--line); }
.topic-head .field { width: min(340px, 100%); }
.topic-list { display: grid; gap: 20px; margin-top: 0; }

.thread .spacer:has(> .text-link) { margin-top: 8px; }
.reply p { margin-block: 7px; }

/* Teaching studio and account forms */
.member-row h3 { overflow-wrap: anywhere; }
.member-row .actions { justify-content: flex-end; }
.dialog-actions { display: flex; justify-content: end; gap: 10px; flex-wrap: wrap; }
dialog .form .dialog-actions .btn { width: auto; min-width: 82px; }
.auth-hint { margin-block: 12px 0; }
.auth-forgot { justify-self: start; font-size: 14px; }

/* Members page, role choices and shareable admin or owner links */
.member-info { min-width: 0; }
.member-row h3 small { margin-left: 8px; font: 600 12px/1.4 var(--sans); color: var(--dim); vertical-align: middle; }
#member-list .member-row[hidden] { display: none; }
#member-list { margin-top: 6px; }
.member-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-top: 16px; }
.member-tools .filters { margin: 0; }
@media (min-width: 741px) {
  /* Keep 變更身分 in one column at the right edge, with or without a reset link beside it. */
  .member-row [data-action=change-role] { order: 1; }
}
.member-count { margin: 12px 0 0; }
.member-count:empty { display: none; }
.member-note { margin: 14px 0 0; font-size: 13px; }
.role-help summary { display: inline-flex; align-items: center; min-height: 40px; font-size: 14px; font-weight: 600; color: var(--accent-hover); }
.role-guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.role-guide > div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.role-guide dt { font-weight: 650; }
.role-guide dd { margin: 4px 0 0; font-size: 13px; line-height: 1.65; color: var(--dim); }
.link-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--selected); border-radius: 12px; background: var(--wash); }
.link-status > div { flex: 1 1 220px; min-width: 0; }
.link-status p { margin: 2px 0 0; }
.link-status .tag { background: var(--card); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { flex: 1; min-width: 0; padding-inline: 12px; font: 13px/1.4 var(--mono); color: var(--dim); }
.copy-field .btn { flex: none; }
.role-options { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.role-options legend { margin-bottom: 8px; padding: 0; font-size: 14px; font-weight: 600; }
.role-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; padding: 13px 14px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.role-option input[type=radio] { grid-row: span 2; width: 18px; height: 18px; min-height: 0; margin: 3px 0 0; padding: 0; border: 0; border-radius: 50%; accent-color: var(--accent); }
.role-option input[type=radio]:focus { box-shadow: none; }
.role-option strong { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 15px; }
.role-option strong small { font: 500 12px/1.4 var(--sans); color: var(--dim); }
.role-option > span { font-size: 13px; line-height: 1.65; color: var(--dim); }
.role-option:has(input:checked) { border-color: var(--accent); background: var(--wash); }
.role-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .role-option:not(:has(input:checked)):hover { border-color: var(--line-hover); }
}
.member-summary, .invite-account { display: grid; gap: 2px; overflow-wrap: anywhere; }
.member-summary { margin: 4px 0 0; }
.invite-panel { max-width: 640px; }
.invite-panel h2 { margin-bottom: 8px; }
.invite-account { margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.invite-panel .actions { margin-top: 20px; }
.invite-panel > .quiet:last-child { margin: 14px 0 0; }
@media (max-width: 599px) {
  .member-tools .search-box { width: 100%; }
  .copy-field { flex-direction: column; }
}

#studio-switch[hidden], .in-studio #nav, .in-studio #menu, .in-studio #account { display: none; }
.staff-session .top, .in-studio .top { position: sticky; top: 0; z-index: 3; }
html:has(.staff-session, .in-studio) { scroll-padding-top: 92px; }
.staff-session .top :focus-visible { outline-offset: 2px; }
.top-actions { gap: 8px; }
.in-studio .top { background: var(--deep); color: #fff; border-color: var(--deep); }
.in-studio .top .brand :is(.mark, .wordmark) { filter: brightness(0) invert(1); }
.in-studio .top .brand small { color: #ffffffc4; font: 600 13px/1.45 var(--sans); letter-spacing: .12em; }
.in-studio #studio-switch { white-space: nowrap; color: #fff; background: #ffffff14; border: 0; }
.in-preview #studio-switch { background: var(--card); color: var(--ink); }
.in-studio .top :focus-visible { outline-color: white; }
.in-studio footer .foot > div a:not(#footer-studio) { display: none; }
.studio-rail { position: sticky; top: 98px; }
.studio-content { min-width: 0; }
.studio-teacher-info, .profile-appearance figure {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.studio-teacher-info > div { min-width: 0; overflow-wrap: anywhere; }
.studio-teacher-info .teacher-portrait { width: 52px; flex: none; }
.studio-teacher-info .avatar { flex: none; }
.profile-appearance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
.profile-appearance figure { margin: 0; flex-direction: column; align-items: start; gap: 6px; }
.profile-appearance figcaption { font-size: 14px; color: var(--dim); }
.profile-appearance .teacher-portrait { width: clamp(76px, 10vw, 108px); flex: none; }
.profile-appearance:has(.teacher-portrait) > .field, .photo-controls [hidden] { display: none; }
.photo-controls { display: grid; flex: 1 1 200px; gap: 6px; min-width: 0; }
.photo-controls small { color: var(--dim); }
.photo-status:empty { display: none; }
.photo-picker { position: relative; overflow: hidden; cursor: pointer; }
.photo-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.photo-picker:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-content .admin-row:has(> .studio-teacher-info) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
.studio-content .intro { margin-bottom: 22px; }
.studio-content .intro h1 { font-family: var(--sans); font-size: clamp(30px, 3.2vw, 46px); }
.studio-content .admin-row .actions { gap: 8px 14px; }
.studio-content .admin-row .actions > * { min-height: 44px; white-space: nowrap; }
.studio-course-info { display: flex; gap: 16px; align-items: center; min-width: 0; }
.studio-course-info img { width: clamp(54px, 6vw, 78px); height: 62px; object-fit: cover; border-radius: 8px; }
.studio-content .section-end { align-items: center; flex-wrap: wrap; }
.studio-content .section-end h2 { margin: 0; }
.studio { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr); align-items: start; gap: clamp(18px, 3vw, 44px); }
.studio-menu {
  display: grid;
  gap: 16px;
  border-inline-start: 1px solid var(--line-strong);
}
.studio-menu-group { display: grid; }
.studio-menu a {
  --menu-detail: var(--dim);
  --menu-count-bg: var(--hover-surface);
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  min-height: var(--control-height);
  padding: 8px 12px 8px 16px;
  border-radius: 0 var(--control-radius) var(--control-radius) 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
.studio-menu .icon { width: 18px; height: 18px; color: var(--menu-detail); }
.studio-menu a > .studio-label {
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: text-decoration-color 120ms ease-out;
}
.studio-menu a > :is(.icon, small) {
  transition: color 120ms ease-out, background-color 120ms ease-out;
}
.studio-menu a[aria-current] {
  --menu-detail: currentColor;
  --menu-count-bg: var(--selected);
  color: var(--accent-hover);
  background: var(--wash);
  font-weight: 600;
}
.studio-menu a[aria-current] .icon { color: var(--accent); }
.studio-menu a > .tab-marker {
  inset-inline-start: -1px;
  inset-block: 0;
  margin-block: auto;
  width: 2px;
  height: 22px;
}
.studio-menu small {
  min-width: 22px;
  padding-inline: 5px;
  border-radius: 5px;
  background: var(--menu-count-bg);
  color: var(--menu-detail);
  text-align: center;
  font: 500 12px/20px var(--sans);
  font-variant-numeric: tabular-nums;
}
.preview-overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, .85fr); align-items: start; gap: 18px; }
.preview-facts h2 { font-size: 22px; }
.preview-facts dl { margin: 14px 0 20px; }
.preview-facts dl div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; }
.preview-facts dt { color: var(--dim); }
.preview-facts dd { margin: 0; font-weight: 600; }
.preview-facts > .btn { width: 100%; }
.preview-actions, .editor-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.preview-actions:not(:empty) { margin-top: 10px; }
.editor-nav { margin-bottom: 12px; }
.editor-nav .crumb { margin: 0; }
.studio-content:has(#course-editor[data-dirty]) .saved-preview,
.studio-content:has(#course-editor:not([data-dirty])) .save-preview { display: none; }
.admin-row { padding-block: 18px; }
.card-slot > :is(.classroom-row, .studio-course) {
  margin-block: 5px;
  background: var(--card);
  border: 1px solid var(--card-edge, var(--line));
  border-radius: 12px;
  padding: clamp(12px, 1.5vw, 20px);
}
.admin-row h3 { margin: 4px 0; font-size: 21px; }
.editor { max-width: 850px; }
.editor > section { display: grid; gap: 16px; }
.editor > section + section { margin-top: 9px; padding-top: 23px; border-top: 1px solid var(--line); }
.editor h2 { margin-bottom: 0; }
.editor .inline-options input { width: 19px; height: 19px; }
.editor .lesson-edit { display: block; margin: 0; border: 1px solid var(--line); border-radius: 12px; }
.editor .lesson-edit + .lesson-edit { margin-top: 10px; }
.lesson-edit summary { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px; list-style: none; }
.lesson-edit summary::-webkit-details-marker { display: none; }
.lesson-edit summary .number, .lesson-edit summary .unit-access { flex: none; }
.lesson-edit summary .unit-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lesson-edit summary .unit-access { color: var(--dim); font-size: 13px; }
.lesson-edit[open] summary { border-bottom: 1px solid var(--line); }
.lesson-edit[open] summary .icon { transform: rotate(180deg); }
.unit-fields { display: grid; gap: 15px; padding: clamp(14px, 2vw, 24px); }
.unit-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.unit-actions .text-link { margin-left: auto; }
.editor #lesson-fields { min-width: 0; }
.editor .lesson-edit .text-link { justify-self: start; color: var(--accent); }
.form { gap: 18px; }
.form [type="file"] { font-size: 14px; }
.inline-options { min-height: 40px; cursor: pointer; }
label.field { gap: 7px; min-width: 0; }
input:not([type='checkbox']), select, textarea { font-size: 16px; border-radius: 10px; min-height: 44px; }
input:not([type=checkbox]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background-color: var(--card);
}
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2351504d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input::file-selector-button { font: inherit; font-weight: 600; color: var(--accent-hover); padding: 6px 12px; margin-right: 10px; background: var(--wash); border: 0; border-radius: 6px; cursor: pointer; }
.inline-options input[type=checkbox] { accent-color: var(--accent); }
@media (forced-colors: active) {
  input:not([type=checkbox]):focus, select:focus, textarea:focus { outline: 2px solid Highlight; }
  select { appearance: auto; }
  nav a[aria-current], .chip[aria-pressed="true"], .account-tabs .selected, .studio-menu a[aria-current] { outline: 1px solid SelectedItem; outline-offset: -2px; }
  .tab-strip { border-color: ButtonText; }
  .tab-marker { background: Highlight; forced-color-adjust: none; }
}
.form-error:empty { display: none; }
.form-error:not(:empty) { padding: 9px 12px; border-left: 3px solid var(--error); background: #fff1f0; }
dialog { border-radius: 18px; padding: clamp(22px, 4vw, 36px); }
dialog h2 { padding-right: 30px; margin-top: 10px; }
.close { display: grid; place-items: center; width: 44px; height: 44px; right: 7px; top: 6px; font-size: 18px; }
.providers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(184px, 100%), 1fr));
  gap: 12px;
  margin-block: 22px;
}
.provider-button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  min-height: var(--control-height);
  padding: 0;
  border: 1px solid #747775;
  border-radius: var(--control-radius);
  background: white;
  color: #1f1f1f;
  font: 500 14px/20px var(--sans);
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.provider-mark { align-self: stretch; display: grid; place-items: center; }
.provider-mark img { display: block; width: 20px; height: 20px; }
.provider-button > span:last-child { padding-inline: 2px 12px; }
.provider-button[data-provider="line"] {
  background: #06c755;
  border-color: transparent;
  color: white;
}
.provider-button[data-provider="line"] .provider-mark { border-inline-end: 1px solid rgb(0 0 0 / 8%); }
.provider-button[data-provider="line"] img { width: 30px; height: 30px; }
.provider-button[data-provider="line"] > span:last-child { padding-inline: 22px; }
.provider-button:focus-visible { outline-offset: 2px; }
.provider-button[data-busy] { cursor: progress; }
@media (hover: hover) and (pointer: fine) {
  .provider-button[data-provider="google"]:hover { border-color: var(--ink); background: #f8f9fa; }
  .provider-button[data-provider="line"]:hover { background: #05b34d; }
}
.provider-button[data-provider="google"]:active { background: #eef0f1; }
.provider-button[data-provider="google"] img { mix-blend-mode: multiply; }
.provider-button[data-provider="line"]:active { background: #048b3c; }
.or-rule { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 13px; line-height: 1.5; }
.or-rule::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.or-rule + .account-tabs { margin-block-start: 10px; }
dialog .form .btn { width: 100%; }
#toast { width: max-content; text-align: center; padding-bottom: max(9px, env(safe-area-inset-bottom)); }


/* Pointer, touch and keyboard states share the same controls and hit areas. */
a, button, summary { -webkit-tap-highlight-color: color-mix(in srgb, var(--accent) 12%, transparent); }
:is(.btn, .member, .menu, .close, .chip, nav a, .studio-menu a, .account-tabs button,
    .lesson, .lesson-edit summary) { -webkit-tap-highlight-color: transparent; }
:is(.btn, .member, .menu, .close, .chip, nav a, .studio-menu a, .lesson,
    .account-tabs button, summary, .text-link, .trial-link, .crumb, .course-title,
    .foot a, .thread h3 a, .inside-link, .credits a, .brand) {
  transition: color 120ms ease-out, background-color 120ms ease-out, border-color 120ms ease-out;
}
.close, .menu { border-radius: var(--control-radius); }
.lesson, .lesson-edit summary { border-radius: 8px; }
.lesson-edit[open] summary { border-radius: 8px 8px 0 0; }
#menu [data-icon] { display: inline-flex; }
#menu[aria-expanded="false"] [data-icon="close"],
#menu[aria-expanded="true"] [data-icon="menu"] { display: none; }
.member[aria-current] {
  color: var(--accent);
  border-color: var(--accent-line);
}
:is(.btn, .member, .menu, .close, nav a, .studio-menu a, .lesson, .lesson-edit summary):focus-visible {
  outline-offset: -2px;
}
:is(.chip, .account-tabs button):focus-visible { outline-offset: -2px; }
.tab-strip > [aria-pressed="true"]:focus-visible > .tab-marker {
  outline: 2px solid white;
  outline-offset: -4px;
}
.btn:not(.secondary):focus-visible { outline-color: white; outline-offset: -4px; }
.in-studio .top #studio-switch:focus-visible { outline-offset: -3px; }
.in-preview .top #studio-switch:focus-visible { outline-color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(.secondary):not(:disabled):hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
  }
  nav a:where(:not([aria-current])):hover {
    color: var(--ink);
  }
  .tab-strip > button[aria-pressed="false"]:enabled:hover {
    color: var(--accent);
  }
  .studio-menu a:not([aria-current], :active, [data-touch-press]):hover > .studio-label {
    text-decoration-line: underline;
    text-decoration-color: currentColor;
  }
  :is(.btn.secondary, .member):where(:not(:disabled, [aria-current])):hover {
    color: var(--ink);
    border-color: var(--line-hover);
    background-color: var(--hover-surface);
  }
  :is(.menu, .close):hover,
  .lesson:where(:not([aria-current])):hover, .lesson-edit summary:hover {
    color: var(--ink);
    background-color: var(--hover-surface);
  }
  .trial-link:hover { border-color: var(--accent-line); background-color: var(--selected); }
  .in-studio #studio-switch:hover { color: white; background-color: #ffffff26; }
  .in-preview #studio-switch:hover { color: var(--ink); background-color: var(--hover-surface); }
  :is(.text-link, .crumb, .trial-link, .brand, .foot a, .thread h3 a, .credits a,
      .inside-link, .course-title, .account-settings summary):not(:disabled):hover {
    color: var(--accent-hover);
  }
  .in-studio .top .brand:hover { color: #fff; }
  :is(.text-link, .foot > div a, .thread h3 a):not(:disabled):hover {
    text-decoration: underline;
    text-underline-offset: .22em;
    text-decoration-thickness: 1px;
  }
  :is(input:not([type=checkbox]), select, textarea):not(:disabled):not(:focus):hover {
    border-color: var(--dim);
  }
}
.btn:not(.secondary):not(:disabled):is(:active, [data-touch-press]) {
  transition-duration: 0s;
  background-color: var(--accent-pressed);
  border-color: var(--accent-pressed);
}
.tab-strip > button[aria-pressed="false"]:enabled:is(:active, [data-touch-press]) {
  transition-duration: 0s;
  color: var(--accent-pressed);
}
.studio-menu a:not([aria-current]):is(:active, [data-touch-press]) > .studio-label {
  color: var(--accent-pressed);
}
:is(.btn.secondary, .member, .menu, .close, .lesson, .lesson-edit summary):where(:not(:disabled, [aria-pressed="true"], .selected, [aria-current])):is(:active, [data-touch-press]),
nav.open a:where(:not([aria-current])):is(:active, [data-touch-press]) {
  transition-duration: 0s;
  color: var(--ink);
  background-color: var(--press-surface);
}
nav a:where(:not([aria-current])):is(:active, [data-touch-press]) { color: var(--ink); }
:is(.text-link, .crumb, .course-title, .trial-link, .foot a, .thread h3 a,
    .inside-link, .credits a, .account-settings summary):not(:disabled):is(:active, [data-touch-press]) {
  color: var(--accent-pressed);
}
.in-studio #studio-switch:is(:active, [data-touch-press]) { background-color: #ffffff36; color: white; }
.in-preview #studio-switch:is(:active, [data-touch-press]) { color: var(--ink); background-color: var(--press-surface); }
@media (pointer: coarse) {
  :root { --control-compact: var(--control-height); }
  .btn.small, .text-link, .crumb, .foot > div a { min-height: 44px; }
}

@media (max-width: 740px) {
  :root { --gutter: clamp(16px, 4.5vw, 30px); }
  .course-layout { grid-template-columns: minmax(0, 1fr); }
  .course-layout > .card-slot:has(> .enrollment) { grid-row: 1; }
  .course-layout > .card-slot:has(> .syllabus) { grid-row: 2; }
  .studio { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .studio-rail { position: static; }
  .in-preview .studio-rail { display: none; }
  .preview-overview { grid-template-columns: minmax(0, 1fr); }
  .studio-menu {
    grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr));
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: calc(var(--control-radius) + 4px);
    background: var(--card);
    isolation: isolate;
  }
  .studio-menu-group { display: contents; }
  .studio-menu a {
    grid-template-columns: 16px minmax(0, 1fr) auto;
    gap: 5px;
    padding: 8px;
    border-radius: var(--control-radius);
    font-size: 14px;
  }
  .studio-menu .icon { width: 16px; height: 16px; }
  .studio-menu small { min-width: 17px; padding-inline: 3px; }
  .studio-menu a[aria-current] { background: transparent; }
  .studio-menu .tab-ink {
    display: grid;
    grid-template-columns: inherit;
    align-items: inherit;
    gap: inherit;
  }
  .studio-menu a .tab-ink :is(.icon, small) { color: inherit; background: transparent; }
  .studio-menu a[aria-current]:focus-visible > .tab-marker { outline: 2px solid white; outline-offset: -4px; }
  .studio-menu a > .tab-marker {
    inset: 0;
    width: auto; height: auto;
    margin: 0;
    border-radius: inherit;
    background: var(--ink);
  }
  .search-box { width: 100%; }
  .tools { flex-direction: column-reverse; align-items: start; }
  .tools > #filter-bar { max-width: 100%; }
  .classroom-row { grid-template-columns: 80px minmax(0, 1fr); }
  .classroom-action { grid-column: 2; }
  .foot { align-items: start; }
  .topic-head { flex-wrap: wrap; }
  .topic-head .field { flex: 1 1 180px; }
  html:has(.staff-session, .in-studio) { scroll-padding-top: 78px; }
}
@media (forced-colors: active) {
  @media (hover: hover) and (pointer: fine) {
    .tab-strip > button[aria-pressed="false"]:enabled:hover .segment-label {
      text-decoration: underline;
      text-underline-offset: .18em;
    }
  }
  .tab-strip > [aria-pressed="true"], .studio-menu a[aria-current] {
    forced-color-adjust: none;
    color: HighlightText;
    background: Highlight;
  }
  .tab-strip .tab-marker, .studio-menu .tab-marker,
  .tab-strip > button > .tab-ink, .studio-menu .tab-ink { display: none; }
  .tab-strip > [aria-pressed="true"]:focus-visible, .studio-menu a[aria-current]:focus-visible {
    outline: 2px solid HighlightText;
    outline-offset: -4px;
  }
}
@media (max-width: 490px) {
  .menu { min-width: 44px; justify-content: center; }
  #studio-switch { min-height: 44px; padding-inline: 8px; gap: 4px; }
  .member-row .actions { justify-content: flex-start; }
  .studio-content .admin-row { display: grid; justify-content: stretch; gap: 8px; }
  .lesson-edit summary { flex-wrap: wrap; column-gap: 7px; padding-inline: 10px; }
  .lesson-edit summary .unit-access { font-size: 12px; }
  .filters .chip { padding-inline: clamp(6px, 2vw, 9px); font-size: 13px; }
  .foot > div { column-gap: 14px; row-gap: 0; }
  .classroom-row { row-gap: 6px; }
  .topic-head > .btn { flex: none; }
}

/* Every card has one stationary hit area and the same raised, focused and pressed states. */
.card-slot:has(:focus-visible) {
  --card-shift: 0 -3px;
  --card-media: scale(1.025);
  --card-shadow: 0 5px 18px -12px color-mix(in srgb, var(--ink) 24%, transparent);
  --card-edge: var(--line-strong);
}
@media (hover: hover) and (pointer: fine) {
  .card-slot:hover {
    --card-shift: 0 -3px;
    --card-media: scale(1.025);
    --card-shadow: 0 5px 18px -12px color-mix(in srgb, var(--ink) 24%, transparent);
    --card-edge: var(--line-strong);
  }
}
.card-slot:is([data-touch-press], :has([data-touch-press]), :active) {
  --card-shift: 0 1px;
  --card-media: scale(1.025);
  --card-shadow: none;
  --card-edge: var(--line-strong);
  --card-speed: 90ms;
}
.card-slot > * { border-color: var(--card-edge, var(--line)); box-shadow: var(--card-shadow, none); }
@media (prefers-reduced-motion: no-preference) {
  :root {
    --motion-feedback: 160ms var(--ease-out);
    --motion-settle: 220ms var(--ease-out);
  }
  .tab-strip .segment-label { display: inline-block; transition: transform var(--motion-feedback); }
  .tab-strip > button:enabled:is(:active, [data-touch-press]) .segment-label {
    transform: translateY(1px);
    transition-duration: 65ms;
  }
  .lesson-edit[open] > .unit-fields,
  .account-settings[open] > .actions {
    animation: surface-enter var(--motion-settle);
  }
  .card-slot > * {
    translate: var(--card-shift, none);
    transition: translate var(--card-speed, 220ms) var(--ease-out), box-shadow var(--motion-settle), border-color var(--motion-feedback);
  }
  .card-art {
    transform: var(--card-media, none);
    transition: transform var(--card-speed, 350ms) var(--ease-out);
  }
  .motion-enter, #auth-form[data-form="register"] > .field:first-child {
    animation: content-settle var(--motion-feedback);
  }
  :is(.btn, .text-link, .crumb, .lesson-state, .trial-link) > .icon,
  .brand .mark {
    transition: transform var(--motion-settle);
  }
  :is(input:not([type="checkbox"]), textarea, select), .search-box {
    transition: border-color var(--motion-feedback), box-shadow var(--motion-feedback);
  }
  .btn[aria-busy="true"]::before {
    content: "";
    width: .9em;
    height: .9em;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: busy-turn 700ms linear infinite;
  }
  dialog[open], nav.open { animation: surface-enter 150ms var(--ease-out); }
  dialog[open]::backdrop { animation: fade-in 150ms ease-out; }
  #toast:not(:empty), .form-error:not(:empty) { animation: fade-in 140ms ease-out; }
  .lesson-edit summary .icon { transition: transform 160ms var(--ease-out); }
  :is(.btn, .member, .trial-link, .provider-button) {
    transition-property: color, background-color, border-color, translate;
    transition-duration: 120ms;
    transition-timing-function: var(--ease-out);
  }
  :is(.btn, .member, .trial-link, .provider-button):not(:disabled):is(:active, [data-touch-press]) {
    translate: 0 1px;
    transition-duration: 50ms;
  }
  @media (hover: hover) and (pointer: fine) {
    :is(.btn, .member, .provider-button):not(:disabled):hover:not(:active) { translate: 0 -1px; }
    .brand:is(:hover, :focus-visible) .mark { transform: translateY(-1px); }
    :is(.btn, .text-link):not(:disabled):is(:hover, :focus-visible) > :is(.icon-arrow, .icon-right),
    .lesson:not([aria-current]):is(:hover, :focus-visible) .lesson-state > :is(.icon-play, .icon-right) { transform: translateX(2px); }
    .crumb:is(:hover, :focus-visible) > .icon { transform: translateX(-2px); }
    .trial-link:is(:hover, :focus-visible) > .icon { transform: scale(1.1); }
  }
  @media (pointer: coarse) {
    :is(.lesson:not([aria-current]), .text-link):is(:active, [data-touch-press]) > .icon,
    .lesson:is(:active, [data-touch-press]) .lesson-state .icon { transform: scale(.94); }
  }
}
@keyframes busy-turn { to { transform: rotate(1turn); } }
@keyframes surface-enter {
  from { opacity: 0; translate: 0 4px; }
  to { opacity: 1; translate: 0 0; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes content-settle { from { translate: 0 2px; } to { translate: 0 0; } }

/* Loading placeholder. Quick loads never show it. After a noticeable wait it fades in, shaped like the page being opened. */
.boot {
  display: grid;
  align-content: start;
  gap: 28px;
  /* Keeps the footer below the fold until the page arrives. */
  min-height: 100vh;
  min-height: 100dvh;
  padding-block: var(--section-space) clamp(52px, 7vw, 96px);
  animation: fade-in .3s ease .45s backwards;
}
.boot i {
  display: block;
  border-radius: 6px;
  background: var(--line);
  animation: boot-breathe 1.2s ease-in-out .45s infinite alternate;
}
.boot-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.boot-rail, .boot-label, .boot-title + .boot-title, .boot-actions { display: none; }
.boot-copy { display: grid; justify-items: start; gap: 16px; }
.boot-title { width: min(300px, 60%); height: clamp(34px, 3.6vw, 46px); margin-top: 8px; }
.boot-text { width: min(620px, 100%); height: 14px; }
.boot-text + .boot-text { width: min(380px, 70%); }
.boot-media {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
  margin-top: clamp(24px, 6vw, 96px);
}
/* Course card: cover on top, white body below. */
.boot-media i {
  aspect-ratio: 5 / 6;
  border-radius: 14px;
  background: linear-gradient(var(--press-surface) 0 36%, var(--card) 0);
  box-shadow: inset 0 0 0 1px var(--line);
}

[data-boot="home"] .boot {
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
  padding-block: clamp(36px, 4.8vw, 76px);
}
[data-boot="home"] :is(.boot-label, .boot-title + .boot-title) { display: block; }
[data-boot="home"] .boot-label { width: 150px; height: 14px; }
[data-boot="home"] .boot-title { width: min(320px, 70%); height: clamp(42px, 4.6vw, 64px); }
[data-boot="home"] .boot-title + .boot-title { width: min(340px, 76%); margin-top: 0; }
[data-boot="home"] .boot-text { width: min(440px, 100%); }
[data-boot="home"] .boot-actions { display: flex; gap: 12px; margin-top: 18px; }
.boot-actions i { width: 104px; height: var(--control-height); border-radius: var(--control-radius); }
.boot-actions i + i { width: 118px; background: none; box-shadow: inset 0 0 0 1px var(--line); }
[data-boot="home"] .boot-media { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
[data-boot="home"] .boot-media i { aspect-ratio: 8 / 5; border-radius: 10px; background: var(--press-surface); box-shadow: none; }
[data-boot="home"] .boot-media i + i { display: none; }

[data-boot="studio"] .boot {
  grid-template-columns: minmax(150px, 200px) minmax(0, 1fr);
  column-gap: clamp(18px, 3vw, 44px);
  align-items: start;
}
/* Menu labels as short lines, at the menu's 44px rhythm. */
[data-boot="studio"] .boot-rail { display: grid; gap: 30px; padding: 15px 12px; grid-row: span 2; }
.boot-rail i { width: 76%; height: 14px; }
.boot-rail i:nth-child(even) { width: 62%; }
.boot-rail i:nth-child(5) { margin-top: 16px; }
[data-boot="studio"] .boot-title { width: min(220px, 60%); height: clamp(30px, 3.2vw, 40px); }
[data-boot="studio"] .boot-media { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 0; }
[data-boot="studio"] .boot-media i { aspect-ratio: auto; height: 108px; border-radius: 12px; background: var(--card); }
/* The workspace name depends on the account, so it appears with the first page. */
[data-boot="studio"] .top .brand small { visibility: hidden; }

.boot-panel .boot-media { grid-template-columns: minmax(0, 1fr); max-width: 820px; margin-top: 0; }
.boot-panel .boot-media i { aspect-ratio: auto; height: 220px; background: var(--card); }

@media (max-width: 740px) {
  [data-boot="home"] .boot { grid-template-columns: minmax(0, 1fr); padding-block: 30px; gap: 24px; }
  [data-boot="home"] .boot-media i { aspect-ratio: 2 / 1; }
  .boot-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-boot="studio"] .boot { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  [data-boot="studio"] .boot-rail {
    grid-row: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 16px;
    padding: 15px 12px;
    border: 1px solid var(--line);
    border-radius: calc(var(--control-radius) + 4px);
  }
  .boot-rail i:nth-child(5) { margin-top: 0; }
}
@media (max-width: 490px) {
  .boot-media { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  main.arrive { animation: fade-in var(--motion-settle); }
}
@media (prefers-reduced-motion: reduce) {
  /* Appear after the same wait, without fading or breathing. */
  .boot { animation: fade-in 1ms .45s backwards !important; }
}
@keyframes boot-breathe { to { opacity: .55; } }
