/* ============================================================
   STAGE — the animation viewport
   ============================================================ */
.hero-demo-wrap { overflow: visible; }
.hero-demo-caption {
  font-size: 12px;
  color: var(--v2-muted, #6F6E66);
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
  font-family: var(--v2-font-sans, system-ui, sans-serif);
}
.stage {
  width: 100%;
  min-height: 400px;
  position: relative;
  overflow: visible;
}

/* ── Title card — cinematic text reveal ── */
#stage > .title-card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14130F;
  z-index: 50;
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
:root[data-theme="light"] #stage > .title-card { background: #FAFAF7; }
#stage > .title-card.is-visible { opacity: 1 !important; }
#stage .title-card__text {
  font-family: var(--v2-font-sans, system-ui, sans-serif);
  font-size: clamp(20px, 4vw, 34px);
  font-weight: 700;
  color: var(--v2-ink, #F2EFE5);
  color: var(--ink);
  text-align: center;
  padding: 32px;
  line-height: 1.35;
  max-width: 440px;
}
/* Each word reveals with stagger */
#stage .title-card__text .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
#stage .title-card__text .word.is-visible {
  opacity: 1;
  transform: translateY(0);
}
#stage .title-card__text .accent {
  color: var(--v2-teal, #14B8A6);
}
#stage .title-card__text .num {
  font-family: var(--mono);
  font-size: 1.4em;
  font-weight: 800;
}

/* Logo — SVG gradient stroke draw */
#stage .brand-wrap {
  display: inline-block;
  margin: 0 auto 20px;
}
#stage .brand-svg { display: block; }
#stage .brand-stroke {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: brandDraw 1.8s cubic-bezier(0.22,1,0.36,1) 0.3s forwards, brandGlow 3s ease-in-out 2.1s infinite;
}
@keyframes brandDraw { to { stroke-dashoffset: 0; } }
@keyframes brandGlow { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

#stage .brand-url {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 18px;
  opacity: 0;
  animation: urlReveal 0.5s ease 2s forwards;
}
@keyframes urlReveal { to { opacity: 0.5; } }

/* ── Selection bar (Ctrl+A select) ── */
#stage .sel-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  background: linear-gradient(180deg, #1a6b5a 0%, #14685a 100%);
  color: #fff;
  padding: 10px 16px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(100%);
  transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}
#stage .sel-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
}
#stage .sel-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}
#stage .sel-sum { font-weight: 700; }
#stage .sel-limit-wrap { }
#stage .sel-limit-bar {
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin-bottom: 4px;
}
#stage .sel-limit-used {
  height: 100%;
  background: rgba(255,255,255,0.4);
  transition: width 0.8s cubic-bezier(0.22,1,0.36,1);
}
#stage .sel-limit-new {
  height: 100%;
  background: #F5A623;
  border-radius: 0 3px 3px 0;
  width: 0;
  transition: width 1s cubic-bezier(0.22,1,0.36,1) 0.3s;
  box-shadow: 0 0 8px rgba(245,166,35,0.5);
}
#stage .sel-limit-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  opacity: 0.6;
}

/* Selected rows */
#stage tr.selected td {
  background: #E3F5F1 !important;
}
#stage tr.selected td:first-child::before {
  content: '✓ ';
  color: var(--teal);
  font-weight: 700;
}

/* ── Animated cursor ── */
#stage .cursor {
  position: absolute;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.2));
}
#stage .cursor.is-visible { opacity: 1; }
#stage .cursor svg { width: 24px; height: 24px; }

/* ── Mockup (1C-style ERP) ── */
#stage .mock {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #EDE6D0 0%, #E8DFC4 4%, #E8DFC4 100%);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity 0.5s ease;
  border-radius: 6px;
  overflow: hidden;
}
.mock.is-hidden { opacity: 0 !important; }

/* Toolbar */
#stage .mock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(180deg, #F0E9D4 0%, #E8DFC4 100%);
  border-bottom: 1px solid #C9BFA5;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5C5646;
}
#stage .mock-header::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  box-shadow: 14px 0 0 #FFC107, 28px 0 0 #F44336;
  margin-right: 16px;
  flex-shrink: 0;
}
#stage .mock-btn {
  background: linear-gradient(180deg, #1e7a67 0%, #14685a 100%);
  color: #fff;
  padding: 7px 16px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: all 0.3s ease;
  cursor: pointer;
}

/* KPIs strip */
#stage .mock-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #F4EDD8;
  border-bottom: 1px solid #C9BFA5;
}
#stage .mock-kpi {
  padding: 10px 14px;
  border-right: 1px solid #D4CAAE;
  text-align: center;
}
#stage .mock-kpi:last-child { border-right: 0; }
#stage .mock-kpi-label {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8C8370;
  margin-bottom: 2px;
}
#stage .mock-kpi-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #3D3929;
}
#stage .mock-kpi-value.ok { color: #0d7a6a; }
#stage .mock-kpi-value.warn { color: #B8860B; }

/* Table */
#stage .mock-table {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #FEFDFB;
}
#stage .mock-table::-webkit-scrollbar { width: 6px; }
#stage .mock-table::-webkit-scrollbar-track { background: #F0EBD9; }
#stage .mock-table::-webkit-scrollbar-thumb { background: #C9BFA5; border-radius: 3px; }

#stage table { width: 100%; border-collapse: collapse; }
#stage th {
  padding: 8px 14px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8C8370;
  background: linear-gradient(180deg, #EDE6D0 0%, #E8DFC4 100%);
  border-bottom: 2px solid #C9BFA5;
  position: sticky;
  top: 0;
  z-index: 2;
}
#stage td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid #F0EBD9;
  font-variant-numeric: tabular-nums;
  background: #FEFDFB;
  color: #3D3929;
  transition: background 0.3s ease;
}
#stage tr:hover td { background: #FAF6EC; }
#stage tr.target td {
  background: #FFF8E1;
}
#stage td.num { color: #A09A8A; font-size: 11px; }
#stage .co-cell { display: inline-flex; align-items: center; gap: 6px; }
#stage .co-logo { width: 16px; height: 16px; object-fit: contain; flex-shrink: 0; filter: grayscale(0.3); }
#stage td.co { font-weight: 500; }
#stage td.sum { text-align: right; font-weight: 500; }
#stage th:last-child, #stage td:last-child { text-align: right; padding-right: 16px; }

/* Status badges */
#mock .status {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-size: 8px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  padding: 2px 6px !important;
  border-radius: 3px !important;
  white-space: nowrap !important;
}
#mock .status::before {
  content: '' !important;
  width: 5px !important;
  height: 5px !important;
  border-radius: 50% !important;
  background: currentColor !important;
  flex-shrink: 0 !important;
}
#mock .status-ok {
  color: #0d7a6a !important;
  background: rgba(20,184,166,0.1) !important;
}
#mock .status-ok.just-registered {
  animation: successPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes successPop {
  0%   { transform: scale(0.7) rotate(-4deg); opacity: 0; filter: blur(4px); }
  60%  { transform: scale(1.08) rotate(1deg); opacity: 1; filter: blur(0); }
  100% { transform: scale(1) rotate(0); opacity: 1; filter: blur(0); }
}
#mock .status-ok::before {
  box-shadow: 0 0 4px rgba(20,184,166,0.5) !important;
}
#mock .status-wait {
  color: #946a0c !important;
  background: rgba(231,132,16,0.08) !important;
}
#mock .status-pending {
  color: #A09A8A !important;
  background: rgba(0,0,0,0.03) !important;
}
#mock .status-send {
  color: #946a0c !important;
  background: rgba(231,132,16,0.08) !important;
}
#mock .status-send::before {
  animation: pulse 1s ease infinite !important;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.3;transform:scale(.5)} }

/* ── Toast (Telegram notification) ── */
#mock .toast {
  position: absolute !important;
  top: 16px !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateX(-30%) translateY(calc(-100% - 30px)) scale(0.85) rotate(-2deg);
  width: 280px !important;
  height: auto !important;
  z-index: 20;
  background: #1B1B1B !important;
  color: #F5F5F5 !important;
  padding: 14px 18px !important;
  font-family: var(--v2-font-sans, system-ui, sans-serif) !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15), 0 12px 36px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.06) !important;
  opacity: 0;
  filter: blur(4px);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              filter 0.3s ease;
  display: block !important;
  flex-direction: unset !important;
  align-items: unset !important;
  gap: 0 !important;
  border: none !important;
  animation: none !important;
}
#mock .toast.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateX(-50%) translateY(0) scale(1) rotate(0deg);
}
#mock .toast-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#mock .toast-brand {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
#mock .toast-time { font-size: 10px; opacity: 0.4; }
#mock .toast-status {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
#mock .toast-detail {
  font-size: 11px;
  opacity: 0.5;
  margin-top: 3px;
}
#mock .toast-line {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}
#mock .toast-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Capability reel ── */
#stage .reel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--paper);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
#stage .reel.is-visible { opacity: 1 !important; }
/* Glitch out — clip-path slicing + chromatic aberration */
#stage .reel.glitch-out .reel-inner,
#stage .reel.glitch-out .reel-logo {
  position: relative;
  animation: glitchBase 0.8s steps(1) forwards;
}
#stage .reel.glitch-out .reel-inner::before,
#stage .reel.glitch-out .reel-inner::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
}
#stage .reel.glitch-out .reel-inner::before {
  color: #0ff;
  animation: glitchLeft 0.8s steps(2) forwards;
  clip-path: inset(0 0 60% 0);
}
#stage .reel.glitch-out .reel-inner::after {
  color: #f0f;
  animation: glitchRight 0.8s steps(2) forwards;
  clip-path: inset(60% 0 0 0);
}
@keyframes glitchBase {
  0%   { opacity: 1; }
  10%  { transform: skewX(-2deg); }
  20%  { transform: skewX(3deg); }
  30%  { transform: skewX(-1deg) translateX(-3px); }
  50%  { transform: skewX(2deg) translateX(2px); opacity: 0.7; }
  70%  { transform: skewX(-4deg); opacity: 0.4; }
  85%  { transform: skewX(1deg); opacity: 0.15; }
  100% { transform: skewX(0); opacity: 0; }
}
@keyframes glitchLeft {
  0%   { transform: translateX(0); opacity: 0; }
  15%  { transform: translateX(-6px); opacity: 0.6; }
  30%  { transform: translateX(4px); opacity: 0.4; }
  50%  { transform: translateX(-8px); opacity: 0.7; }
  70%  { transform: translateX(3px); opacity: 0.3; }
  100% { transform: translateX(0); opacity: 0; }
}
@keyframes glitchRight {
  0%   { transform: translateX(0); opacity: 0; }
  15%  { transform: translateX(5px); opacity: 0.5; }
  35%  { transform: translateX(-7px); opacity: 0.6; }
  55%  { transform: translateX(6px); opacity: 0.5; }
  75%  { transform: translateX(-4px); opacity: 0.2; }
  100% { transform: translateX(0); opacity: 0; }
}
#stage .reel-inner {
  display: flex;
  align-items: baseline;
  gap: 0;
  font-family: var(--mono);
  font-size: clamp(16px, 3vw, 22px);
  color: var(--ink);
  overflow: hidden;
  padding: 0 24px;
}
#stage .reel-fix {
  font-weight: 400;
  opacity: 0.5;
  white-space: nowrap;
  flex-shrink: 0;
}
#stage .reel-mid {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  max-width: 400px;
  overflow: hidden;
  transition: max-width 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease 0.2s, margin 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0 0.15em;
}
#stage .reel-mid.is-collapsed {
  max-width: 0;
  opacity: 0;
  margin: 0;
}
#stage .reel-dash {
  opacity: 0.3;
  flex-shrink: 0;
}
#stage .reel-fix--done {
  color: var(--teal);
  opacity: 0;
  font-weight: 700;
  transition: opacity 0.6s ease 0.8s;
}
#stage .reel-fix--done.is-visible {
  opacity: 1;
}
#stage .reel-com {
  opacity: 0;
  transition: opacity 0.5s ease 0.4s;
}
#stage .reel-com.is-visible {
  opacity: 0.4;
}
#stage .reel-logo {
  margin-bottom: 24px;
  opacity: 0;
}
#stage .reel-logo.is-visible {
  opacity: 1;
}
#stage .reel-logo-stroke {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}
#stage .reel-logo.is-visible .reel-logo-stroke {
  animation: rlDraw 1.5s ease-out forwards, rlGlow 3s ease-in-out 1.5s infinite;
}
@keyframes rlDraw { to { stroke-dashoffset: 0; } }
@keyframes rlGlow { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }
#stage .reel-slot {
  display: inline-block;
  height: 1.4em;
  overflow: hidden;
  vertical-align: bottom;
  flex-shrink: 1;
  min-width: 0;
}
#stage .reel-items {
  display: flex;
  flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
#stage .reel-item {
  height: 1.4em;
  display: flex;
  align-items: center;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
}

/* ── Debug bar ── */
.debug {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--ink); color: var(--paper);
