:root {
  --ink: #162033;
  --muted: #637088;
  --line: #dbe5f3;
  --soft: #f5f8fc;
  --blue: #0874d9;
  --blue-dark: #0759aa;
  --green: #16865a;
  --red: #c63e3e;
  --panel: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #eef4fb;
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.65rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 12px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 80px;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 1fr);
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 16px 36px rgba(26, 44, 70, .08);
}

.preview-panel,
#library {
  grid-column: 1 / -1;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e8f4ff;
  color: var(--blue-dark);
  font-weight: 800;
  font-size: .85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #cce6ff;
  border-color: var(--blue);
}

.wide {
  grid-column: 1 / -1;
}

button,
.secondary,
.primary,
.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.primary {
  background: var(--blue);
  color: white;
}

.primary:hover {
  background: var(--blue-dark);
}

.secondary,
.ghost-link {
  background: #fff;
  color: var(--blue-dark);
  border-color: #bdd7f3;
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 700;
}

.message.ok {
  color: var(--green);
}

.message.bad {
  color: var(--red);
}

.empty-state,
.video-missing {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed #b8c7dc;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  text-align: center;
}

#draftEditor {
  display: grid;
  gap: 14px;
}

.interaction-head,
.interaction-title,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.interaction-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.file-note {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}

.remove-question {
  min-height: 34px;
  color: var(--red);
  background: #fff6f6;
  border-color: #f0c4c4;
}

.player-card {
  min-height: 420px;
}

.iv-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid #d7d7d7;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(20, 30, 45, .08);
}

.iv-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1420;
}

.iv-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0b1420;
}

.iv-missing {
  display: grid;
  place-items: center;
  height: 100%;
  color: #dce8f5;
  text-align: center;
}

.iv-missing span {
  display: block;
  margin-top: 8px;
  color: #9eb3ca;
}

.iv-time-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(80, 80, 80, .56);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
}

.iv-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.iv-pill {
  position: absolute;
  min-height: 54px;
  max-width: min(360px, 46%);
  padding: 0 28px 0 0;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 20, 20, .82);
  color: white;
  font-size: clamp(1rem, 2vw, 1.55rem);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .32);
}

.iv-pill span {
  display: inline-grid;
  place-items: center;
  width: 58px;
  align-self: stretch;
  margin-right: 18px;
  border-radius: 999px;
  background: #9d19a8;
  font-size: 1.5rem;
}

.iv-bottom-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 58px 46px 1fr auto auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 14px;
  background: rgba(24, 24, 24, .94);
  color: #f4f4f4;
}

.iv-play,
.iv-bookmark {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: white;
  font-size: 1.7rem;
}

.iv-timeline {
  position: relative;
  height: 5px;
  background: rgba(255, 255, 255, .24);
}

.iv-progress {
  height: 100%;
  width: 0;
  background: #ddd;
}

.iv-marker {
  position: absolute;
  top: -6px;
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  border: 3px solid #e7e7e7;
  border-radius: 50%;
  background: #343434;
  transform: translateX(-50%);
}

.iv-clock {
  white-space: nowrap;
  font-weight: 800;
}

.iv-controls {
  white-space: nowrap;
  color: #d8d8d8;
  font-size: 1.25rem;
}

.iv-footer {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 38px;
  padding: 7px 16px;
  color: #777;
  border-top: 1px solid #e6e6e6;
  background: #fff;
  font-weight: 800;
}

.iv-footer strong {
  margin-left: auto;
  color: #777;
}

.iv-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 5vw;
  background: rgba(0, 0, 0, .55);
  z-index: 40;
}

.iv-modal.open {
  display: flex;
}

.iv-modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 64px);
  overflow: auto;
  background: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .36);
}

.iv-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #777;
  color: white;
  font-size: 1.6rem;
}

.iv-modal-media {
  min-height: 110px;
  padding: 70px 30px 10px;
  border-bottom: 1px solid #e5e5e5;
}

.iv-modal-media.empty {
  min-height: 88px;
}

.iv-modal-media img {
  display: block;
  max-width: min(330px, 75%);
  max-height: 220px;
  object-fit: contain;
}

.iv-modal-body {
  padding: 34px 30px 28px;
}

.iv-question {
  margin-bottom: 24px;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 1.15;
  font-weight: 700;
}

.iv-options {
  display: grid;
  gap: 14px;
}

.iv-choice {
  justify-content: flex-start;
  min-height: 66px;
  padding: 12px 24px;
  border: 0;
  border-radius: 8px;
  background: #ddd;
  color: #111;
  box-shadow: inset 0 -4px rgba(0, 0, 0, .15);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
}

.iv-choice.correct {
  background: #b7e8d3;
  color: #1f5a40;
}

.iv-choice.correct::before {
  content: "✓";
  margin-right: 16px;
  font-weight: 900;
}

.iv-choice.wrong {
  background: #f5c4c4;
  color: #6d1c1c;
}

.iv-feedback {
  min-height: 42px;
  margin: 24px 0 20px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 900;
}

.iv-feedback.correct {
  color: #2278df;
}

.iv-feedback.wrong {
  color: #c63e3e;
}

.iv-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.iv-score-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 230px;
  padding: 12px 20px;
  border: 1px solid #e7e7e7;
  border-radius: 999px;
}

.iv-score-bar {
  width: 120px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2eaa71 50%, #f9d348 50%);
}

.iv-score {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  font-weight: 900;
}

.iv-continue {
  min-height: 66px;
  padding: 12px 32px;
  border: 0;
  border-radius: 999px;
  background: #1f7fe5;
  color: white;
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.publish-box {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.library-list {
  display: grid;
  gap: 10px;
}

.library-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.library-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .88rem;
}

.embed-body {
  background: transparent;
}

.embed-wrap {
  width: 100%;
}

@media (max-width: 900px) {
  .shell,
  .form-grid,
  .mini-grid,
  .choices-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .iv-bottom-bar {
    grid-template-columns: 44px 1fr auto;
  }

  .iv-bookmark,
  .iv-controls {
    display: none;
  }

  .iv-modal {
    padding: 18px;
  }
}
