:root {
  --white: #FFFFFF;
  --surface: #FCF9FA;
  --ruby: #A70F35;
  --garnet: #710923;
  --pale-ruby: #F5DDE4;
  --text: #21171A;
  --muted: #74686C;
  --border: #E9E2E4;
  --success: #2E6B50;
  --warning: #9B621B;
  --danger: #9C2F2F;
  --shadow: 0 22px 60px rgba(113, 9, 35, 0.09);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--surface); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(167,15,53,.3); outline-offset: 3px; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
  opacity: .55;
}
.ambient-one { width: 330px; height: 330px; top: -170px; right: -130px; background: rgba(245,221,228,.72); }
.ambient-two { width: 240px; height: 240px; bottom: 12%; left: -160px; background: rgba(245,221,228,.4); }

.app-shell { width: min(100%, 1060px); margin: 0 auto; padding-bottom: calc(96px + var(--safe-bottom)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(76px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) clamp(18px, 4vw, 34px) 10px;
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid rgba(233,226,228,.72);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; min-width: 130px; }
.brand-logo { display: block; width: 138px; height: auto; object-fit: contain; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.offline-badge { padding: 7px 11px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); font-size: .78rem; }
.offline-badge.online { color: var(--success); background: #F1F8F4; border-color: #CFE4D8; }
.offline-badge.offline { color: var(--garnet); background: var(--pale-ruby); border-color: #EAC3CF; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border); background: var(--white); color: var(--garnet); font-size: 1.25rem; cursor: pointer; }

main { padding: 22px clamp(18px, 4vw, 34px) 40px; }
.view { animation: viewIn 330ms ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.hero, .page-intro { max-width: 760px; padding: 18px 0 20px; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--ruby); font-size: .78rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.15rem, 8vw, 4.8rem); line-height: .99; font-weight: 500; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.35rem, 4.5vw, 2rem); line-height: 1.1; font-weight: 500; }
.hero-copy, .page-intro > p:last-child, .session-copy, .dialog-copy { color: var(--muted); font-size: 1.02rem; line-height: 1.65; }

.session-card {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid rgba(167,15,53,.12);
  border-radius: 30px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}
.session-light { position: absolute; width: 150px; height: 150px; right: -40px; top: -58px; border-radius: 50%; background: radial-gradient(circle, rgba(167,15,53,.22), rgba(167,15,53,0) 68%); animation: breathe 4.5s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(.9); opacity: .55; } 50% { transform: scale(1.16); opacity: .9; } }
.session-head, .section-heading, .dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.status-pill { flex: none; padding: 7px 10px; border-radius: 999px; font-size: .76rem; font-weight: 720; }
.status-current { color: var(--garnet); background: var(--pale-ruby); }
.progress-line { height: 8px; margin: 24px 0 8px; overflow: hidden; border-radius: 999px; background: #F0EAEC; }
.progress-line span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--garnet), var(--ruby)); transition: width 480ms cubic-bezier(.2,.8,.2,1); }
.session-meta { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: .78rem; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 50px;
  padding: 13px 18px;
  border-radius: 15px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.primary-button { width: 100%; margin-top: 22px; border: 0; color: #fff; background: linear-gradient(135deg, var(--garnet), var(--ruby)); box-shadow: 0 12px 28px rgba(113,9,35,.18); font-weight: 720; }
.secondary-button { border: 1px solid var(--border); background: var(--white); color: var(--garnet); font-weight: 700; }
.primary-button:active, .secondary-button:active, .horizon-card:active { transform: scale(.985); }
.primary-button:hover { box-shadow: 0 16px 36px rgba(113,9,35,.24); }

.section-block { margin-top: 36px; }
.section-heading { margin-bottom: 16px; }
.horizon-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.horizon-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 16px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 21px;
  background: rgba(255,255,255,.84);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.horizon-card:hover { border-color: rgba(167,15,53,.35); background: #fff; transform: translateY(-2px); }
.horizon-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--pale-ruby); color: var(--garnet); font-weight: 800; }
.horizon-card strong { display: block; margin-bottom: 5px; }
.horizon-card small { display: block; color: var(--muted); line-height: 1.35; }
.truth-list { display: grid; gap: 10px; }
.truth-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 17px; border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.76); }
.truth-item p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.truth-dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(46,107,80,.09); }
.truth-dot.ready { background: var(--success); }
.truth-dot.pending { background: var(--warning); box-shadow: 0 0 0 6px rgba(155,98,27,.09); }

.roadmap-list { display: grid; gap: 12px; }
.roadmap-card { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 18px; border-radius: 20px; border: 1px solid var(--border); background: #fff; }
.roadmap-card > span { color: var(--ruby); font-size: .8rem; font-weight: 800; }
.roadmap-card p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }
.roadmap-card em { font-size: .75rem; font-style: normal; color: var(--muted); }
.roadmap-card.current { border-color: rgba(167,15,53,.35); background: linear-gradient(135deg, #fff, #FCF5F7); }

.feature-preview { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 22px; margin: 20px 0; padding: 24px; border: 1px solid var(--border); border-radius: 24px; background: #fff; }
.feature-preview p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.pulse-orb { position: relative; display: grid; place-items: center; width: 90px; height: 90px; border-radius: 50%; background: var(--pale-ruby); }
.pulse-orb::before, .pulse-orb::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; border: 1px solid rgba(167,15,53,.24); animation: ripple 2.4s ease-out infinite; }
.pulse-orb::after { animation-delay: 1.2s; }
.pulse-orb span { width: 18px; height: 18px; border-radius: 50%; background: var(--ruby); }
@keyframes ripple { from { transform: scale(.55); opacity: .9; } to { transform: scale(1.45); opacity: 0; } }

.gesture-panel { position: relative; min-height: 250px; margin: 20px 0; overflow: hidden; border: 1px solid var(--border); border-radius: 26px; background: repeating-linear-gradient(to bottom, #fff 0, #fff 56px, #F1E9EC 57px, #fff 58px); }
.gesture-line { position: absolute; height: 3px; border-radius: 99px; background: linear-gradient(90deg, var(--ruby), rgba(167,15,53,.15)); transform-origin: left center; }
.line-one { width: 150px; left: 23%; top: 42%; transform: rotate(-9deg); }
.line-two { width: 130px; left: 44%; top: 40%; transform: rotate(28deg); }
.line-three { width: 115px; left: 60%; top: 58%; transform: rotate(-16deg); }
.gesture-marker { position: absolute; width: 14px; height: 14px; left: 21%; top: calc(42% - 5px); border-radius: 50%; background: var(--ruby); box-shadow: 0 0 0 9px rgba(167,15,53,.12); animation: markerTravel 4.2s ease-in-out infinite; }
@keyframes markerTravel { 0%,100% { left: 21%; top: calc(42% - 5px); } 42% { left: 52%; top: 46%; } 72% { left: 67%; top: 57%; } }
.gesture-panel p { position: absolute; left: 18px; bottom: 0; color: var(--muted); font-size: .82rem; }

.metric-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.metric-card { padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: #fff; }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: 10px 0 6px; color: var(--garnet); font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5,1fr);
  width: min(100%, 1060px);
  min-height: calc(70px + var(--safe-bottom));
  padding: 8px 10px calc(8px + var(--safe-bottom));
  border-top: 1px solid rgba(233,226,228,.88);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; border-radius: 16px; color: var(--muted); }
.bottom-nav a > span { font-size: 1.1rem; }
.bottom-nav small { font-size: .68rem; }
.bottom-nav a.active { color: var(--garnet); background: var(--pale-ruby); }

.diagnostic-dialog { width: min(calc(100% - 24px), 620px); max-height: min(82vh, 760px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 28px; color: var(--text); background: #fff; box-shadow: 0 30px 90px rgba(33,23,26,.24); }
.diagnostic-dialog::backdrop { background: rgba(33,23,26,.42); backdrop-filter: blur(5px); }
.dialog-header { position: sticky; top: 0; z-index: 2; padding: 22px 22px 12px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }
.dialog-copy { padding: 0 22px; }
.diagnostic-list { display: grid; gap: 9px; padding: 8px 22px 14px; }
.diagnostic-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.diagnostic-item .result-dot { width: 11px; height: 11px; border-radius: 50%; background: #B7AFB2; }
.diagnostic-item.pass .result-dot { background: var(--success); }
.diagnostic-item.warn .result-dot { background: var(--warning); }
.diagnostic-item.fail .result-dot { background: var(--danger); }
.diagnostic-item small { color: var(--muted); text-align: right; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 22px 10px; }
.dialog-actions .primary-button { margin: 0; }
.diagnostic-note { min-height: 22px; margin: 0; padding: 4px 22px 24px; color: var(--muted); font-size: .84rem; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(92px + var(--safe-bottom)); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 14px; color: #fff; background: var(--text); box-shadow: 0 16px 38px rgba(33,23,26,.24); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 700px) {
  .brand-logo { width: 118px; }
  .horizon-grid, .metric-grid { grid-template-columns: 1fr; }
  .session-head { align-items: center; }
  .feature-preview { grid-template-columns: 1fr; }
  .pulse-orb { width: 78px; height: 78px; }
  .roadmap-card { grid-template-columns: 36px 1fr; }
  .roadmap-card em { grid-column: 2; }
  .dialog-actions { grid-template-columns: 1fr; }
  .bottom-nav small { font-size: .62rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
