/* TFA Board styles. One deliberate light look in the Tutor-For-All brand:
   navy chrome, warm cream ground, gold for the tutor's controls. The board paper is always white. */
:root {
  --navy: #1e3a6f;
  --navy-deep: #15294f;
  --cream: #f5ebc8;
  --ground: #efe8d6;
  --panel: #fffdf7;
  --paper: #ffffff;
  --gold: #e6b340;
  --gold-hover: #efc35c;
  --gold-deep: #b8862a;
  --ink: #1b2440;
  --muted: #5a6480;
  --line: #e2d9bf;
  --good: #2f8a57;
  --danger: #b42a2a;
  --font: 'Andika', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}

[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}
body.is-board {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
#app {
  position: relative;
  min-height: 100%;
}
body.is-board #app {
  position: absolute;
  inset: 0;
}

/* ---------- the board app ---------- */

.tfa-app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.tfa-app button {
  font-family: var(--font);
  touch-action: manipulation;
}
.tfa-app button:focus-visible,
.tfa-app a:focus-visible,
.tfa-app input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.tfa-bar {
  flex: none;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  background: var(--navy);
  color: var(--cream);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.tfa-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: none;
}
.tfa-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
}
.tfa-name {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.tfa-rolechip {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  background: var(--gold);
  color: var(--navy-deep);
  border-radius: 999px;
  padding: 3px 9px;
}
.tfa-who {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 235, 200, 0.9);
  font-size: 14px;
  white-space: nowrap;
}
.tfa-who-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tfa-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8a93ab;
  box-shadow: 0 0 0 3px rgba(138, 147, 171, 0.28);
}
.tfa-who[data-on='true'] .tfa-dot {
  background: #4cc38a;
  box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.28);
}
/* tutor, recorded boards: minutes together, inside the presence pill */
.tfa-timer {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid rgba(245, 235, 200, 0.28);
  color: var(--cream);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tfa-timer .tfa-ico {
  width: 17px;
  height: 17px;
  color: var(--gold);
}
.tfa-app[data-compact='tight'] .tfa-timer {
  display: none;
}
.tfa-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.tfa-act {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid rgba(245, 235, 200, 0.3);
  background: transparent;
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.tfa-act:hover {
  background: rgba(255, 255, 255, 0.1);
}
.tfa-act[aria-pressed='true'],
.tfa-act-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy-deep);
}
.tfa-act[aria-pressed='true']:hover,
.tfa-act-primary:hover {
  background: var(--gold-hover);
}
.tfa-ico {
  width: 22px;
  height: 22px;
  flex: none;
}
.tfa-act .tfa-ico {
  width: 20px;
  height: 20px;
}

/* narrower screens: secondary labels become tooltips, then everything tightens */
.tfa-app[data-compact='yes'] .tfa-act:not(.tfa-act-primary) span,
.tfa-app[data-compact='tight'] .tfa-act span,
.tfa-app[data-compact='tight'] .tfa-who-text,
.tfa-app[data-who='dot'] .tfa-who-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.tfa-app[data-compact='yes'] .tfa-act:not(.tfa-act-primary),
.tfa-app[data-compact='tight'] .tfa-act {
  width: 40px;
  padding: 0;
}
.tfa-app[data-compact='yes'][data-role='tutor'] .tfa-name,
.tfa-app[data-compact='yes'] .tfa-pair {
  display: none; /* room for "Student is here" next to the tutor buttons (the pairing stays in the tooltip) */
}
.tfa-pair {
  text-transform: none;
  letter-spacing: 0.02em;
}
.tfa-app[data-compact='tight'] .tfa-bar {
  gap: 8px;
}
.tfa-app[data-compact='tight'] .tfa-actions {
  gap: 4px;
}
.tfa-app[data-compact='tight'] .tfa-name,
.tfa-app[data-compact='tight'] .tfa-rolechip {
  display: none;
}
.tfa-app[data-compact='tight'] .tfa-who {
  padding: 8px;
}

.tfa-body {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.tfa-rail {
  flex: none;
  width: 88px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.tfa-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tfa-tool {
  width: 68px;
  height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.tfa-tool .tfa-ico {
  width: 28px;
  height: 28px;
}
.tfa-tool[data-tool='hl'] .tfa-ico path:last-child {
  stroke: #f2c200;
  stroke-width: 3.2;
}
.tfa-tool:hover {
  background: rgba(30, 58, 111, 0.08);
}
.tfa-tool[aria-pressed='true'] {
  background: var(--navy);
  color: var(--cream);
}
.tfa-tool:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}
.tfa-swatches {
  display: flex;
  gap: 3px;
  padding: 0 0 6px;
}
.tfa-swatch {
  position: relative;
  width: 25px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.tfa-swatch::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px rgba(27, 36, 64, 0.22);
}
.tfa-swatch[aria-pressed='true']::after {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4.5px var(--navy);
}
.tfa-sizes {
  display: flex;
  gap: 3px;
  padding: 0 0 8px;
}
.tfa-size {
  width: 25px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.tfa-size i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pen, var(--navy));
  box-shadow: 0 0 0 1px rgba(27, 36, 64, 0.18);
}
.tfa-size[data-size='1'] i {
  width: 9px;
  height: 9px;
}
.tfa-size[data-size='2'] i {
  width: 15px;
  height: 15px;
}
.tfa-size:hover {
  background: rgba(30, 58, 111, 0.08);
}
.tfa-size[aria-pressed='true'] {
  box-shadow: inset 0 0 0 2px var(--navy);
}
.tfa-watching {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
}
.tfa-watching .tfa-ico {
  width: 34px;
  height: 34px;
  color: var(--gold-deep);
}
.tfa-watching strong {
  font-size: 17px;
}

/* tall, narrow screens: tools along the bottom */
.tfa-app[data-layout='bottom'] .tfa-body {
  flex-direction: column-reverse;
}
.tfa-app[data-layout='bottom'] .tfa-rail {
  width: auto;
  flex-direction: row;
  justify-content: flex-start; /* centred by the margins below, but never cut off when too wide */
  padding: 6px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border-right: 0;
  border-top: 1px solid var(--line);
}
.tfa-app[data-layout='bottom'] .tfa-tools,
.tfa-app[data-layout='bottom'] .tfa-watching {
  flex-direction: row;
  margin: 0 auto;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-rail {
  padding: 6px 4px;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-tools {
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 4px;
}
/* phones: the tools on one row, the colors and pen sizes on a second row under them */
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-tools::after {
  content: '';
  order: 1;
  flex-basis: 100%;
  height: 0;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-swatches,
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-sizes {
  order: 2;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-sizes {
  margin-left: 10px;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-tool {
  width: 54px;
  font-size: 11.5px;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-swatches,
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-sizes {
  gap: 1px;
  padding: 0 2px;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-swatch,
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-size {
  width: 24px;
}
.tfa-app[data-layout='bottom'] .tfa-swatches,
.tfa-app[data-layout='bottom'] .tfa-sizes {
  padding: 0 4px;
  align-items: center;
}
.tfa-app[data-layout='bottom'] .tfa-tool {
  width: 60px;
  height: 56px;
}

.tfa-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex; /* the board, then the tutor's page strip on its right */
}
.tfa-app[data-layout='bottom'] .tfa-main {
  flex-direction: column;
}
.tfa-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  background: var(--ground);
}
.tfa-page {
  position: relative;
  flex: none;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(21, 41, 79, 0.14), 0 10px 30px rgba(21, 41, 79, 0.12);
  touch-action: none;
  cursor: crosshair;
}
.tfa-page[data-tool='text'] {
  cursor: text;
}
.tfa-page[data-tool='eraser'] {
  cursor: none;
}
.tfa-app[data-locked='true'] .tfa-page {
  cursor: default;
}
.tfa-page canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.tfa-editor {
  position: absolute;
  z-index: 3;
  box-sizing: content-box;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 2px dashed rgba(30, 58, 111, 0.55);
  outline-offset: 5px;
  background: rgba(255, 255, 255, 0.35);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: normal;
  white-space: pre;
  overflow: hidden;
  resize: none;
  -webkit-user-select: text;
  user-select: text;
  caret-color: currentColor;
  -webkit-appearance: none;
  appearance: none;
}
.tfa-stage.tfa-drop .tfa-page {
  outline: 4px dashed var(--gold);
  outline-offset: -8px;
}

/* tutor: paper and pages, in a strip on the right of the board (under it on tall screens).
   It sits beside the board rather than on it, so no writing space is lost. */
.tfa-pagebar {
  flex: none;
  width: 84px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
}
.tfa-pb {
  width: 68px;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.tfa-pb .tfa-ico {
  width: 26px;
  height: 26px;
}
.tfa-pb:hover {
  background: rgba(30, 58, 111, 0.08);
}
.tfa-pb:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}
.tfa-pb-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 64px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.tfa-pb-arrow {
  height: 42px;
}
.tfa-pb-arrow .tfa-ico {
  transform: rotate(90deg); /* up for the page before, down for the page after */
}
.tfa-pb-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.tfa-pb-word {
  color: var(--muted);
  font-size: 12px;
}
.tfa-pb-num {
  font-size: 15px;
  white-space: nowrap;
}

/* tall screens: the strip becomes a row under the board */
.tfa-app[data-layout='bottom'] .tfa-pagebar {
  width: auto;
  height: 52px;
  flex-direction: row;
  gap: 10px;
  padding: 0 10px;
  overflow: hidden;
  border-left: 0;
  border-top: 1px solid var(--line);
}
.tfa-app[data-layout='bottom'] .tfa-pb {
  width: auto;
  height: 42px;
  flex-direction: row;
  gap: 7px;
  padding: 0 12px;
  font-size: 14px;
}
.tfa-app[data-layout='bottom'] .tfa-pb .tfa-ico {
  width: 22px;
  height: 22px;
}
.tfa-app[data-layout='bottom'] .tfa-pb-nav {
  flex-direction: row;
  width: auto;
  padding: 0 6px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.tfa-app[data-layout='bottom'] .tfa-pb-arrow {
  width: 42px;
  padding: 0;
}
.tfa-app[data-layout='bottom'] .tfa-pb-arrow .tfa-ico {
  transform: none;
}
.tfa-app[data-layout='bottom'] .tfa-pb-count {
  flex-direction: row;
  gap: 5px;
  min-width: 92px;
  justify-content: center;
}
.tfa-app[data-layout='bottom'] .tfa-pb-word {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-pagebar {
  gap: 4px;
  padding: 0 4px;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-pb:not(.tfa-pb-arrow) {
  width: 44px;
  padding: 0;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-pb:not(.tfa-pb-arrow) span,
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-pb-word {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.tfa-app[data-layout='bottom'][data-compact='tight'] .tfa-pb-count {
  min-width: 56px;
}

/* student: which page the tutor is on */
.tfa-pagebadge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(21, 41, 79, 0.82);
  color: var(--cream);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* the paper chooser */
.tfa-papers {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 6px 0 2px;
}
.tfa-paper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.tfa-paper:hover {
  border-color: rgba(30, 58, 111, 0.45);
}
.tfa-paper[aria-pressed='true'] {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 2px var(--gold);
}
.tfa-paper-pic {
  display: block;
  width: 84px;
  height: 104px;
  border-radius: 4px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(21, 41, 79, 0.25);
}
.tfa-paper-lines {
  background-image: linear-gradient(
    to bottom,
    transparent 7px,
    #a8c0ea 7px,
    #a8c0ea 8px,
    transparent 8px,
    transparent 13px,
    #cbd9f2 13px,
    #cbd9f2 14px,
    transparent 14px,
    transparent 19px,
    #7d9fda 19px,
    #7d9fda 20.5px,
    transparent 20.5px
  );
  background-size: 100% 25px;
  background-position: 0 4px;
}
.tfa-paper-grid {
  background-image: linear-gradient(#d0dcf0 1px, transparent 1px), linear-gradient(90deg, #d0dcf0 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: -1px -1px;
}

.tfa-pill {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--navy);
  color: var(--cream);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 6px 18px rgba(21, 41, 79, 0.25);
  pointer-events: none;
}
.tfa-pill[data-kind='warn'] {
  background: #fff4da;
  color: #7a4d06;
  box-shadow: 0 0 0 1px #f0d28c, 0 6px 18px rgba(21, 41, 79, 0.15);
}
.tfa-pill[data-kind='good'] {
  background: #e3f4ea;
  color: #1f6a43;
  box-shadow: 0 0 0 1px #b7e0c7, 0 6px 18px rgba(21, 41, 79, 0.15);
}
.tfa-busy {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--panel);
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 12px 40px rgba(21, 41, 79, 0.25);
}
.tfa-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--navy-deep);
  color: #ffffff;
  font-size: 14.5px;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(21, 41, 79, 0.3);
}
.tfa-toast-btn {
  flex: none;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: var(--navy-deep);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.tfa-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(21, 41, 79, 0.45);
}
.tfa-modal-card {
  width: min(440px, 100%);
  max-height: calc(100% - 8px);
  overflow: auto;
  box-sizing: border-box;
  padding: 22px 22px 18px;
  border-radius: 18px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  -webkit-user-select: text;
  user-select: text;
}
.tfa-modal-card.tfa-wide {
  width: min(760px, 100%);
}
.tfa-modal-title {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.25;
  text-wrap: balance;
}
.tfa-modal-text,
.tfa-modal-body p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.45;
}
.tfa-modal-body p.tfa-hint,
.tfa-hint {
  color: var(--muted);
  font-size: 13.5px;
}
.tfa-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.tfa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  box-sizing: border-box;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.tfa-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.tfa-btn-primary {
  background: var(--navy);
  color: #ffffff;
}
.tfa-btn-primary:hover {
  background: var(--navy-deep);
}
.tfa-btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.tfa-btn-plain {
  background: transparent;
  border-color: var(--line);
  color: var(--navy);
}
.tfa-btn-plain:hover {
  background: rgba(30, 58, 111, 0.06);
}
.tfa-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  font-size: 15px;
  cursor: pointer;
}
.tfa-check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--navy);
}
.tfa-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
  max-height: 55vh;
  overflow: auto;
  padding: 2px;
}
.tfa-pagebtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.tfa-pagebtn:hover,
.tfa-pagebtn:focus-visible {
  border-color: var(--navy);
}
.tfa-thumb {
  display: block;
  width: 100%;
  max-width: 120px;
  height: auto;
  background: #f4f0e6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.tfa-snap {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
.tfa-linkbox {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font: 14px ui-monospace, Menlo, Consolas, monospace;
}

.tfa-cover {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ground);
}
.tfa-cover-card {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.tfa-cover-logo {
  width: 84px;
  height: 84px;
}
.tfa-cover h2 {
  margin: 6px 0 0;
  color: var(--navy);
  font-size: 24px;
  text-wrap: balance;
}
.tfa-cover p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}
.tfa-spinner {
  width: 34px;
  height: 34px;
  box-sizing: border-box;
  border: 4px solid rgba(30, 58, 111, 0.15);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: tfa-spin 0.8s linear infinite;
}
@keyframes tfa-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tfa-spinner {
    animation-duration: 2.4s;
  }
}

/* ---------- start page ---------- */

body.is-landing {
  overflow: auto;
}
.land {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-block: 40px 56px;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.land-head {
  display: flex;
  align-items: center;
  gap: 18px;
}
.land-head img {
  flex: none;
  width: 88px;
  height: 88px;
}
.land h1 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  letter-spacing: -0.01em;
}
.land-lede {
  max-width: 46ch;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}
.land-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.land-card h2 {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 20px;
}
.land-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.land-code label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}
.land-code input {
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1.5px solid #cfc4a5;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: 16px var(--font);
}
.land-code input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}
.land-go {
  min-height: 52px;
  font-size: 17px;
}
.land-error {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}
.land-saved {
  margin: 0;
  color: var(--muted);
}
.land-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.land-steps {
  margin: 18px 0 0;
  padding-left: 22px;
  line-height: 1.6;
}
.land-status {
  margin: 0;
  color: var(--muted);
}
.land-retry {
  align-self: flex-start;
  margin-top: 10px;
}
.land-hi {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.land-pairs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.land-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1.5px solid var(--navy);
  border-radius: 14px;
  background: var(--navy);
  color: var(--cream);
  font: 16px var(--font);
  text-align: left;
  cursor: pointer;
}
.land-pair strong {
  font-size: 19px;
  letter-spacing: 0.02em;
}
.land-pair span {
  font-size: 14px;
  opacity: 0.85;
}
.land-pair:hover {
  background: var(--navy-deep);
}
.land-pair:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.land-pair:disabled {
  opacity: 0.6;
  cursor: default;
}
.land-pair-practice {
  background: #ffffff;
  color: var(--navy);
}
.land-pair-practice:hover {
  background: var(--cream);
}
.land-typed {
  margin-top: 16px;
}
.land-typed label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 15px;
}
.land-typed-row {
  display: flex;
  gap: 8px;
}
.land-typed input {
  flex: 1;
  min-width: 0;
  height: 44px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1.5px solid #cfc4a5;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: 16px var(--font);
  text-transform: uppercase;
}
.land-typed input::placeholder {
  text-transform: none;
}
.land-typed input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}
.land-who .land-saved {
  margin-top: 14px;
}
.land-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.land-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
.land-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.land-student {
  margin: 0;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 480px) {
  .land-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .land h1 {
    font-size: 30px;
  }
}
