/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: var(--ink);
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: var(--brand-soft);
  text-shadow: none;
}

::selection {
  background: var(--brand-soft);
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Design tokens now live in css/tokens.css, loaded before this file. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}

/* Al-Nokhba: Arabic interface text uses the brand's Arabic face and is never
   letter-spaced or uppercased. (Printed-document previews render in their
   own frames with their own fonts.) */
[dir="rtl"],
[lang="ar"] {
  font-family: var(--font-arabic);
}

:is([dir="rtl"], [lang="ar"]),
:is([dir="rtl"], [lang="ar"]) * {
  letter-spacing: normal !important;
  text-transform: none !important;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 65px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--accent);
}

.brand-logo-triangle {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--accent-ink);
}

/* The Alnokhba Hub mark (img/brand/alnokhba-hub-mark.svg, referenced — not inlined, so it can never drift from
   the real artwork): 26px tall; the button's 10px gap keeps the clear space (≥ 0.25 × its height). */
.brand-mark {
  display: flex;
  align-items: center;
}

.brand-mark img {
  display: block;
  width: auto;
  height: 26px;
}

.brand-text {
  color: var(--text);
}

/* Header menu bar: Files / Tools, each a button that opens a dropdown. */

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.menu-caret {
  color: var(--muted);
  font-size: 10px;
}

.menu-trigger-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-inline-start: 6px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.topbar-page-label {
  color: var(--muted);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saves-to-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 12px;
}

.saves-to-chip .mono {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
}

.rec-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.rec-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.rec-timer {
  display: none;
  color: var(--text);
  font-weight: 600;
}

.rec-status[data-state="recording"],
.rec-status[data-state="paused"] {
  border-color: var(--danger-border);
  background: var(--danger-soft-bg);
  color: var(--text);
}

.rec-status[data-state="recording"] .rec-timer,
.rec-status[data-state="paused"] .rec-timer {
  display: inline;
}

.rec-status[data-state="recording"] .rec-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent);
  animation: pulse 1.2s ease-in-out infinite;
}

.rec-status[data-state="paused"] .rec-status-dot {
  background: var(--meter-warn);
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

/* Home page */

.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  min-height: calc(100vh - 65px);
  padding: 40px 24px;
}

.home-title {
  margin: 0;
  color: var(--text);
  font-size: 40px;
  font-weight: 700;
  text-align: center;
}

.home-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.home-sub {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1320px;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.home-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.home-card h2 {
  margin: 4px 0 10px;
  font-size: 18px;
}

.home-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.home-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 50%;
}

.home-card-icon-record {
  background: var(--danger);
}

.home-card-icon-record::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-inverse);
}

.home-card-icon-edit {
  background: var(--info);
}

.home-card-icon-edit::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 16px solid var(--ink-inverse);
}

.home-card-pill {
  margin-top: 20px;
  padding: 8px 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.home-card-pill-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.home-card-icon-scorm {
  border-radius: var(--radius-lg);
  background: var(--purple);
  color: var(--on-brand);
}

.home-card-icon-pdf {
  border-radius: var(--radius-lg);
  background: var(--danger-soft);
  color: var(--danger);
}

.home-card-icon-pdf svg {
  width: 28px;
  height: 28px;
}

.home-card-icon-scorm svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 1080px) {
  .home-cards {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    width: 100%;
  }
}

@media (max-width: 640px) {
  .home-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

.no-tools-note {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ==========================================================================
   Video Editor
   ========================================================================== */

.app-panel-editor {
  height: calc(100vh - 65px);
  padding: 16px 20px;
  --ed-overlay: #a855f7;
  --ed-video: #4f8cff;
  --ed-audio: #2fb463;
}

.editor-layout {
  display: flex;
  gap: 14px;
  height: 100%;
}

.editor-bin,
.editor-inspector {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  width: 240px;
  padding: 14px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.editor-inspector {
  /* Wider than the bin: the Clip tools icon row needs 5×44px + gaps. */
  width: 320px;
}

.editor-bin h2,
.editor-inspector h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-bin-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-bin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.editor-bin-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-4);
  cursor: grab;
}

.editor-bin-item:active {
  cursor: grabbing;
}

.editor-bin-thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
}

.editor-bin-thumb img,
.editor-bin-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.editor-bin-thumb-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-1);
  color: var(--muted);
  font-size: 18px;
}

.editor-bin-info {
  flex: 1;
  min-width: 0;
}

.editor-bin-name {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-bin-meta {
  color: var(--muted);
  font-size: 11px;
}

.editor-bin-add {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.editor-bin-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.editor-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.editor-preview-wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.editor-preview {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.editor-preview canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

.editor-preview-overlay {
  position: absolute;
  overflow: hidden;
  pointer-events: none;
}

.editor-preview-overlay.drawing {
  pointer-events: auto;
  cursor: crosshair;
}

.editor-overlay-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed var(--accent);
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}

.editor-preview-overlay.mode-crop .editor-overlay-box {
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.editor-preview-overlay.drawing .editor-overlay-box {
  pointer-events: none;
}

.editor-overlay-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: #fff;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
}

/* Bigger invisible hit area than the visible handle. */
.editor-overlay-handle::after {
  content: "";
  position: absolute;
  inset: -12px;
}

.editor-preview-empty {
  position: absolute;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.editor-transport {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
}

.editor-play-btn {
  width: 40px;
  height: 40px;
}

.editor-play-btn .icon-play {
  border-top-width: 8px;
  border-bottom-width: 8px;
  border-left-width: 13px;
}

.editor-play-btn .icon-pause span {
  width: 5px;
  height: 16px;
}

.editor-time {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.editor-spacer {
  flex: 1;
}

.editor-toolbar {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.editor-toolbar-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
}

.editor-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.editor-zoom input {
  width: 110px;
}

.editor-timeline {
  display: flex;
  flex-shrink: 0;
  max-height: min(320px, 38vh);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.editor-timeline-labels {
  flex-shrink: 0;
  width: 120px;
  border-right: 1px solid var(--border);
}

.editor-timeline-scroll {
  position: relative;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}

.editor-ruler-spacer,
.editor-ruler {
  height: 26px;
  border-bottom: 1px solid var(--border);
}

.editor-ruler {
  position: relative;
}

.editor-ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
}

.editor-ruler-tick span {
  position: absolute;
  top: 4px;
  left: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.editor-track-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.editor-track-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ed-overlay);
}

.editor-track-label-video .editor-track-dot {
  background: var(--ed-video);
}

.editor-track-label-audio .editor-track-dot {
  background: var(--ed-audio);
}

.editor-track-lane {
  position: relative;
  border-bottom: 1px solid var(--border);
}

.editor-track-lane-overlay {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.07), rgba(168, 85, 247, 0.02));
}

.editor-track-lane-video {
  background: rgba(79, 140, 255, 0.04);
}

.editor-track-lane-audio {
  background: linear-gradient(90deg, rgba(47, 180, 99, 0.08), rgba(47, 180, 99, 0.02));
}

.editor-clip {
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: var(--surface-4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

.editor-clip:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.editor-clip:active {
  cursor: grabbing;
}

.editor-clip.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-border), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.editor-clip-video {
  background: linear-gradient(180deg, #3f5f91, #2a3f63);
}

.editor-clip-audio {
  background: linear-gradient(180deg, #359962, #1f5c38);
}

.editor-clip-text {
  background: linear-gradient(180deg, #9657c9, #6b3a96);
}

.editor-clip-logo {
  background: linear-gradient(180deg, #c9803c, #8a5323);
}

.editor-clip-label {
  display: block;
  overflow: hidden;
  padding: 6px 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.editor-clip-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: ew-resize;
}

.editor-clip-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 18px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 2px;
  transform: translate(-50%, -50%);
}

.editor-clip-handle-left {
  left: 0;
}

.editor-clip-handle-right {
  right: 0;
}

.editor-clip-transition {
  position: absolute;
  top: 50%;
  right: 2px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid var(--surface-1);
  border-radius: 50%;
  background: var(--surface-4);
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.editor-clip-transition.is-set {
  background: var(--accent);
  color: var(--accent-ink);
}

.editor-clip-transition:hover {
  color: var(--text);
}

.editor-clip-transition.is-set:hover {
  background: var(--brand-hover);
}

.editor-clip-transition:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.editor-clip-transition svg {
  width: 12px;
  height: 12px;
}

.editor-popover {
  position: fixed;
  z-index: 30;
  width: 300px;
  max-height: calc(100vh - 16px);
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-popover);
}

.editor-popover .editor-card-title {
  margin-bottom: 10px;
}

.editor-anim-override {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
  background: var(--accent-soft-bg);
  color: var(--warning);
}

.editor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 4;
  width: 2px;
  background: var(--danger);
  pointer-events: none;
}

.editor-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.editor-inspector-row {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-1);
}

.editor-inspector-row:first-child {
  margin-top: 0;
}

.editor-inspector-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.editor-inspector-row input[type="text"],
.editor-inspector-row input[type="number"],
.editor-inspector-row textarea,
.editor-inspector-row select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-4);
  color: var(--text);
  font: inherit;
}

.editor-number-input {
  width: 80px !important;
  font-family: var(--font-mono);
  text-align: end;
}

.editor-inspector-row input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-4);
  cursor: pointer;
}

.editor-inspector-row textarea {
  resize: vertical;
  min-height: 56px;
}

.editor-inspector-row input[type="range"] {
  width: 100%;
}

.editor-inspector-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.editor-inspector-row-inline label {
  margin: 0;
}

.editor-inspector-row-inline .val {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Clip tools — header/crossfade/clip-tools cards, icon row, accordion */

.editor-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.editor-card:first-child {
  margin-top: 0;
}

.editor-card-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.editor-clip-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-clip-header-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 50%;
}

.editor-clip-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.editor-clip-header-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-clip-header-meta {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
}

.editor-clip-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.editor-clip-actions .editor-btn {
  flex: 1;
  justify-content: center;
}

.editor-tools-tabs {
  margin-bottom: 12px;
}

.editor-tool-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.editor-tool-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  color: var(--text);
  cursor: pointer;
}

.editor-tool-icon-btn:hover {
  border-color: var(--border-strong);
}

.editor-tool-icon-btn[aria-pressed="true"],
.editor-tool-icon-btn[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
  color: var(--accent);
}

.editor-tool-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.editor-tool-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
}

.editor-tools-panel {
  margin-top: 4px;
}

.editor-accordion {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-accordion-row {
  border-bottom: 1px solid var(--border);
}

.editor-accordion-row:last-child {
  border-bottom: 0;
}

.editor-accordion-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 0;
  border-inline-start: 2px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: start;
  font: inherit;
  font-size: 13px;
}

.editor-accordion-row-head:hover {
  background: var(--raised);
}

.editor-accordion-row[data-open="true"] .editor-accordion-row-head {
  border-inline-start-color: var(--accent);
  background: var(--accent-soft-bg);
}

.editor-accordion-row-icon {
  display: flex;
  flex-shrink: 0;
  color: var(--muted);
}

.editor-accordion-row-label {
  flex: 1 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-accordion-row-value {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-align: end;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-accordion-row-chevron {
  display: flex;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.editor-accordion-row[data-open="true"] .editor-accordion-row-chevron {
  transform: rotate(180deg);
}

.editor-accordion-row-body {
  padding: 12px;
  background: var(--surface-1);
}

.editor-audio-details {
  margin: 6px 0 4px 50px;
}

.editor-mode-segmented {
  margin: 10px 0;
}

@media (max-width: 1100px) {
  .editor-bin,
  .editor-inspector {
    width: 190px;
  }
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* Stage */

.stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #000;
  aspect-ratio: 16 / 9;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(10, 12, 16, 0.78);
  text-align: center;
}

.stage-overlay p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Recording controls — an icon-only stack on the left edge of the stage.
   Only Start shows while idle; Pause and Stop take over once recording. */

.stage-controls {
  position: absolute;
  top: 50%;
  inset-inline-start: 20px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(-50%);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  transform: scale(1.06);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-btn-record {
  background: var(--danger);
}

.icon-btn-record:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 85%, var(--ink));
}

.icon-btn-secondary {
  background: rgba(23, 23, 26, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.14);
}

.icon-btn-secondary:hover:not(:disabled) {
  background: rgba(38, 43, 54, 0.95);
}

.icon-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
}

.icon-square {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: #fff;
}

.icon-pause {
  display: flex;
  gap: 7px;
}

.icon-pause span {
  width: 8px;
  height: 26px;
  border-radius: 2px;
  background: #fff;
}

.icon-play {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid #fff;
}

@media (max-width: 700px) {
  .stage-controls {
    inset-inline-start: 12px;
    gap: 12px;
  }

  .icon-btn {
    width: 52px;
    height: 52px;
  }
}

/* Hint */

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Sound — sits under the video stage, full stage width, its panels laid
   out in a responsive grid rather than the single narrow column the
   sidebar tabs use. */

.sound-section {
  margin-top: 28px;
}

.sound-section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
}

.sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
  gap: 14px;
}

select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}


/* Side panels */

.panel-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.panel h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.row > label,
.row > .label {
  flex-shrink: 0;
  color: var(--muted);
}

.row select,
.row input[type="range"] {
  flex: 1;
  min-width: 0;
}

select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-4);
}

input[type="range"] {
  accent-color: var(--accent);
}


.note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.note:empty {
  display: none;
}

/* Corner picker */

.corner-picker {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-4);
}

.corner-picker button {
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.corner-picker button[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent);
}

/* Background picker */

.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bg-item {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface-4) center / cover no-repeat;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.bg-item[aria-checked="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-border);
}

.bg-item .bg-label {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2px 4px;
  overflow: hidden;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 11px;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bg-blur {
  background-image: radial-gradient(circle at 30% 40%, #5a6478, #23262f 70%);
  color: #fff;
}

/* Result dialog */

.modal {
  width: min(720px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-1);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.modal-body {
  padding: 20px;
}

.modal h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.modal video {
  display: block;
  width: 100%;
  max-height: 55vh;
  border-radius: 10px;
  background: #000;
}

.result-info {
  margin: 12px 0 0;
  color: var(--muted);
}

.result-msg {
  margin: 8px 0 0;
}

.result-msg:empty {
  display: none;
}

.result-msg.success {
  color: var(--success);
}

.result-msg.error {
  color: var(--danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* About dialog: the lockup (EN/AR swap by page language, like .home-endorsed-*), version, licence note, Guide link. */

.modal-about {
  width: min(380px, calc(100vw - 32px));
  text-align: center;
}

.about-lockup {
  display: block;
  height: 56px;
  width: auto;
  margin: 4px auto 14px;
}

.about-lockup-ar {
  display: none;
}

html:lang(ar) .about-lockup-en {
  display: none;
}

html:lang(ar) .about-lockup-ar {
  display: block;
}

.about-byline {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.about-byline-ar {
  display: none;
}

html:lang(ar) .about-byline-en {
  display: none;
}

html:lang(ar) .about-byline-ar {
  display: inline;
}

.about-version {
  margin: 0 0 14px;
  font-weight: 600;
}

.about-licence {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-about .modal-actions {
  justify-content: center;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-4);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
}

.toast.error {
  border-color: var(--danger);
}

/* Audio mixer */

.val {
  display: inline-block;
  min-width: 54px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.meter {
  display: inline-block;
  width: 56px;
  height: 7px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-4);
  vertical-align: middle;
}

.meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--success));
  transition: width 0.1s linear;
}

.channel-strip .channel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.channel-strip .channel-head strong {
  flex: 1;
  font-size: 13px;
}

.channel-strip details {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.channel-strip summary {
  margin: -2px 0 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.channel-strip summary::marker {
  color: var(--accent);
}

/* Files panel */

.file-active-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-4);
}

.file-active-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-active-label {
  flex: 1;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-page-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-page-row input[type="range"] {
  flex: 1;
}

#filePageCount {
  min-width: 48px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.file-item-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-4);
  color: inherit;
  cursor: pointer;
  text-align: start;
}

.file-item-main:disabled {
  cursor: default;
  opacity: 0.6;
}

.file-item.active .file-item-main {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.file-badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.file-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.file-item-name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-status {
  color: var(--muted);
  font-size: 11px;
}

.file-item-status.error {
  color: var(--danger);
}

.file-item-remove {
  flex-shrink: 0;
  width: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-4);
  color: var(--muted);
  cursor: pointer;
}

.file-item-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}


/* ==========================================================================
   SCORM Builder
   ========================================================================== */

.menu-item-icon {
  gap: 8px;
}

.menu-icon {
  display: inline-flex;
}

.menu-icon-scorm {
  color: var(--purple);
}

.menu-icon-pdf {
  color: var(--danger);
}

.menu-icon-about {
  color: var(--muted);
}

/* ==========================================================================
   SCORM Builder (js/scorm/). Same tokens and components as the rest of the
   app; purple is the section's accent, amber stays the action colour.
   ========================================================================== */

.scorm-page {
  padding: 20px 24px 32px;
}

.scorm-page [hidden] {
  display: none !important;
}

.scorm-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.scorm-side {
  display: flex;
  flex: 1 1 250px;
  flex-direction: column;
  gap: 16px;
  max-width: 300px;
}

.scorm-main {
  display: flex;
  flex: 999 1 600px;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

@media (max-width: 900px) {
  .scorm-page {
    padding: 16px;
  }

  .scorm-side {
    max-width: none;
  }

  .scorm-sum-thumb {
    max-width: 240px;
  }
}

/* Cards */

.scorm-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.scorm-card > * {
  margin-top: 0;
  margin-bottom: 0;
}

.scorm-card > * + * {
  margin-top: 14px;
}

.scorm-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scorm-card-title {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.scorm-card-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scorm-subcard {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-subcard-col {
  flex-direction: column;
  align-items: stretch;
}

.scorm-subcard-text {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 2px;
}

.scorm-subcard-title {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.scorm-subcard p {
  margin: 0;
}

/* Two-column step bodies */

.scorm-cols {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.scorm-col-main,
.scorm-col-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.scorm-col-main {
  flex: 999 1 460px;
}

.scorm-col-side {
  flex: 1 1 300px;
  max-width: 400px;
}

.scorm-cols-left .scorm-col-side {
  max-width: 340px;
}

.scorm-cols-sim .scorm-col-side {
  flex-basis: 340px;
  max-width: 460px;
}

@media (max-width: 900px) {
  .scorm-col-side,
  .scorm-cols-left .scorm-col-side,
  .scorm-cols-sim .scorm-col-side {
    max-width: none;
  }
}

/* Generic text bits */

.scorm-hint {
  color: var(--muted);
  font-size: 12px;
}

p.scorm-hint {
  margin: 0;
}

.scorm-hint svg {
  flex-shrink: 0;
}

.scorm-label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.scorm-mono {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
}

.scorm-mono-muted {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.scorm-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
  background: var(--accent-soft-bg);
  color: var(--warning);
  font-size: 13px;
}

.scorm-warn svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.scorm-empty {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.scorm-badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--purple-soft-border);
  border-radius: 4px;
  background: var(--purple-soft-bg);
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.scorm-rec-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.scorm-ico-editor {
  display: inline-flex;
  color: var(--ed-video-dot);
}

/* Buttons, inputs and controls (on top of components.css) */

.scorm-page .btn svg {
  flex-shrink: 0;
}

.scorm-page .btn-sm,
.scorm-page .btn-small-inline {
  gap: 6px;
  padding: 6px 11px;
  font-size: 12px;
}

.scorm-page .btn-small-inline {
  align-self: flex-start;
}

.scorm-next svg {
  margin-right: -2px;
}

.scorm-btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.scorm-btn-row-end {
  justify-content: flex-end;
}

.scorm-link-btn {
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}

.scorm-link-btn:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.scorm-icon-btn,
.scorm-grip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.scorm-grip {
  width: 24px;
  cursor: grab;
}

.scorm-icon-btn:hover {
  background: var(--danger-soft-bg);
  color: var(--danger-text);
}

.scorm-icon-sm {
  width: 30px;
  height: 30px;
}

.scorm-page :is(.scorm-icon-btn, .scorm-grip, .scorm-link-btn, .scorm-dashed-btn, .scorm-choice, .scorm-lesson-title, .scorm-tab, .scorm-qitem, .scorm-marker, .scorm-rail-step):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scorm-page input[type="text"],
.scorm-page input[type="url"],
.scorm-page input[type="number"],
.scorm-page select,
.scorm-page textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.scorm-page textarea {
  resize: vertical;
}

.scorm-page input:disabled,
.scorm-page select:disabled {
  opacity: 0.5;
}

.scorm-page :is(input[type="text"], input[type="url"], input[type="number"], select, textarea):focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.scorm-page input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.scorm-mono-input {
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
}

.scorm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.scorm-field > label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.scorm-hint-inline {
  color: var(--muted);
  font-weight: 400;
}

.scorm-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.scorm-field-row-wide {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

@media (max-width: 640px) {
  .scorm-field-row,
  .scorm-field-row-wide {
    grid-template-columns: minmax(0, 1fr);
  }
}

.scorm-seg {
  display: inline-grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  grid-template-columns: none;
  max-width: 100%;
}

.scorm-seg button {
  min-height: 34px;
  padding: 7px 12px;
  line-height: 1.25;
}

.scorm-seg.is-disabled {
  opacity: 0.5;
}

.scorm-seg button:disabled {
  cursor: not-allowed;
}

.scorm-seg-sm button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.scorm-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}

.scorm-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.scorm-switch-row {
  justify-content: space-between;
  gap: 16px;
  margin-top: 0 !important;
  padding: 12px 0;
}

.scorm-switch-row + .scorm-switch-row {
  border-top: 1px solid var(--border);
}

.scorm-switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scorm-switch-title {
  color: var(--text);
  font-size: 14px;
}

.scorm-switch-desc {
  color: var(--muted);
  font-size: 12px;
}

.scorm-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  color: var(--text-2);
  font-size: 13px;
}

.scorm-inline-form select {
  width: auto;
}

.scorm-slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scorm-slider-row.is-disabled {
  opacity: 0.45;
}

.scorm-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

/* Step rail */

.scorm-rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.scorm-rail-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scorm-rail-step:hover {
  background: var(--surface-3);
}

.scorm-rail-step.is-current {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.scorm-rail-dot {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.scorm-rail-step.is-current .scorm-rail-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.scorm-rail-step.is-done:not(.is-current) .scorm-rail-dot {
  border-color: var(--success);
  background: var(--success);
  color: var(--accent-ink);
}

.scorm-rail-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scorm-rail-title {
  font-size: 13px;
  font-weight: 600;
}

.scorm-rail-summary {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Course summary */

.scorm-sum-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  color: var(--ink-muted);
}

.scorm-sum-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scorm-sum-thumb svg {
  width: 36px;
  height: 36px;
  opacity: 0.9;
}

.scorm-sum-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.scorm-sum-title.is-placeholder {
  color: var(--muted);
}

.scorm-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scorm-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-tile-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scorm-tile-value {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-tile-extra {
  color: var(--muted);
  font-size: 11px;
}

.scorm-tile.is-good .scorm-tile-value {
  color: var(--success);
}

.scorm-tile.is-bad .scorm-tile-value {
  color: var(--danger-text);
}

/* Step header */

.scorm-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
}

.scorm-step-text {
  min-width: 0;
}

.scorm-kicker {
  margin: 0 0 4px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scorm-step-title {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.scorm-step-title:focus {
  outline: none;
}

.scorm-step-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.scorm-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scorm-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Step 1 — course content */

.scorm-thumb-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.scorm-dashed-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 4px 12px 4px 4px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.scorm-dashed-btn > span {
  display: inline-flex;
  padding-left: 8px;
}

.scorm-dashed-btn:hover:not(:disabled) {
  border-color: var(--text-2);
  color: var(--text);
}

.scorm-dashed-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.scorm-dashed-thumb {
  width: 52px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
}

.scorm-menu-wrap {
  position: relative;
}

.scorm-rec-menu {
  right: auto;
  left: 0;
  width: 300px;
}

.scorm-lessons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.scorm-lessons:empty {
  display: none;
}

.scorm-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  cursor: pointer;
}

.scorm-lesson:hover {
  border-color: var(--border-strong);
}

.scorm-lesson.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.scorm-lesson.is-dragging {
  opacity: 0.5;
}

.scorm-lesson.drop-before {
  box-shadow: 0 -2px 0 var(--accent);
}

.scorm-lesson.drop-after {
  box-shadow: 0 2px 0 var(--accent);
}

.scorm-lesson.is-pending {
  border-style: dashed;
  cursor: default;
}

.scorm-lesson-num {
  flex-shrink: 0;
  width: 22px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.scorm-lesson-thumb {
  position: relative;
  flex-shrink: 0;
  width: 104px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-deep);
}

.scorm-lesson-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scorm-duration {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
}

.scorm-lesson-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.scorm-lesson-title {
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.scorm-lesson-metas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.scorm-src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.scorm-src::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.scorm-src-editor {
  border-color: var(--ed-video-border);
  background: var(--info-soft);
  color: var(--info);
}

.scorm-src-recording {
  border-color: var(--danger-border);
  background: var(--danger-soft-bg);
  color: var(--danger-text);
}

.scorm-src-upload {
  border-color: var(--ed-audio-border);
  background: var(--success-soft);
  color: var(--ed-audio-wave);
}

.scorm-meta {
  color: var(--muted);
  font-size: 12px;
}

.scorm-pending-label {
  color: var(--text-2);
  font-size: 13px;
}

.scorm-lesson progress,
.scorm-dialog progress {
  width: 100%;
  accent-color: var(--accent);
}

.scorm-inspector .scorm-card-kicker {
  color: var(--purple);
}

.scorm-insp-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background: #000;
}

.scorm-insp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
}

.scorm-insp-head .scorm-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scorm-card > .scorm-insp-head + * {
  margin-top: 8px;
}

.scorm-chapters,
.scorm-captions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.scorm-chapter {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 6px;
}

.scorm-page .scorm-chapter input {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 13px;
}

.scorm-page input.scorm-ch-time {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.scorm-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-caption-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Step 2 — player & tracking */

.scorm-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.scorm-std-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.scorm-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 72px;
  padding: 12px 14px 12px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scorm-choice::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 12px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
}

.scorm-choice:hover {
  border-color: var(--border-strong);
}

.scorm-choice[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.scorm-choice[aria-checked="true"]::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 0 3px, transparent 4px);
}

.scorm-choice-title {
  font-size: 14px;
  font-weight: 600;
}

.scorm-choice-desc {
  color: var(--muted);
  font-size: 12px;
}

.scorm-choice-meta {
  margin-top: auto;
  padding-top: 6px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
}

.scorm-table-wrap {
  overflow-x: auto;
}

.scorm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.scorm-table th,
.scorm-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.scorm-table tr:last-child > * {
  border-bottom: 0;
}

.scorm-table thead th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.scorm-table thead th.is-active {
  color: var(--accent);
}

.scorm-table tbody th {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.scorm-table td {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
}

.scorm-pp {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
}

.scorm-pp-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.scorm-pp-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.scorm-pp-title {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  max-width: calc(100% - 16px);
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-pp-bar {
  position: relative;
  height: 6px;
  margin: 12px 12px 10px;
  border-radius: 3px;
  background: #2b2e36;
}

.scorm-pp-bar > span {
  position: absolute;
  top: 0;
  bottom: 0;
}

.scorm-pp-watched {
  inset-inline-start: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
}

.scorm-pp-played {
  z-index: 1;
  inset-inline-start: 0;
  border-radius: 3px;
  background: var(--accent);
}

.scorm-pp-locked {
  inset-inline-end: 0;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(135deg, #3a3e48 0 4px, #24272e 4px 8px);
}

.scorm-pp-furthest {
  z-index: 2;
  top: -4px !important;
  bottom: -4px !important;
  width: 2px;
  margin-inline-start: -1px;
  background: #fff;
}

.scorm-pp-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 12px;
}

.scorm-pp-play {
  width: 0;
  height: 0;
  border-block: 6px solid transparent;
  border-inline-start: 10px solid var(--text);
}

.scorm-pp-spacer {
  flex: 1;
}

.scorm-pp-chip {
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: 11px;
}

/* Step 3 — quiz checkpoints */

.scorm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scorm-tab {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

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

.scorm-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
  color: var(--text);
  font-weight: 600;
}

.scorm-card > .scorm-strip {
  margin-top: 36px;
}

.scorm-strip {
  position: relative;
  height: 64px;
}

.scorm-strip-frames {
  display: flex;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  cursor: pointer;
  touch-action: none;
}

.scorm-strip-frames img {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.scorm-strip-playhead {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.scorm-marker {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 18px;
  margin-left: -9px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.scorm-marker::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--purple);
}

.scorm-marker::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 2px var(--surface-1);
}

.scorm-marker.is-selected::before,
.scorm-marker.is-selected::after {
  background: var(--accent);
}

.scorm-marker-label {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
}

.scorm-strip-times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px !important;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.scorm-qlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.scorm-qitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scorm-qitem:hover {
  border-color: var(--border-strong);
}

.scorm-qitem.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.scorm-qbadge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--purple-soft-border);
  border-radius: 5px;
  background: var(--purple-soft-bg);
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.scorm-qtext {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.scorm-qtype {
  font-size: 13px;
  font-weight: 600;
}

.scorm-qwarn {
  display: inline-flex;
  color: var(--meter-warn);
}

.scorm-code-sm {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.scorm-qeditor-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scorm-pauses {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.scorm-page input.scorm-time-input {
  width: 86px;
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.scorm-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px !important;
  padding: 0;
  list-style: none;
}

.scorm-answer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-answer.is-correct {
  border-color: var(--ed-audio-border);
  background: var(--success-soft);
}

.scorm-answer > input[type="radio"],
.scorm-answer > input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--success);
}

.scorm-page .scorm-answer input[type="text"] {
  flex: 1;
  min-height: 34px;
  background: transparent;
}

.scorm-answer-fixed {
  flex: 1;
  min-height: 34px;
  padding: 7px 0;
  font-size: 14px;
}

.scorm-correct {
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scorm-num-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.scorm-num {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.scorm-page .scorm-num input {
  width: 100px;
  font-family: var(--font-mono);
}

/* Step 4 — package */

.scorm-build-card {
  border-color: var(--accent-soft-border);
}

.scorm-build-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.scorm-build-row .scorm-field {
  flex: 1 1 260px;
}

.scorm-build-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.scorm-build-action .scorm-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scorm-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.scorm-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}

.scorm-check-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.scorm-check-icon svg {
  width: 12px;
  height: 12px;
}

.is-ok > .scorm-check-icon {
  background: var(--success-soft);
  color: var(--success);
}

.is-warn > .scorm-check-icon {
  background: var(--accent-soft-bg);
  color: var(--meter-warn);
}

.is-error > .scorm-check-icon {
  background: var(--danger-soft-bg);
  color: var(--danger-text);
}

.scorm-check-item.is-error {
  color: var(--danger-text);
}

.scorm-tree {
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  font-size: 12px;
}

.scorm-tree-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  color: var(--text-2);
}

.scorm-tree-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-tree-size {
  flex-shrink: 0;
  color: var(--muted);
}

.scorm-tree-row.depth-1 {
  padding-left: 14px;
}

.scorm-tree-row.depth-2 {
  padding-left: 30px;
}

.scorm-tree-row.depth-1 .scorm-tree-name::before,
.scorm-tree-row.depth-2 .scorm-tree-name::before {
  content: "└ ";
  color: var(--border-strong);
}

.scorm-tree-row.is-root {
  color: var(--text);
  font-weight: 600;
}

.scorm-tree-row.is-dir .scorm-tree-name {
  color: var(--purple);
}

.scorm-tree-row.is-note {
  color: var(--muted);
  font-style: italic;
}

.scorm-code {
  max-height: 380px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}

.scorm-code .x-tag {
  color: var(--info);
}

.scorm-code .x-attr {
  color: var(--purple);
}

.scorm-code .x-val {
  color: var(--ed-audio-wave);
}

.scorm-dialog {
  width: min(440px, 92vw);
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  box-shadow: var(--shadow-dialog);
  color: var(--text);
}

.scorm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.scorm-dialog > * + * {
  margin-top: 12px;
}

.scorm-dialog-stage {
  margin-bottom: 0;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 13px;
}

.scorm-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

/* Step 5 — LMS simulator */

.scorm-sim-card {
  padding: 0;
  overflow: hidden;
}

.scorm-sim-card > * + * {
  margin-top: 0;
}

.scorm-sim-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
}

.scorm-sim-badge {
  padding: 3px 8px;
  border: 1px solid var(--purple-soft-border);
  border-radius: 5px;
  background: var(--purple-soft-bg);
  color: var(--purple);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scorm-sim-course {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-page .scorm-sim-select {
  width: auto;
  max-width: 260px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 13px;
}

.scorm-sim-std {
  color: var(--muted);
  font-size: 12px;
}

.scorm-sim-session {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.scorm-sim-frame-wrap {
  background: var(--bg);
}

.scorm-sim-frame {
  display: block;
  width: 100%;
  height: 420px;
  border: 0;
}

.scorm-sim-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.scorm-sim-spacer {
  flex: 1;
}

.scorm-sim-tiles {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 14px 14px;
}

@media (max-width: 640px) {
  .scorm-sim-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.scorm-log-wrap {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
}

.scorm-log {
  margin: 0;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  list-style: none;
}

.scorm-log-line {
  padding: 1px 12px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.scorm-log-t {
  margin-right: 8px;
  color: var(--muted);
}

.scorm-log-fn {
  color: var(--info);
}

.scorm-log-line.is-set .scorm-log-fn {
  color: var(--purple);
}

.scorm-log-line.is-commit .scorm-log-fn,
.scorm-log-line.is-init .scorm-log-fn,
.scorm-log-line.is-finish .scorm-log-fn {
  color: var(--accent);
}

.scorm-log-res {
  color: var(--ed-audio-wave);
}

.scorm-log-line.is-error {
  background: var(--danger-soft-bg);
}

.scorm-log-err,
.scorm-log-line.is-error .scorm-log-res {
  color: var(--danger-text);
}

.scorm-log-launch {
  margin: 6px 0;
  padding: 4px 12px;
  border-block: 1px dashed var(--border);
  color: var(--purple);
  font-size: 11px;
}

.scorm-log-launch:first-child {
  margin-top: 0;
  border-top: 0;
}

.scorm-cmi tbody th {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.scorm-cmi td {
  color: var(--text);
  overflow-wrap: anywhere;
}

.scorm-cmi td.is-hot {
  color: var(--meter-warn);
}

/* Recorder: marker button (feeds SCORM chapters) */

.icon-btn-marker svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Editor animations (js/editor/anim/): preset tiles, options, timeline
   indicators. See docs/animations-plan.md.
   ========================================================================== */

.editor-anim-tabs {
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 10px;
}

.editor-anim-host > * + * {
  margin-top: 10px;
}

.editor-anim-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.editor-anim-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
}

.editor-anim-tile canvas {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: var(--surface-inset);
}

.editor-anim-tile:hover {
  border-color: var(--border-strong);
}

.editor-anim-tile[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
  color: var(--text);
}

.editor-anim-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.editor-anim-seg2 {
  grid-template-columns: 1fr 1fr;
}

.editor-inspector-row-inline .val.mono {
  font-family: var(--font-mono);
}

.editor-clip-anim {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}

.editor-clip-anim-in {
  left: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0));
}

.editor-clip-anim-out {
  right: 0;
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0));
}

.editor-clip-anim-combo {
  position: absolute;
  top: 1px;
  right: 7px;
  z-index: 2;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

/* Zoom & pan */

.editor-preview-overlay.mode-zoom .editor-overlay-box {
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
}

.editor-zoom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.editor-zoom-list:empty {
  display: none;
}

.editor-zoom-seg {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
}

.editor-zoom-seg[data-selected="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.editor-zoom-pick {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-4);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}

.editor-zoom-pick[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.editor-zoom-seg .editor-zoom-time {
  width: 0;
  flex: 1 1 66px;
  min-width: 0;
  height: 36px;
  padding: 0 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-4);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}

.editor-zoom-dash {
  color: var(--muted);
}

.editor-zoom-del {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.editor-zoom-del:hover {
  background: var(--danger-soft-bg);
  color: var(--danger-text);
}

.editor-zoom-pick:focus-visible,
.editor-zoom-del:focus-visible,
.editor-zoom-time:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.editor-clip-zoom {
  position: absolute;
  bottom: 0;
  z-index: 1;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  pointer-events: none;
}

/* ==========================================================================
   SCORM Builder — lesson types: type chips, the Add lesson dialog, the
   lesson bar and the full-width lesson editor.
   ========================================================================== */

.scorm-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px 0 6px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg, var(--surface-4));
  color: var(--chip-fg, var(--text-2));
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.scorm-type-chip-icon {
  display: inline-flex;
}

.scorm-type-chip-icon svg {
  width: 14px;
  height: 14px;
}

.scorm-lesson-thumb.is-type {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--chip-bg);
  color: var(--chip-fg);
}

.scorm-lesson-thumb.is-type svg {
  width: 28px;
  height: 28px;
}

.scorm-lesson {
  cursor: default;
}

.scorm-page .scorm-lesson-edit {
  flex-shrink: 0;
}

/* Add lesson dialog */

.scorm-add-dialog {
  width: min(880px, 94vw);
}

.scorm-add-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .scorm-add-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.scorm-add-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.scorm-add-card:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.scorm-add-card[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.scorm-add-card:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.scorm-add-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scorm-add-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--chip-bg);
  color: var(--chip-fg);
}

.scorm-add-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.scorm-add-name {
  font-size: 14px;
  font-weight: 600;
}

.scorm-add-desc {
  color: var(--muted);
  font-size: 12px;
}

.scorm-add-rule {
  color: var(--text-2);
  font-size: 11px;
}

.scorm-add-sources {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-add-sources .scorm-btn-row {
  margin-top: 8px;
}

.scorm-page .scorm-add-sources select {
  width: auto;
  max-width: 320px;
}

.scorm-add-footer {
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.scorm-add-selected {
  color: var(--text-2);
  font-size: 13px;
}

/* Lesson bar + editor */

.scorm-lesson-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.scorm-lesson-bar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  text-decoration: none;
}

.scorm-lesson-bar-num {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.scorm-page input.scorm-lesson-bar-title {
  flex: 1 1 180px;
  min-width: 140px;
  font-size: 15px;
  font-weight: 600;
}

.scorm-rule-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-pill);
  background: var(--accent-soft-bg);
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

.scorm-lesson-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scorm-cols-editor .scorm-col-side {
  flex-basis: 340px;
  max-width: 420px;
}

.scorm-editor-video {
  max-height: 60vh;
  background: #000;
}

.scorm-page.is-editing-lesson .scorm-step-sub {
  display: none;
}

/* Question bank: picker, question editor, type chips */

.scorm-picker {
  width: min(760px, 94vw);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

.scorm-picker-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.scorm-page .scorm-picker-tools input[type="search"] {
  flex: 1 1 200px;
  width: auto;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  color: var(--text);
  font: inherit;
}

.scorm-picker-chips {
  margin-top: 10px;
}

.scorm-picker-chips .chip {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
}

.scorm-picker-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--accent-soft-border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-picker-list-wrap {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 44vh;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-picker-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.scorm-picker-list .scorm-empty {
  margin: 6px;
}

.scorm-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.scorm-picker-row:hover {
  background: var(--surface-3);
}

.scorm-picker-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.scorm-picker-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.scorm-picker-q {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-qtype-chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--purple-soft-border);
  border-radius: 4px;
  background: var(--purple-soft-bg);
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.scorm-src-bank {
  border-color: var(--ed-video-border);
  color: var(--info);
}

.scorm-qed > * + * {
  margin-top: 12px;
}

.scorm-qed-types {
  width: 100%;
}

.scorm-qed-body > * + *,
.scorm-qed-body .scorm-answers {
  margin-top: 8px;
}

.scorm-pairs,
.scorm-order-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.scorm-pair,
.scorm-order-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scorm-page .scorm-pair input,
.scorm-page .scorm-order-item input {
  flex: 1;
  min-width: 0;
  min-height: 34px;
}

.scorm-pair-arrow {
  color: var(--muted);
}

/* Quiz lesson editor */

.scorm-quiz-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.scorm-quiz-left {
  flex: 1 1 220px;
  max-width: 280px;
}

.scorm-quiz-centre {
  flex: 999 1 460px;
  min-width: 0;
}

.scorm-quiz-right {
  display: flex;
  flex: 1 1 280px;
  flex-direction: column;
  gap: 16px;
  max-width: 360px;
}

@media (max-width: 1100px) {
  .scorm-quiz-left,
  .scorm-quiz-right {
    max-width: none;
  }
}

.scorm-quiz-name {
  flex: 1 1 240px;
}

.scorm-quiz-qs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.scorm-quiz-q {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-quiz-q.is-open {
  border-color: var(--accent);
}

.scorm-quiz-q.is-dragging {
  opacity: 0.5;
}

.scorm-quiz-q.drop-before {
  box-shadow: 0 -2px 0 var(--accent);
}

.scorm-quiz-q.drop-after {
  box-shadow: 0 2px 0 var(--accent);
}

.scorm-quiz-q-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 4px;
}

.scorm-quiz-q-text {
  flex: 1 1 200px;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorm-quiz-q-editor {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* ---- Lesson types: slides / PDF editor ---- */
.scorm-slides-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.scorm-slides-left,
.scorm-slides-right,
.scorm-slides-centre {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-slide-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.scorm-slide-thumb {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text);
  text-align: start;
  cursor: pointer;
}

.scorm-slide-thumb:hover { border-color: var(--border-strong); }
.scorm-slide-thumb.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.scorm-slide-thumb-num {
  flex: 0 0 auto;
  min-width: 18px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.scorm-slide-thumb-img {
  flex: 1 1 auto;
  width: 100%;
  min-height: 40px;
  border-radius: 4px;
  background: #fff;
  object-fit: contain;
}

.scorm-slide-dot {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface-1);
  border-radius: 50%;
  background: var(--danger);
}

.scorm-slide-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
}

.scorm-slide-big {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
}

.scorm-slide-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
}

.scorm-slide-hotspots { position: absolute; inset: 0; pointer-events: none; }

.scorm-slide-hotspot {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-soft-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.scorm-slide-hotspot.is-selected { border-style: solid; background: var(--accent); color: var(--accent-ink); }

.scorm-slide-nav { justify-content: space-between; }

.scorm-narration { display: flex; flex-direction: column; gap: 10px; }

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

.scorm-wave {
  flex: 1 1 160px;
  height: 44px;
  min-width: 120px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
}

.scorm-rec-btn[aria-pressed="true"] { border-color: var(--danger); color: var(--danger-text); }
.scorm-rec-btn svg { color: var(--danger); }

.scorm-rec-level {
  display: inline-block;
  width: 10px;
  height: calc(10px + var(--level, 0) * 30px);
  border-radius: var(--radius-pill);
  background: var(--success);
  transition: height 80ms linear;
}

.scorm-narr-player { width: 100%; height: 36px; }

.scorm-radio-list { display: flex; flex-direction: column; gap: 6px; }

.btn-danger-ghost { color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-soft-bg); }

@media (max-width: 1100px) {
  .scorm-slides-layout { grid-template-columns: 1fr; }
  .scorm-slide-thumbs { flex-direction: row; max-height: none; overflow-x: auto; }
  .scorm-slide-thumb { width: 120px; flex: 0 0 auto; }
}

/* ---- Lesson types: reading editor ---- */
.scorm-read-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.scorm-read-left,
.scorm-read-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-read-left { position: sticky; top: 12px; }

.scorm-read-palette {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.scorm-read-pal {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: start;
  cursor: grab;
}

.scorm-read-pal svg { flex: 0 0 auto; color: var(--brand); }
.scorm-read-pal:hover,
.scorm-read-pal:focus-visible { border-color: var(--border); background: var(--surface-inset); }

.scorm-read-centre { min-width: 0; }

.scorm-read-sheet {
  padding: 32px 24px 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.scorm-read-page {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.65;
}

.scorm-read-page.is-size-S { font-size: 14px; }
.scorm-read-page.is-size-M { font-size: 16px; }
.scorm-read-page.is-size-L { font-size: 19px; }

.scorm-rb {
  position: relative;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
}

.scorm-rb:hover,
.scorm-rb:focus-within { border-color: var(--border); }
.scorm-rb.is-selected { border-color: var(--accent-soft-border); background: var(--surface-inset); }

.scorm-rb-handle {
  position: absolute;
  top: 6px;
  inset-inline-start: -30px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: grab;
  opacity: 0;
}

.scorm-rb:hover .scorm-rb-handle,
.scorm-rb:focus-within .scorm-rb-handle,
.scorm-rb-handle:focus-visible { opacity: 1; }

.scorm-rb-tools {
  position: absolute;
  top: -14px;
  inset-inline-end: 8px;
  z-index: 1;
  display: none;
  gap: 2px;
  align-items: center;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-4);
}

.scorm-rb:hover .scorm-rb-tools,
.scorm-rb:focus-within .scorm-rb-tools,
.scorm-rb.is-selected .scorm-rb-tools { display: flex; }

.scorm-rb-type {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.scorm-read-edit {
  min-height: 1.6em;
  outline: none;
  overflow-wrap: anywhere;
}

.scorm-read-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.scorm-read-edit mark { padding: 0 2px; border-radius: 3px; background: var(--warning-soft); color: var(--ink); }
.scorm-read-edit a { color: var(--brand); }

.scorm-read-heading { display: flex; gap: 10px; align-items: flex-start; }
.scorm-read-heading .scorm-read-edit { flex: 1 1 auto; min-width: 0; }
.scorm-read-page h2.scorm-read-edit { margin: 0; font-size: 1.6em; line-height: 1.25; }
.scorm-read-page h3.scorm-read-edit { margin: 0; font-size: 1.25em; line-height: 1.3; }
.scorm-read-level { flex: 0 0 auto; transform: scale(0.85); transform-origin: top right; }
.scorm-read-level button { min-height: 28px; padding: 0 8px; font-size: 12px; }

.scorm-read-callout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-inline-start: 4px solid var(--info);
  border-radius: var(--radius-md);
  background: var(--info-soft);
}

.scorm-read-callout.is-tip { border-color: var(--success); background: var(--success-soft); }
.scorm-read-callout.is-warning { border-color: var(--warning); background: var(--warning-soft); }
.scorm-page select.scorm-read-tone { align-self: flex-start; width: auto; min-height: 30px; height: 30px; padding: 0 28px 0 10px; font-size: 12px; }

.scorm-read-quote {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 2px 16px;
  border-inline-start: 3px solid var(--line-strong);
  font-style: italic;
}

.scorm-page input.scorm-read-input {
  width: 100%;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-style: normal;
}

.scorm-page input.scorm-read-input:focus { border-style: solid; border-color: var(--accent); outline: none; }

.scorm-read-list { margin: 6px 0 0; padding-inline-start: 1.4em; }

.scorm-read-expand { border: 1px solid var(--border); border-radius: var(--radius-md); }
.scorm-read-expand-head { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.scorm-page .scorm-read-expand-head input.scorm-read-input { border: 0; font-weight: 600; font-size: 14px; color: var(--text); }
.scorm-read-expand > .scorm-read-edit { padding: 8px 12px; }
.scorm-read-caret { display: flex; color: var(--muted); }

.scorm-read-table-wrap { display: flex; flex-direction: column; gap: 8px; overflow-x: auto; }
.scorm-read-table { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.scorm-read-table th,
.scorm-read-table td { min-width: 80px; padding: 6px 8px; border: 1px solid var(--border); text-align: start; vertical-align: top; outline: none; }
.scorm-read-table th { background: var(--surface-inset); }
.scorm-read-table td:focus,
.scorm-read-table th:focus { box-shadow: inset 0 0 0 2px var(--accent); }

.scorm-read-figure { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.scorm-read-figure img,
.scorm-read-figure video { max-width: 100%; border-radius: var(--radius-md); }
.scorm-read-figure audio { width: 100%; }

.scorm-read-empty {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
}

.scorm-read-empty select { min-height: 32px; }

.scorm-read-pdf { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.scorm-read-pdf img { flex: 0 0 auto; width: 110px; border-radius: 4px; background: #fff; }

.scorm-read-hr { margin: 12px 0; border: 0; border-top: 1px solid var(--border-strong); }

.scorm-read-drop {
  position: absolute;
  inset-inline: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  pointer-events: none;
}

.scorm-read-drop[hidden] { display: none; }

.scorm-read-slash {
  position: absolute;
  inset-inline-start: 8px;
  top: 100%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: 220px;
  max-height: 280px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  box-shadow: var(--shadow-lg);
}

.scorm-read-slash-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: start;
  cursor: pointer;
}

.scorm-read-slash-item[aria-selected="true"],
.scorm-read-slash-item:hover { background: var(--accent-soft-bg); }
.scorm-read-slash-item svg { color: var(--brand); }

.scorm-read-toolbar {
  position: fixed;
  z-index: 50;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  box-shadow: var(--shadow-md);
}

.scorm-read-toolbar[hidden] { display: none; }

.scorm-read-fmt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.scorm-read-fmt:hover { background: var(--accent-soft-bg); }
.scorm-read-rtl { font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.scorm-read-blank { text-align: center; }

@media (max-width: 1100px) {
  .scorm-read-layout { grid-template-columns: 1fr; }
  .scorm-read-left { position: static; }
  .scorm-read-palette { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---- Lesson types: audio editor ---- */
.scorm-audio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.scorm-audio-main,
.scorm-audio-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-audio-transport {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.scorm-audio-el { display: none; }

.scorm-audio-play {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

.scorm-audio-glyph {
  display: block;
  width: 0;
  height: 0;
  margin-inline-start: 4px;
  border-block: 8px solid transparent;
  border-inline-start: 13px solid currentColor;
}

.scorm-audio-play.is-playing .scorm-audio-glyph {
  width: 12px;
  height: 14px;
  margin: 0;
  border: 0;
  border-inline: 4px solid currentColor;
}

.scorm-audio-wave {
  flex: 1 1 auto;
  min-width: 0;
  height: 96px;
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  cursor: pointer;
}

.scorm-audio-wave:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.scorm-audio-marks,
.scorm-tlines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.scorm-tlines { max-height: 420px; margin-top: 10px; overflow-y: auto; }

.scorm-audio-mark,
.scorm-tline {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
  padding: 2px 4px;
  border-radius: var(--radius-md);
}

.scorm-tline.is-selected { background: var(--surface-inset); }
.scorm-tline.is-current { box-shadow: inset 3px 0 0 var(--brand); }
.scorm-tlines[dir="rtl"] .scorm-tline.is-current { box-shadow: inset -3px 0 0 var(--brand); }
.scorm-tline-time { justify-self: start; font-size: 12px; }

.scorm-page input.scorm-tline-text { unicode-bidi: plaintext; }
.scorm-page input.scorm-tline-text:dir(rtl),
.scorm-tlines[dir="rtl"] input.scorm-tline-text {
  font-family: "Amiri", "Noto Naskh Arabic", "Scheherazade New", "Traditional Arabic", serif;
  font-size: 16px;
}

@media (max-width: 1100px) {
  .scorm-audio-layout { grid-template-columns: 1fr; }
}

/* ---- Lesson types: activity editor ---- */
.scorm-act-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.scorm-act-main,
.scorm-act-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-act-tabs { flex-wrap: wrap; }

.scorm-act-list,
.scorm-act-sub,
.scorm-act-dd {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.scorm-act-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.scorm-act-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px; }
.scorm-act-head { color: var(--muted); font-size: 12px; font-weight: 600; }
.scorm-act-order { grid-template-columns: 28px minmax(0, 1fr) 32px 32px 32px; }
.scorm-act-zone { grid-template-columns: 28px minmax(0, 1fr) 32px; }
.scorm-act-dditem { grid-template-columns: minmax(0, 1fr) minmax(0, 220px) 32px; }
.scorm-act-catitem { grid-template-columns: minmax(0, 1fr) 32px; }

.scorm-act-cards,
.scorm-act-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.scorm-act-card,
.scorm-act-cat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.scorm-act-card-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.scorm-act-card-add { align-items: center; justify-content: center; border-style: dashed; }

.scorm-dd-board {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  user-select: none;
}

.scorm-dd-board > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }

.scorm-dd-zone {
  position: absolute;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  cursor: move;
  touch-action: none;
}

.scorm-dd-zone.is-selected { border-style: solid; background: color-mix(in srgb, var(--brand) 26%, transparent); }
.scorm-dd-zone:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.scorm-dd-zone-label {
  position: absolute;
  top: 4px;
  inset-inline-start: 6px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}

.scorm-dd-handle {
  position: absolute;
  inset-inline-end: -6px;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--surface-1);
  border-radius: 3px;
  background: var(--accent);
  cursor: nwse-resize;
}

.scorm-dd-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .scorm-act-layout { grid-template-columns: 1fr; }
}

/* ---- Lesson types: branching scenario editor ---- */
.scorm-br-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.scorm-br-main,
.scorm-br-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-br-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scorm-br-toolbar .scorm-hint { max-width: 420px; margin: 0; }

.scorm-br-map {
  height: min(70vh, 640px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface-inset);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--ink) 10%, transparent) 1px, transparent 1.4px);
  background-size: 18px 18px;
}

.scorm-br-canvas { position: relative; }
.scorm-br-edges { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.scorm-br-edge { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.scorm-br-edge.is-onpath { stroke: var(--brand); stroke-width: 3; }
.scorm-br-edge.is-temp { stroke: var(--accent); stroke-dasharray: 6 4; }

.scorm-br-node {
  position: absolute;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-4);
  box-shadow: var(--shadow-sm);
}

.scorm-br-node.is-onpath { border-color: color-mix(in srgb, var(--brand) 60%, transparent); }
.scorm-br-node.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow-sm); }
.scorm-br-node.is-droptarget { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }

.scorm-br-head {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: start;
  cursor: grab;
  touch-action: none;
}

.scorm-br-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.scorm-br-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorm-br-media { display: flex; color: var(--brand); }

.scorm-br-start {
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scorm-br-choices { margin: 0; padding: 0 0 6px; list-style: none; border-top: 1px solid var(--border); }

.scorm-br-choice {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 4px 18px 4px 10px;
  font-size: 12px;
}

.scorm-br-choice-text { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.scorm-br-pts { flex: 0 0 auto; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.scorm-br-pts.is-plus { color: var(--success); }
.scorm-br-pts.is-minus { color: var(--danger-text); }

.scorm-br-dot {
  position: absolute;
  top: 50%;
  right: -7px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid var(--surface-4);
  border-radius: 50%;
  background: var(--muted);
  cursor: crosshair;
  touch-action: none;
}

.scorm-br-dot.is-linked { background: var(--brand); }
.scorm-br-dot:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }

.scorm-br-ending { border-radius: var(--radius-pill); }
.scorm-br-ending .scorm-br-head { border-radius: var(--radius-pill); }
.scorm-br-ending.is-best { border-color: var(--success); background: var(--success-soft); }
.scorm-br-ending.is-ok { border-color: var(--warning); background: var(--warning-soft); }
.scorm-br-ending.is-poor { border-color: var(--danger); background: var(--danger-soft); }

.scorm-br-rating { padding: 1px 6px; border-radius: var(--radius-pill); background: var(--surface-raised); font-size: 10px; text-transform: uppercase; }
.scorm-br-ending.is-best .scorm-br-rating { color: var(--success); }
.scorm-br-ending.is-ok .scorm-br-rating { color: var(--warning); }
.scorm-br-ending.is-poor .scorm-br-rating { color: var(--danger); }

.scorm-br-mediabox { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.scorm-br-mediabox img,
.scorm-br-video { width: 100%; max-height: 200px; border-radius: var(--radius-md); background: #000; object-fit: contain; }
.scorm-br-choice-edit { gap: 8px; }

@media (max-width: 1100px) {
  .scorm-br-layout { grid-template-columns: 1fr; }
}

/* ---- Lesson types: simulation editor ---- */
.scorm-sim2-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.scorm-sim2-left,
.scorm-sim2-right,
.scorm-sim2-centre {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-sim2-left .btn.is-active { border-color: var(--accent); color: var(--accent); }

.scorm-sim2-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 64vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.scorm-sim2-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.scorm-sim2-step.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.scorm-sim2-thumb { position: relative; display: block; overflow: hidden; border-radius: 4px; background: #000; aspect-ratio: 16 / 9; }
.scorm-sim2-thumb img { display: block; width: 100%; height: 100%; object-fit: fill; }
.scorm-sim2-thumb-hs { position: absolute; border: 1.5px dashed var(--accent); border-radius: 2px; }
.scorm-sim2-step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scorm-sim2-step-kind { color: var(--info); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.scorm-sim2-step-instr { overflow: hidden; color: var(--text-2); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.scorm-sim2-centre-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.scorm-sim2-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #000;
  user-select: none;
  touch-action: none;
}

.scorm-sim2-stage.is-edit { cursor: crosshair; }
.scorm-sim2-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }

.scorm-sim2-hotspot {
  position: absolute;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  cursor: move;
}

.scorm-sim2-stage:not(.is-edit) .scorm-sim2-hotspot { cursor: default; }
.scorm-sim2-hotspot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.scorm-sim2-stage:not(.is-edit) .scorm-dd-handle { display: none; }

.scorm-sim2-bubble {
  position: absolute;
  z-index: 2;
  max-width: 46%;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: #10303A;
  color: #E8F8FD;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: pre-wrap;
}

.scorm-sim2-bubble[hidden] { display: none; }
.scorm-sim2-cursor { position: absolute; z-index: 3; margin: -2px 0 0 -4px; pointer-events: none; }
.scorm-sim2-testnote { position: absolute; top: 8px; inset-inline-start: 8px; padding: 2px 8px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 12px; }
.scorm-sim2-capture-video { width: 100%; max-height: 52vh; border-radius: var(--radius-md); background: #000; }

.scorm-sim2-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.scorm-sim2-actions { flex-wrap: wrap; }

@media (max-width: 1200px) {
  .scorm-sim2-layout { grid-template-columns: 1fr; }
}

/* ---- Lesson types: HTML package editor ---- */
.scorm-html-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.scorm-html-left,
.scorm-html-centre,
.scorm-html-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.scorm-html-info {
  margin: 8px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-inset);
  color: var(--text-2);
  font-size: 12px;
}

.scorm-html-tree { margin: 0; padding-inline-start: 14px; list-style: none; font-size: 12px; }
.scorm-html-left .card > .scorm-html-tree { padding-inline-start: 0; max-height: 360px; overflow: auto; }
.scorm-html-tree li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; padding: 2px 0; }
.scorm-html-tree summary { color: var(--text-2); font-weight: 600; cursor: pointer; }
.scorm-html-fname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorm-html-tree li.is-start .scorm-html-fname { color: var(--accent); font-weight: 600; }
.scorm-html-badge { padding: 0 6px; border-radius: var(--radius-pill); background: var(--accent-soft-bg); color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; }

.scorm-html-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.scorm-html-stage {
  display: flex;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface-inset);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1.4px);
  background-size: 16px 16px;
}

.scorm-html-frame {
  max-width: 100%;
  height: 520px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  transition: width 0.2s;
}

.scorm-html-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-size: 12px;
}

.scorm-html-log li { display: flex; gap: 10px; }
.scorm-html-log code { color: var(--info); font-family: var(--font-mono); }

.scorm-html-api { margin: 0; white-space: pre-wrap; font-size: 12px; }

.scorm-html-checks { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.scorm-html-check { position: relative; margin: 0; padding-inline-start: 22px; font-size: 13px; }
.scorm-html-check::before { position: absolute; inset-inline-start: 0; top: 0; font-weight: 700; }
.scorm-html-check.is-ok::before { content: "✓"; color: var(--success); }
.scorm-html-check.is-warn::before { content: "!"; color: var(--accent); }
.scorm-html-check.is-error::before { content: "✕"; color: var(--danger-text); }
.scorm-html-sub { margin: 4px 0; padding-inline-start: 16px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.scorm-html-check .btn { margin-top: 6px; }
.scorm-html-report { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; overflow-wrap: anywhere; }
.scorm-html-scos { margin: 8px 0 0; padding-inline-start: 18px; font-size: 12px; }
.scorm-html-scos code { margin-inline-start: 6px; color: var(--muted); }

@media (max-width: 1200px) {
  .scorm-html-layout { grid-template-columns: 1fr; }
}

/* Long completion rules stay on one line in the lesson bar (full text in the tooltip). */
.scorm-lesson-bar .scorm-rule-chip { display: inline-block; max-width: 300px; overflow: hidden; line-height: 26px; text-overflow: ellipsis; white-space: nowrap; }

/* Lesson row menu: weight + required */
.scorm-lesson.is-menu-open { flex-wrap: wrap; border-color: var(--accent-soft-border); }
.scorm-lesson-menu {
  display: flex;
  flex: 1 0 100%;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 2px 36px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  cursor: default;
}

.scorm-lesson-menu .scorm-field-row { align-items: end; }
.scorm-lesson-menu .scorm-switch-row { flex: 1 1 240px; }
.scorm-lesson-menu .btn { align-self: flex-start; }


/* ==========================================================================
   PDF Maker (js/pdf/). Same tokens and components as the SCORM Builder;
   red is the section's accent, amber stays the action colour.
   ========================================================================== */

.pdf-layout { display: flex; flex-direction: column; gap: 16px; max-width: 1480px; margin: 0 auto; }

.pdf-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.pdf-head-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.pdf-lang { display: flex; flex-direction: column; gap: 6px; }

.pdf-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
}

.pdf-template {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-height: 44px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.pdf-template:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.pdf-template:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pdf-template-name { font-size: 15px; font-weight: 700; }
.pdf-template-chip { padding: 1px 8px; border-radius: var(--radius-pill); background: var(--purple-soft-bg); color: var(--purple); font-size: 11px; font-weight: 600; }
.pdf-template-desc { color: var(--muted); font-size: 12px; line-height: 1.45; }

/* A4 sketches (0.707 ratio) */
.pdf-sketch { display: flex; justify-content: center; width: 100%; padding: 12px 0; border-radius: var(--radius-md); background: var(--bg-deep); }
.pdf-sketch-page { display: flex; flex-direction: column; gap: 5px; width: 92px; height: 130px; padding: 10px 9px; border-radius: 2px; background: #F4F1EC; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }
.pdf-sketch-page > span { display: block; flex: 0 0 auto; border-radius: 1px; background: #C9C3BA; }
.pdf-sk-title { height: 7px; width: 70%; background: #B03A3D !important; }
.pdf-sk-line { height: 3px; width: 100%; }
.pdf-sk-line-s { height: 3px; width: 60%; }
.pdf-sk-img { height: 26px; width: 100%; background: #DCD6CC !important; }
.pdf-sk-q { height: 4px; width: 80%; background: #8C857C !important; }
.pdf-sk-lines { height: 14px; width: 100%; background: repeating-linear-gradient(to bottom, transparent 0 4px, #C9C3BA 4px 5px) !important; }
.pdf-sk-opts { height: 8px; width: 90%; background: radial-gradient(circle at 4px 4px, #8C857C 2.5px, transparent 3px) 0 0 / 22px 8px repeat-x !important; }
.pdf-sk-table { height: 16px; width: 100%; background: transparent !important; border: 1px solid #8C857C; }
.pdf-sk-slide { height: 30px; width: 100%; background: #DCD6CC !important; border: 1px solid #8C857C; }
.pdf-sk-ts { height: 3px; width: 100%; background: linear-gradient(to right, #B03A3D 0 16%, transparent 16% 22%, #C9C3BA 22%) !important; }
.pdf-sk-row { height: 9px; width: 100%; background: transparent !important; border-bottom: 1px solid #C9C3BA; box-shadow: inset 10px 0 0 #DCD6CC; }

.pdf-page .scorm-kicker { color: var(--danger-text); }
.pdf-recent-table td { font-family: var(--font-ui); vertical-align: middle; }
.pdf-recent-table td.scorm-mono { font-family: var(--font-mono); }
.pdf-recent-name { font-weight: 600; text-align: start; }
.pdf-recent-actions { display: flex; gap: 6px; justify-content: flex-end; }

.pdf-type-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-pill);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Document bar */
.pdf-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.pdf-bar-back { display: inline-flex; gap: 6px; align-items: center; min-height: 36px; }
.scorm-page input.pdf-bar-title { flex: 1 1 200px; min-width: 160px; max-width: 460px; font-size: 15px; font-weight: 600; }
.pdf-bar-pages { color: var(--muted); font-size: 12px; }
.pdf-bar-saved { display: inline-flex; gap: 4px; align-items: center; color: var(--success); font-size: 12px; }
.pdf-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pdf-placeholder { padding: 24px; }
.pdf-templates-page { display: flex; flex-direction: column; gap: 20px; }

/* PDF Maker editor: outline | pages | settings */
.pdf-editor { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.pdf-left, .pdf-right, .pdf-centre { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pdf-right { position: sticky; top: 12px; }
.pdf-preview { display: flex; flex-direction: column; gap: 8px; }
.pdf-preview-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pdf-zoom-val { min-width: 44px; text-align: center; color: var(--muted); font-size: 12px; }
.pdf-desk { position: relative; min-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #6b6f76; }
.pdf-desk[aria-busy="true"]::after { content: "Laying out pages…"; position: absolute; top: 10px; inset-inline-end: 12px; padding: 2px 10px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; }
.pdf-frame { display: block; width: 100%; border: 0; }
.pdf-status { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.pdf-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.pdf-chip.is-warn { border-color: var(--accent-soft-border); background: var(--accent-soft-bg); color: var(--accent); }
.pdf-settings-tabs { flex-wrap: wrap; margin-bottom: 12px; }
.pdf-settings-panel { display: flex; flex-direction: column; gap: 10px; }
.pdf-sub { display: flex; flex-direction: column; gap: 10px; padding-inline-start: 10px; border-inline-start: 2px solid var(--border); }
.pdf-accent-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.pdf-accent-row input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: none; }
.pdf-logo-thumb { max-width: 80px; max-height: 32px; border-radius: 4px; background: #fff; }
@media (max-width: 1200px) { .pdf-editor { grid-template-columns: 1fr; } .pdf-right { position: static; } }

/* PDF Maker handout editor */
.pdf-outline { display: flex; flex-direction: column; gap: 2px; margin: 0 0 8px; padding: 0; list-style: none; }
.pdf-ol-fixed { display: flex; justify-content: space-between; min-height: 32px; align-items: center; padding: 0 8px; color: var(--muted); font-size: 13px; }
.pdf-ol-row { display: flex; align-items: center; gap: 2px; }
.pdf-ol-section, .pdf-ol-sub { display: flex; flex: 1 1 auto; gap: 8px; align-items: center; min-width: 0; min-height: 40px; padding: 4px 8px; border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: start; cursor: pointer; }
.pdf-ol-section:hover, .pdf-ol-sub:hover { background: var(--surface-inset); }
.pdf-ol-section.is-current { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.pdf-ol-section:focus-visible, .pdf-ol-sub:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pdf-ol-num { flex: 0 0 auto; min-width: 18px; color: var(--danger-text); font-weight: 700; }
.pdf-ol-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-ol-page { flex: 0 0 auto; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.pdf-ol-row { position: relative; }
.pdf-ol-tools { position: absolute; inset-inline-end: 4px; top: 50%; display: none; transform: translateY(-50%); padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-4); }
.pdf-ol-row:hover .pdf-ol-tools, .pdf-ol-row:focus-within .pdf-ol-tools { display: flex; }
.pdf-ol-subs { margin: 0 0 4px; padding: 0 0 0 26px; list-style: none; }
.pdf-ol-sub { min-height: 32px; color: var(--text-2); font-size: 12px; }
.pdf-section-card { padding: 14px; }
.pdf-section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.scorm-page input.pdf-section-title { font-size: 17px; font-weight: 700; }
.pdf-edit-sheet .scorm-read-figure img { max-height: 180px; object-fit: contain; }
.pdf-edit-sheet { max-height: 400px; overflow: auto; background: #fbfaf8; color: #1d1b19; }
.pdf-edit-sheet .scorm-read-edit:empty::before { color: #9a938a; }
.pdf-edit-sheet .scorm-rb.is-selected { border-color: #B03A3D; background: #fff4f2; }
.pdf-edit-sheet .scorm-rb:hover, .pdf-edit-sheet .scorm-rb:focus-within { border-color: #d8d0c6; }
.pdf-edit-sheet .scorm-rb-handle { color: #7a736b; }
.pdf-edit-sheet .scorm-read-table th, .pdf-edit-sheet .scorm-read-table td { border-color: #d8d0c6; }
.pdf-edit-sheet .scorm-read-table th { background: #f1ece5; }
.pdf-edit-sheet .scorm-page input.scorm-read-input, .pdf-edit-sheet input.scorm-read-input { color: #3b3632; border-color: #d8d0c6; }
.pdf-edit-sheet .scorm-read-callout { background: #faf3ef; border-color: #B03A3D; }
.pdf-edit-sheet .scorm-read-quote { border-color: #cfc8bf; }
.pdf-edit-sheet .scorm-read-empty { border-color: #d8d0c6; color: #6b655e; }
.pdf-cols-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pdf-cols-edit > .scorm-read-edit { padding: 4px 6px; border: 1px dashed #d8d0c6; border-radius: 4px; }
.pdf-pagebreak { padding: 4px 0; border-block: 1px dashed #B03A3D; color: #B03A3D; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-align: center; text-transform: uppercase; }
.pdf-qblock { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px dashed #d8d0c6; border-radius: 6px; }
.pdf-qblock-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.pdf-qblock-item { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.pdf-qblock-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-qblock-pts { display: inline-flex; gap: 4px; align-items: center; color: #6b655e; font-size: 12px; }
.pdf-qblock-pts input { width: 56px; min-height: 30px; }

/* PDF Maker exam editor */
.pdf-exam-tabs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.pdf-xpart { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-inset); }
.pdf-xq-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; counter-reset: xq; }
.pdf-xq { position: relative; display: flex; gap: 4px; align-items: center; min-height: 40px; font-size: 12px; }
.pdf-xq-tools { position: absolute; inset-inline-end: 0; top: 50%; display: none; transform: translateY(-50%); padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-4); }
.pdf-xq:hover .pdf-xq-tools, .pdf-xq:focus-within .pdf-xq-tools { display: flex; }
.pdf-xq .scorm-qtype-chip { flex: 0 0 auto; }
.pdf-xq-handle { position: static; opacity: 1; width: 22px; }
.pdf-xq-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scorm-page input.pdf-xq-pts { flex: 0 0 auto; width: 52px; min-height: 30px; padding: 4px 6px; font-size: 12px; }
.pdf-xactions { display: flex; flex-direction: column; gap: 8px; }
.pdf-field-chips { flex-wrap: wrap; margin-bottom: 8px; }

/* PDF Maker export screen */
.pdf-export { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.pdf-export-main, .pdf-export-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pdf-export-side { position: sticky; top: 12px; }
.pdf-export-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pdf-export-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); cursor: pointer; }
.pdf-export-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pdf-export-card.is-key .pdf-export-name { color: var(--danger-text); }
.pdf-export-thumb { position: relative; height: 180px; overflow: hidden; border-radius: var(--radius-md); background: #6b6f76; }
.pdf-thumb-inner { position: absolute; top: 0; left: 50%; width: 840px; transform: translateX(-50%) scale(0.155); transform-origin: top center; pointer-events: none; }
.pdf-export-card-row { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.pdf-export-card-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.pdf-export-name { font-weight: 600; }
.pdf-export-pages { color: var(--muted); font-size: 12px; }
.pdf-pattern { display: block; padding: 8px 10px; border-radius: var(--radius-md); background: var(--surface-inset); color: var(--text-2); font-family: var(--font-mono); font-size: 12px; word-break: break-all; }
.pdf-how { align-items: flex-start; padding: 8px 0; }
.pdf-how > span { display: flex; flex-direction: column; gap: 4px; }
.pdf-how.is-disabled { opacity: 0.55; }
.pdf-badge { display: inline-block; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--purple-soft-bg); color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; vertical-align: middle; }
.pdf-checks { gap: 10px; }
.pdf-totals { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0; }
.pdf-totals dt { color: var(--text-2); font-size: 13px; }
.pdf-totals dd { margin: 0; font-size: 15px; font-weight: 700; text-align: end; }
.pdf-export-actions { display: flex; flex-direction: column; gap: 8px; }
.pdf-combined-holder { position: fixed; top: 0; left: -12000px; width: 900px; height: 50px; overflow: hidden; }
@media (max-width: 1100px) { .pdf-export { grid-template-columns: 1fr; } .pdf-export-side { position: static; } }
.pdf-attach-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; padding: 0; list-style: none; }
.pdf-attach-item { display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-inset); }
.pdf-attach-name { flex: 1 1 auto; font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

/* Al-Nokhba endorsed lockup ("by Tamayouz") on Home. Clear space ≥ 0.2 × the
   mark; never recoloured, never mirrored. */
.home-endorsed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 48px 0 0;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.home-endorsed img {
  display: block;
  width: auto;
  height: 14px;
}

/* «من تميز» when the page is Arabic; "by Tamayouz" otherwise. */
.home-endorsed-ar { display: none; }
html:lang(ar) .home-endorsed-en { display: none; }
html:lang(ar) .home-endorsed-ar { display: inline; }

/* Theme switch (js/theme.js): Auto → Light → Dark. A neutral header pill; the
   ::after extends the hit area to 44px without changing the header's height. */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--text);
  font: 600 12.5px/1 var(--font-ui);
  cursor: pointer;
}

.theme-toggle::after {
  content: "";
  position: absolute;
  inset: -6px -2px;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-sunken);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.theme-toggle-icon {
  display: inline-flex;
  color: var(--brand);
}

/* Interface language (js/i18n/core.js): EN | عربي, the active one a brand chip.
   Same pill as the theme switch; each label in its own script. */
.lang-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  padding: 0 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  color: var(--muted);
  cursor: pointer;
}

.lang-toggle::after {
  content: "";
  position: absolute;
  inset: -6px -2px;
}

.lang-toggle:hover {
  border-color: var(--border-strong);
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.lang-toggle-opt {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--radius-pill);
  font: 600 12px/1 var(--font-sans);
}

.lang-toggle-opt[lang="ar"] {
  font-family: var(--font-arabic);
  font-size: 13px;
}

.lang-toggle-opt.is-active {
  background: var(--brand);
  color: var(--on-brand);
}

/* The header's Alnokhba Hub mark is the same gold artwork on light or dark (gold reads on
   both); the dark/light swap below is kept for the markup shape only. Never mirrored in RTL. */
.brand-mark .brand-mark-dark { display: none; }
[data-theme="dark"] .brand-mark .brand-mark-light { display: none; }
[data-theme="dark"] .brand-mark .brand-mark-dark { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark .brand-mark-light { display: none; }
  :root:not([data-theme="light"]) .brand-mark .brand-mark-dark { display: block; }
}
