/* ─────────────────────────────────────────────────────────────
   MAYA · neon cosmic theme for Telegram Mini App
   Mobile-first, dark base, 4 sacred neons (red/cyan/blue/amber)
   ───────────────────────────────────────────────────────────── */

:root {
  --bg-0: #050010;
  --bg-1: #0a0420;
  --bg-2: #110735;
  --bg-card: rgba(20, 10, 50, 0.55);
  --bg-card-2: rgba(30, 15, 70, 0.4);
  --hairline: rgba(180, 160, 255, 0.18);
  --hairline-2: rgba(180, 160, 255, 0.08);

  --ink: #e8e2ff;
  --ink-dim: rgba(232, 226, 255, 0.65);
  --ink-faint: rgba(232, 226, 255, 0.38);

  /* 4 sacred neons */
  --n-red:    oklch(0.72 0.22 22);
  --n-cyan:   oklch(0.88 0.16 195);
  --n-blue:   oklch(0.68 0.24 265);
  --n-amber:  oklch(0.88 0.17 85);
  --n-violet: oklch(0.62 0.22 305);

  /* glow strength */
  --glow: 1;

  /* typography */
  --font-display: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 60% at 30% 10%, rgba(120, 60, 220, 0.28), transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 90%, rgba(20, 200, 220, 0.18), transparent 60%),
    radial-gradient(ellipse 100% 100% at 50% 50%, var(--bg-1) 0%, var(--bg-0) 100%);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─────────────────────────────────────────────────────────────
   Background layers: stars, scanlines, vignette
   ───────────────────────────────────────────────────────────── */
#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 4px 90px;
  min-height: 100vh;
  background: transparent;
  isolation: isolate;
}

#particles {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}

.scanlines {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.0) 0px,
    rgba(255,255,255,0.0) 2px,
    rgba(180, 160, 255, 0.025) 2px,
    rgba(180, 160, 255, 0.025) 3px
  );
  mix-blend-mode: screen;
}

.vignette {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 6;
  background: radial-gradient(ellipse 80% 80% at 50% 50%, transparent 50%, rgba(0,0,0,0.55) 100%);
}


/* ─────────────────────────────────────────────────────────────
   Navigation header
   ───────────────────────────────────────────────────────────── */
#nav {
  display: grid;
  grid-template-columns: 44px 44px 1fr 44px 44px;
  align-items: center;
  gap: 8px;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--bg-0) 60%, transparent 100%);
  z-index: 10;
}
.nav-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  transition: all .2s;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.nav-btn:active { background: rgba(255,255,255,.1); transform: scale(.92); }
.today-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.date-tap {
  text-align: center;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 12px;
  transition: background .2s;
  flex: 1;
  min-width: 0;
}
.date-tap:active { background: var(--bg-card); }

#date-display .day {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
#date-display .full {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: 2px;
}
#date-display .full b,
#date-display .full strong {
  color: var(--n-cyan);
  text-shadow: 0 0 calc(10px * var(--glow)) currentColor;
}

/* ─────────────────────────────────────────────────────────────
   Neon color classes
   ───────────────────────────────────────────────────────────── */
.c-red    { color: var(--n-red); }
.c-cyan   { color: var(--n-cyan); }
.c-blue   { color: var(--n-blue); }
.c-amber  { color: var(--n-amber); }
.c-violet { color: var(--n-violet); }

/* ─────────────────────────────────────────────────────────────
   Card / surface
   ───────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(8px);
  overflow: hidden;
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px;
  font-weight: 500;
}
.card-title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--n-cyan);
  box-shadow: 0 0 calc(8px * var(--glow)) var(--n-cyan);
}

/* ─────────────────────────────────────────────────────────────
   Typography helpers
   ───────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.display {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}
.mono { font-family: var(--font-mono); }
.dim { color: var(--ink-dim); }
.muted { color: var(--ink-faint); }
.kin-num {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-shadow:
    0 0 calc(10px * var(--glow)) currentColor,
    0 0 calc(30px * var(--glow)) currentColor;
}
.hr { height: 1px; background: var(--hairline); margin: 14px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ─────────────────────────────────────────────────────────────
   Seal & tone images
   ───────────────────────────────────────────────────────────── */
.seal-img {
  vertical-align: middle;
  object-fit: contain;
}
.seal-img.round { border-radius: 50%; }
.seal-img.glow {
  filter: drop-shadow(0 0 calc(8px * var(--glow)) currentColor);
}
.tone-img {
  vertical-align: middle;
  object-fit: contain;
}

/* ─────────────────────────────────────────────────────────────
   Kin card (main hero)
   ───────────────────────────────────────────────────────────── */
.kin-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.kin-header {
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seal-badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 96px; height: 96px;
  border-radius: 50%;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1.5px solid var(--hairline);
  background: rgba(255,255,255,0.03);
}
.seal-badge img {
  border-radius: 50%;
}
.seal-badge.red {
  border-color: color-mix(in oklab, var(--n-red) 40%, transparent);
  box-shadow: 0 0 calc(24px * var(--glow)) color-mix(in oklab, var(--n-red) 30%, transparent);
}
.seal-badge.cyan {
  border-color: color-mix(in oklab, var(--n-cyan) 40%, transparent);
  box-shadow: 0 0 calc(24px * var(--glow)) color-mix(in oklab, var(--n-cyan) 30%, transparent);
}
.seal-badge.blue {
  border-color: color-mix(in oklab, var(--n-blue) 40%, transparent);
  box-shadow: 0 0 calc(24px * var(--glow)) color-mix(in oklab, var(--n-blue) 30%, transparent);
}
.seal-badge.amber {
  border-color: color-mix(in oklab, var(--n-amber) 40%, transparent);
  box-shadow: 0 0 calc(24px * var(--glow)) color-mix(in oklab, var(--n-amber) 30%, transparent);
}

.kin-number {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow:
    0 0 calc(10px * var(--glow)) currentColor,
    0 0 calc(30px * var(--glow)) currentColor;
}
.kin-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 2px;
  color: var(--ink);
}
.kin-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* ─────────────────────────────────────────────────────────────
   Info grid (seal, tone, wave, castle)
   ───────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.info-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: background .2s, transform .1s, border-color .2s;
}
.info-item:hover { background: rgba(255,255,255,.06); border-color: var(--hairline); }
.info-item:active { transform: scale(0.97); }
.info-sub {
  font-size: 10px;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 4px;
  line-height: 1.3;
}
.info-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.32em;
}
.info-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.info-value .seal-img,
.info-value .tone-img { margin-right: 4px; }

/* ─────────────────────────────────────────────────────────────
   WaveBar — 13-column progress strip
   ───────────────────────────────────────────────────────────── */
.wave-bar {
  margin: 14px 0;
}
.wave-bar .wave-bar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  display: flex; justify-content: space-between;
}
.wave-bar-strip {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 3px;
}
.wave-bar-cell {
  height: 6px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--hairline-2);
  transition: all .25s;
}
.wave-bar-cell.active {
  background: currentColor;
  box-shadow: 0 0 calc(8px * var(--glow)) currentColor;
  border-color: transparent;
}
.wave-bar-cell.passed {
  background: color-mix(in oklab, currentColor 35%, transparent);
  border-color: transparent;
}

/* ─────────────────────────────────────────────────────────────
   Expand panels
   ───────────────────────────────────────────────────────────── */
.expand-panel {
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 18px;
  margin-bottom: 0;
  transition: max-height .3s ease, opacity .25s ease, padding .25s ease, margin .25s ease, border-color .25s ease;
}
.expand-panel.open {
  max-height: 500px;
  opacity: 1;
  padding: 16px 18px;
  margin-bottom: 12px;
  border-color: var(--hairline);
}
.expand-panel h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 10px;
}
.expand-panel p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-dim);
}
.expand-close {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--n-cyan);
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 0;
}

/* ─────────────────────────────────────────────────────────────
   Bracket frame — angular corner brackets
   ───────────────────────────────────────────────────────────── */
.bracket-frame {
  position: relative;
  padding: 22px 18px;
}
.bracket-frame::before, .bracket-frame::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 1.5px solid currentColor;
  box-shadow: 0 0 calc(8px * var(--glow)) currentColor;
}
.bracket-frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.bracket-frame::after  { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }
.bracket-frame .br-tr {
  position: absolute; width: 18px; height: 18px;
  border: 1.5px solid currentColor;
  box-shadow: 0 0 calc(8px * var(--glow)) currentColor;
  top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 6px;
}
.bracket-frame .br-bl {
  position: absolute; width: 18px; height: 18px;
  border: 1.5px solid currentColor;
  box-shadow: 0 0 calc(8px * var(--glow)) currentColor;
  bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 6px;
}

/* ─────────────────────────────────────────────────────────────
   Affirmation / transmission
   ───────────────────────────────────────────────────────────── */
.affirmation {
  background: rgba(8, 4, 24, 0.7);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.affirmation .aff-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.affirmation .aff-body {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-line;
}
.affirmation .aff-line {
  color: var(--ink);
}
.affirmation .aff-prefix {
  color: var(--n-cyan);
}
.affirmation .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--n-cyan);
  font-style: normal;
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   Question block
   ───────────────────────────────────────────────────────────── */
.question-block {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 12px;
  text-align: center;
}
.question-block .q {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* ─────────────────────────────────────────────────────────────
   Detail section (description)
   ───────────────────────────────────────────────────────────── */
.detail-section {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.detail-section h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.detail-section h3 .dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block;
}
.detail-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
}
.section-intro,
.detail-section .section-intro,
.expand-panel .section-intro {
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
  line-height: 1.3;
  margin: 4px 0 0;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}
.section-intro + .pp-props,
.section-intro + .pp-main {
  border-top: none;
}

/* ─────────────────────────────────────────────────────────────
   GAP badge
   ───────────────────────────────────────────────────────────── */
.gap-badge {
  display: inline-block;
  background: var(--n-red);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.12em;
  box-shadow: 0 0 calc(8px * var(--glow)) var(--n-red);
}

/* ─────────────────────────────────────────────────────────────
   Oracle cross
   ───────────────────────────────────────────────────────────── */
.oracle-cross {
  display: grid;
  grid-template-areas:
    ". guide ."
    "anti main analog"
    ". hidden .";
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 8px;
  margin: 16px 0;
}
.oracle-cell {
  text-align: center;
  padding: 10px 4px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  cursor: pointer;
  transition: all .2s;
  display: flex; flex-direction: column; align-items: center;
}
.oracle-cell:hover { border-color: currentColor; }
.oracle-cell:active { transform: scale(0.95); }
.oracle-cell.main {
  background: rgba(40, 20, 80, 0.6);
  border-color: color-mix(in oklab, currentColor 40%, transparent);
  box-shadow:
    0 0 calc(30px * var(--glow)) color-mix(in oklab, currentColor 35%, transparent),
    inset 0 0 24px color-mix(in oklab, currentColor 15%, transparent);
}
.oracle-cell .seal-icon { font-size: 28px; line-height: 1; margin: 4px 0; }
.oracle-cell .seal-icon img { border-radius: 50%; }
.oracle-cell .kin-num-cell {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 calc(8px * var(--glow)) currentColor;
  margin-top: 2px;
}
.oracle-cell .role {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 2px;
}

.oracle-list { margin-top: 12px; }
.oracle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--hairline-2);
  transition: background .2s;
  cursor: pointer;
  border-radius: 10px;
}
.oracle-row:hover { background: rgba(255,255,255,.04); }
.oracle-row:last-child { border-bottom: none; }
.oracle-row.highlighted {
  background: color-mix(in oklab, var(--n-cyan) 10%, transparent);
  border-color: transparent;
}
.oracle-arrow {
  font-size: 16px; width: 24px; text-align: center; flex-shrink: 0;
  color: var(--ink-faint);
}
.oracle-info { flex: 1; }
.oracle-role {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.oracle-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-top: 2px;
}
.oracle-hint {
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
  margin-top: 2px;
}
.oracle-seal-desc { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.oracle-seal-img { flex-shrink: 0; }
.oracle-nav-hint { font-size: 10px; color: var(--ink-faint); margin-top: 4px; opacity: 0.5; }
.oracle-row:hover .oracle-nav-hint { opacity: 1; }
.legend-hint { font-size: 10px; opacity: 0.5; cursor: help; }

/* ─────────────────────────────────────────────────────────────
   Wave list (kins of wave)
   ───────────────────────────────────────────────────────────── */
.wave-kin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.wave-kin-row:hover { background: rgba(255,255,255,.06); }
.wave-kin-row:active { background: rgba(255,255,255,.08); }
.wave-kin-row.current {
  font-weight: bold;
  background: color-mix(in oklab, var(--n-cyan) 10%, transparent);
  border-color: color-mix(in oklab, var(--n-cyan) 25%, transparent);
  box-shadow: 0 0 calc(8px * var(--glow)) color-mix(in oklab, var(--n-cyan) 15%, transparent);
}
.wave-kin-row .wave-kin-marker {
  width: 16px; text-align: center; flex-shrink: 0;
  font-size: 12px; color: var(--n-cyan);
}
.wave-kin-row .wave-kin-img { flex-shrink: 0; }
.wave-kin-row .wave-kin-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.wave-kin-row .wave-kin-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

/* ─────────────────────────────────────────────────────────────
   Wave & DooT banners
   ───────────────────────────────────────────────────────────── */
.wave-banner {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  text-align: center;
}
.wave-banner .emoji { font-size: 24px; }
.wave-banner .text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 4px;
  color: var(--ink);
}
.doot-banner {
  background: linear-gradient(135deg, rgba(100,40,140,0.3), rgba(20,200,220,0.2));
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--n-cyan);
}

/* ─────────────────────────────────────────────────────────────
   CycleStrip — swipeable bars for Cycles tab
   ───────────────────────────────────────────────────────────── */
.cycle-strip {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}
.cycle-strip-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.cycle-strip-grid {
  display: grid;
  gap: 4px;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
  position: relative;
}
.cycle-strip-grid:active { cursor: grabbing; }
.cycle-cell {
  min-height: 44px;
  padding: 6px 2px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-faint);
  transition: all .4s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-mono); text-align: center;
  pointer-events: none;
  transform: scale(1);
  opacity: 0.6;
}
.cycle-cell.active {
  color: currentColor;
  opacity: 1;
}

/* smooth sliding marker — one element that transitions between cells */
.cycle-marker {
  position: absolute;
  pointer-events: none;
  border: 1.5px solid currentColor;
  background: color-mix(in oklab, currentColor 18%, transparent);
  box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in oklab, currentColor 50%, transparent);
  border-radius: 8px;
  z-index: 2;
  transition: left .35s cubic-bezier(.2,.7,.3,1), top .35s cubic-bezier(.2,.7,.3,1),
              width .35s cubic-bezier(.2,.7,.3,1), height .35s cubic-bezier(.2,.7,.3,1);
}
.cycle-cell .cell-num { font-size: 16px; font-weight: 600; }
.cycle-cell .cell-label {
  font-size: 8px; letter-spacing: 0.12em;
  margin-top: 3px; opacity: 0.55;
  text-transform: uppercase;
}
.cycle-cell.active .cell-label { opacity: 1; }

.cycle-info-card {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
  animation: fadeIn .25s ease;
}
.cycle-strip {
  transition: border-color .4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.cycle-strip-grid {
  transition: all .3s ease;
}

/* ─────────────────────────────────────────────────────────────
   Tab bar (bottom)
   ───────────────────────────────────────────────────────────── */
#tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px 8px env(safe-area-inset-bottom, 8px);
  background: linear-gradient(180deg, transparent, rgba(5, 0, 16, 0.92) 30%);
  z-index: 20;
  backdrop-filter: blur(12px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: none;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all .2s;
}
.tab:active { transform: scale(.95); }
.tab .tab-icon { font-size: 16px; line-height: 1; }
.tab.active {
  color: var(--n-cyan);
  background: rgba(20, 200, 220, 0.08);
  border-color: rgba(20, 200, 220, 0.25);
  box-shadow: 0 0 calc(14px * var(--glow)) rgba(20, 200, 220, 0.25);
}

/* ─────────────────────────────────────────────────────────────
   Tzolkin grid
   ───────────────────────────────────────────────────────────── */
.tzolkin-grid-wrapper {
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  padding: 4px;
  overflow-x: auto;
}
.tzolkin-grid {
  display: grid;
  grid-template-columns: 28px repeat(13, minmax(20px, 1fr));
  grid-template-rows: repeat(20, auto);
  gap: 2px;
  min-width: 300px;
}
.tzolkin-header-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
}
.tzolkin-header-cell.mystic { color: var(--ink-dim); background: rgba(255,255,255,.04); }
.tzolkin-row-header {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tzolkin-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s;
  min-height: 34px;
  aspect-ratio: 1 / 1.15;
  position: relative;
  gap: 1px;
  padding: 1px 0;
}
.tzolkin-cell:hover { transform: scale(1.15); z-index: 2; }
.tzolkin-cell:active { transform: scale(0.95); }

/* Neon colors for tzolkin cells */
.tzolkin-cell.color-red    { background: oklch(0.45 0.15 22);  color: #fff; }
.tzolkin-cell.color-cyan   { background: oklch(0.75 0.08 195); color: #0a0420; }
.tzolkin-cell.color-blue   { background: oklch(0.40 0.16 265); color: #fff; }
.tzolkin-cell.color-amber  { background: oklch(0.72 0.12 85);  color: #0a0420; }
.tzolkin-cell.color-gap    { background: oklch(0.55 0.14 155); color: #fff; }
.tzolkin-cell.color-mystic { background: rgba(120,100,160,0.4); color: var(--ink-dim); }

.tzolkin-cell.mag-gate {
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 2px !important;
}
.tzolkin-cell.spectral-polar {
  border: 1.5px solid var(--n-violet);
  border-radius: 50% !important;
}
.tzolkin-cell.current-kin {
  box-shadow: 0 0 12px #fff, inset 0 0 8px rgba(255,255,255,.3);
  outline: 2.5px solid #fff;
  z-index: 3;
  transform: scale(1.15);
}
.tzolkin-cell.birth-kin {
  box-shadow: 0 0 8px var(--n-cyan);
  outline: 2px solid var(--n-cyan);
  z-index: 1;
}

.tz-kin-num { font-size: 9px; font-weight: 800; }

/* Tzolkin legend */
.tzolkin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.tzolkin-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* Maya numeral dots & bars */
.maya-num {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.maya-bar {
  display: block;
  width: 10px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.maya-dots {
  display: flex;
  gap: 1px;
  justify-content: center;
}
.maya-dot {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

/* ─────────────────────────────────────────────────────────────
   Moon tab clickable items
   ───────────────────────────────────────────────────────────── */
.moon-clickable {
  cursor: pointer;
  transition: background .2s;
  border-radius: 8px;
}
.moon-clickable:hover { background: rgba(255,255,255,.06); }

/* ─────────────────────────────────────────────────────────────
   Modal overlay
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 0, 16, 0.75);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 18px;
  max-width: 440px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: fadeIn .3s ease;
  backdrop-filter: blur(12px);
}
.modal-content h3 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 12px;
}
.modal-close {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--n-violet), var(--n-blue));
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  box-shadow: 0 0 calc(12px * var(--glow)) var(--n-violet);
}
.modal-close:active { opacity: .8; }

/* ─────────────────────────────────────────────────────────────
   Personal kin section
   ───────────────────────────────────────────────────────────── */
.birth-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}
.birth-input-group input[type="date"] {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,.04);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  color-scheme: dark;
}
.birth-input-group button {
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--n-violet), var(--n-blue));
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  box-shadow: 0 0 calc(12px * var(--glow)) var(--n-violet);
}
.birth-clear-btn {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: underline;
}
.connection-list { margin-top: 12px; }
.connection-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline-2);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}
.connection-item:last-child { border: none; }
.connection-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  color: var(--n-cyan);
}
.connection-text { flex: 1; }

/* pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 100px;
  border: 1px solid var(--hairline);
  background: rgba(255,255,255,0.03);
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-dim);
}
.pill .pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 calc(6px * var(--glow)) currentColor;
}

/* ─────────────────────────────────────────────────────────────
   Tone badge above kin number
   ───────────────────────────────────────────────────────────── */
.tone-above {
  margin-bottom: 6px;
  opacity: 0.85;
}

/* ─────────────────────────────────────────────────────────────
   Kin popup overlay
   ───────────────────────────────────────────────────────────── */
.popup-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 0, 16, 0.75);
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.popup-card {
  background: var(--bg-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 18px;
  max-width: 340px;
  width: 100%;
  max-height: 75vh;
  overflow-y: auto;
  animation: fadeIn .2s ease;
  backdrop-filter: blur(12px);
}
.popup-close-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.popup-close-btn:active { background: rgba(255,255,255,0.08); }

/* ─────────────────────────────────────────────────────────────
   Animations
   ───────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.kin-card, .affirmation, .question-block, .oracle-cross, .detail-section,
.wave-banner, .expand-panel.open, .card, .cycle-strip {
  animation: fadeIn .3s ease;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.blink { animation: blink 1s steps(2) infinite; }

/* ─────────────────────────────────────────────────────────────
   Music toggle button
   ───────────────────────────────────────────────────────────── */
.music-btn {
  position: fixed;
  bottom: 72px;
  right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(5, 0, 16, 0.75);
  color: var(--ink-faint);
  font-size: 18px;
  cursor: pointer;
  z-index: 25;
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
  transition: all .25s;
}
.music-btn:active { transform: scale(.92); }
.music-btn.playing {
  color: var(--n-cyan);
  border-color: color-mix(in oklab, var(--n-cyan) 50%, transparent);
  box-shadow: 0 0 calc(14px * var(--glow)) color-mix(in oklab, var(--n-cyan) 40%, transparent);
}

/* Settings button (mirrors music-btn on the left) */
.settings-btn {
  position: fixed;
  bottom: 72px;
  left: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: rgba(5, 0, 16, 0.75);
  color: var(--ink-faint);
  font-size: 18px;
  cursor: pointer;
  z-index: 25;
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
  transition: all .25s;
}
.settings-btn:active { transform: scale(.92); }

/* Vibration toast */
.vib-toast {
  position: fixed;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5,0,16,0.95);
  border: 1px solid var(--n-amber);
  box-shadow: 0 0 16px color-mix(in oklab, var(--n-amber) 30%, transparent);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: pre;
  text-align: center;
  z-index: 9999;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity .3s;
  letter-spacing: .04em;
  line-height: 1.8;
  max-width: 90vw;
}
.vib-toast.show { opacity: 1; }

/* Haptic visual pulse — edge glow on every haptic call */
@keyframes haptic-pulse {
  0%   { box-shadow: inset 0 0 0 0px transparent; }
  35%  { box-shadow: inset 0 0 0 3px rgba(180,160,255,0.35); }
  100% { box-shadow: inset 0 0 0 0px transparent; }
}
#app.haptic-flash { animation: haptic-pulse 140ms ease-out; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(180,160,255,0.15); border-radius: 2px; }


/* Long Count table */
.maya-lc-table { display: flex; flex-direction: column; gap: 4px; }
.maya-lc-row {
  display: grid;
  grid-template-columns: 88px 90px 70px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  font-family: var(--font-mono);
  font-size: 11px;
}
.maya-lc-row.lc-highlight {
  background: rgba(180,160,255,0.07);
  border-left: 2px solid var(--n-violet);
}
.lc-name { color: var(--ink); font-size: 12px; letter-spacing: 0.04em; }
.lc-days { color: var(--n-amber); text-align: right; white-space: nowrap; }
.lc-years { color: var(--n-cyan); text-align: right; white-space: nowrap; }
.lc-note { color: var(--ink-faint); line-height: 1.4; }

/* Unified popup sections */
.pp-intro {
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
  line-height: 1.3;
  margin: 0 0 10px;
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}
.pp-props {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--ink-dim);
  margin: 0 0 12px;
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
}
.pp-main {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
  margin: 0;
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
  font-family: var(--font-body);
}

/* ─────────────────────────────────────────────────────────────
   Collapsible sections (PRO mode)
   ───────────────────────────────────────────────────────────── */
.collapsible-header {
  cursor: pointer;
  position: relative;
  padding-left: 18px;
}
.collapsible-header::before {
  content: '▸';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--ink-faint);
  transition: transform .2s;
}
.collapsible.open .collapsible-header::before {
  transform: translateY(-50%) rotate(90deg);
}
.collapsible-body {
  display: none;
  margin-top: 10px;
  animation: fadeIn .2s ease;
}
.collapsible.open .collapsible-body {
  display: block;
}

/* ─────────────────────────────────────────────────────────────
   Harmonic grouping in wave kin list
   ───────────────────────────────────────────────────────────── */
.wave-kin-row.harm-first {
  border-top: 1px solid rgba(180,160,255,0.2);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  margin-top: 4px;
}
.wave-kin-row.harm-last {
  border-bottom: 1px solid rgba(180,160,255,0.2);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  margin-bottom: 4px;
}
.wave-kin-row.harm-first,
.wave-kin-row.harm-last,
.wave-kin-row.harm-first ~ .wave-kin-row:not(.harm-first):not(.harm-last) {
  border-left: 1px solid rgba(180,160,255,0.15);
  border-right: 1px solid rgba(180,160,255,0.15);
}
.wave-kin-row.harm-open-top {
  border-top: 1px dashed rgba(180,160,255,0.15);
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}
.wave-kin-row.harm-open-bottom {
  border-bottom: 1px dashed rgba(180,160,255,0.15);
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

/* ─────────────────────────────────────────────────────────────
   Status badges (GAP, Gate, Harmonic)
   ───────────────────────────────────────────────────────────── */
.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.status-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: opacity .2s;
}
.status-badge:active { opacity: 0.7; }
.gap-bg { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.gate-bg { background: rgba(255,255,255,0.08); color: var(--ink); border: 1px solid var(--hairline); }
.sp-bg { background: rgba(192,125,255,0.12); color: var(--n-violet); border: 1px solid rgba(192,125,255,0.3); }
.harm-bg { background: rgba(255,255,255,0.04); color: var(--ink-faint); border: 1px solid var(--hairline-2); }

/* ─────────────────────────────────────────────────────────────
   Kin search
   ───────────────────────────────────────────────────────────── */
.kin-search-row {
  display: flex;
  gap: 8px;
}
.kin-search-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s;
  -moz-appearance: textfield;
}
.kin-search-input::-webkit-inner-spin-button,
.kin-search-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.kin-search-input:focus { border-color: var(--n-cyan); }
.kin-search-input::placeholder { color: var(--ink-faint); }
.kin-search-go {
  width: 48px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: rgba(125,223,239,0.1);
  color: var(--n-cyan);
  font-size: 20px;
  cursor: pointer;
  transition: all .2s;
}
.kin-search-go:active { background: rgba(125,223,239,0.2); transform: scale(0.95); }

/* ─────────────────────────────────────────────────────────────
   Share button
   ───────────────────────────────────────────────────────────── */
.share-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(125,223,239,0.08);
  color: var(--n-cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: all .2s;
}
.share-btn:active {
  background: rgba(125,223,239,0.18);
  transform: scale(0.97);
}

/* ─────────────────────────────────────────────────────────────
   Tab transition
   ───────────────────────────────────────────────────────────── */
#card {
  transition: opacity .15s ease, transform .15s ease;
}
#card.tab-fade {
  opacity: 0;
  transform: translateY(6px);
}

/* ─────────────────────────────────────────────────────────────
   Desktop adaptation
   ───────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  #app {
    max-width: 680px;
    padding: 0 20px 90px;
  }
  .kin-card, .detail-section, .affirmation {
    padding: 24px 22px;
  }
  #nav {
    padding: 20px 0 16px;
  }
  .tzolkin-cell {
    min-height: 42px;
  }
  .tz-kin-num { font-size: 11px; }
  .maya-bar { width: 14px; height: 3px; }
  .maya-dot { width: 3px; height: 3px; }
  .tzolkin-grid {
    grid-template-columns: 32px repeat(13, minmax(28px, 1fr));
  }
  .oracle-cross {
    gap: 8px;
  }
  .cycle-info-card {
    padding: 20px;
  }
}

@media (min-width: 1024px) {
  #app {
    max-width: 800px;
    padding: 0 28px 90px;
  }
  .kin-card, .detail-section, .affirmation {
    padding: 28px 26px;
  }
  .tzolkin-cell {
    min-height: 48px;
  }
  .tz-kin-num { font-size: 12px; }
}
