/* Nara Demo — Base Variables & Reset */
:root {
  --indigo-deep: #1E1B4B;
  --indigo: #4F46E5;
  --indigo-soft: #312E81;
  --sand: #FBBF77;
  --sand-light: #FEF3E2;
  --slate: #0F172A;
  --white: #ffffff;

  --wa-green: #075E54;
  --wa-bg: #ECE5DD;
  --wa-bubble-in: #ffffff;
  --wa-bubble-out: #DCF8C6;
  --ig-grad: linear-gradient(135deg, #833AB4, #E1306C, #FCB045);

  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, monospace;

  /* Phone width scales with viewport; height fills available flex space */
  --phone-w: clamp(300px, 26vw, 440px);
  --phone-h-max: 900px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  color: var(--white);
  font-family: var(--font-body);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: linear-gradient(135deg, var(--indigo-deep) 0%, var(--indigo-soft) 100%);
}

.demo-stage {
  width: 100%;
  height: 100%;
  padding: 18px clamp(20px, 3vw, 40px);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

/* === 3-column grid (sidebars + center) === */
.stage-grid {
  flex: 1;
  display: grid;
  grid-template-columns: clamp(180px, 14vw, 220px) 1fr clamp(200px, 16vw, 240px);
  gap: clamp(16px, 2vw, 32px);
  min-height: 0;
}

.left-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-section {
  background: rgba(0,0,0,0.25);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-section.ticker-section {
  border-color: rgba(251,191,119,0.2);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-heading {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--sand);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.center-col {
  display: flex;
  gap: clamp(16px, 2vw, 32px);
  justify-content: center;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding-right: 2px;
}
.right-sidebar::-webkit-scrollbar { display: none; }

/* === Pause state: freeze all CSS animations === */
.demo-stage[data-state="paused"] *,
.demo-stage[data-state="paused"] *::before,
.demo-stage[data-state="paused"] *::after {
  animation-play-state: paused !important;
}
.demo-stage[data-state="paused"]::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(251,191,119,0.35);
}

/* === Topbar === */
.stage-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.stage-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--white);
}
.stage-wordmark .dot { color: var(--sand); }
.stage-tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 4px;
}
.cycling-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 1px;
}

/* === Case Pill (right sidebar) === */
.case-pill {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  text-align: left;
  color: inherit;
  font-family: inherit;
  flex-shrink: 0;
}
.case-pill:hover { background: rgba(255,255,255,0.08); }
.case-pill .case-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  letter-spacing: 2px;
}
.case-pill .case-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 3px;
}
.case-pill .case-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}
.case-pill.active {
  background: rgba(251,191,119,0.18);
  border-color: var(--sand);
}
.case-pill.active .case-num { color: var(--sand); }
.case-pill.active .case-title { color: var(--white); }
.case-pill.active .case-meta { color: rgba(251,191,119,0.7); }

/* === Phone Frames === */
.phone-frame {
  width: var(--phone-w);
  max-height: 100%;
  background: #000;
  border-radius: 40px;
  padding: 8px;
  position: relative;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
}
.phone-notch {
  width: 110px;
  height: 24px;
  background: #000;
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  border-radius: 0 0 14px 14px;
  z-index: 2;
}
.phone-screen {
  background: #fff;
  border-radius: 32px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  max-height: var(--phone-h-max);
  position: relative;
  display: flex;
  flex-direction: column;
}
.status-bar {
  background: #f1f5f9;
  padding: 5px 18px 4px;
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--indigo-deep);
  flex-shrink: 0;
}
.phone-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* === Instagram chrome === */
.ig-header {
  background: #fff;
  border-bottom: 1px solid #efefef;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ig-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ig-grad);
  flex-shrink: 0;
}
.ig-header .ig-handle { font-weight: 700; font-size: 15px; color: #000; }
.ig-header .ig-meta { font-size: 12px; color: #8e8e8e; margin-top: 1px; }
.ig-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.ig-body::-webkit-scrollbar { display: none; }
.ig-story-card {
  background: linear-gradient(135deg, var(--sand-light), #fff);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid #efefef;
  margin-bottom: 4px;
}
.ig-story-meta {
  font-size: 10px;
  color: #8e8e8e;
  font-family: var(--font-mono);
  letter-spacing: 1px;
}
.ig-story-text {
  font-size: 14px;
  font-weight: 600;
  color: #000;
  margin-top: 4px;
  line-height: 1.3;
}
.ig-reel-card {
  background: var(--ig-grad);
  border-radius: 14px;
  padding: 12px;
  color: #fff;
  margin-bottom: 4px;
}
.ig-reel-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  opacity: 0.9;
}
.ig-reel-text {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  line-height: 1.3;
}
.ig-comment-public {
  background: #f8f7f4;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: #000;
  line-height: 1.45;
}
.ig-comment-public.brand { background: #EEF2FF; border-left: 2px solid var(--indigo); }
.ig-comment-public .ig-c-handle { font-weight: 700; color: var(--indigo-deep); margin-right: 4px; }
.ig-dm {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  opacity: 0;
  transform: translateY(8px);
  animation: bubble-in 280ms ease-out forwards;
}
.ig-dm.in { background: #efefef; color: #000; align-self: flex-start; }
.ig-dm.out { background: var(--indigo); color: #fff; align-self: flex-end; }
.ig-dm strong { font-weight: 700; }

@keyframes bubble-in {
  to { opacity: 1; transform: translateY(0); }
}

/* === WhatsApp chrome === */
.wa-header {
  background: var(--wa-green);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.wa-header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--indigo-deep);
  font-size: 15px;
  flex-shrink: 0;
}
.wa-header .wa-name { font-weight: 600; font-size: 15px; color: #fff; }
.wa-header .wa-meta { font-size: 12px; color: rgba(255,255,255,0.85); margin-top: 1px; }

.wa-body {
  background: var(--wa-bg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.wa-body::-webkit-scrollbar { display: none; }

.wa-bubble {
  padding: 8px 12px;
  border-radius: 9px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.13);
  color: var(--slate);
  opacity: 0;
  transform: translateY(8px);
  animation: bubble-in 280ms ease-out forwards;
}
.wa-bubble.in  { background: var(--wa-bubble-in);  align-self: flex-start; }
.wa-bubble.out { background: var(--wa-bubble-out); align-self: flex-end; }
.wa-bubble strong { color: var(--indigo-deep); font-weight: 700; }
.wa-bubble .wa-time {
  display: inline-block;
  font-size: 9px;
  color: #667781;
  margin-left: 6px;
  font-weight: 500;
}
.wa-bubble.broadcast {
  background: #FEF3C7;
  border-left: 3px solid #F59E0B;
}

/* === Nara ticker (vertical stack in left sidebar) === */
.ticker-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.ticker-stack::-webkit-scrollbar { display: none; }
.ticker-pill {
  background: rgba(79,70,229,0.25);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateX(8px);
  animation: ticker-in 200ms ease-out forwards;
}
.ticker-pill.fade-out {
  animation: ticker-out 400ms ease-in forwards;
}
.ticker-pill.sand { background: rgba(251,191,119,0.85); color: var(--indigo-deep); }
.ticker-pill.live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #E1306C;
  animation: blink 1.5s infinite;
}
.ticker-pill.live.wa::before { background: #25D366; }
.ticker-pill strong { font-weight: 700; }
.ticker-roi {
  background: rgba(34,197,94,0.25);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  margin-top: 4px;
  flex-shrink: 0;
}
.ticker-roi strong { font-weight: 700; }

@keyframes ticker-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ticker-out {
  to { opacity: 0; transform: translateX(-8px); }
}
@keyframes blink {
  50% { opacity: 0.45; }
}

/* === Controls === */
.control-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.control-btn:hover { background: rgba(255,255,255,0.15); }
.control-btn.flash {
  background: rgba(251,191,119,0.45);
  border-color: var(--sand);
  transform: scale(0.98);
}

/* Kbd hint badges */
.btn-kbd, kbd.btn-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 2px 7px;
  border-radius: 4px;
  color: rgba(255,255,255,0.7);
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}

/* Help trigger — smaller, lower-key than control buttons */
.help-trigger {
  background: transparent;
  color: rgba(255,255,255,0.55);
  border: 1px dashed rgba(255,255,255,0.15);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.08s;
}
.help-trigger:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.85);
  border-color: rgba(251,191,119,0.4);
}
.help-trigger.flash {
  background: rgba(251,191,119,0.3);
  border-color: var(--sand);
  color: #fff;
  transform: scale(0.98);
}

/* Case-pill flash (when jumped via number key) */
.case-pill.flash {
  background: rgba(251,191,119,0.35) !important;
  border-color: var(--sand) !important;
  transform: scale(0.99);
  transition: transform 0.08s;
}
.scene-progress {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
  margin-top: 6px;
}
.scene-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--sand));
  border-radius: 100px;
  transition: width 200ms linear;
}
.scene-pace {
  font-family: var(--font-mono);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  display: block;
  text-align: left;
}

/* === Keyboard shortcuts help overlay === */
.help-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.help-overlay[hidden] { display: none; }
.help-card {
  background: rgba(30,27,75,0.92);
  border: 1px solid rgba(251,191,119,0.35);
  border-radius: 16px;
  padding: 32px 40px;
  max-width: 480px;
  width: calc(100% - 48px);
  color: #fff;
  font-family: var(--font-body);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.help-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: -0.01em;
}
.help-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.help-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.help-list > div:last-child { border-bottom: none; padding-bottom: 0; }
.help-list dt {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.help-list dd {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  text-align: right;
}
.help-hint {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-mono);
  letter-spacing: 1px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.help-card kbd, .help-hint kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(251,191,119,0.4);
  padding: 4px 9px;
  border-radius: 5px;
  color: var(--sand);
  min-width: 26px;
  text-align: center;
  display: inline-block;
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}

/* === Transition overlay === */
.transition-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  animation: fade-in 300ms ease-out;
  z-index: 10;
}
.transition-card {
  text-align: center;
  padding: 32px 48px;
  background: rgba(30,27,75,0.7);
  border: 1px solid rgba(251,191,119,0.3);
  border-radius: 14px;
  max-width: 480px;
}
.transition-card .case-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--sand);
  font-weight: 700;
}
.transition-headline {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-top: 6px;
}
.transition-detail {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  margin-top: 8px;
}
.transition-next {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(251,191,119,0.85);
  font-weight: 600;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
