/* DSE CHINESE HISTORY AI · 中史人工智能系統
   Visual preview — yellow-frame editorial system
   Tokens must stay exact. */

:root {
  --yellow: #E7CD3A;
  --white: #FFFFFF;
  --coral: #D96D3F;
  --ink: #000000;
  --body: #1F1F1F;
  --muted: #666666;
  --input: #AFAFAF;
  --track: #E8E8E8;
  --hair: #E5E5E5;
  --soft: #F4F4F4;
  --shadow: 0 24px 44px rgba(0, 0, 0, 0.26), 0 6px 14px rgba(0, 0, 0, 0.08);
  --font-ui: "Noto Sans TC", "Noto Sans CJK TC", "Noto Sans CJK HK", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --font-display: "Oswald", "Noto Sans TC", sans-serif;
  --stage-max: 1280px;
  --pad-login-x: 72px;
  --pad-login-y: 72px;
  --pad-app: 36px 48px 48px;
  --radius-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html { height: 100%; }

body {
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

body {
  min-height: 100%;
  background: var(--yellow);
  color: var(--body);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select {
  font-family: inherit;
}

button { cursor: pointer; }

[hidden], .hidden { display: none !important; }
img, svg { display: block; max-width: 100%; }
svg#icon-sprite {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* ---------- Preview switcher (hidden in screenshots) ---------- */
.preview-switcher {
  position: fixed;
  z-index: 80;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.preview-switcher span {
  padding: 0 6px;
  opacity: 0.7;
  font-weight: 700;
}

.preview-switcher button {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.preview-switcher button:hover,
.preview-switcher button.is-on {
  background: var(--coral);
}

body.shot .preview-switcher { display: none !important; }
body.shot.is-app .canvas { min-height: 0; padding-bottom: 64px; }
body.shot.is-app .stage { min-height: 0; }

/* ---------- Masthead above the white stage ---------- */
.canvas {
  min-height: 100vh;
  padding: 0 5.5vw 5vw;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.masthead {
  text-align: center;
  padding: 22px 12px 18px;
  color: var(--ink);
  pointer-events: none;
  width: 100%;
  max-width: var(--stage-max);
}

.masthead .eyebrow {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink);
}

.masthead h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: clamp(28px, 3.4vw, 44px);
  letter-spacing: 0.04em;
  line-height: 1.05;
  color: var(--ink);
}

.masthead-sub {
  margin: 8px 0 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--ink);
}

body.is-app .masthead {
  padding: 14px 12px 12px;
}

body.is-app .masthead h1 {
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 0.06em;
}

/* ---------- White stage ---------- */
.stage {
  position: relative;
  width: 100%;
  max-width: var(--stage-max);
  background: var(--white);
  box-shadow: var(--shadow);
  flex: 0 0 auto;
  overflow: visible;
}

body.view-login .stage {
  min-height: 680px;
}

body.is-app .stage {
  min-height: calc(100vh - 86px);
}

/* ---------- Shared type ---------- */
.kicker {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  color: var(--coral);
}

.lead {
  margin: 0;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.22;
  color: var(--ink);
}

.fine {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.text-link {
  display: inline-block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
  background: none;
  border: 0;
  padding: 0;
}

.text-link:hover { color: var(--coral); }

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
}

.section-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--coral);
}

/* ---------- Forms ---------- */
.field {
  display: block;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 18px;
  border: 1.5px solid var(--input);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.field:focus { border-color: var(--ink); }

.field::placeholder { color: #9A9A9A; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--coral);
  color: var(--white);
  border-color: var(--coral);
  width: 100%;
}

.btn-primary:hover { filter: brightness(0.96); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn-ghost:hover { background: var(--ink); color: var(--white); }

.btn-coral-outline {
  background: transparent;
  color: var(--coral);
  border-color: var(--coral);
}

.btn-coral-outline:hover { background: var(--coral); color: var(--white); }

.btn-compact {
  min-height: 36px;
  padding: 0 16px;
  letter-spacing: 0.08em;
  width: auto;
}

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Login ---------- */
.login {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: 40px;
  padding: var(--pad-login-y) var(--pad-login-x);
  min-height: 680px;
  align-items: center;
}

.login-left { max-width: 400px; width: 100%; }
.login-copy { max-width: 400px; }

.signin-register {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  line-height: 1.5;
}

.signin-register .text-link {
  font-size: 13px;
}

.signin-register + .signin-register {
  margin-top: 8px;
}

.register-intro {
  margin-top: 12px;
}

.role-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.role-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 18px 18px 16px;
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 0;
  text-align: left;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.role-card:hover {
  border-color: var(--coral);
}

.role-card:active { transform: translateY(1px); }

.role-card-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.role-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.register-form { margin-top: 18px; gap: 10px; }

.field-block { display: flex; flex-direction: column; }

.field-block .lbl {
  margin: 0 0 6px;
  letter-spacing: 0.08em;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.login.is-register { align-items: start; }

.login.is-register .login-art { padding-top: 0; }

.login-copy .kicker { max-width: 22em; }

.login-copy .lead { margin-top: 14px; }

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.login-note {
  margin-top: 22px;
  max-width: 36em;
}

.login-links {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.login-footer {
  margin-top: 28px;
}

.usage-rules-toggle {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.usage-rules-toggle:hover,
.usage-rules-toggle:focus-visible {
  color: var(--ink);
}

.usage-rules-dialog {
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 0;
  max-width: 36rem;
  width: calc(100% - 32px);
  max-height: 90vh;
  background: var(--white);
  color: var(--ink);
  overflow: hidden;
}

.usage-rules-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.usage-rules-sheet {
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  box-sizing: border-box;
}

.usage-rules-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.usage-rules-body {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--body);
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

.usage-rules-sheet > #usage-rules-close {
  flex-shrink: 0;
}

/* Right typographic lockup + illustration */
.login-art {
  position: relative;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 8px;
}

.lockup {
  position: relative;
  z-index: 2;
  color: var(--ink);
  line-height: 0.86;
  pointer-events: none;
}

.lockup .dse {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(18px, 1.8vw, 26px);
  letter-spacing: 0.22em;
  margin-left: 2px;
}

.lockup .line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.22em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(42px, 5.4vw, 72px);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.lockup .word-outline {
  font-weight: 500;
  color: var(--ink);
  -webkit-text-stroke: 0;
}

.lockup .word-yellow {
  color: var(--yellow);
  -webkit-text-stroke: 2.5px var(--ink);
  paint-order: stroke fill;
}

.lockup .zh {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: clamp(22px, 2.1vw, 30px);
  letter-spacing: 0.12em;
  line-height: 1.15;
}

.lockup .sub {
  display: block;
  margin: 0 0 18px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(14px, 1.3vw, 18px);
  letter-spacing: 0.16em;
  line-height: 1.3;
}

.illus-wrap {
  position: relative;
  z-index: 1;
  margin-top: -18px;
  margin-left: -4px;
  pointer-events: none;
}

.illus-wrap svg {
  width: 100%;
  height: auto;
  max-height: 500px;
}

/* ---------- App chrome inside the stage ---------- */
.app-chrome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 48px 16px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}

.app-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.app-brand .brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  pointer-events: none;
}

.app-brand .en {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}

.app-brand .en .accent {
  color: var(--yellow);
  -webkit-text-stroke: 1.4px var(--ink);
  paint-order: stroke fill;
}

.app-brand .zh {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.app-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 1.5px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  line-height: 1;
}

.badge-ink {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.badge-coral {
  background: var(--coral);
  color: var(--white);
  border-color: var(--coral);
}

.user-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.chrome-link {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.chrome-link:hover { color: var(--coral); }

/* Quiet corner ornament on inner pages */
.chrome-deco { display: none; }

/* ---------- App body ---------- */
.app-body {
  padding: var(--pad-app);
  position: relative;
}

.tabs {
  display: flex;
  gap: 28px;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--hair);
}

.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.tab:hover { color: var(--ink); }

.tab.is-on {
  color: var(--ink);
  border-bottom-color: var(--coral);
}

.panel { display: none; }
.panel.is-on { display: block; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
}

.grid-2-eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
}

.stack { display: flex; flex-direction: column; gap: 28px; }

.block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.rule {
  height: 2px;
  background: var(--ink);
  border: 0;
  margin: 0 0 16px;
}

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--ink);
}

table.data th {
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink);
  padding: 0 10px 10px 0;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}

table.data td {
  padding: 13px 10px 13px 0;
  border-bottom: 1px solid var(--hair);
  vertical-align: middle;
}

table.data tbody tr:hover td { background: #FFFDF5; }

table.data .name-btn {
  border: 0;
  background: none;
  padding: 0;
  font-weight: 800;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
}

table.data .name-btn:hover { color: var(--coral); }

.status {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}

.status-wait { color: var(--coral); }
.status-off { color: var(--muted); border-color: var(--input); }
.status-ok { color: var(--ink); background: var(--yellow); border-color: var(--ink); }
.status-pending { color: var(--ink); background: transparent; }

/* ---------- Bars (learning analysis) ---------- */
.bars { display: flex; flex-direction: column; gap: 14px; }

.bar-row { display: grid; grid-template-columns: 88px 1fr 52px; gap: 12px; align-items: center; }

.bar-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.bar-track {
  height: 10px;
  background: var(--track);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #DDDDDD;
}

.bar-fill {
  height: 100%;
  background: var(--coral);
  border-radius: 999px;
  width: 0;
}

.bar-val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-align: right;
}

.disclaimer {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.disclaimer strong { color: var(--ink); font-weight: 800; }

/* ---------- Cards / comments ---------- */
.comment {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.75;
}

.comment p { margin: 0 0 10px; }
.comment p:last-child { margin-bottom: 0; }

.file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  padding: 6px 0;
}

.file-name em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}

.hw-card, .soft-box {
  border-top: 2px solid var(--ink);
  padding-top: 16px;
}

.meta-line {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 16px;
}

.meta-line b { color: var(--ink); font-weight: 800; }

/* ---------- Marking ---------- */
.back-row { margin-bottom: 18px; }

.script-box {
  border: 2px solid var(--ink);
  padding: 18px 20px;
  background: var(--white);
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--body);
}

.script-box h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--ink);
}

.mark-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.mark-actions .btn { width: auto; min-width: 148px; }

textarea.area {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1.5px solid var(--input);
  border-radius: 12px;
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
  outline: none;
}

textarea.area:focus { border-color: var(--ink); }

label.lbl {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin: 0 0 8px;
  color: var(--ink);
}

/* ---------- Exam + bank layouts ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 2px solid var(--ink);
}

.split > div { padding: 18px 20px; }
.split > div + div { border-left: 2px solid var(--ink); }

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }

.mini-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 14px;
}

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}
.item-list li:last-child { border-bottom: 0; }
.item-list .ttl { font-weight: 800; color: var(--ink); font-size: 13.5px; }
.item-list .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  margin-right: 6px;
}

.tag-coral { border-color: var(--coral); color: var(--coral); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  max-width: 320px;
  background: var(--ink);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-on,
#toast-banner:not(.hidden) {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

body.shot .toast { display: none !important; }

/* ---------- Motion ---------- */
.anim-float { animation: float 6.5s ease-in-out infinite; }
.anim-float-slow { animation: float 11s ease-in-out infinite; }
.anim-float-delay { animation: float 7.5s ease-in-out 0.8s infinite; }
.anim-sway { animation: sway 8s ease-in-out infinite; }
.anim-sway-slow { animation: sway 14s ease-in-out infinite; }
.anim-spin { animation: spin 48s linear infinite; transform-origin: center; transform-box: fill-box; }
.anim-twinkle { animation: twinkle 2.8s ease-in-out infinite; }
.anim-twinkle-2 { animation: twinkle 3.4s ease-in-out 0.9s infinite; }
.anim-twinkle-3 { animation: twinkle 2.2s ease-in-out 1.4s infinite; }
.anim-draw {
  stroke-dasharray: 280;
  stroke-dashoffset: 280;
  animation: draw 2.8s ease forwards, float 9s ease-in-out 2.8s infinite;
}
.anim-ticks { animation: ticks-in 1.4s ease both; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-2.2deg); }
  50% { transform: rotate(2.8deg); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  45% { opacity: 1; }
  60% { opacity: 0.35; }
  80% { opacity: 1; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes ticks-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .anim-draw { stroke-dashoffset: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .login {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 48px 32px 32px;
    min-height: 0;
  }
  .login-art { min-height: 0; }
  .app-chrome, .app-body { padding-left: 24px; padding-right: 24px; }
  .grid-2, .grid-2-eq, .split { grid-template-columns: 1fr; }
  .split > div + div { border-left: 0; border-top: 2px solid var(--ink); }
  body.view-login .stage { min-height: 0; }
}

@media (max-width: 640px) {
  .masthead h1 { font-size: 22px; }
  .masthead-sub { font-size: 13px; }
  .lead { font-size: 20px; }
  .lockup .line { font-size: 36px; }
  .bar-row { grid-template-columns: 72px 1fr 44px; }
  .app-chrome { flex-direction: column; align-items: flex-start; }
  .preview-switcher { right: 12px; left: 12px; }
}

/* ---------- Icons ---------- */
.icon {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.2em;
  flex: 0 0 auto;
  overflow: visible;
}
.icon-lg { width: 1.35em; height: 1.35em; }
.icon-xl { width: 1.7em; height: 1.7em; }
.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- App work surface (dense tools) ---------- */
body.is-app .canvas { padding: 0 3.2vw 3.2vw; }
body.is-app .stage { max-width: 1320px; }
body.is-app .app-body { padding: 24px 32px 36px; }
body.is-app .app-chrome { padding: 18px 32px 14px; }

/* ---------- Teacher preview banner ---------- */
.preview-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 32px 0;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  background: #FFF6C9;
  color: var(--ink);
}
.preview-banner p { margin: 0; font-size: 13px; line-height: 1.55; }
.preview-banner strong { font-weight: 800; }

/* ---------- Homework cards / lists ---------- */
.assign-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.assign-row:last-child { border-bottom: 0; }
.assign-row h3 { margin: 0 0 4px; font-size: 15px; font-weight: 800; color: var(--ink); }
.dim-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.dim-card { padding-top: 4px; }
.dim-card p { margin: 8px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- Writing workspace ---------- */
.work-split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
}
.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
select.field, .field-select {
  appearance: none;
  background: var(--white) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/></svg>") no-repeat right 16px center;
  padding-right: 36px;
  height: 42px;
  border-radius: var(--radius-pill);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
}
.question-stem {
  margin: 0 0 14px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.55;
}
.source-box {
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  background: #FFFEF8;
  font-size: 13px;
  line-height: 1.7;
  color: var(--body);
  margin-bottom: 16px;
}
.step-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  color: var(--ink);
}
.feedback-box {
  border: 2px solid var(--ink);
  padding: 18px 20px;
  background: var(--white);
}
.feedback-wait {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
}
.ask-list { list-style: none; margin: 12px 0 0; padding: 0; }
.ask-list li { margin: 0 0 8px; }
.ask-list button.text-link { font-size: 13px; text-align: left; }

/* ---------- Annotation ---------- */
.hl-source {
  background: #F6E48A;
  border-bottom: 2px solid var(--ink);
  padding: 0 2px;
}
.hl-fact {
  background: #F8E4D8;
  border-bottom: 2px solid var(--coral);
  padding: 0 2px;
}
.hl-out {
  background: #F1F1F1;
  color: #6A6A6A;
  text-decoration: line-through;
  padding: 0 3px;
  border: 1px dashed #B0B0B0;
}
.ocr-flag {
  background: #F8E4D8;
  border-bottom: 2px dashed var(--coral);
  color: #8A3B16;
  font-weight: 800;
  cursor: pointer;
  padding: 0 3px;
}
.ocr-fixed {
  background: #EFEFE0;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 800;
  padding: 0 3px;
}
.tag-out {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border: 1.5px solid var(--coral);
  color: var(--coral);
  border-radius: 999px;
  white-space: nowrap;
}
.anno-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
}
.header-mask {
  background: var(--ink);
  color: var(--white);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.header-open {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 10px;
  font-size: 12px;
  margin-bottom: 10px;
}
.header-open dt { font-weight: 800; color: var(--ink); }
.header-open dd { margin: 0; }
.ratio-bar {
  display: flex;
  height: 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 8px;
}
.ratio-bar .src { background: #E7CD3A; }
.ratio-bar .fact { background: #D96D3F; }

/* ---------- Rubric ---------- */
.point-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
}
.point-row:last-child { border-bottom: 0; }
.point-row .ttl { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.point-row .note { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.score { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink); }
.holistic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.holistic .col {
  border: 1.5px solid var(--ink);
  padding: 12px 14px;
}

/* ---------- Consensus / lock banners ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  background: #FFFEF8;
  font-size: 13px;
  line-height: 1.6;
  color: var(--body);
  margin-bottom: 16px;
}
.notice-warn { background: #FFF6C9; }
.notice-lock { background: #F8E4D8; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-back[hidden] { display: none !important; }
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--white);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 24px 26px 22px;
  color: var(--ink);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 900; }
.icon-btn {
  border: 0;
  background: none;
  padding: 4px;
  line-height: 0;
  color: var(--ink);
}
.icon-btn:hover { color: var(--coral); }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- Toast ---------- */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--ink);
  color: var(--white);
}
.toast .icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin-top: 0;
  background: #E7CD3A;
  padding: 2px;
  box-sizing: content-box;
}
.toast .icon path, .toast .icon circle, .toast .icon rect { stroke: #000; }
label.notice { cursor: pointer; }
label.notice input[type="checkbox"] { margin-top: 3px; accent-color: #D96D3F; width: 16px; height: 16px; }

.toast strong { display: block; font-size: 13px; font-weight: 800; margin-bottom: 2px; }

/* ---------- Forms in app ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.stat-pill {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

/* Draft panel */
.draft-panel {
  border: 2px solid var(--ink);
  padding: 16px 18px;
  background: #FFFEF8;
}
.draft-panel h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; }
.draft-panel .k { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; margin: 12px 0 4px; }

@media (max-width: 1040px) {
  .work-split, .dim-grid, .holistic, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 960px) {
  body.is-app .app-chrome, body.is-app .app-body, .preview-banner { padding-left: 20px; padding-right: 20px; }
  .preview-banner { margin-left: 20px; margin-right: 20px; }
  .tabs { gap: 16px; overflow-x: auto; }
}


.local-preview-unofficial {
  margin-top: 10px;
  color: var(--muted, #64748b);
}
.local-preview-unofficial summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted, #64748b);
}
