/* ===== OceanNote design tokens ===== */
:root {
  --hull-navy: #0F2A43;
  --hull-navy-deep: #0A1D31;
  --hull-navy-panel: #17334F;
  --deck-cream: #F3ECDD;
  --card-white: #FFFFFF;
  --brass: #E3A857;
  --brass-deep: #B9822F;
  --sea-teal: #1D9E75;
  --sea-teal-deep: #0F6E56;
  --coral: #E2725B;
  --coral-deep: #A8442F;
  --ink: #16232F;
  --ink-soft: #4A5A68;
  --ink-faint: #8A98A5;
  --ink-on-navy: #BFD0DC;
  --ink-on-navy-faint: #8298AC;
  --line: #E1E4E0;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 10px rgba(15, 42, 67, 0.08);
  --shadow-pressed: inset 0 2px 4px rgba(15, 42, 67, 0.15);

  --font-display: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Nunito', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

/* Apple Pencil / touch text selection is switched off app-wide. There's
   no text anywhere in OceanNote worth selecting or copying — the header
   labels, page-strip counters, etc. are all just UI chrome, never a
   document. Without this, iPadOS Safari periodically mistakes an Apple
   Pencil stroke (or a resting Pencil tip) for a text-selection gesture
   and pops up its native selection handles + Copy/Look Up/Translate
   menu right over the page the child is writing on — distracting, and
   for a kid who's already easy to knock off task, a real problem.
   Actual form fields (name/subject/date, mission titles, etc.) get
   selection back explicitly below, since typing/editing needs it. */
* {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}


html, body {
  margin: 0;
  padding: 0;
  background: var(--deck-cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0;
}

p { margin: 0; line-height: 1.5; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
}

a { color: inherit; text-decoration: none; }

/* ===== Top bar ===== */
.topbar {
  position: relative;
  background: var(--hull-navy);
  color: var(--deck-cream);
  padding: 18px 20px 22px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-bottom: 3px solid var(--brass-deep);
}

.topbar .eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-on-navy-faint);
  margin: 0 0 6px;
  padding-right: 40px;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding-right: 40px;
}

.topbar .brand .porthole {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hull-navy);
  font-size: 15px;
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

.topbar .subtitle {
  margin-top: 4px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--ink-on-navy);
}

/* Decorative anchor badge, top-right of the topbar (matches the fleet's shared look) */
.topbar .anchor-badge {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(191, 208, 220, 0.35);
  background: var(--hull-navy-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--deck-cream);
  flex-shrink: 0;
}

.topbar .anchor-badge svg { width: 17px; height: 17px; }

.topbar .deck-header-actions {
  position: absolute;
  top: 18px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .deck-header-actions .save-indicator {
  font-size: 12px;
  color: var(--ink-on-navy-faint);
}

/* This topbar is shared across many screens; only slide-deck.html's
   header carries both a "Saved" label and Exit button, so only it
   needs the extra reserved space and title truncation to avoid the
   two colliding on a long presentation topic. */
.topbar.has-deck-actions .brand,
.topbar.has-deck-actions .subtitle {
  padding-right: 150px;
}

.topbar.has-deck-actions #deck-topic {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* ===== Main content ===== */
main {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 18px 100px;
}

/* ===== Big primary button (porthole CTA) ===== */
/* ===== Rank widget (dashboard) ===== */

.rank-widget {
  display: block;
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin: 0 0 16px;
}

.rank-widget-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.rank-widget-name {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--hull-navy);
  font-weight: 600;
}

.rank-widget-xp {
  font-size: 13px;
  font-weight: 700;
  color: var(--brass-deep);
}

.rank-widget-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--deck-cream);
  overflow: hidden;
  margin-bottom: 6px;
}

.rank-widget-fill {
  height: 100%;
  background: var(--brass);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

.rank-widget-next {
  font-size: 12px;
  color: var(--ink-faint);
}

/* ===== Crew Record screen ===== */

.crew-hero {
  background: var(--hull-navy);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin: 4px 0 20px;
  text-align: center;
}

.crew-hero .rank-widget-bar { background: rgba(255,255,255,0.16); margin-top: 12px; }
.crew-hero .rank-widget-next { color: var(--ink-on-navy-faint); margin-top: 6px; }

.crew-hero-rank {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--deck-cream);
  font-weight: 600;
}

.crew-hero-xp {
  font-size: 14px;
  color: var(--brass);
  font-weight: 700;
  margin-top: 4px;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.rank-row.reached { opacity: 1; }
.rank-row.current { box-shadow: 0 0 0 2px var(--brass); }

.rank-row-name {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--hull-navy);
}

.rank-row-xp {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 700;
}

.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.badge-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 12px;
  text-align: center;
  opacity: 0.5;
}

.badge-card.earned { opacity: 1; }

.badge-card-icon { font-size: 26px; margin-bottom: 6px; }

.badge-card-name {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--hull-navy);
  margin-bottom: 4px;
}

.badge-card-desc {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.start-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--brass);
  color: var(--hull-navy-deep);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  margin: 18px 0 26px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.start-button:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.start-button .ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--hull-navy);
  color: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.start-button .ring svg { width: 21px; height: 21px; }

.start-button .label {
  text-align: left;
}

.start-button .label .big {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  display: block;
}

.start-button .label .small {
  font-size: 13px;
  color: var(--hull-navy);
  opacity: 0.75;
}

/* ===== Section heading ===== */
.section-heading {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 26px 0 12px;
  font-weight: 600;
}

/* ===== Voyage card (in-progress work) ===== */
.voyage-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.voyage-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.voyage-card .subject {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sea-teal-deep);
  font-weight: 700;
}

.voyage-card .topic {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 2px 0 10px;
}

.progress-track {
  height: 8px;
  background: var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--sea-teal);
  border-radius: 6px;
}

.progress-fill.done { background: var(--brass); }

.status-check {
  color: var(--sea-teal-deep);
  font-weight: 700;
  font-size: 13px;
}

/* ===== Empty state ===== */
.empty-state {
  background: var(--card-white);
  border: 1.5px dashed var(--brass-deep);
  border-radius: var(--radius-md);
  padding: 26px 20px;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state .icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  color: var(--brass-deep);
  opacity: 0.85;
}

.empty-state .icon svg { width: 100%; height: 100%; }

/* ===== Quick action row ===== */
.quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.quick-actions .action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-card);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--hull-navy);
}

.quick-actions .action .icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.quick-actions .action .icon-badge svg { width: 18px; height: 18px; }

/* ===== Reusable icon badge (rounded-square, matches fleet module icons) ===== */
.icon-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--hull-navy);
  color: var(--deck-cream);
}

.icon-badge svg { width: 22px; height: 22px; }
.icon-badge.gold { background: var(--brass); color: var(--hull-navy-deep); }
.icon-badge.teal { background: var(--sea-teal); color: #fff; }
.icon-badge.coral { background: var(--coral); color: #fff; }

/* ===== Bottom navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-white);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 6px 12px 4px;
  border-radius: var(--radius-sm);
  background: none;
}

.bottom-nav .nav-item .nav-icon {
  width: 34px;
  height: 26px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav .nav-item .nav-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
}

/* Each item carries its own brand colour, like the rest of the fleet */
.bottom-nav .nav-item.color-gold .nav-icon { color: var(--brass-deep); }
.bottom-nav .nav-item.color-navy .nav-icon { color: var(--hull-navy); }
.bottom-nav .nav-item.color-teal .nav-icon { color: var(--sea-teal-deep); }
.bottom-nav .nav-item.color-green .nav-icon { color: var(--sea-teal); }
.bottom-nav .nav-item.color-coral .nav-icon { color: var(--coral-deep); }

.bottom-nav .nav-item.active {
  color: var(--hull-navy);
  font-weight: 700;
}

.bottom-nav .nav-item.active .nav-icon {
  background: rgba(227, 168, 87, 0.18);
}

.bottom-nav .nav-item.active.color-gold .nav-icon { background: rgba(227, 168, 87, 0.22); }
.bottom-nav .nav-item.active.color-navy .nav-icon { background: rgba(15, 42, 67, 0.1); }
.bottom-nav .nav-item.active.color-teal .nav-icon { background: rgba(29, 158, 117, 0.16); }
.bottom-nav .nav-item.active.color-green .nav-icon { background: rgba(29, 158, 117, 0.16); }
.bottom-nav .nav-item.active.color-coral .nav-icon { background: rgba(226, 114, 91, 0.16); }

/* ===== Subject / template grid (used on later pages) ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.grid-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  box-shadow: var(--shadow-card);
  font-weight: 700;
  color: var(--hull-navy);
  text-align: center;
}

/* ===== Utility ===== */
.center-note {
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 30px;
}

/* ===== Back link in topbar ===== */
.back-link {
  font-size: 20px;
  line-height: 1;
  margin-right: 2px;
}

/* ===== Mission setup steps ===== */
.step .grid { margin-top: 4px; }
.grid-card {
  border: none;
  font-family: var(--font-body);
}

/* ===== Voyage / mission cards on dashboard (real data) ===== */
.voyage-card.link { display: block; position: relative; padding-right: 44px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill.docked { background: rgba(227, 168, 87, 0.18); color: var(--brass-deep); }
.status-pill.progress { background: rgba(29, 158, 117, 0.14); color: var(--sea-teal-deep); }

/* ===== Feedback log ===== */
.form-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 20px 20px 6px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.form-card select.field-input { appearance: none; }

.stats-card {
  background: var(--hull-navy);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 24px;
  color: var(--deck-cream);
}

.stats-card .stats-total {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.4px;
  color: var(--ink-on-navy);
  margin-bottom: 14px;
}

.stat-row { margin-bottom: 12px; }
.stat-row:last-child { margin-bottom: 0; }

.stat-row .stat-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}

.stat-row .stat-count { color: var(--brass); font-weight: 700; }

.stat-track {
  height: 8px;
  background: rgba(191, 208, 220, 0.18);
  border-radius: 6px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: var(--brass);
  border-radius: 6px;
}

.stat-fill.positive { background: var(--sea-teal); }

.feedback-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  position: relative;
}

.feedback-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  padding-right: 26px;
}

.feedback-card .feedback-work {
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.feedback-card .feedback-note {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

.feedback-card .feedback-date {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.feedback-delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--ink-faint);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Missions ===== */
.link-toggle-btn {
  background: none;
  border: none;
  color: var(--sea-teal-deep);
  font-weight: 700;
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.voyage-card.link.wide-action { padding-right: 90px; }

.card-action-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--deck-cream);
  color: var(--ink-soft);
}

.card-action-btn.add { background: rgba(29, 158, 117, 0.16); color: var(--sea-teal-deep); }
.card-action-btn.remove { background: rgba(226, 114, 91, 0.14); color: var(--coral-deep); }

.voyage-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--ink-faint);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.voyage-transfer-btn {
  position: absolute;
  top: 10px;
  right: 44px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--sea-teal-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.voyage-transfer-btn svg { width: 14px; height: 14px; }

/* ===== Paper Dock — template cards ===== */
.template-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
}

.template-card.recommended {
  border: 2px solid var(--brass);
  background: #FFF8EB;
}

.template-preview {
  width: 56px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--card-white);
  border: 1px solid var(--line);
  background-size: 100% 12px, 12px 100%;
}

.template-preview.small { width: 44px; height: 56px; }

.template-preview[data-layout="blank"] { background: #fff; }
.template-preview[data-layout="ruled"],
.template-preview[data-layout="wideRuled"],
.template-preview[data-layout="reading-response"] {
  background-image: repeating-linear-gradient(#fff 0 9px, var(--line) 9px 10px);
}
.template-preview[data-layout="graph"] {
  background-image: repeating-linear-gradient(#fff 0 7px, var(--line) 7px 8px),
                     repeating-linear-gradient(90deg, #fff 0 7px, var(--line) 7px 8px);
}
.template-preview[data-layout="dotGrid"] {
  background-image: radial-gradient(var(--ink-faint) 1px, transparent 1px);
  background-size: 8px 8px;
}
.template-preview[data-layout="isometric"] {
  background-image: repeating-linear-gradient(30deg, var(--line) 0 1px, transparent 1px 9px),
                     repeating-linear-gradient(-30deg, var(--line) 0 1px, transparent 1px 9px);
}
.template-preview[data-layout="fiveLine"] {
  background-image: repeating-linear-gradient(#fff 0 12px, var(--line) 12px 13px);
}
.template-preview[data-layout="musicStaff"] {
  background-image: repeating-linear-gradient(#fff 0 6px, var(--ink-faint) 6px 7px);
  background-position: center 20px;
  background-repeat: no-repeat;
  background-size: 100% 30px;
}
.template-preview[data-layout="chineseGrid"] {
  background-image: repeating-linear-gradient(#fff 0 13px, var(--line) 13px 14px),
                     repeating-linear-gradient(90deg, #fff 0 13px, var(--line) 13px 14px);
}
.template-preview[data-layout="cornell"],
.template-preview[data-layout="mathWorking"],
.template-preview[data-layout="experiment"],
.template-preview[data-layout="diagramLab"] {
  background-image: repeating-linear-gradient(#fff 0 14px, var(--line) 14px 15px);
}

.template-info { flex: 1; min-width: 0; }
.template-name { font-weight: 700; color: var(--hull-navy); font-size: 14px; }
.template-best-for { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.use-button {
  display: inline-block;
  margin-top: 8px;
  background: var(--brass);
  color: var(--hull-navy-deep);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
}

.category-block { margin-bottom: 18px; }
.category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* ===== Editor page ===== */
/* The editor fills the screen and never scrolls as a whole — only the page
   window inside it does. (Before, a zoomed page made the whole document
   taller than the screen, so up/down scrolling and left/right scrolling
   were handled by two different things and the edges were hard to reach.) */
.editor-body {
  padding-bottom: 0;
  position: fixed;
  inset: 0;
  min-height: 0;
  overflow: hidden;
}

.editor-header {
  background: var(--hull-navy);
  color: var(--deck-cream);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-header .mission-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.editor-header .mission-title::after {
  content: '\270E';
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.55;
  font-weight: 400;
}

.editor-header .mission-subject {
  font-size: 12px;
  color: #BFD0DC;
}

.editor-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: calc(100% - 122px);  /* the title always keeps a little room */
  overflow-x: auto;               /* on a narrow screen the buttons scroll sideways inside the header */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.editor-header .header-actions::-webkit-scrollbar { display: none; }
.editor-header .header-actions > * { flex-shrink: 0; }
.editor-header > div:first-child { flex: 1 1 0; min-width: 110px; }

.save-indicator {
  font-size: 11px;
  color: #BFD0DC;
  white-space: nowrap;
}

.header-btn {
  background: var(--brass);
  color: var(--hull-navy-deep);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

.header-btn.ghost {
  background: transparent;
  color: var(--deck-cream);
  border: 1px solid rgba(255,255,255,0.35);
}

/* The window onto the page: page on the left/top, bars on the right/bottom.
   The bars sit in their own strip, so they never cover the page itself. */
.editor-viewport {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #E7E2D6;
}

.editor-scroll {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;                 /* both directions, inside this box only */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #E7E2D6;
  scrollbar-width: none;          /* our own brass bars replace the native ones */
}
.editor-scroll::-webkit-scrollbar { display: none; }

/* The gutter around the page lives on this inner box (not on the scroll box),
   so it always counts as part of what can be scrolled — including the room at
   the bottom that lets the page's last corner slide out from under the
   I'm stuck button. When zoomed, JS gives it an exact width. */
.editor-scroll-inner {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 100%;
  padding: 18px 12px 84px;
}

/* ===== Brass scroll bars (shown when the page is bigger than the window) ===== */
.sb-track {
  display: none;
  position: relative;
  background: rgba(15, 42, 67, 0.09);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.editor-viewport.show-v .sb-v {
  display: block;
  grid-column: 2;
  grid-row: 1;
  width: 28px;
  border-left: 1px solid rgba(15, 42, 67, 0.12);
}
.editor-viewport.show-h .sb-h {
  display: block;
  grid-column: 1;
  grid-row: 2;
  height: 28px;
  border-top: 1px solid rgba(15, 42, 67, 0.12);
}
.sb-thumb {
  position: absolute;
  background: var(--brass);
  border: 2px solid var(--brass-deep);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 42, 67, 0.28);
}
.sb-v .sb-thumb { left: 3px; right: 3px; top: 0; }
.sb-h .sb-thumb { top: 3px; bottom: 3px; left: 0; }
.sb-thumb::after {              /* little grip lines */
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 14px;
  background: repeating-linear-gradient(to bottom, var(--brass-deep) 0 2px, transparent 2px 5px);
  opacity: 0.8;
}
.sb-h .sb-thumb::after {
  width: 14px;
  height: 8px;
  background: repeating-linear-gradient(to right, var(--brass-deep) 0 2px, transparent 2px 5px);
}
.sb-thumb.dragging { background: var(--brass-deep); }
.sb-track.sb-idle .sb-thumb { display: none; }   /* nothing to scroll that way */

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 700px;
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-card);
  border-radius: 10px;
  overflow: hidden;
  touch-action: none;
}

.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

#draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
}

/* ===== Toolbar (bottom, floating) ===== */
.editor-toolbar {
  flex: none;            /* sits under the page window (no longer floats over it) */
  position: relative;
  background: var(--card-white);
  border-top: 1px solid var(--line);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* Scroll-snap makes each button settle fully into view rather than
     stopping mid-scroll — a tap right after swiping to reveal a tool
     (e.g. Highlighter, which starts off-screen) is far more likely to
     land cleanly on the button instead of being read as a continued
     scroll gesture. */
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.tool-btn {
  background: var(--deck-cream);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--hull-navy);
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 54px;
}

.tool-btn .icon { font-size: 17px; }
.tool-btn.active { background: var(--hull-navy); color: var(--deck-cream); }
.tool-btn:disabled { opacity: 0.35; }

.color-swatches {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 0 4px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.swatch.active { border-color: var(--hull-navy); }

#text-input-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.floating-text-box {
  position: absolute;
  min-width: 120px;
  min-height: 28px;
  padding: 2px 4px;
  outline: 2px dashed var(--brass);
  background: rgba(255,255,255,0.85);
  font-family: var(--font-body);
  pointer-events: auto;
}

#image-file-input { display: none; }

/* ===== Focus bar (below header, above canvas) ===== */
.focus-bar {
  background: #163856;
  color: var(--deck-cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
}

.focus-bar .timer {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.focus-bar .focus-toggle {
  background: rgba(255,255,255,0.12);
  color: var(--deck-cream);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
}

.focus-bar .focus-toggle.on { background: var(--brass); color: var(--hull-navy-deep); }

/* ===== Page strip (multi-page voyages) ===== */
.page-strip {
  background: var(--deck-cream);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
}

.page-nav-btn {
  background: var(--card-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  font-weight: 700;
  color: var(--hull-navy);
  flex-shrink: 0;
}

.page-nav-btn:disabled { opacity: 0.3; }

.page-strip-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.page-strip-add {
  margin-left: auto;
  background: var(--brass);
  color: var(--hull-navy-deep);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.page-strip-remove {
  background: transparent;
  color: var(--coral-deep);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(168, 68, 47, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}

.page-strip-remove.hidden { display: none; }

/* ===== Tappable heading zone (overlays the printed header band) ===== */
.header-tap-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5.65%; /* HEADER_BAND_H (56px) of PAGE_HEIGHT (990px) */
  cursor: pointer;
  z-index: 5;
}

.header-tap-hint {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 12px;
  color: var(--ink-faint);
  opacity: 0.7;
}

/* ===== Full focus mode ===== */
body.focus-mode .editor-header .mission-subject,
body.focus-mode .editor-header .header-btn.ghost { display: none; }
body.focus-mode .tool-btn.hide-in-focus { display: none; }
body.focus-mode .page-strip.hide-in-focus,
body.focus-mode .header-tap-zone.hide-in-focus { display: none; }
body.focus-mode .editor-scroll,
body.focus-mode .editor-viewport { background: #DED8C8; }

/* ===== I'm Stuck floating button (always reachable) ===== */
.stuck-fab {
  position: fixed;
  right: 16px;
  bottom: 90px;
  background: var(--coral);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 12px 18px;
  border-radius: 30px;
  box-shadow: 0 4px 14px rgba(162, 68, 47, 0.4);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 40;
}

.stuck-fab .icon { font-size: 16px; }

/* keep the I'm stuck button off the scroll bars when they're showing */
body.has-sb-v .stuck-fab { right: 44px; }
body.has-sb-h .stuck-fab { bottom: 118px; }

/* ===== Overlay sheets / modals ===== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 67, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
}

.overlay-backdrop.centered { align-items: center; padding: 20px; }
.overlay-backdrop.hidden { display: none; }

.sheet {
  background: var(--deck-cream);
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  max-height: 82vh;
  overflow-y: auto;
}

.overlay-backdrop.centered .sheet {
  border-radius: var(--radius-lg);
  max-height: 88vh;
}

.sheet .sheet-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--hull-navy);
  margin-bottom: 4px;
}

.sheet .sheet-subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.sheet .close-x {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 18px;
  color: var(--ink-faint);
}

.overlay-backdrop > .sheet { position: relative; }

/* ---- I'm Stuck sheet ---- */
.stuck-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.stuck-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}

.stuck-step .step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sea-teal);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stuck-step .step-text { font-size: 14px; color: var(--ink); }

.example-box {
  background: #FFF8EB;
  border: 1px solid var(--brass);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13px;
  color: var(--hull-navy-deep);
  margin-bottom: 14px;
  display: none;
}

.example-box.visible { display: block; }

/* ---- Buttons used inside sheets ---- */
.sheet-btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  margin-bottom: 10px;
}

.sheet-btn.primary { background: var(--brass); color: var(--hull-navy-deep); }
.sheet-btn.secondary { background: var(--card-white); color: var(--hull-navy); box-shadow: var(--shadow-card); }
.sheet-btn.danger { background: var(--coral); color: #fff; }
.sheet-btn.ghost { background: transparent; color: var(--ink-soft); box-shadow: none; font-weight: 600; }
.sheet-btn:disabled { opacity: 0.4; }

.header-btn.danger-ghost {
  background: transparent;
  color: #E8B4A8;
  border: 1px solid rgba(226, 114, 91, 0.5);
  padding: 7px 10px;
}

/* ---- Mistake modal ---- */
.category-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.category-chip {
  background: var(--card-white);
  box-shadow: var(--shadow-card);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.category-chip.active { background: var(--hull-navy); color: var(--deck-cream); }

.sheet textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 16px;
  background: var(--card-white);
}

/* ---- Ship-to-Shore Transfer ---- */
.transfer-source-card .sheet-btn { margin-top: 10px; margin-bottom: 0; }

.transfer-code {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
  color: var(--hull-navy);
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 22px 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.center-note.warn { color: var(--coral-deep); font-weight: 700; }

/* ---- Page info sheet (Subject / Name / No. / Date) ---- */
.field-row { margin-bottom: 14px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--card-white);
}

.field-input:focus { outline: 2px solid var(--sea-teal); outline-offset: 1px; }

/* ---- Maths stamps sheet ---- */
.stamp-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }

.stamp-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card-white);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: 14px;
}

.stamp-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--deck-cream);
  color: var(--hull-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.stamp-option-text { display: flex; flex-direction: column; gap: 2px; }
.stamp-option-label { font-weight: 700; font-size: 14px; color: var(--hull-navy); }
.stamp-option-hint { font-size: 12px; color: var(--ink-soft); }

.stamp-group-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 14px 2px 6px;
}
.stamp-group-label:first-child { margin-top: 2px; }

/* ---- Shape size pills (Small / Medium / Large) ---- */
.size-pill-row { display: flex; gap: 8px; margin-bottom: 4px; }
.size-pill {
  flex: 1;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--card-white);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
}
.size-pill.active { border-color: var(--sea-teal); color: var(--hull-navy); background: var(--deck-cream); }

#zoom-pill-row .size-pill { padding: 10px 2px; font-size: 12px; }

/* ---- Mind map branch picker: 4 big picture tiles ---- */
.branch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
.branch-tile {
  background: var(--card-white);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 10px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--hull-navy);
  font-weight: 700;
  font-size: 14px;
}
.branch-tile canvas { width: 100%; max-width: 168px; height: auto; display: block; }
.branch-tile:active { background: var(--deck-cream); border-color: var(--sea-teal); }
.branch-tile .branch-hint {
  margin-top: -4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.branch-tile .branch-hint.good-start { color: var(--sea-teal-deep); }

/* the same picker, as a compact row inside the Slide Deck draw sheet */
.draw-branch-picker { margin-top: 12px; }
.draw-branch-picker.hidden { display: none; }
.draw-branch-picker .stamp-group-label { margin-top: 0; }
.draw-branch-picker .branch-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 0; }
.draw-branch-picker .branch-tile { padding: 6px 4px 8px; gap: 4px; font-size: 13px; }

/* ---- Table rows/cols stepper ---- */
.stepper-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 2px;
}
.stepper-row .field-label { flex: 1; margin: 0; }
.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card-white);
  color: var(--hull-navy);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.stepper-btn:active { background: var(--deck-cream); }
.stepper-value {
  min-width: 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--hull-navy);
}

/* ---- Floating text box formatting toolbar ---- */
.text-format-toolbar {
  position: absolute;
  display: flex;
  gap: 4px;
  background: var(--hull-navy);
  border-radius: 8px;
  padding: 4px;
  pointer-events: auto;
  z-index: 5;
}
.format-btn {
  width: 28px;
  height: 26px;
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
}
.format-btn.active { background: var(--sea-teal); }

.image-position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.image-position-btn {
  background: var(--card-white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hull-navy);
  text-align: center;
}

.image-position-btn:active { background: var(--brass); color: var(--hull-navy-deep); }

/* ---- Mission check sheet ---- */
.check-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-card);
}

.check-item input { width: 20px; height: 20px; accent-color: var(--sea-teal); flex-shrink: 0; }
.check-item label { font-size: 14px; color: var(--ink); }

.check-status {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.check-status.ready { color: var(--sea-teal-deep); font-weight: 700; }

/* ---- Mission complete screen ---- */
.complete-screen {
  position: fixed;
  inset: 0;
  background: var(--hull-navy);
  color: var(--deck-cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
  text-align: center;
  z-index: 80;
}

.complete-screen.hidden { display: none; }

.complete-screen .badge {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 6px;
}

.complete-screen .title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
}

.complete-screen .xp {
  color: var(--brass);
  font-weight: 700;
  font-size: 15px;
}

.complete-screen .xp-bonus {
  margin-top: 8px;
  color: var(--ink-on-navy);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.6;
}
.complete-screen .xp-bonus[hidden] { display: none; }

.complete-screen .actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  width: 100%;
  max-width: 360px;
}

.complete-screen .actions .header-btn { flex: 1; text-align: center; padding: 12px; }

.complete-screen .make-presentation-btn {
  margin-top: 14px;
  width: 100%;
  text-align: center;
  padding: 12px;
  white-space: normal;
}

/* ===== Presentation Dock (Phase 4A) ===== */

/* Secondary CTA on Captain's Deck — same shape as start-button, quieter
   color so "Start homework" stays the obvious first choice. */
.start-button.secondary {
  background: var(--card-white);
  color: var(--hull-navy);
  box-shadow: var(--shadow-card);
  margin-top: -10px;
}

.start-button.secondary .label .small { color: var(--ink-soft); opacity: 1; }

.start-button .ring.teal { background: var(--sea-teal); color: #fff; }

/* Template picker cards on presentation-setup.html — reuses .template-card
   spacing but drops the paper-preview swatch in favor of a slot-title list. */
.presentation-template-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card-white);
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
  font-family: var(--font-body);
}

.slot-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.slot-chip {
  background: var(--deck-cream);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 20px;
}

/* Storyboard slide-slot cards on storyboard.html */
.slide-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
}

.slide-slot-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hull-navy);
  color: var(--deck-cream);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-slot-title {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  color: var(--hull-navy);
  padding: 4px 0;
}

.slide-slot-title:focus { outline: none; border-bottom: 2px solid var(--sea-teal); }

.center-note.ready { color: var(--sea-teal-deep); font-weight: 700; }

/* ===== Upload a Worksheet (Paper Dock) ===== */

.upload-worksheet-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  margin: 14px 0 22px;
}

.upload-worksheet-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--hull-navy);
  margin-bottom: 4px;
}

.upload-worksheet-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.upload-worksheet-card .sheet-btn { margin-bottom: 8px; }
.upload-worksheet-card .sheet-btn:last-of-type { margin-bottom: 0; }
.upload-worksheet-card .center-note { margin-top: 10px; margin-bottom: 0; }

.board-review-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  margin: -8px 0 22px;
  border: 2px dashed var(--brass);
}

.board-review-textarea {
  width: 100%;
  min-height: 140px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--hull-navy);
  margin-bottom: 12px;
  resize: vertical;
}

.board-review-actions .sheet-btn { margin-bottom: 8px; }
.board-review-actions .sheet-btn:last-child { margin-bottom: 0; }

/* ===== Slide Deck editor (Phase 4B) ===== */

/* Extra link on each storyboard row, opens that slide in the deck */
.slide-slot-open {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--hull-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Slide strip — numbered chips, current slide highlighted */
.slide-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin-bottom: 4px;
}

.slide-chip {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card-white);
  box-shadow: var(--shadow-card);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
}

.slide-chip.active {
  background: var(--hull-navy);
  color: var(--deck-cream);
}

.slide-editor-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 16px;
}

.guardrail-note {
  font-size: 12px;
  color: var(--brass-deep);
  background: #FFF8EB;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 8px;
}

.add-bullet-btn {
  background: transparent;
  color: var(--sea-teal-deep);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 2px;
}

.bullet-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.bullet-row .field-input { margin-bottom: 0; }

.bullet-icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--ink-soft);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-btn {
  width: 100%;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--deck-cream);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
}

.image-btn-row { display: flex; gap: 8px; }
.image-btn-row .upload-btn,
.image-btn-row .sheet-btn { flex: 1; width: auto; margin-bottom: 0; }

.image-preview-wrap { text-align: center; }

.image-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  margin-bottom: 10px;
}

.deck-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.deck-nav-btn {
  flex: 1;
  background: var(--card-white);
  color: var(--hull-navy);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-md);
  padding: 12px;
  font-weight: 700;
  font-size: 13px;
}

.deck-nav-btn:disabled { opacity: 0.35; }

.deck-actions { margin-bottom: 20px; }

/* ===== Bridge Cards (Phase 4C) ===== */

.level-toggle {
  display: flex;
  background: var(--card-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 4px;
  margin-bottom: 16px;
}

.level-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
}

.level-btn.active {
  background: var(--hull-navy);
  color: var(--deck-cream);
}

.bridge-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
  min-height: 160px;
  margin-bottom: 14px;
}

.bridge-card-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.bridge-card-text {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.5;
  color: var(--hull-navy);
}

.use-for-all-btn {
  width: 100%;
  background: transparent;
  color: var(--sea-teal-deep);
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  margin-bottom: 18px;
}

.use-for-all-btn.confirmed { color: var(--sea-teal-deep); font-weight: 800; }

/* ===== Practice Voyage (Phase 4D) ===== */

.mode-toggle {
  display: flex;
  background: var(--card-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 4px;
  margin-bottom: 14px;
}

.mode-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
}

.mode-btn.active { background: var(--hull-navy); color: var(--deck-cream); }

.timer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.timer-display {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--hull-navy);
  flex: 1;
}

.timer-btn {
  background: var(--sea-teal);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
}

.timer-btn.ghost { background: var(--deck-cream); color: var(--ink-soft); }

.voyage-slide-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 20px;
  min-height: 180px;
  margin-bottom: 16px;
}

.voyage-slide-title {
  font-family: var(--font-display);
  font-size: 21px;
  color: var(--hull-navy);
  margin-bottom: 14px;
}

.voyage-slide-title.small { font-size: 16px; margin-bottom: 12px; }

.voyage-slide-image {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.voyage-bullet-list { padding-left: 20px; color: var(--ink); }
.voyage-bullet-list li { margin-bottom: 8px; font-size: 15px; }

.voyage-empty-note { color: var(--ink-soft); font-size: 13px; font-style: italic; }

.voyage-card-text {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  color: var(--hull-navy);
}

.practice-complete-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 16px;
}

.practice-complete-card .big-icon { font-size: 40px; margin-bottom: 8px; }
.practice-complete-card h2 { font-family: var(--font-display); color: var(--hull-navy); margin-bottom: 6px; }
.practice-complete-card p { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }

/* ===== Question Radar (Phase 4E) ===== */

.radar-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.radar-question {
  background: var(--deck-cream);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--hull-navy);
}

/* ===== Draw / diagram sheet (Phase 4F-add) ===== */

.sheet.draw-sheet { max-width: 560px; }

.draw-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  /* Pinned to the top of the sheet's own scroll area, so Eraser/Undo/
     Text can never end up scrolled out of view above the fold — the
     canvas and buttons can scroll away from the toolbar, but never
     the other way around. */
  position: sticky;
  top: -22px;
  padding-top: 22px;
  margin-top: -22px;
  background: var(--deck-cream);
  z-index: 5;
}

.draw-tool-btn,
.draw-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--deck-cream);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.draw-tool-btn.active { background: var(--hull-navy); color: var(--deck-cream); }
.draw-icon-btn:disabled { opacity: 0.35; }
.draw-icon-btn.active { background: var(--sea-teal); color: #fff; }

.draw-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.draw-color-btn.active { border-color: var(--hull-navy); }

.draw-canvas-wrap {
  position: relative;
  margin: 0 auto 12px;
}

.draw-canvas {
  width: 100%;
  max-height: 32vh;
  height: auto;
  display: block;
  background: repeating-conic-gradient(#F2EEE3 0% 25%, #FBF6EC 0% 50%) 0 0 / 20px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  touch-action: none;
}

.draw-canvas.expanded { max-height: 62vh; }

.draw-insert-row { display: flex; gap: 8px; margin-bottom: 14px; }
.draw-insert-row .sheet-btn.small { flex: 1; width: auto; padding: 10px; font-size: 12px; margin-bottom: 0; }

/* Keeps "Use this picture" reachable without hunting for it — it stays
   pinned to the bottom of the (scrollable) sheet no matter how tall the
   canvas or toolbar above it gets, since missing this button meant a
   finished drawing had no way to actually land on the slide. */
.draw-sheet-footer {
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--deck-cream);
  border-top: 1px solid var(--line);
}
.draw-sheet-footer .sheet-btn { margin-bottom: 8px; }
.draw-sheet-footer .sheet-btn:last-child { margin-bottom: 0; }

/* ===== Vlog Kit (Phase K1) ===== */

.vlog-title-card {
  background: var(--hull-navy);
  color: var(--deck-cream);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 22px 20px;
  margin-bottom: 18px;
  text-align: center;
}

.vlog-title-card-kicker {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--sea-teal);
  margin-bottom: 10px;
}

.vlog-title-card-topic {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 14px;
}

.vlog-title-card-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 12px;
}

.vlog-title-card-field {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.vlog-title-card-field .field-tag {
  color: var(--sea-teal);
  font-weight: 700;
  min-width: 84px;
}

.vlog-title-card-field .field-value {
  color: var(--deck-cream);
}

.write-nav-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.write-nav-row .sheet-btn {
  flex: 1;
  margin-bottom: 0;
}

.live-view-card {
  min-height: 34vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.live-view-card .voyage-slide-body {
  font-size: 20px;
  line-height: 1.5;
}

.live-next-btn {
  width: 100%;
  background: var(--sea-teal);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  padding: 22px;
  border-radius: var(--radius-md);
  margin-top: 14px;
  box-shadow: var(--shadow-card);
}

.live-next-btn:disabled {
  background: var(--line);
  color: var(--ink-faint);
}

.live-prev-btn {
  width: 100%;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14px;
  padding: 10px;
  margin-top: 8px;
}

.live-prev-btn:disabled {
  color: var(--ink-faint);
  visibility: hidden;
}
