:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #2d145f;
  color: #171b1f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 214, 78, 0.28), transparent 28%),
    linear-gradient(145deg, #6f38cf 0%, #3037a7 48%, #16a0b7 100%);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 16px clamp(14px, 4vw, 38px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(31, 20, 82, 0.68);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #ffcf3d;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #fff;
  font-size: 19px;
  letter-spacing: 0;
}

.brand span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  margin-top: 2px;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  padding: 4px;
}

.tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  padding: 8px 12px;
  font-weight: 750;
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  color: #2d145f;
}

.status-pill {
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-grid,
.page-stack {
  padding: 22px clamp(14px, 4vw, 38px) 34px;
}

.recorder-grid {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr) minmax(270px, 360px);
  gap: 20px;
}

.page-stack {
  display: grid;
  gap: 20px;
}

.panel,
.pack-card,
.clip-card {
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid #ded8cc;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(31, 38, 35, 0.08);
}

.setup-panel,
.question-panel,
.pack-builder,
.account-card {
  align-self: start;
  padding: 18px;
}

.recorder-grid .panel,
.page-stack .panel,
.clip-card,
.empty-note {
  background: rgba(255, 255, 255, 0.94);
}

.stage {
  min-width: 0;
}

.panel-title,
.section-head,
.pack-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head h1,
.section-head p,
.panel-title h2,
.pack-card h2,
.pack-card p {
  margin: 0;
}

.section-head h1 {
  color: #fff;
  font-size: 30px;
  letter-spacing: 0;
}

.section-head p {
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
  margin-top: 4px;
}

.panel-title {
  margin-bottom: 14px;
}

.panel-title h2,
.pack-card h2 {
  font-size: 17px;
  letter-spacing: 0;
}

.panel-title span,
.pack-card-head span,
.pack-meta,
.version {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  color: #555e5c;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #d4cec2;
  border-radius: 8px;
  background: #fffdfa;
  color: #171b1f;
  padding: 11px 12px;
  outline: 0;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field .question-input {
  min-height: 210px;
}

.field input:focus,
.field textarea:focus {
  border-color: #184e4a;
  box-shadow: 0 0 0 3px rgba(24, 78, 74, 0.12);
}

.drive-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  border: 1px solid #d8d1c5;
  border-radius: 8px;
  background: #fffdfa;
  padding: 12px;
}

.drive-panel strong,
.drive-panel span {
  display: block;
}

.drive-panel strong {
  font-size: 14px;
}

.drive-panel span {
  color: #66706f;
  font-size: 12px;
  line-height: 1.35;
}

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

.drive-actions .button {
  flex: 1 1 160px;
}

.oauth-debug {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e2dbcf;
}

.oauth-debug span {
  color: #707976;
  font-size: 12px;
  font-weight: 700;
}

.oauth-debug code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid #e2dbcf;
  border-radius: 8px;
  background: #f6f4ee;
  padding: 8px;
  color: #202725;
  font-size: 12px;
}

.mini-pack-list,
.question-list,
.clip-grid {
  display: grid;
  gap: 10px;
}

.pack-button,
.question-row {
  width: 100%;
  border: 1px solid #d8d1c5;
  border-radius: 8px;
  background: #fffdfa;
  color: #202725;
  padding: 12px;
  text-align: left;
}

.pack-button {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
}

.pack-button.active,
.question-row.active,
.pack-card.active {
  border-color: #2f66ff;
  box-shadow: 0 0 0 3px rgba(47, 102, 255, 0.16);
}

.pack-button strong,
.pack-button small {
  display: block;
}

.pack-button strong {
  font-size: 14px;
}

.pack-button small {
  color: #66706f;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.deck-badge,
.deck-art span {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
  color: #fff;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.deck-badge {
  width: 46px;
  height: 46px;
}

.deck-legacy { background: linear-gradient(145deg, #ff8bb4, #ffcf5b); }
.deck-job { background: linear-gradient(145deg, #55d6ff, #2f66ff); }
.deck-kids { background: linear-gradient(145deg, #54e48d, #f5d547); }
.deck-founder { background: linear-gradient(145deg, #8067ff, #ff6b8b); }
.deck-testimonial { background: linear-gradient(145deg, #ff8b3d, #fb3f5f); }
.prompt-card:not(.deck-legacy, .deck-job, .deck-kids, .deck-founder, .deck-testimonial),
.pack-button:not(.deck-legacy, .deck-job, .deck-kids, .deck-founder, .deck-testimonial) .deck-badge,
.pack-card:not(.deck-legacy, .deck-job, .deck-kids, .deck-founder, .deck-testimonial) .deck-art {
  background: linear-gradient(145deg, #20c6b7, #3553d8);
}

.pack-card.deck-legacy,
.pack-card.deck-job,
.pack-card.deck-kids,
.pack-card.deck-founder,
.pack-card.deck-testimonial {
  background: rgba(255, 255, 255, 0.94);
}

.pack-card.deck-legacy .deck-art { background: linear-gradient(145deg, #ff8bb4, #ffcf5b); }
.pack-card.deck-job .deck-art { background: linear-gradient(145deg, #55d6ff, #2f66ff); }
.pack-card.deck-kids .deck-art { background: linear-gradient(145deg, #54e48d, #f5d547); }
.pack-card.deck-founder .deck-art { background: linear-gradient(145deg, #8067ff, #ff6b8b); }
.pack-card.deck-testimonial .deck-art { background: linear-gradient(145deg, #ff8b3d, #fb3f5f); }

.pack-button.deck-legacy,
.pack-button.deck-job,
.pack-button.deck-kids,
.pack-button.deck-founder,
.pack-button.deck-testimonial {
  border: 0;
  color: #fff;
}

.pack-button.deck-legacy small,
.pack-button.deck-job small,
.pack-button.deck-kids small,
.pack-button.deck-founder small,
.pack-button.deck-testimonial small {
  color: rgba(255, 255, 255, 0.86);
}

.recorder {
  overflow: hidden;
}

.camera-wrap {
  position: relative;
  min-height: 540px;
  background: #111332;
}

video {
  display: block;
  width: 100%;
  height: 100%;
}

#cameraPreview {
  position: absolute;
  inset: 0;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(18vh, 150px) 26px 280px;
  color: #d9e0dc;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(42, 31, 125, 0.8), rgba(17, 19, 50, 0.9)),
    #111332;
}

.prompt-overlay {
  position: absolute;
  inset: auto 18px 18px;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
}

.prompt-card {
  width: min(100%, 680px);
  min-height: 210px;
  display: grid;
  align-content: center;
  gap: 16px;
  border: 7px solid #fff;
  border-radius: 8px;
  padding: clamp(18px, 4vw, 34px);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.question-count {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 13px;
}

.question-text {
  margin: 0;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: 0;
}

.prompt-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.prompt-card-foot strong {
  font-size: 24px;
}

.recording-dot {
  position: absolute;
  top: 18px;
  left: 18px;
  display: none;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(177, 37, 37, 0.86);
  font-size: 13px;
}

.is-recording .recording-dot {
  display: flex;
}

.recording-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
}

.gate {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid #ded8cc;
  background: #fffdfa;
  padding: 18px;
}

.gate strong {
  font-size: 18px;
}

.gate p {
  margin: 0;
  color: #5e6865;
  line-height: 1.45;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #ded8cc;
  background: #fffaf2;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid #d2cabe;
  border-radius: 8px;
  padding: 10px 14px;
  background: #fffdfa;
  color: #202725;
  font-weight: 750;
  text-decoration: none;
}

.button.primary {
  border-color: #184e4a;
  background: #184e4a;
  color: #fff;
}

.button.danger {
  border-color: #b84a37;
  background: #b84a37;
  color: #fff;
}

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

.session-strip,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #ded8cc;
}

.metric-grid {
  border-top: 0;
  padding: 0;
}

.metric {
  min-width: 0;
  border: 1px solid #e2dbcf;
  border-radius: 8px;
  padding: 10px;
  background: #fffdfa;
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  color: #707976;
  font-size: 12px;
}

.metric strong {
  margin-top: 4px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.question-row {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
}

.question-row span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8f1ed;
  color: #184e4a;
  font-size: 12px;
  font-weight: 800;
}

.question-row p {
  margin: 2px 0 0;
  line-height: 1.35;
}

.packs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  gap: 20px;
  align-items: start;
}

.pack-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pack-card {
  overflow: hidden;
  padding: 0;
}

.deck-art {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 20px;
}

.deck-art span {
  width: 96px;
  height: 96px;
  border: 4px solid rgba(255, 255, 255, 0.72);
  font-size: 34px;
}

.pack-card-head,
.pack-card p,
.pack-meta,
.pack-card ol {
  margin-left: 16px;
  margin-right: 16px;
}

.pack-card-head {
  margin-top: 16px;
}

.pack-card p {
  color: #5d6764;
  line-height: 1.45;
  margin-top: 10px;
}

.pack-meta {
  margin-top: 10px;
  font-weight: 750;
}

.pack-card ol {
  margin-top: 12px;
  margin-bottom: 16px;
  padding-left: 20px;
  color: #303735;
}

.pack-card li {
  margin: 7px 0;
  line-height: 1.35;
}

.clip-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.clip-card {
  overflow: hidden;
}

.clip-card video {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #101416;
}

.clip-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.clip-body strong {
  line-height: 1.3;
}

.clip-body span {
  color: #5f6a66;
  font-size: 12px;
}

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

.clip-actions a,
.clip-actions button {
  flex: 1 1 110px;
  text-align: center;
  font-size: 13px;
}

.clip-status a {
  color: #184e4a;
  font-weight: 750;
}

.empty-note {
  grid-column: 1 / -1;
  border: 1px dashed #cfc7bb;
  border-radius: 8px;
  padding: 16px;
  color: #66706f;
  line-height: 1.45;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: min(92vw, 560px);
  border-radius: 8px;
  padding: 12px 14px;
  background: #171b1f;
  color: #fff;
  box-shadow: 0 18px 44px rgba(31, 38, 35, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
}

@media (max-width: 1180px) {
  .recorder-grid {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .question-panel {
    grid-column: 1 / -1;
  }

  .clip-grid,
  .account-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tab {
    padding: 8px 6px;
    font-size: 13px;
  }

  .status-pill {
    justify-self: stretch;
  }

  .recorder-grid,
  .packs-layout,
  .pack-cards,
  .clip-grid,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .stage {
    order: -1;
  }

  .camera-wrap {
    min-height: 62vh;
  }

  .session-strip,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls .button {
    flex: 1 1 calc(50% - 10px);
  }

  .question-text {
    font-size: 27px;
  }

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