:root {
  color-scheme: light;
  --bg: #eef8ff;
  --ink: #102a43;
  --muted: #4f6f86;
  --line: #bfdff2;
  --panel: #ffffff;
  --accent: #0284c7;
  --accent-strong: #075985;
  --gold: #0ea5e9;
  --soft: #e0f2fe;
  --warn: #b45309;
  --sky-glow: #bae6fd;
  --shadow: 0 20px 45px rgba(14, 116, 144, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #dff3ff 0%, var(--bg) 34%, #f8fcff 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  font-size: 16px;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

button:hover {
  border-color: var(--accent);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.button-link:hover {
  border-color: var(--accent);
}

.primary-button {
  border-color: var(--accent);
  background: linear-gradient(180deg, #0ea5e9, var(--accent));
  color: #fff;
  font-weight: 700;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 22px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 60px);
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip span,
.meta-row span,
.install-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 13px;
}

.install-button {
  min-height: 36px;
  color: var(--accent-strong);
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  background: transparent;
  font-weight: 700;
}

.tab.is-active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #0ea5e9, var(--accent));
  color: #fff;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.live-layout,
.workspace-grid,
.builder-grid,
.slides-layout,
.versions-grid,
.bible-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: stretch;
}

section,
.cue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-weight: 700;
}

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

textarea {
  resize: vertical;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inline-toolbar {
  margin-top: 0;
}

.live-settings {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.workspace-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.share-board {
  margin-top: 16px;
}

.share-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 18px;
  align-items: center;
}

.platform-qr {
  width: 100%;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.workspace-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.workspace-stats strong {
  display: block;
  color: var(--accent-strong);
  font-size: 26px;
}

.workspace-stats span,
.workspace-summary span {
  color: var(--muted);
  font-size: 13px;
}

.workspace-summary {
  display: grid;
  gap: 10px;
}

.workspace-summary div,
.correction-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.correction-box {
  margin-top: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.check-row input {
  width: auto;
}

#confidenceValue {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent-strong);
  font-weight: 800;
}

.cue-card {
  min-height: 380px;
}

.cue-card h2 {
  font-size: 30px;
}

.meta-row,
.suggestion-list,
.result-list,
.version-list,
.history-list,
.project-list,
.scripture-results {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
}

.passage-box {
  margin-top: 14px;
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  background: linear-gradient(180deg, #f0f9ff, var(--soft));
  line-height: 1.55;
}

.suggestion,
.result-item,
.version-option,
.history-item,
.project-item,
.scripture-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.suggestion strong,
.result-item strong,
.history-item strong,
.project-item strong,
.scripture-result strong {
  display: block;
  margin-bottom: 5px;
}

.history-board {
  margin-top: 16px;
}

.compact {
  margin-bottom: 8px;
}

.history-item,
.project-item,
.scripture-result {
  min-height: 0;
  text-align: left;
}

.history-item span,
.project-item span {
  color: var(--muted);
  font-size: 13px;
}

.selector-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 10px;
  margin-top: 12px;
}

.scripture-result p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.action-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--accent-strong);
  font-weight: 800;
}

.display-stage {
  position: relative;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(186, 230, 253, 0.34), transparent 34%),
    linear-gradient(160deg, #082f49 0%, #075985 46%, #0c4a6e 100%);
  color: #fff;
  overflow: hidden;
}

.display-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, transparent, rgba(2, 132, 199, 0.2));
  pointer-events: none;
}

.display-topline {
  position: absolute;
  top: 20px;
  right: 20px;
  left: 20px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.display-topline button {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.96);
  color: #075985;
  font-weight: 800;
}

.display-stage h2 {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto 18px;
  color: #fff;
  font-size: clamp(38px, 7vw, 86px);
  text-align: center;
  text-shadow: 0 8px 26px rgba(2, 8, 23, 0.35);
}

.display-reference {
  position: relative;
  z-index: 1;
  margin: 0 auto 26px;
  color: #bae6fd;
  font-size: clamp(20px, 3vw, 34px);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 4px 18px rgba(2, 8, 23, 0.28);
}

.display-text {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 34px);
  background: rgba(240, 249, 255, 0.1);
  backdrop-filter: blur(6px);
  font-size: clamp(24px, 4vw, 48px);
  line-height: 1.34;
  text-align: center;
}

.slideshow-preview {
  margin-top: 16px;
}

.slide-deck-preview {
  display: grid;
  place-items: center;
  min-height: 420px;
}

.ready-slide {
  position: relative;
  display: grid;
  align-content: center;
  width: min(100%, calc(420px * var(--slide-ratio, 1.777)));
  max-width: 100%;
  min-height: 420px;
  overflow: hidden;
  border-radius: 8px;
  padding: 56px 64px 44px 86px;
  background: var(--slide-bg, #eef8ff);
  color: var(--slide-title, #172222);
  aspect-ratio: var(--slide-aspect, 16 / 9);
}

.ready-slide::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 28px;
  background: var(--slide-primary, #0284c7);
}

.ready-slide.cover::after {
  content: "";
  position: absolute;
  top: 18%;
  left: 13%;
  width: 72%;
  height: 8px;
  background: var(--slide-accent, #c58a19);
}

.ready-slide h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 24px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.02;
}

.ready-slide .slide-body {
  position: relative;
  z-index: 1;
  max-width: 86%;
  border-radius: 8px;
  padding: 22px 24px;
  background: var(--slide-panel, #fff);
  color: var(--slide-body, #172222);
}

.ready-slide .slide-body p {
  margin: 0 0 12px;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.28;
}

.ready-slide .reference-pill {
  position: absolute;
  top: 42px;
  right: 52px;
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--slide-primary, #0284c7);
  color: #fff;
  font-weight: 800;
}

.ready-slide footer {
  position: absolute;
  right: 54px;
  bottom: 28px;
  color: var(--slide-muted, #5a6462);
  font-size: 13px;
}

.presentation-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #111;
}

.presentation-overlay .ready-slide {
  display: none;
  width: min(100vw, calc(100vh * var(--slide-ratio, 1.777)));
  height: min(100vh, calc(100vw / var(--slide-ratio, 1.777)));
  min-height: 0;
  border-radius: 0;
}

.presentation-overlay .ready-slide.is-current {
  display: grid;
}

.presentation-controls {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 51;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  transform: translateX(-50%);
  opacity: 0.18;
}

.presentation-controls:hover,
.presentation-controls:focus-within {
  opacity: 1;
}

.inline-select {
  align-self: center;
  margin: 0 0 0 4px;
  font-weight: 800;
}

.confidence {
  color: var(--accent-strong);
  font-weight: 800;
}

.locked {
  color: var(--warn);
  font-weight: 800;
}

.body-copy,
.result-item p,
.suggestion p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 16px, 720px);
    padding-top: 12px;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .tabs {
    display: flex;
    gap: 8px;
    margin-inline: -8px;
    overflow-x: auto;
    padding: 0 8px 8px;
    scroll-snap-type: x proximity;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 138px;
    scroll-snap-align: start;
  }

  .live-layout,
  .workspace-grid,
  .builder-grid,
  .slides-layout,
  .versions-grid,
  .bible-layout,
  .selector-grid {
    grid-template-columns: 1fr;
  }

  .workspace-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .display-topline {
    position: static;
    margin-bottom: 28px;
  }

  .ready-slide {
    width: 100%;
    min-height: 260px;
    padding: 42px 24px 34px 48px;
  }

  .ready-slide .reference-pill {
    position: static;
    width: fit-content;
    margin-bottom: 14px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar button,
  .toolbar .button-link,
  .toolbar select,
  .primary-button {
    width: 100%;
  }

  .share-grid {
    grid-template-columns: 1fr;
  }

  .platform-qr {
    justify-self: center;
  }

  .presentation-controls {
    left: 8px;
    right: 8px;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
  }

  .presentation-controls button {
    flex: 1 1 110px;
  }
}
