/* PROTOTYPE-001 / English Tutor v0.1 — A journey, B focus, C studio.
   Throwaway visual exploration. No external fonts or image dependencies. */
@layer reset, foundations, layout, components, variants, responsive, accessibility;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { color-scheme: light; scroll-behavior: smooth; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  button, input, textarea, select { font: inherit; }
  button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button, input, select, textarea { max-width: 100%; }
  a { color: inherit; text-decoration: none; }
  svg { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: middle; }
  img, video, audio, canvas { max-width: 100%; }
  [hidden] { display: none !important; }
}

@layer foundations {
  :root {
    --ink: #233c34;
    --ink-strong: #173b30;
    --muted: #69756c;
    --paper: #f7f6f0;
    --surface: #fffefa;
    --surface-soft: #f0f1e8;
    --green: #214d3e;
    --green-dark: #153d31;
    --green-soft: #e6eee5;
    --green-faint: #f0f5ed;
    --orange: #c65e2a;
    --orange-soft: #fae9dd;
    --border: #e2e5d9;
    --border-strong: #ccd4c6;
    --error: #a23733;
    --shadow: 0 5px 20px rgb(35 60 52 / 3%);
    --shadow-float: 0 12px 40px rgb(24 45 35 / 15%);
    --radius: 20px;
    --radius-sm: 12px;
    --sidebar-width: 234px;
    --toolbar-height: 64px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    --display: "Iowan Old Style", "Palatino Linotype", "Noto Serif TC", "Noto Serif CJK TC", "Songti TC", Georgia, serif;
  }
  body { min-width: 320px; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.65; letter-spacing: .015em; }
  h1, h2, h3, h4 { color: var(--ink-strong); font-weight: 650; letter-spacing: -.035em; line-height: 1.35; overflow-wrap: anywhere; }
  h1 { font-size: clamp(28px, 3vw, 40px); }
  h2 { font-size: 23px; }
  h3 { font-size: 17px; }
  h4 { font-size: 15px; }
  p + p { margin-top: 12px; }
  small, .caption { font-size: 12px; line-height: 1.6; }
  strong { font-weight: 650; }
  code, .kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
  .muted, .caption, .subtle { color: var(--muted); }
  .eyebrow { display: block; margin-bottom: 8px; color: var(--orange); font-size: 10px; font-weight: 750; line-height: 1.5; letter-spacing: .18em; text-transform: uppercase; }
  .text-green { color: var(--green); }
  .text-orange { color: var(--orange); }
  .text-center { text-align: center; }
  .text-right { text-align: right; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .stack, .aside-stack { display: flex; min-width: 0; flex-direction: column; gap: 20px; }
  .row, .inline, .actions, .card-head, .section-title { display: flex; align-items: center; gap: 12px; }
  .row, .actions { flex-wrap: wrap; }
  .justify-between, .card-head, .section-title { justify-content: space-between; }
  .grow { flex: 1; min-width: 0; }
  .nowrap { white-space: nowrap; }
  .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
}

@layer layout {
  .prototype-toolbar { position: fixed; z-index: 80; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; height: var(--toolbar-height); padding: 10px 24px; color: #fafaf1; background: #24372f; box-shadow: 0 1px rgb(255 255 255 / 8%); font-size: 11px; }
  .prototype-toolbar .toolbar-brand, .prototype-toolbar .toolbar-group, .prototype-toolbar .toolbar-controls, .device-switch, .surface-switch, .view-switch { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
  .prototype-toolbar strong { font-size: 13px; letter-spacing: .05em; }
  .prototype-toolbar .muted { color: #c0ccc2; }
  .prototype-toolbar button, .prototype-toolbar .btn, .prototype-toolbar select { min-height: 34px; padding: 5px 11px; color: #dbe5da; background: transparent; border: 1px solid rgb(255 255 255 / 15%); border-radius: 7px; font-size: 11px; white-space: nowrap; }
  .prototype-toolbar button.active, .prototype-toolbar button[aria-pressed="true"], .prototype-toolbar .is-active { color: #24372f; background: #e9efdf; border-color: #e9efdf; }
  .prototype-toolbar select option { color: var(--ink); background: var(--surface); }
  .prototype-label, .prototype-note { font-size: 11px; color: #cbd7ca; }
  .app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; padding-top: var(--toolbar-height); margin-inline: auto; }
  .sidebar { position: sticky; top: var(--toolbar-height); display: flex; flex-direction: column; gap: 24px; height: calc(100svh - var(--toolbar-height)); padding: 34px 20px 22px; border-right: 1px solid var(--border); background: #f5f5ec; overflow-y: auto; overscroll-behavior: contain; }
  .brand { display: flex; align-items: center; gap: 11px; margin: 0 10px 15px; color: var(--green-dark); font-weight: 750; line-height: 1.3; }
  .brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px 11px 11px 3px; background: var(--green); color: #f4f5e7; font-family: var(--display); font-size: 26px; font-weight: 500; }
  .brand-name { font-size: 17px; letter-spacing: -.04em; }
  .brand small, .brand-sub { display: block; margin-top: 3px; color: var(--muted); font-family: var(--font); font-size: 9px; font-weight: 500; letter-spacing: .13em; text-transform: uppercase; }
  .nav-section { display: flex; flex-direction: column; gap: 5px; }
  .nav-section-title, .nav-label-heading { margin: 0 13px 9px; color: #858d7f; font-size: 9px; font-weight: 650; letter-spacing: .13em; text-transform: uppercase; }
  .nav-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 11px 14px; border: 0; border-radius: 9px; color: #637061; background: transparent; font-size: 13px; text-align: left; transition: background .18s, color .18s; }
  .nav-link svg, .nav-link .nav-icon { width: 19px; flex: 0 0 19px; font-size: 18px; text-align: center; opacity: .85; }
  .nav-link:hover { background: #e9ece0; color: var(--green); }
  .nav-link.active, .nav-link[aria-current="page"] { color: #fffef3; background: var(--green); font-weight: 600; box-shadow: 0 4px 9px rgb(33 77 62 / 10%); }
  .nav-link .badge { margin-left: auto; }
  .sidebar-footer { margin-top: auto; padding-top: 18px; }
  .sidebar-tip { padding: 18px; border-radius: 12px; color: #50634f; background: #e9eddf; font-size: 12px; }
  .sidebar-tip strong { display: block; margin-bottom: 6px; }
  .user-mini { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 20px 10px 0; border-top: 1px solid var(--border); font-size: 12px; }
  .avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; color: #516143; background: #e1e7d6; font-weight: 650; }
  .avatar.large { width: 64px; height: 64px; font-size: 24px; }
  .main { min-width: 0; padding-bottom: 110px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 78px; padding: 18px 42px; border-bottom: 1px solid var(--border); background: rgb(255 254 250 / 55%); font-size: 12px; }
  .topbar .topbar-actions, .topbar .row { display: flex; align-items: center; gap: 16px; }
  .breadcrumbs { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
  .breadcrumbs strong { color: var(--ink); font-weight: 500; }
  .page-content { width: 100%; max-width: 1440px; margin-inline: auto; padding: 34px 42px; }
  .page-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 28px; }
  .page-heading p { max-width: 620px; margin-top: 9px; color: var(--muted); font-size: 13px; }
  .page-heading .eyebrow { margin-bottom: 8px; }
  .section-title { margin: 26px 0 16px; }
  .section-title:first-child { margin-top: 0; }
  .section-title h2, .section-title h3 { font-size: 18px; }
  .section-title > a, .section-title > button { color: var(--green); font-size: 12px; }
  .grid { display: grid; gap: 20px; min-width: 0; }
  .grid > *, .dashboard-grid > *, .lesson-layout > *, .workspace-grid > *, .admin-grid > * { min-width: 0; }
  .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
  .grid-4, .stat-grid, .skill-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
  .dashboard-grid { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(250px,1fr); gap: 24px; align-items: stretch; }
  .lesson-layout { display: grid; grid-template-columns: minmax(0,1fr) 270px; gap: 24px; align-items: start; }
  .lesson-sidebar { display: flex; flex-direction: column; gap: 16px; }
  .workspace-grid { display: grid; grid-template-columns: minmax(220px,.78fr) minmax(0,1.8fr); gap: 22px; align-items: start; }
  .master-list, .detail-panel { min-width: 0; }
  .admin-grid { display: grid; grid-template-columns: minmax(0,1.75fr) minmax(255px,.8fr); gap: 22px; align-items: start; }
  .admin-grid.three-columns { grid-template-columns: 240px minmax(0,1fr) 270px; }
  .mobile-nav { display: none; }
  .bottom-variant-bar { position: fixed; z-index: 90; left: 50%; bottom: 18px; display: flex; align-items: center; justify-content: center; gap: 12px; width: max-content; max-width: calc(100vw - 24px); min-height: 49px; padding: 7px 10px; border: 1px solid #476052; border-radius: 15px; background: #243b31; box-shadow: var(--shadow-float); color: #f2f4e9; transform: translateX(-50%); font-size: 11px; }
  .bottom-variant-bar button { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; border: 0; border-radius: 9px; background: #344d3f; color: #fff; font-size: 16px; }
  .bottom-variant-bar .variant-label { min-width: 135px; text-align: center; }
  .bottom-variant-bar small { color: #bdcdbb; font-size: 10px; }
  .bottom-variant-bar .active { background: #e4ecd9; color: var(--green-dark); }
}

@layer components {
  .card { position: relative; min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
  .card.flat { box-shadow: none; }
  .card.soft { background: var(--green-faint); }
  .card-head { margin-bottom: 18px; }
  .card-head h2, .card-head h3 { font-size: 16px; }
  .card-head .eyebrow { margin: 0; }
  .card > .caption { margin-top: 7px; }
  .card.selected, .card[aria-selected="true"] { border-color: #839b78; box-shadow: 0 0 0 2px #dfe8d8; }
  .hero { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 290px; padding: 34px 32px; overflow: hidden; border: 1px solid #335b47; border-radius: 22px; color: #d5e1cf; background: var(--green-dark); isolation: isolate; }
  .hero h1, .hero h2, .hero h3 { max-width: 560px; color: #fcfced; font-family: var(--display); font-size: clamp(27px,2.6vw,38px); font-weight: 500; line-height: 1.45; letter-spacing: -.04em; }
  .hero .eyebrow { color: #d6dcb4; }
  .hero p { max-width: 420px; margin-top: 12px; color: #c0d0bf; font-size: 12px; line-height: 1.85; }
  .hero-content { position: relative; z-index: 2; flex: 1; min-width: 0; }
  .hero .actions { margin-top: 24px; }
  .hero .badge, .hero .pill { border-color: #5c7761; color: #e7e9cc; background: #315440; }
  .hero .button, .hero .btn { border-color: #e8ecd8; color: var(--green-dark); background: #ecf0dd; }
  .hero .button.secondary, .hero .btn.secondary, .hero .button.ghost, .hero .btn.ghost { border-color: #68806a; color: #f2f5e9; background: transparent; }
  .hero-art { position: relative; display: grid; place-items: center; width: 155px; height: 190px; flex: 0 0 155px; }
  .audio-orbit { position: relative; display: grid; place-items: center; width: 132px; height: 132px; border: 1px solid #68866a; border-radius: 50%; background: #2c523c; color: #e2e8bf; font-size: 40px; }
  .audio-orbit::before, .audio-orbit::after { content: ""; position: absolute; inset: -16px; border: 1px solid rgb(174 194 143 / 23%); border-radius: 50%; }
  .audio-orbit::after { inset: -32px; border-style: dashed; transform: rotate(-20deg); }
  .audio-orbit svg { width: 43px; height: 43px; }
  .hero-art::after { content: ""; position: absolute; top: 29px; right: 15px; width: 10px; height: 10px; border-radius: 50%; background: #d5a46b; box-shadow: -130px 92px 0 -2px #c1c9a1; }
  .button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 1px solid var(--green); border-radius: 9px; color: #fffdf1; background: var(--green); font-size: 12px; font-weight: 600; line-height: 1.5; text-align: center; transition: background .18s, box-shadow .18s, transform .18s; }
  .button:hover, .btn:hover { background: #30614d; box-shadow: 0 3px 9px rgb(21 61 49 / 10%); }
  .button:active, .btn:active { transform: translateY(1px); }
  .button.secondary, .btn.secondary, .button.outline, .btn.outline { border-color: var(--border-strong); color: var(--green); background: var(--surface); }
  .button.secondary:hover, .btn.secondary:hover, .button.outline:hover, .btn.outline:hover { background: var(--green-faint); }
  .button.ghost, .btn.ghost, .link-button { border-color: transparent; color: var(--green); background: transparent; box-shadow: none; }
  .button.orange, .btn.orange { border-color: var(--orange); background: var(--orange); color: #fff; }
  .button.danger, .btn.danger { border-color: #ecc4bf; background: #fff7f3; color: var(--error); }
  .button.small, .btn.small { min-height: 36px; padding: 7px 12px; font-size: 11px; }
  .button.large, .btn.large { min-height: 50px; padding-inline: 24px; font-size: 14px; }
  .button.icon, .btn.icon, .icon-button { display: inline-grid; place-items: center; min-width: 42px; min-height: 42px; padding: 9px; border: 1px solid var(--border); border-radius: 50%; color: var(--green); background: var(--surface); }
  .button.full, .btn.full { width: 100%; }
  button:disabled, .button[aria-disabled="true"], .btn[aria-disabled="true"] { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
  .link-button { min-height: 36px; padding: 5px 0; border: 0; font-size: 12px; font-weight: 600; text-align: left; }
  .badge, .pill { display: inline-flex; align-items: center; gap: 5px; width: max-content; max-width: 100%; padding: 4px 9px; border: 1px solid #dce5d3; border-radius: 6px; color: #507344; background: #eef3e8; font-size: 10px; font-weight: 550; line-height: 1.5; white-space: normal; }
  .pill { border-radius: 30px; padding-inline: 11px; }
  .badge.orange, .pill.orange, .badge.pending, .pill.pending { border-color: #f0dbc8; color: #a65327; background: #fbf0e4; }
  .badge.neutral, .pill.neutral { border-color: var(--border); color: var(--muted); background: #f2f3ed; }
  .badge.success, .pill.success { border-color: #d1dfc9; color: #446338; background: #e9f0e1; }
  .badge.error, .pill.error { border-color: #eccdc6; color: #9d4035; background: #fcece6; }
  .badge.blue, .pill.blue { border-color: #d9e4e3; color: #4b706c; background: #edf4f2; }
  .tabs { display: flex; align-items: center; gap: 5px; width: max-content; max-width: 100%; margin-bottom: 22px; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: #eeeee4; overflow-x: auto; }
  .tabs button, .tabs a, .tab { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 16px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
  .tabs .active, .tabs [aria-selected="true"] { color: var(--green-dark); background: var(--surface); box-shadow: 0 2px 7px rgb(22 57 38 / 7%); font-weight: 650; }
  .metric { position: relative; min-width: 0; padding: 21px 23px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
  .metric-label, .metric > .muted:first-child { color: var(--muted); font-size: 11px; }
  .metric-value, .metric > strong { display: block; margin-top: 5px; color: var(--green-dark); font-family: var(--display); font-size: 31px; font-weight: 500; letter-spacing: -.05em; line-height: 1.4; }
  .metric-value small, .metric > strong small { margin-left: 4px; color: var(--muted); font-family: var(--font); font-size: 11px; font-weight: 450; letter-spacing: 0; }
  .metric > .caption, .metric-note { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
  .metric-icon { position: absolute; top: 22px; right: 20px; color: #9ba991; }
  .progress-bar, .progress-track { width: 100%; height: 5px; overflow: hidden; border-radius: 5px; background: #e9ecdf; }
  .progress-bar > span, .progress-bar > i, .progress-bar > div, .progress-track > span { display: block; height: 100%; border-radius: inherit; background: #86a16c; }
  .hero .progress-bar { background: #426249; }
  .hero .progress-bar > span { background: #b5c58d; }
  .progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
  .stage-path { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; padding: 12px 0 6px; }
  .stage-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; padding: 6px 8px; text-align: center; color: #939b8c; font-size: 11px; }
  .stage-item::before { content: ""; position: absolute; top: 24px; left: -50%; z-index: 0; width: 100%; height: 1px; background: var(--border); }
  .stage-item:first-child::before { display: none; }
  .stage-dot, .stage-number { position: relative; z-index: 1; display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 50%; color: #86917e; background: var(--surface); font-family: var(--display); font-size: 16px; }
  .stage-item strong { display: block; color: #6d7b66; font-size: 11px; }
  .stage-item small { display: block; margin-top: 3px; font-size: 9px; }
  .stage-item.active .stage-dot, .stage-item.current .stage-dot, .stage-item.active .stage-number { border-color: var(--green); color: #fff; background: var(--green); box-shadow: 0 0 0 5px #e9efe1; }
  .stage-item.active strong, .stage-item.current strong { color: var(--green); }
  .stage-item.done .stage-dot, .stage-item.complete .stage-dot { color: var(--green); border-color: #b7c9a6; background: #e5eddb; }
  .stage-item.active::before, .stage-item.done::before { background: #afc69c; }
  .activity-list { display: flex; flex-direction: column; }
  .activity-row { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 16px 0; border-bottom: 1px solid var(--border); }
  .activity-row:first-child { padding-top: 0; }
  .activity-row:last-child { padding-bottom: 0; border-bottom: 0; }
  .activity-row > .grow > strong, .activity-title { display: block; margin-bottom: 3px; font-size: 12px; }
  .activity-row .caption { font-size: 10px; }
  .activity-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid #e1e7d7; border-radius: 10px; color: #687e50; background: #eef2e6; font-size: 17px; }
  .activity-icon.orange { color: #a96235; border-color: #f0dfcb; background: #fbf0e3; }
  .activity-icon.blue { color: #4c746e; border-color: #dbe7e0; background: #edf4ee; }
  .quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .quick-actions > * { flex: 1 1 130px; }
  .player { position: relative; min-width: 0; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink); background: var(--surface); }
  .player-title { margin: 8px 0 4px; font-size: 20px; }
  .player-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
  .waveform { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 110px; margin-block: 24px; padding-inline: 8px; overflow: hidden; }
  .waveform > span, .waveform > i, .waveform > b { display: block; width: 4px; min-width: 2px; max-height: 84px; height: 27px; border-radius: 5px; background: #b9c9a8; }
  .waveform > :nth-child(3n) { height: 54px; background: #8fae78; }
  .waveform > :nth-child(4n) { height: 72px; background: #4b7653; }
  .waveform > :nth-child(5n) { height: 40px; }
  .waveform > :nth-child(7n) { height: 84px; background: #356649; }
  .player-controls { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 18px; margin-top: 22px; }
  .play-button, .player-controls .play, .player-controls [data-action="play"], .player-controls [data-action="play-audio"] { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; min-height: 60px; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: #fff; font-size: 24px; box-shadow: 0 4px 16px rgb(35 60 52 / 15%); }
  .player-time { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; }
  .player-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
  .notice { display: flex; align-items: flex-start; gap: 10px; margin-block: 18px; padding: 13px 16px; border: 1px solid #dce6d2; border-radius: 10px; color: #5c6f50; background: #eef3e7; font-size: 11px; line-height: 1.8; }
  .notice:first-child { margin-top: 0; }
  .notice.warning, .notice.orange { border-color: #eddcc7; color: #895e34; background: #fcf2e5; }
  .notice.error { border-color: #eccdc6; color: #983e34; background: #fdf0eb; }
  .prototype-banner { margin: 0 0 22px; padding: 7px 12px; border: 1px solid #e4e5d9; border-radius: 7px; color: #7b826f; background: #f1f2e8; font-size: 10px; }
  .field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
  .field label, label.field-label { color: var(--ink); font-size: 12px; font-weight: 600; }
  .field .hint { color: var(--muted); font-size: 11px; }
  input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 9px; outline: none; color: var(--ink); background: #fffefa; font-size: 13px; line-height: 1.6; transition: border-color .15s, box-shadow .15s; }
  input::placeholder, textarea::placeholder { color: #8e9689; }
  input:focus, select:focus, textarea:focus { border-color: #7e9b69; box-shadow: 0 0 0 3px #e7efde; }
  textarea { min-height: 120px; resize: vertical; }
  input[type="range"] { width: 100%; min-height: 26px; accent-color: var(--green); cursor: pointer; }
  input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; flex-shrink: 0; margin: 2px 5px 2px 0; accent-color: var(--green); vertical-align: middle; }
  .form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
  .form-grid .full { grid-column: 1/-1; }
  .setting-row, .evidence-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-block: 17px; border-bottom: 1px solid var(--border); }
  .setting-row:last-child, .evidence-row:last-child { border-bottom: 0; }
  .setting-row > :first-child { flex: 1; min-width: 0; }
  .setting-row select, .setting-row input:not([type="checkbox"]) { max-width: 160px; }
  .setting-row strong, .evidence-row strong { display: block; font-size: 12px; }
  .setting-row p, .evidence-row p { margin-top: 3px; color: var(--muted); font-size: 11px; }
  .empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 230px; padding: 35px 22px; text-align: center; }
  .empty-state > svg { width: 42px; height: 42px; color: #8b9b77; }
  .empty-state p { max-width: 390px; color: var(--muted); font-size: 12px; }
  .timeline { display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; list-style: none; }
  .timeline-item { position: relative; padding: 0 0 24px 28px; border-left: 1px solid #d5dec9; }
  .timeline-item:last-child { padding-bottom: 0; border-left-color: transparent; }
  .timeline-item::before { content: ""; position: absolute; top: 3px; left: -5px; width: 9px; height: 9px; border-radius: 50%; background: #a6bb8c; box-shadow: 0 0 0 4px var(--surface); }
  .timeline-item.active::before { background: var(--orange); }
  .timeline-item strong { display: block; font-size: 12px; }
  .timeline-item small { color: var(--muted); font-size: 10px; }
  .sentence-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
  .sentence-nav button { width: 37px; height: 37px; padding: 0; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: var(--surface); font-size: 11px; }
  .sentence-nav button.active { color: #fff; border-color: var(--green); background: var(--green); }
  .sentence-nav button.done { color: #496b3c; background: var(--green-soft); }
  .review-result { margin-top: 20px; padding: 20px; border: 1px solid #d3dfc8; border-radius: 12px; background: #f0f5ea; }
  .review-result h3 { margin-bottom: 10px; font-size: 14px; }
  .review-result blockquote, .english-text { margin: 12px 0; font-family: var(--display); font-size: 21px; line-height: 1.8; letter-spacing: 0; }
  .word-chip { display: inline-flex; align-items: center; gap: 6px; margin: 4px 4px 4px 0; padding: 7px 11px; border: 1px solid #d9e1ce; border-radius: 7px; background: #f1f5e9; color: #4f6a3e; font-size: 12px; }
  .card-links { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
  .note-card { border-top: 3px solid #9bad7b; }
  .note-card h3 { font-family: var(--display); font-size: 23px; }
  .note-card p { margin-top: 11px; color: #69765f; font-size: 12px; }
  .tutor-message { display: flex; align-items: flex-start; gap: 12px; max-width: 86%; margin: 20px 0; }
  .tutor-message .bubble { padding: 17px 20px; border: 1px solid var(--border); border-radius: 0 16px 16px; background: var(--surface); font-size: 13px; line-height: 1.85; }
  .tutor-message.user { margin-left: auto; flex-direction: row-reverse; }
  .tutor-message.user .bubble { border-color: #dae4cf; border-radius: 16px 0 16px 16px; background: #e9efdf; }
  .chat-input { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .record-button { display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 0 0 6px #e9efdf; }
  .record-button.recording { background: #b9513f; box-shadow: 0 0 0 6px #f7e5df; }
  .article-reader { max-width: 720px; margin-inline: auto; }
  .article-reader h2 { margin: 18px 0; font-family: var(--display); font-size: 30px; }
  .article-reader p { color: #4e5d4c; font-family: var(--display); font-size: 19px; line-height: 1.95; letter-spacing: 0; }
  .retell-state { display: flex; min-height: 280px; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 28px; border: 1px dashed #aabf95; border-radius: 16px; background: #f2f6e9; text-align: center; }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); overscroll-behavior-inline: contain; }
  .data-table { width: 100%; border-collapse: collapse; color: var(--ink); text-align: left; font-size: 12px; }
  .data-table th { padding: 13px 18px; border-bottom: 1px solid var(--border); background: #f1f3e9; color: #748067; font-size: 10px; font-weight: 600; white-space: nowrap; }
  .data-table td { padding: 16px 18px; border-bottom: 1px solid #e9ecdf; vertical-align: middle; }
  .data-table tr:last-child td { border-bottom: 0; }
  .data-table tbody tr:hover { background: #f8faf1; }
  .data-table td:first-child { font-weight: 600; }
  .data-table .table-title { display: block; min-width: 150px; font-weight: 600; }
  .data-table .caption { display: block; margin-top: 3px; font-weight: 400; font-size: 10px; }
  .data-table .button, .data-table .btn { white-space: nowrap; }
  .table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin: 0 0 20px; }
  .table-toolbar input { max-width: 280px; }
  .editor-timeline { display: flex; flex-direction: column; gap: 8px; }
  .segment-row { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; align-items: start; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 9px; background: #fbfcf5; font-size: 12px; }
  .segment-row .time, .segment-row code { padding-top: 3px; color: #82916f; font-size: 10px; }
  .segment-row.active { border-color: #a2b78d; background: #f0f4e7; }
  .checklist { display: flex; flex-direction: column; gap: 13px; margin: 0; padding: 0; list-style: none; }
  .checklist li, .checklist label { display: flex; align-items: flex-start; gap: 9px; color: #647359; font-size: 12px; }
  .checklist li::before { content: "✓"; display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; border: 1px solid #cbd9bd; border-radius: 50%; color: #5b7950; background: #eef4e6; font-size: 10px; }
  .checklist li.pending::before { content: "·"; color: #a96b36; border-color: #ecd9bf; background: #faf0e1; }
  .upload-zone { display: grid; justify-items: center; gap: 10px; min-height: 200px; padding: 30px; border: 1px dashed #aebf97; border-radius: 14px; background: #f6f8ef; text-align: center; }
  .modal-backdrop { position: fixed; z-index: 110; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; background: rgb(20 42 32 / 45%); backdrop-filter: blur(4px); }
  .modal { width: min(580px,100%); max-height: calc(100svh - 48px); padding: 30px; overflow-y: auto; border: 1px solid #e1e5d6; border-radius: 22px; background: var(--surface); box-shadow: 0 25px 80px rgb(15 41 28 / 25%); }
  .modal .card-head { margin-bottom: 20px; }
  .modal .actions { justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
  .toast { position: fixed; z-index: 120; top: calc(var(--toolbar-height) + 20px); left: 50%; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px); padding: 13px 22px; border: 1px solid #58754c; border-radius: 11px; background: var(--green-dark); color: #f4f6e9; box-shadow: var(--shadow-float); transform: translateX(-50%); font-size: 12px; }
  /* Engineer's integrated view vocabulary. */
  .skip-link { position: fixed; z-index: 150; top: 8px; left: 8px; padding: 10px 16px; border-radius: 8px; color: #fff; background: var(--green); transform: translateY(-150%); }
  .skip-link:focus { transform: none; }
  .brand-english { display: block; margin-top: 3px; font-family: var(--display); font-size: 12px; font-weight: 450; letter-spacing: .03em; }
  .brand small { max-width: 145px; font-size: 9px; letter-spacing: .01em; }
  .sidebar > .nav-section { display: block; margin: -5px 13px -15px; color: #7b8772; font-size: 9px; letter-spacing: .15em; }
  .sidebar nav { display: flex; flex-direction: column; gap: 5px; }
  .sidebar-bottom { margin-top: auto; }
  .sidebar-note { margin: 20px 6px; padding: 17px 14px; border: 1px solid #e1e6d4; border-radius: 12px; background: #edf0e3; font-size: 11px; }
  .sidebar-note > svg { display: block; margin-bottom: 10px; color: #7e9467; }
  .sidebar-note strong { color: #5c7350; font-size: 11px; }
  .sidebar-note p { margin-top: 6px; color: #7b876d; font-size: 10px; line-height: 1.9; }
  button.user-mini { width: 100%; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 0; color: inherit; background: transparent; text-align: left; }
  .user-mini > span:nth-child(2) { flex: 1; }
  .user-mini small { display: block; color: var(--muted); font-size: 9px; }
  .user-mini > svg { width: 14px; }
  .nav-count { display: grid; place-items: center; min-width: 18px; height: 18px; margin-left: auto; padding-inline: 4px; border-radius: 5px; color: #7c8b6b; background: #e7ecdc; font-size: 9px; }
  .sync-status { display: inline-flex; align-items: center; gap: 6px; color: #879078; font-size: 10px; }
  .sync-status > span, .prototype-dot { display: inline-block; width: 5px; height: 5px; flex-shrink: 0; border-radius: 50%; background: #95ae76; }
  .prototype-label { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
  .prototype-dot { width: 6px; height: 6px; background: #b6c88e; }
  .prototype-label .toolbar-note { margin-left: 8px; color: #b5c3b3; font-size: 10px; }
  .bottom-variant-bar .variant-caption { padding-left: 6px; color: #b6c8ad; font-size: 9px; white-space: nowrap; }
  .bottom-variant-bar .variant-option { display: block; padding: 7px 14px; color: #d4dfcb; background: transparent; text-align: left; font-size: 11px; }
  .bottom-variant-bar .variant-option b { margin-right: 4px; font-family: var(--display); font-size: 14px; }
  .bottom-variant-bar .variant-option span { display: block; margin-top: 1px; font-size: 8px; opacity: .65; }
  .bottom-variant-bar .variant-option.active { color: #24402f; background: #e7edda; }
  .keyboard-hint { padding-right: 5px; color: #a3b69a; font-size: 10px; white-space: nowrap; }
  .button.button-secondary { border-color: var(--border-strong); color: var(--green); background: var(--surface); }
  .button.button-secondary:hover { background: var(--green-faint); }
  .button.button-ghost, .button.text-button, .text-button { border-color: transparent; color: var(--green); background: transparent; box-shadow: none; }
  .button.text-button, .text-button { justify-content: flex-start; min-height: 35px; padding: 8px 0; font-size: 11px; }
  .button.button-icon, .button-round { display: inline-grid; place-items: center; width: 42px; min-width: 42px; height: 42px; padding: 9px; border: 1px solid var(--border); border-radius: 50%; color: var(--green); background: var(--surface); }
  .button.full-width, .full-width { width: 100%; }
  .card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
  .card-actions + .caption { margin-top: 12px; }
  .page-content > .card + .card, .page-content > .card + .grid, .page-content > .grid + .card, .page-content > .grid + .grid, .page-content > .dashboard-grid + .card, .page-content > .workspace-grid + .card, .page-content > .stat-grid + .admin-grid, .page-content > .skill-grid, .path-overview { margin-top: 24px; }
  .page-content > .card > p, .lesson-sidebar .card > p, .aside-stack .card > p { margin-top: 10px; font-size: 12px; }
  .hero-copy { position: relative; z-index: 2; flex: 1; min-width: 0; }
  .hero-copy > .button { margin-top: 24px; }
  .hero-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 19px; color: #c0d0b9; font-size: 10px; }
  .hero-meta svg { margin-right: 3px; }
  .hero .resume-label { display: inline-block; margin-left: 12px; color: #a5b99b; font-size: 9px; }
  .hero .button.button-primary { border-color: #e8ecd8; color: var(--green-dark); background: #ecf0dd; }
  .hero-dot { display: inline-block; width: 3px; height: 3px; margin: 0 6px 3px; border-radius: 50%; background: #a8bb8c; }
  .hero-art .orbit { display: none; }
  .hero-art .audio-orbit { position: absolute; top: 21px; }
  .art-wave { position: absolute; inset: auto -8px 18px; display: flex; justify-content: center; align-items: center; gap: 3px; height: 30px; opacity: .65; }
  .art-wave i { display: block; width: 2px; height: calc(var(--bar-height,30px) * .4); border-radius: 3px; background: #b6c995; }
  .art-label { position: absolute; bottom: -9px; color: #9fb58f; font-size: 7px; letter-spacing: .2em; white-space: nowrap; }
  .daily-card { height: 100%; }
  .daily-card .card-head > svg { color: #9da777; }
  .daily-total { display: flex; align-items: baseline; gap: 7px; margin: 6px 0 13px; }
  .daily-total strong { font-family: var(--display); font-size: 44px; font-weight: 500; line-height: 1.2; letter-spacing: -.07em; }
  .daily-total > span { color: #859077; font-size: 12px; }
  .week-dots { display: flex; justify-content: space-between; gap: 5px; margin: 22px 0 12px; }
  .week-dots > span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #e4e8da; border-radius: 50%; color: #a1a88f; font-size: 9px; }
  .week-dots .done { border-color: #dce6c9; color: #76905a; background: #eef3e3; }
  .week-dots .done svg { width: 12px; height: 12px; }
  .week-dots .today { border-color: #c99463; color: #a45e2b; background: #fcf0dd; }
  .week-dots .rest { border-style: dashed; }
  .daily-card .caption { font-size: 9px; }
  .daily-card .text-button { margin-top: 8px; }
  .action-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; padding: 0 18px 0 0; border: 0; border-right: 1px solid var(--border); color: var(--ink); background: transparent; text-align: left; }
  .action-card:last-child { border-right: 0; padding-right: 0; }
  .action-card strong { margin-top: 2px; font-size: 13px; }
  .action-card p { color: var(--muted); font-size: 11px; line-height: 1.8; }
  .tile-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border: 1px solid #e1e7d7; border-radius: 9px; color: #788e5d; background: #eef2e5; }
  .action-card:nth-child(2) .tile-icon { color: #ac784b; border-color: #efdfca; background: #fcf2e4; }
  .action-card:nth-child(3) .tile-icon { color: #65827c; border-color: #dce6dc; background: #eef4eb; }
  .text-link { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 2px; color: #627d50; font-size: 10px; }
  .text-link svg { width: 13px; }
  .skill-mini { display: flex; flex-wrap: wrap; gap: 14px; margin: 20px 0 4px; }
  .skill-mini span { color: #718166; font-size: 11px; }
  .skill-mini b { margin-left: 6px; color: #97a08b; font-size: 10px; font-weight: 450; }
  .focus-kicker { margin-bottom: 16px; color: #8a9777; font-size: 10px; text-align: center; letter-spacing: .15em; }
  .focus-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 13px 0 30px; color: #8b9878; font-size: 11px; }
  .focus-layout > .card { margin-top: 26px; }
  .workspace-task { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; margin-top: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 8px; color: #7a876b; background: #f8faf2; text-align: left; font-size: 12px; }
  .workspace-task small { color: #92a17e; font-family: var(--display); font-size: 14px; }
  .workspace-task svg { width: 14px; margin-left: auto; }
  .workspace-task.active { border-color: #b6c5a3; color: var(--green-dark); background: #eaf0df; font-weight: 600; }
  .detail-panel > .grid { margin-top: 18px; }
  .path-list { display: flex; flex-direction: column; gap: 16px; }
  .path-card { display: flex; align-items: center; gap: 25px; }
  .path-card > div { flex: 1; min-width: 0; }
  .path-index { align-self: flex-start; color: #b0bba1; font-family: var(--display); font-size: 35px; line-height: 1.3; }
  .path-card.current { border-color: #b2c19f; background: #f2f5e8; }
  .path-card.current .path-index { color: #7a9464; }
  .path-card h2 { font-size: 22px; }
  .path-card p { margin: 8px 0; color: var(--muted); font-size: 12px; }
  .stage-item { border: 0; background: transparent; cursor: pointer; }
  .stage-item.current .stage-number { border-color: var(--green); background: var(--green); color: #fff; box-shadow: 0 0 0 5px #e9efe1; }
  .listening-card { padding: 26px; }
  .listening-card .card-head { margin-bottom: 5px; }
  .player-art { display: flex; flex-direction: column; align-items: center; margin-top: 10px; padding-top: 32px; }
  .player-art > .audio-orbit { width: 95px; height: 95px; margin: 5px 0 20px; color: #607f4e; background: #edf2e4; border-color: #cedbbd; }
  .player-art > .audio-orbit::before, .player-art > .audio-orbit::after { border-color: #e3ead8; }
  .player-art > .audio-orbit svg { width: 32px; height: 32px; }
  .player-art .waveform { width: 100%; }
  .waveform > i { height: var(--bar-height,30px); }
  .is-playing .waveform > i { animation: waveform-breathe 1s ease-in-out infinite alternate; animation-delay: var(--delay,0s); }
  @keyframes waveform-breathe { from { transform: scaleY(.45); } to { transform: scaleY(1); } }
  .player-progress .player-time { margin-top: -2px; }
  .player-controls .button-primary { width: 58px; height: 58px; min-height: 58px; padding: 14px; border-radius: 50%; }
  .player-controls .button-primary svg { width: 24px; height: 24px; }
  .player-options { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
  .player-options .button { min-height: 35px; padding: 6px 11px; font-size: 10px; }
  .pass-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--border); font-size: 11px; }
  .sentence-audio { display: flex; align-items: center; gap: 15px; margin: 20px 0; padding: 17px; border: 1px solid #dce6d0; border-radius: 12px; background: #f2f6e9; }
  .sentence-audio .waveform { flex: 1; min-height: 36px; height: 40px; margin: 0; }
  .sentence-audio .waveform i { max-height: 30px; }
  .sentence-list { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
  .sentence-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; color: #78846b; background: transparent; text-align: left; font-size: 11px; }
  .sentence-item.active { color: var(--green); border-color: #b1c2a1; background: #f0f4e7; }
  .feedback-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 20px 0; }
  .feedback-grid > div { padding: 16px; border-radius: 9px; background: #f0f4e8; }
  .feedback-grid p { margin-top: 7px; color: #728268; font-size: 12px; }
  .word-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin: 16px 0; }
  .word-heading h2 { font-family: var(--display); font-size: 38px; }
  .word-heading span { color: #8c987d; font-size: 12px; }
  .definition { padding: 20px; margin: 20px 0; border-left: 2px solid #a9bc8c; border-radius: 0 10px 10px 0; background: #f3f6ec; }
  .definition p { font-family: var(--display); font-size: 20px; line-height: 1.8; }
  .definition p + p { color: #7a886b; font-size: 16px; }
  .word-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
  .video-stage { overflow: hidden; margin-block: 20px; border-radius: 14px; background: #294337; }
  .video-scene { position: relative; display: grid; place-items: center; min-height: 250px; overflow: hidden; background: #d8dac3; }
  .scene-window { position: absolute; top: 20px; left: 24px; width: 90px; height: 110px; border: 7px solid #8a9b7b; background: linear-gradient(150deg,#e9edda,#b2c7a8); }
  .scene-window::before { content: ""; position: absolute; top: 44%; width: 100%; height: 4px; background: #8a9b7b; }
  .scene-window::after { content: ""; position: absolute; left: 47%; height: 100%; width: 4px; background: #8a9b7b; }
  .scene-table { position: absolute; bottom: 49px; left: 25%; right: 25%; height: 13px; border-radius: 50%; background: #aa9068; box-shadow: 0 8px 0 -3px #89754f; }
  .scene-person { position: absolute; bottom: -30px; width: 93px; height: 150px; border-radius: 50% 50% 0 0; background: #8c9d73; }
  .scene-person::before { content: ""; position: absolute; top: -47px; left: 21px; width: 53px; height: 60px; border-radius: 46% 46% 40% 40%; background: #d5b58a; box-shadow: inset 0 13px #6d7156; }
  .person-one { left: 19%; transform: rotate(3deg); }
  .person-two { right: 19%; background: #b58d64; transform: rotate(-3deg); }
  .person-two::before { box-shadow: inset 0 15px #585f49; }
  .video-scene > span { position: absolute; top: 17px; right: 18px; color: #7c8a6f; font-size: 9px; letter-spacing: .13em; }
  .video-controls { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 18px; color: #d4dfc9; font-size: 10px; }
  .video-controls .button { border-color: #5e7658; color: #e8edda; background: transparent; }
  .article-header { padding-bottom: 22px; margin-bottom: 23px; border-bottom: 1px solid var(--border); }
  .article-meta { color: #8a957d; font-size: 10px; }
  .article-body p { font-size: 19px; }
  .article-body p + p { margin-top: 22px; }
  .card-search, .search-box { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .card-search { max-width: 520px; margin-bottom: 22px; }
  .card-search input, .search-box input { flex: 1; min-width: 0; padding: 6px 4px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 11px !important; }
  .source-link { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; margin-top: 11px; padding: 5px 0; border: 0; color: #7c8d6a; background: transparent; font-size: 10px; }
  .note-card > h3 { font-size: 22px; }
  .tutor-presence { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 0; text-align: center; }
  .tutor-orb { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 8px; border: 1px solid #c5d5b4; border-radius: 50%; color: #668b4c; background: #e7efdb; box-shadow: 0 0 0 8px #f3f6ec; }
  .tutor-orb svg { width: 27px; height: 27px; }
  .tutor-presence h2 { font-family: var(--display); font-size: 26px; }
  .tutor-presence p { font-size: 12px; }
  .chat-messages { margin: 16px 0 20px; }
  .tutor-message { display: block; padding: 17px 20px; border: 1px solid var(--border); border-radius: 0 15px 15px; background: #f5f7ee; }
  .tutor-message strong { color: #849274; font-size: 10px; }
  .tutor-message > p { margin-top: 6px; font-size: 12px; line-height: 1.95; }
  .tutor-message.user { background: #e9efdf; border-color: #dae4cf; border-radius: 15px 0 15px 15px; }
  .chat-input { padding: 8px 10px 8px 15px; }
  .chat-input input { min-width: 0; padding-inline: 0 !important; border: 0 !important; background: transparent; box-shadow: none !important; font-size: 12px !important; }
  .chat-input > .button { flex-shrink: 0; width: 39px; height: 39px; min-height: 39px; padding: 9px; border-radius: 50%; }
  .settings-layout { display: flex; flex-direction: column; gap: 20px; max-width: 920px; }
  .settings-layout .field { margin-top: 20px; }
  .settings-layout .field > span { display: flex; justify-content: space-between; font-size: 12px; }
  .toggle { display: flex; align-items: center; flex: 0 0 44px; width: 44px; height: 25px; padding: 3px; border: 0; border-radius: 30px; background: #dfe5d4; }
  .toggle > span { width: 19px; height: 19px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgb(22 42 20 / 12%); transition: transform .2s; }
  .toggle.on { background: #6e8b59; }
  .toggle.on > span { transform: translateX(19px); }
  .profile-overview { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; }
  .profile-overview > div { flex: 1; }
  .avatar-large { width: 62px; height: 62px; font-size: 24px; }
  .profile-overview p { margin-top: 8px; font-size: 12px; }
  .profile-level { margin: 22px 0; color: #9aab87; font-family: var(--display); font-size: 40px; line-height: 1; }
  .profile-level span { margin-left: 8px; color: #8a967d; font-family: var(--font); font-size: 11px; }
  .assessment-intro { display: flex; align-items: center; gap: 30px; background: #edf2e4; }
  .assessment-intro > div:first-child { flex: 1; }
  .assessment-intro p { max-width: 610px; margin-top: 11px; color: #7b896e; font-size: 12px; }
  .assessment-count { flex-shrink: 0; color: #899a73; text-align: center; }
  .assessment-count strong { display: block; color: #597a43; font-family: var(--display); font-size: 50px; font-weight: 450; line-height: 1.2; }
  .assessment-count span { font-size: 9px; }
  .skill-card h2 { margin-bottom: 12px; font-family: var(--display); font-size: 27px; }
  .skill-card p { min-height: 50px; color: #7d886e; font-size: 11px; }
  .skill-card .button { width: 100%; }
  .skill-status { display: flex; justify-content: space-between; margin: 18px 0; padding-block: 12px; border-block: 1px solid var(--border); color: #9aa58a; font-size: 10px; }
  .skill-status strong { color: #7c8d6b; font-size: 11px; font-weight: 450; }
  .library-filters { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
  .library-filters .search-box { max-width: 340px; }
  .data-table td small { display: block; margin-top: 5px; color: #8e9c7c; font-size: 9px; font-weight: 400; }
  .stat-grid .metric > svg { position: absolute; top: 21px; right: 20px; color: #91a17c; }
  .stat-grid .metric > span:first-child { color: #849273; font-size: 11px; }
  .stat-grid .metric > p { margin-top: 6px; color: #98a58b; font-size: 10px; }
  .editor-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
  .editor-toolbar strong { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; }
  .editor-toolbar strong svg { width: 12px; color: #9aaa86; }
  .editor-timeline { display: flex; flex-direction: row; align-items: center; gap: 12px; margin-bottom: 20px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; background: #f5f7ed; }
  .editor-timeline > span { color: #96a483; font-family: ui-monospace,monospace; font-size: 9px; }
  .editor-timeline .waveform { flex: 1; min-width: 0; min-height: 55px; height: 55px; margin: 0; gap: 3px; }
  .editor-timeline .waveform i { max-height: 43px; width: 3px; }
  .segment-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .segment-list .segment-row { grid-template-columns: 23px 90px minmax(0,1fr) 35px; gap: 10px; padding: 13px; }
  .segment-index { padding-top: 7px; color: #95a482; font-family: var(--display); font-size: 15px; }
  .segment-times { display: flex; flex-direction: column; gap: 5px; }
  .segment-times label { display: flex; align-items: center; gap: 5px; color: #9aa58b; font-size: 9px; }
  .segment-times input { min-height: 27px !important; width: 59px !important; padding: 3px 5px !important; border-radius: 5px !important; font-size: 10px !important; }
  .segment-text textarea { min-height: 64px; padding: 7px 9px; font-family: var(--display); font-size: 14px; line-height: 1.7; }
  .segment-list .button-icon { min-width: 31px; width: 31px; height: 31px; min-height: 31px; padding: 7px; }
  .editor-grid .aside-stack .field { margin-top: 18px; }
  .editor-grid .aside-stack h3 { margin-bottom: 10px; }
  .check-row { display: flex; align-items: flex-start; gap: 7px; margin-top: 17px; color: #7c8b6d; font-size: 11px; }
  .check-row input { margin-top: 2px; }
  .check-row + .caption { margin-top: 12px; }
  .checklist { margin-top: 24px; }
  .checklist .check-row { margin-top: 0; padding: 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
  .form-error { margin-top: 12px; color: var(--error); font-size: 11px; }
  .field em { color: #a66d41; font-size: 10px; font-style: normal; }
}

@layer variants {
  .variant-b, .variant-c { display: none; }
  body[data-variant="A"] .variant-a { display: initial; }
  body[data-variant="B"] .variant-a, body[data-variant="B"] .variant-c { display: none; }
  body[data-variant="B"] .variant-b { display: initial; }
  body[data-variant="C"] .variant-a, body[data-variant="C"] .variant-b { display: none; }
  body[data-variant="C"] .variant-c { display: initial; }
  .variant-only { display: none; }
  body[data-variant="A"] .variant-only[data-variant="A"], body[data-variant="B"] .variant-only[data-variant="B"], body[data-variant="C"] .variant-only[data-variant="C"] { display: block; }
  /* B removes the vertical rail and prioritises a single central task. */
  body[data-variant="B"][data-surface="learner"] .app-shell { display: block; }
  body[data-variant="B"][data-surface="learner"] .sidebar { position: relative; top: auto; display: flex; flex-direction: row; align-items: center; gap: 30px; height: auto; padding: 17px 38px; border-right: 0; border-bottom: 1px solid var(--border); background: #fffef8; overflow: visible; }
  body[data-variant="B"][data-surface="learner"] .sidebar .brand { margin: 0; flex-shrink: 0; }
  body[data-variant="B"][data-surface="learner"] .sidebar .nav-section { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  body[data-variant="B"][data-surface="learner"] .sidebar nav { display: flex; flex: 1; justify-content: center; flex-wrap: wrap; }
  body[data-variant="B"][data-surface="learner"] .sidebar .nav-link { width: auto; min-height: 40px; padding: 8px 13px; font-size: 11px; }
  body[data-variant="B"][data-surface="learner"] .sidebar .nav-link svg { display: none; }
  body[data-variant="B"][data-surface="learner"] .nav-section-title, body[data-variant="B"][data-surface="learner"] .nav-label-heading, body[data-variant="B"][data-surface="learner"] .sidebar-tip, body[data-variant="B"][data-surface="learner"] .sidebar-footer, body[data-variant="B"][data-surface="learner"] .sidebar .user-mini { display: none; }
  body[data-variant="B"][data-surface="learner"] .topbar { min-height: 54px; padding-block: 12px; }
  body[data-variant="B"][data-surface="learner"] .page-content { max-width: 1050px; padding-top: 42px; }
  body[data-variant="B"][data-surface="learner"] .page-heading { justify-content: center; margin-bottom: 30px; text-align: center; }
  body[data-variant="B"][data-surface="learner"] .page-heading > div:first-child { width: 100%; }
  body[data-variant="B"][data-surface="learner"] .page-heading p { margin-inline: auto; }
  body[data-variant="B"][data-surface="learner"] .dashboard-grid { grid-template-columns: 1fr; }
  body[data-variant="B"][data-surface="learner"] .dashboard-grid > .aside-stack { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-variant="B"][data-surface="learner"] .hero { min-height: 345px; justify-content: center; padding: 40px; text-align: center; background: #e8eddf; border-color: #d4dec7; }
  body[data-variant="B"][data-surface="learner"] .hero h1, body[data-variant="B"][data-surface="learner"] .hero h2, body[data-variant="B"][data-surface="learner"] .hero h3 { margin-inline: auto; color: var(--green-dark); font-size: 38px; }
  body[data-variant="B"][data-surface="learner"] .hero p { margin-inline: auto; color: #67785d; }
  body[data-variant="B"][data-surface="learner"] .hero .eyebrow { color: #6f835b; }
  body[data-variant="B"][data-surface="learner"] .hero .actions { justify-content: center; }
  body[data-variant="B"][data-surface="learner"] .hero-art { display: none; }
  body[data-variant="B"][data-surface="learner"] .hero .button, body[data-variant="B"][data-surface="learner"] .hero .btn { color: #fffef1; background: var(--green); border-color: var(--green); }
  body[data-variant="B"][data-surface="learner"] .hero .secondary { color: var(--green); background: transparent; }
  body[data-variant="B"][data-surface="learner"] .focus-layout { width: min(100%,760px); margin-inline: auto; }
  body[data-variant="B"][data-surface="learner"] .lesson-layout { grid-template-columns: minmax(0,1fr); max-width: 820px; margin-inline: auto; }
  body[data-variant="B"][data-surface="learner"] .lesson-sidebar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  /* C makes browsing and active work adjacent, with compact information rows. */
  body[data-variant="C"] { --sidebar-width: 196px; --radius: 12px; --radius-sm: 8px; }
  body[data-variant="C"] .sidebar { gap: 22px; padding: 28px 13px; background: #213e32; border-color: #213e32; }
  body[data-variant="C"] .sidebar .brand { color: #f2f2e2; margin-inline: 7px; }
  body[data-variant="C"] .brand-mark { color: #263f30; background: #d9e3c8; }
  body[data-variant="C"] .brand small, body[data-variant="C"] .sidebar .caption, body[data-variant="C"] .sidebar .muted { color: #afbea8; }
  body[data-variant="C"] .nav-section-title, body[data-variant="C"] .nav-label-heading { color: #a0b394; }
  body[data-variant="C"] .nav-link { color: #c0cfb5; border-radius: 6px; }
  body[data-variant="C"] .nav-link.active { color: #f8faea; background: #40604a; box-shadow: none; }
  body[data-variant="C"] .nav-link:hover { color: #fff; background: #345640; }
  body[data-variant="C"] .sidebar-tip { color: #c0cfb5; background: #2d4b39; }
  body[data-variant="C"] .user-mini { color: #e1e8d4; border-color: #3a5741; }
  body[data-variant="C"] .page-content { padding: 26px 30px; }
  body[data-variant="C"] .topbar { min-height: 66px; padding-inline: 30px; }
  body[data-variant="C"] .page-heading { margin-bottom: 20px; }
  body[data-variant="C"] h1 { font-family: var(--font); font-size: 29px; }
  body[data-variant="C"] .card { padding: 20px; box-shadow: none; }
  body[data-variant="C"] .hero { min-height: 230px; padding: 25px; border-radius: 12px; }
  body[data-variant="C"] .hero h2 { font-family: var(--font); font-size: 26px; }
  body[data-variant="C"] .hero-art { width: 110px; flex-basis: 110px; transform: scale(.75); }
  body[data-variant="C"] .workspace-grid { gap: 18px; grid-template-columns: minmax(230px,.75fr) minmax(0,1.7fr); }
  body[data-variant="C"] .master-list { display: flex; flex-direction: column; gap: 9px; position: sticky; top: calc(var(--toolbar-height) + 20px); }
  body[data-variant="C"] .master-list .card { padding: 17px; }
  body[data-variant="C"] .master-list .card.selected { border-left: 3px solid var(--green); }
  body[data-variant="C"] .metric { padding: 15px 18px; border-radius: 10px; }
  body[data-variant="C"] .metric-value { font-size: 27px; }
  body[data-variant="C"] .stage-path { padding: 5px 0; }
  body[data-variant="C"] .stage-item { padding-inline: 4px; font-size: 10px; }
  body[data-variant="C"] .activity-row { padding-block: 12px; }
  body[data-variant="C"] .data-table td { padding-block: 13px; }
  /* The material back office keeps its own operational hierarchy in all variants. */
  body[data-surface="admin"] .page-content { max-width: 1600px; }
  body[data-surface="admin"] .page-heading h1 { font-family: var(--font); font-size: 31px; }
  body[data-surface="admin"] .sidebar { background: #eff1e9; }
  body[data-surface="admin"] .hero { min-height: 190px; }
  body[data-surface="admin"] .hero h2 { font-family: var(--font); font-size: 26px; }
  body[data-surface="admin"] .mobile-nav { display: none; }
  body[data-surface="admin"][data-variant="B"] .admin-grid { grid-template-columns: minmax(0,1fr) 290px; }
  body[data-surface="admin"][data-variant="C"] .sidebar { background: #213e32; }
  body[data-surface="admin"] .data-table { min-width: 700px; }
}

@layer responsive {
  @media (min-width: 1650px) { .page-content { padding-top: 45px; } .hero { min-height: 320px; } }
  @media (max-width: 1200px) {
    :root { --sidebar-width: 205px; }
    .page-content { padding: 28px; }
    .topbar { padding-inline: 28px; }
    .dashboard-grid { grid-template-columns: minmax(0,1.6fr) minmax(220px,1fr); gap: 18px; }
    .hero { padding: 28px; }
    .hero-art { width: 110px; flex-basis: 110px; transform: scale(.8); }
    .card { padding: 21px; }
    .lesson-layout { grid-template-columns: minmax(0,1fr) 235px; gap: 18px; }
    .stat-grid, .grid-4, .skill-grid { gap: 12px; }
    .metric { padding: 18px; }
    .metric-value { font-size: 28px; }
    .prototype-toolbar { gap: 12px; padding-inline: 18px; }
    .prototype-toolbar .toolbar-note, .prototype-toolbar .prototype-note { display: none; }
    body[data-variant="B"][data-surface="learner"] .sidebar { gap: 20px; padding-inline: 25px; }
    body[data-variant="B"][data-surface="learner"] .sidebar .nav-link { padding-inline: 9px; }
  }
  @media (max-width: 1000px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid > .aside-stack { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .hero { min-height: 265px; }
    .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .admin-grid, body[data-surface="admin"][data-variant="B"] .admin-grid { grid-template-columns: minmax(0,1fr); }
    .admin-grid.three-columns { grid-template-columns: minmax(190px,.7fr) minmax(0,1.3fr); }
    .admin-grid.three-columns > :last-child { grid-column: 1/-1; }
    .stat-grid, .grid-4, .skill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .lesson-layout { grid-template-columns: 1fr; }
    .lesson-sidebar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    body[data-variant="C"] .workspace-grid { grid-template-columns: minmax(180px,.7fr) minmax(0,1.3fr); }
  }
  @media (max-width: 900px) {
    .app-shell, body[data-variant="B"][data-surface="learner"] .app-shell { display: block; }
    .sidebar, body[data-variant="B"][data-surface="learner"] .sidebar { display: none; }
    .main { padding-bottom: 170px; }
    .topbar { min-height: 67px; padding: 15px 26px; }
    .page-content, body[data-variant="C"] .page-content { padding: 26px; }
    .mobile-nav { position: fixed; z-index: 70; inset: auto 0 0; display: flex; align-items: center; justify-content: space-around; gap: 2px; min-height: 69px; padding: 7px 8px max(9px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgb(255 254 248 / 96%); backdrop-filter: blur(10px); }
    .mobile-nav .nav-link, .mobile-nav button, .mobile-nav a { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: auto; min-width: 42px; min-height: 48px; padding: 4px; border: 0; border-radius: 8px; background: transparent; color: #7b8770; font-size: 9px; line-height: 1.4; box-shadow: none; text-align: center; }
    .mobile-nav svg { width: 20px; height: 20px; }
    .mobile-nav .active, .mobile-nav [aria-current="page"] { color: var(--green-dark); background: #edf2e4; }
    .bottom-variant-bar { bottom: 83px; }
    body[data-surface="admin"] .main { padding-bottom: 100px; }
    body[data-surface="admin"] .bottom-variant-bar { bottom: 18px; }
    .prototype-toolbar { overflow-x: auto; justify-content: flex-start; gap: 20px; scrollbar-width: thin; }
    .prototype-toolbar > * { flex-shrink: 0; }
  }
  @media (max-width: 620px) {
    h1 { font-size: 28px; } h2 { font-size: 20px; }
    .topbar, body[data-variant="C"] .topbar { min-height: 62px; padding: 13px 20px; gap: 10px; }
    .topbar .topbar-actions { gap: 9px; }
    .topbar .topbar-actions .caption, .topbar .date-label { display: none; }
    .breadcrumbs { font-size: 10px; }
    .page-content, body[data-variant="C"] .page-content, body[data-variant="B"][data-surface="learner"] .page-content { padding: 24px 20px; }
    .page-heading { gap: 14px; margin-bottom: 23px; }
    .page-heading p { font-size: 12px; line-height: 1.85; }
    .page-heading > .actions { width: 100%; }
    .page-heading > .actions > .button, .page-heading > .actions > .btn { flex: 1; }
    .eyebrow { font-size: 9px; }
    .grid-2, .grid-3, .form-grid, .admin-grid.three-columns { grid-template-columns: 1fr; }
    .grid, .grid-2, .grid-3, .dashboard-grid, .aside-stack, .stack { gap: 16px; }
    .grid-4, .stat-grid, .skill-grid { gap: 10px; }
    .dashboard-grid > .aside-stack, body[data-variant="B"][data-surface="learner"] .dashboard-grid > .aside-stack { display: flex; flex-direction: column; }
    .hero, body[data-variant="C"] .hero { min-height: 285px; padding: 25px; gap: 0; border-radius: 17px; }
    .hero h1, .hero h2, .hero h3 { font-size: 29px; }
    .hero-art { display: none; }
    .hero p { font-size: 11px; }
    .hero .actions { gap: 9px; }
    .hero .button, .hero .btn { padding-inline: 13px; font-size: 11px; }
    .card, body[data-variant="C"] .card { padding: 20px; border-radius: 15px; }
    .card-head { margin-bottom: 17px; }
    .card-head h2, .card-head h3 { font-size: 15px; }
    .metric, body[data-variant="C"] .metric { padding: 16px; border-radius: 12px; }
    .metric-value, .metric > strong { font-size: 28px; }
    .metric-label { font-size: 10px; }
    .metric-icon { top: 16px; right: 14px; font-size: 13px; }
    .stage-path { gap: 0; }
    .stage-item { gap: 8px; padding-inline: 2px; }
    .stage-item strong { font-size: 9px; letter-spacing: -.02em; }
    .stage-item small { display: none; }
    .stage-dot, .stage-number { width: 31px; height: 31px; font-size: 13px; }
    .stage-item::before { top: 22px; }
    .player { padding: 22px 18px; }
    .player-controls { gap: 12px; }
    .waveform { gap: 3px; min-height: 100px; margin-block: 18px; }
    .waveform > span, .waveform > i { width: 3px; }
    .player-footer { font-size: 10px; }
    .lesson-sidebar, body[data-variant="B"][data-surface="learner"] .lesson-sidebar { display: flex; flex-direction: column; }
    .workspace-grid, body[data-variant="C"] .workspace-grid { grid-template-columns: 1fr; }
    body[data-variant="C"] .master-list { position: static; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    body[data-variant="C"] .master-list > .section-title, body[data-variant="C"] .master-list > .notice { grid-column: 1/-1; }
    body[data-variant="C"] .master-list .card { padding: 13px; }
    body[data-variant="C"] .master-list h3 { font-size: 13px; }
    .setting-row, .evidence-row { gap: 12px; }
    .setting-row select, .setting-row input:not([type="checkbox"]) { max-width: 110px; }
    .tabs { width: 100%; }
    .tabs button, .tabs a { min-height: 40px; padding-inline: 13px; font-size: 11px; }
    .button, .btn { min-height: 44px; }
    .button.small, .btn.small { min-height: 40px; }
    .notice { padding: 11px 13px; font-size: 10px; }
    .tutor-message { max-width: 100%; gap: 8px; }
    .tutor-message .bubble { padding: 14px; font-size: 12px; }
    .tutor-message .avatar { width: 29px; height: 29px; font-size: 11px; }
    .chat-input { gap: 12px; padding: 17px 12px; }
    .article-reader p { font-size: 18px; }
    .segment-row { grid-template-columns: 52px minmax(0,1fr); gap: 9px; padding: 12px; }
    .segment-row > :last-child:not(:nth-child(2)) { grid-column: 2; }
    .modal-backdrop { align-items: flex-end; padding: 12px; }
    .modal { max-height: calc(100svh - 24px); padding: 23px; border-radius: 20px; }
    .modal .actions { gap: 9px; }
    .modal .actions > * { flex: 1; }
    .bottom-variant-bar { gap: 8px; min-height: 44px; padding: 5px 8px; border-radius: 12px; }
    .bottom-variant-bar .variant-label { min-width: 128px; font-size: 10px; }
    .bottom-variant-bar small, .bottom-variant-bar .kbd { display: none; }
    .bottom-variant-bar button { min-width: 34px; min-height: 34px; }
    body[data-variant="B"][data-surface="learner"] .hero { min-height: 310px; padding: 28px 23px; }
    body[data-variant="B"][data-surface="learner"] .hero h2 { font-size: 31px; }
    body[data-surface="admin"] .page-heading h1 { font-size: 27px; }
  }
  /* Explicit device previews behave like their target width on a desktop browser. */
  body[data-device="phone"] .app-shell { display: block; width: min(390px,100%); min-height: 100svh; border-inline: 1px solid var(--border); background: var(--paper); box-shadow: 0 0 70px rgb(33 77 62 / 6%); }
  body[data-device="tablet"] .app-shell { display: block; width: min(834px,100%); border-inline: 1px solid var(--border); background: var(--paper); }
  body[data-device="phone"] .sidebar, body[data-device="tablet"] .sidebar, body[data-variant="B"][data-surface="learner"][data-device="phone"] .sidebar, body[data-variant="B"][data-surface="learner"][data-device="tablet"] .sidebar { display: none; }
  body[data-device="phone"] .main, body[data-device="tablet"] .main { padding-bottom: 170px; }
  body[data-device="phone"] .mobile-nav, body[data-device="tablet"] .mobile-nav { position: fixed; z-index: 70; inset: auto auto 0 50%; display: flex; align-items: center; justify-content: space-around; gap: 2px; width: min(390px,100%); min-height: 69px; padding: 7px 8px max(9px,env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: rgb(255 254 248 / 97%); transform: translateX(-50%); }
  body[data-device="tablet"] .mobile-nav { width: min(834px,100%); }
  body[data-device="phone"] .mobile-nav .nav-link, body[data-device="tablet"] .mobile-nav .nav-link, body[data-device="phone"] .mobile-nav button, body[data-device="tablet"] .mobile-nav button { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: auto; min-width: 42px; min-height: 48px; padding: 4px; border: 0; border-radius: 8px; color: #7b8770; background: transparent; box-shadow: none; font-size: 9px; }
  body[data-device="phone"] .mobile-nav .active, body[data-device="tablet"] .mobile-nav .active { color: var(--green); background: #edf2e4; }
  body[data-device="phone"] .bottom-variant-bar, body[data-device="tablet"] .bottom-variant-bar { bottom: 83px; }
  body[data-device="tablet"] .dashboard-grid { grid-template-columns: minmax(0,1.5fr) minmax(235px,1fr); gap: 18px; }
  body[data-device="tablet"] .hero-art { display: none; }
  body[data-device="tablet"] .hero { padding: 25px; }
  body[data-device="tablet"] .hero h2 { font-size: 29px; }
  body[data-device="tablet"] .page-content { padding: 28px; }
  body[data-device="tablet"] .topbar { padding-inline: 28px; }
  body[data-device="tablet"] .grid-4, body[data-device="tablet"] .stat-grid, body[data-device="tablet"] .skill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-device="tablet"] .lesson-layout, body[data-device="tablet"] .admin-grid, body[data-device="tablet"][data-surface="admin"][data-variant="B"] .admin-grid { grid-template-columns: 1fr; }
  body[data-device="tablet"] .lesson-sidebar { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-device="tablet"][data-variant="B"] .dashboard-grid { grid-template-columns: 1fr; }
  body[data-device="tablet"][data-variant="B"] .dashboard-grid > .aside-stack { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-device="phone"] .topbar, body[data-device="phone"][data-variant="C"] .topbar { min-height: 62px; padding: 13px 20px; gap: 10px; }
  body[data-device="phone"] .topbar .topbar-actions { gap: 9px; }
  body[data-device="phone"] .topbar .date-label, body[data-device="phone"] .topbar .topbar-actions .caption { display: none; }
  body[data-device="phone"] .page-content, body[data-device="phone"][data-variant="C"] .page-content, body[data-device="phone"][data-variant="B"][data-surface="learner"] .page-content { padding: 24px 20px; }
  body[data-device="phone"] h1 { font-size: 28px; }
  body[data-device="phone"] .page-heading { gap: 14px; margin-bottom: 23px; }
  body[data-device="phone"] .page-heading p { font-size: 12px; }
  body[data-device="phone"] .page-heading > .actions { width: 100%; }
  body[data-device="phone"] .grid-2, body[data-device="phone"] .grid-3, body[data-device="phone"] .form-grid, body[data-device="phone"] .dashboard-grid, body[data-device="phone"] .lesson-layout, body[data-device="phone"] .workspace-grid, body[data-device="phone"][data-variant="C"] .workspace-grid, body[data-device="phone"] .admin-grid, body[data-device="phone"][data-surface="admin"][data-variant="B"] .admin-grid, body[data-device="phone"] .admin-grid.three-columns { grid-template-columns: 1fr; }
  body[data-device="phone"] .grid-4, body[data-device="phone"] .stat-grid, body[data-device="phone"] .skill-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  body[data-device="phone"] .dashboard-grid > .aside-stack, body[data-device="phone"][data-variant="B"] .dashboard-grid > .aside-stack, body[data-device="phone"] .lesson-sidebar, body[data-device="phone"][data-variant="B"][data-surface="learner"] .lesson-sidebar { display: flex; flex-direction: column; }
  body[data-device="phone"] .hero, body[data-device="phone"][data-variant="C"] .hero { min-height: 285px; padding: 25px; border-radius: 17px; }
  body[data-device="phone"] .hero h1, body[data-device="phone"] .hero h2, body[data-device="phone"] .hero h3 { font-size: 29px; }
  body[data-device="phone"] .hero-art { display: none; }
  body[data-device="phone"] .hero p { font-size: 11px; }
  body[data-device="phone"] .hero .actions { gap: 9px; }
  body[data-device="phone"] .hero .button, body[data-device="phone"] .hero .btn { padding-inline: 13px; font-size: 11px; }
  body[data-device="phone"] .card, body[data-device="phone"][data-variant="C"] .card { padding: 20px; border-radius: 15px; }
  body[data-device="phone"] .metric { padding: 16px; border-radius: 12px; }
  body[data-device="phone"] .metric-value { font-size: 28px; }
  body[data-device="phone"] .metric-label { font-size: 10px; }
  body[data-device="phone"] .stage-item { gap: 8px; padding-inline: 2px; }
  body[data-device="phone"] .stage-item strong { font-size: 9px; }
  body[data-device="phone"] .stage-item small { display: none; }
  body[data-device="phone"] .stage-dot, body[data-device="phone"] .stage-number { width: 31px; height: 31px; font-size: 13px; }
  body[data-device="phone"] .stage-item::before { top: 22px; }
  body[data-device="phone"] .player { padding: 22px 18px; }
  body[data-device="phone"] .player-controls { gap: 12px; }
  body[data-device="phone"] .master-list { position: static; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  body[data-device="phone"] .master-list > .section-title { grid-column: 1/-1; }
  body[data-device="phone"] .master-list .card { padding: 13px; }
  body[data-device="phone"] .tabs { width: 100%; }
  body[data-device="phone"] .tabs button { padding-inline: 12px; font-size: 11px; }
  body[data-device="phone"] .tutor-message { max-width: 100%; gap: 8px; }
  body[data-device="phone"] .tutor-message .bubble { padding: 14px; font-size: 12px; }
  body[data-device="phone"] .segment-row { grid-template-columns: 52px minmax(0,1fr); gap: 9px; padding: 12px; }
  body[data-device="phone"] .segment-row > :last-child:not(:nth-child(2)) { grid-column: 2; }
  body[data-device="phone"] .bottom-variant-bar { gap: 8px; min-height: 44px; padding: 5px 8px; }
  body[data-device="phone"] .bottom-variant-bar small, body[data-device="phone"] .bottom-variant-bar .kbd { display: none; }
  body[data-device="phone"][data-surface="admin"] .mobile-nav, body[data-device="tablet"][data-surface="admin"] .mobile-nav { display: none; }
  body[data-device="phone"][data-surface="admin"] .main, body[data-device="tablet"][data-surface="admin"] .main { padding-bottom: 100px; }
  body[data-device="phone"][data-surface="admin"] .bottom-variant-bar, body[data-device="tablet"][data-surface="admin"] .bottom-variant-bar { bottom: 18px; }
}

@layer accessibility {
  :focus-visible { outline: 3px solid #d18340; outline-offset: 4px; }
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #a5bb8b; outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
  @media print { .prototype-toolbar, .bottom-variant-bar, .sidebar, .mobile-nav, .toast { display: none !important; } .app-shell { display: block !important; width: 100% !important; padding: 0; } .main { padding-bottom: 0 !important; } .page-content { padding: 20px; } .card { break-inside: avoid; box-shadow: none; } }
}

/* FIGMA-PROTOTYPE-002: additive layout and interaction repairs.
   Keep all three visual directions; confine wide content to its own workspace. */
html { scroll-padding-top: calc(var(--toolbar-height) + 16px); }
.main, .page-content, .table-wrap, .segment-list, .segment-row > *,
.word-editor-list, .word-editor-row > * { min-width: 0; }
.page-content { overflow-wrap: anywhere; }
.table-wrap { position: relative; isolation: isolate; }
.data-table th { position: relative; }
.table-wrap:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.library-filters > *, .search-box { min-width: 0; max-width: 100%; }
.segment-text textarea { width: 100%; resize: vertical; }
.word-editor-list { display: grid; gap: 10px; }
.word-editor-row { display: grid; grid-template-columns: minmax(90px,1fr) repeat(2,minmax(75px,.55fr)) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--green-faint); }
.word-editor-row label { display: grid; gap: 5px; font-size: 12px; }
.word-editor-row input { width: 100%; }
.modal-backdrop { padding: 16px; overscroll-behavior: contain; }
.modal { position: relative; max-height: calc(100dvh - 32px); overscroll-behavior: contain; scrollbar-gutter: stable; scroll-padding-block: 64px 20px; }
.modal > h2 { padding-right: 42px; margin-bottom: 18px; }
.modal-close { position: sticky; top: 0; z-index: 2; float: right; display: grid; place-items: center; width: 40px; height: 40px; margin: -9px -9px 0 8px; padding: 9px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--green); }
body:has(.modal-backdrop) { overflow: hidden; }
.modal :is(input,textarea,select,button) { scroll-margin-block: 64px 24px; }
.card-actions { flex-wrap: wrap; }
.bottom-variant-bar .variant-option { flex-shrink: 0; }

/* A preview selected on a wide monitor should retain usable mobile controls. */
body[data-device="phone"] .bottom-variant-bar { gap: 5px; width: min(366px,calc(100vw - 24px)); min-height: 48px; }
body[data-device="phone"] .bottom-variant-bar :is(.variant-caption,.keyboard-hint,.variant-option span) { display: none; }
body[data-device="phone"] .bottom-variant-bar .variant-option { flex: 1; padding: 7px 5px; white-space: nowrap; font-size: 11px; }
body[data-device="phone"] .bottom-variant-bar .variant-arrow { flex: 0 0 34px; }
body[data-device="phone"] .segment-list .segment-row { grid-template-columns: 24px minmax(0,1fr) 40px; }
body[data-device="phone"] .segment-list .segment-times { grid-column: 2; flex-direction: row; flex-wrap: wrap; }
body[data-device="phone"] .segment-list .segment-text { grid-column: 1 / -1; grid-row: 2; }
body[data-device="phone"] .segment-list .segment-row > button { grid-column: 3; grid-row: 1; min-height: 40px; }
body[data-device="phone"] .word-editor-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
body[data-device="phone"] .word-editor-row > :first-child { grid-column: 1 / -1; }

@media (max-width: 620px) {
  :root { --toolbar-height: 104px; }
  .prototype-toolbar { flex-wrap: wrap; align-content: center; gap: 6px; padding: 8px 12px; overflow: visible; }
  .prototype-toolbar .prototype-label { width: 100%; font-size: 10px; }
  .prototype-toolbar .toolbar-controls { width: 100%; min-width: 0; gap: 10px; justify-content: space-between; }
  .prototype-toolbar :is(.surface-switch,.view-switch) { gap: 4px; }
  .prototype-toolbar button { min-height: 36px; padding: 5px 8px; font-size: 10px; }
  .bottom-variant-bar { width: min(366px,calc(100vw - 24px)); gap: 5px; min-height: 48px; }
  .bottom-variant-bar :is(.variant-caption,.keyboard-hint,.variant-option span) { display: none; }
  .bottom-variant-bar .variant-option { flex: 1; padding: 7px 5px; white-space: nowrap; font-size: 11px; }
  .bottom-variant-bar .variant-arrow { flex: 0 0 34px; }
  .mobile-nav { gap: 0; }
  .mobile-nav button, body[data-device="phone"] .mobile-nav button { min-width: 0; font-size: 10px; }
  .main { padding-bottom: 170px; }
  .modal-backdrop { align-items: center; padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); padding: 22px; }
  .modal .form-grid { grid-template-columns: minmax(0,1fr); }
  .modal .card-actions > .button { flex: 1 1 140px; }
  .segment-list .segment-row { grid-template-columns: 24px minmax(0,1fr) 40px; }
  .segment-list .segment-times { grid-column: 2; flex-direction: row; flex-wrap: wrap; }
  .segment-list .segment-text { grid-column: 1 / -1; grid-row: 2; }
  .segment-list .segment-row > button { grid-column: 3; grid-row: 1; min-height: 40px; }
  .word-editor-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .word-editor-row > :first-child { grid-column: 1 / -1; }
}
/* Word rows share the sentence editor's index / timing / text structure. */
.word-editor-list > section { display: grid; gap: 10px; min-width: 0; }
.word-editor-list > section > h3 { margin-top: 12px; font-size: 14px; }
.word-editor-row > .segment-index { grid-column: 1; grid-row: 1; }
@media (max-width: 620px) {
  .word-editor-row > .segment-times { grid-column: 2; grid-row: 1; }
}
body[data-device="phone"] .word-editor-row > .segment-times { grid-column: 2; grid-row: 1; }
/* The content studio keeps its four destinations reachable on narrow screens. */
@media (max-width: 900px) {
  body[data-surface="admin"] .admin-mobile-nav { display: flex; }
  body[data-surface="admin"] .main { padding-bottom: 170px; }
  body[data-surface="admin"] .bottom-variant-bar { bottom: 83px; }
}
body[data-device="phone"][data-surface="admin"] .admin-mobile-nav,
body[data-device="tablet"][data-surface="admin"] .admin-mobile-nav { display: flex; }
body[data-device="phone"][data-surface="admin"] .main,
body[data-device="tablet"][data-surface="admin"] .main { padding-bottom: 170px; }
body[data-device="phone"][data-surface="admin"] .bottom-variant-bar,
body[data-device="tablet"][data-surface="admin"] .bottom-variant-bar { bottom: 83px; }
.admin-mobile-nav > button { flex: 1 1 0; min-width: 0; }
