/* SadhnaVault — Sacred Temple (Night) v4
   Mobile redesign: hamburger drawer for app-bar, tab nav becomes top
   sticky element, snapshot button & brand stay outside React mount.
   ─────────────────────────────────────────────────────────────────── */

/* ──── Floating "Live Snapshot" button (outside React mount) ──── */
#sv-snapshot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font-family: 'Cinzel', 'Cormorant Garamond', serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #1a1038;
  background: linear-gradient(180deg, #ffd97a, #e6c068 55%, #b78a2f);
  border: 1px solid #ffd97a;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(230, 192, 104, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.55);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
  cursor: pointer;
}
#sv-snapshot:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 12px 30px rgba(230, 192, 104, 0.55),
              0 0 0 3px rgba(230, 192, 104, 0.22);
}
#sv-snapshot small {
  opacity: 0.75;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* ──── Mobile sidebar chrome (hidden on desktop) ──── */
#sv-menu, #sv-brand, #sv-drawer-backdrop, #sv-sidebar { display: none; }

/* ─── Original v2 base styles below ─── */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Spectral:wght@400;500;600;700&family=Tiro+Devanagari+Sanskrit&display=swap');

:root {
  /* Cosmic palette */
  --night-0: #0a0617;
  --night-1: #120a26;
  --night-2: #1a1038;
  --night-3: #251650;
  --night-4: #2f1a64;
  --veil: rgba(255, 244, 214, 0.08);

  --gold:        #e6c068;
  --gold-bright: #ffd97a;
  --gold-deep:   #b78a2f;
  --gold-glow:   rgba(230, 192, 104, 0.55);

  --saffron:     #ff9933;
  --sindoor:     #d63031;
  --maroon:      #6e0e1a;
  --rose:        #ffb5b5;
  --jade:        #7be39d;
  --lotus:       #ffc4e1;

  --ink:         #fff4d6;
  --ink-soft:    #e8d8a8;
  --muted:       #b9a37a;
  --line:        rgba(230, 192, 104, 0.32);
  --line-soft:   rgba(230, 192, 104, 0.14);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.65);
  --glow-gold: 0 0 24px rgba(230, 192, 104, 0.35);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: 'Spectral', 'Cormorant Garamond', 'Noto Serif Devanagari', Georgia, serif;
  font-weight: 400;
  line-height: 1.6;

  background:
    radial-gradient(1100px 700px at 12% -8%, #3a1d7a 0%, transparent 55%),
    radial-gradient(900px 600px at 110% 8%, #5a1942 0%, transparent 50%),
    radial-gradient(1000px 800px at 50% 120%, #1f0d4a 0%, transparent 55%),
    linear-gradient(180deg, #0a0617 0%, #120a26 60%, #0a0617 100%);
  background-attachment: fixed;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  position: relative;
  overflow-x: hidden;
}

/* ───────── Cosmic backdrop layers ───────── */
body::before {
  /* Starfield + faint mandala dust */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, rgba(255, 244, 214, 0.85), transparent 60%),
    radial-gradient(1.2px 1.2px at 78% 32%, rgba(255, 244, 214, 0.7), transparent 60%),
    radial-gradient(1.6px 1.6px at 38% 72%, rgba(255, 217, 122, 0.85), transparent 60%),
    radial-gradient(1px 1px at 88% 84%, rgba(255, 244, 214, 0.6), transparent 60%),
    radial-gradient(1.2px 1.2px at 22% 88%, rgba(255, 244, 214, 0.7), transparent 60%),
    radial-gradient(1px 1px at 64% 12%, rgba(255, 244, 214, 0.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 50% 50%, rgba(255, 217, 122, 0.6), transparent 60%);
  background-size: 1200px 900px;
  animation: drift 120s linear infinite;
  opacity: 0.85;
}

body::after {
  /* Massive yantra watermark */
  content: "";
  position: fixed;
  top: 50%; left: 50%;
  width: 90vmin;
  height: 90vmin;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600' fill='none' stroke='%23ffd97a' stroke-width='1.2'><circle cx='300' cy='300' r='280'/><circle cx='300' cy='300' r='220'/><circle cx='300' cy='300' r='160'/><circle cx='300' cy='300' r='100'/><circle cx='300' cy='300' r='40'/><polygon points='300,40 470,330 130,330'/><polygon points='300,560 130,270 470,270'/><polygon points='40,180 560,180 300,560'/><polygon points='40,420 560,420 300,40'/><line x1='20' y1='300' x2='580' y2='300'/><line x1='300' y1='20' x2='300' y2='580'/><line x1='100' y1='100' x2='500' y2='500'/><line x1='100' y1='500' x2='500' y2='100'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  animation: spin 240s linear infinite;
}

@keyframes drift {
  0%   { background-position: 0 0; }
  100% { background-position: 1200px 900px; }
}
@keyframes spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after { animation: none !important; }
}

#root { min-height: 100vh; position: relative; z-index: 1; }
a { color: var(--gold-bright); text-decoration: none; }
a:hover { color: #fff; text-shadow: 0 0 8px var(--gold-glow); }

/* ───────── Glass surface helper ───────── */
.app-bar,
.panel,
.tab-nav,
.login-card,
.duo-card,
.path-card,
.result-card,
.utility-card,
.admin-card,
.editor-card,
.stat-grid article,
.note-card {
  background:
    linear-gradient(180deg, rgba(36, 22, 76, 0.78), rgba(18, 10, 38, 0.78));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 244, 214, 0.06);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

/* ───────── Shell ───────── */
.app-shell {
  max-width: 1380px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 120px;
}

/* ───────── Login (webapp polish + mandala backdrop) ───────── */
.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  isolation: isolate;
  /* extra cosmic glow behind everything */
  background:
    radial-gradient(720px 520px at 50% 40%, rgba(110, 14, 26, 0.45) 0%, transparent 60%),
    radial-gradient(900px 700px at 50% 90%, rgba(36, 22, 76, 0.6) 0%, transparent 70%);
}

/* Layer A: Animated Sri-Yantra mandala (rotates very slowly) */
.login-shell::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: min(94vmin, 720px);
  height: min(94vmin, 720px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -2;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600' fill='none' stroke='%23ffd97a' stroke-width='1.1' opacity='0.85'><defs><radialGradient id='g' cx='50%25' cy='50%25' r='50%25'><stop offset='0%25' stop-color='%23ffd97a' stop-opacity='0.55'/><stop offset='40%25' stop-color='%23e6c068' stop-opacity='0.18'/><stop offset='100%25' stop-color='%236e0e1a' stop-opacity='0'/></radialGradient></defs><circle cx='300' cy='300' r='280' fill='url(%23g)'/><circle cx='300' cy='300' r='280'/><circle cx='300' cy='300' r='240'/><circle cx='300' cy='300' r='200'/><circle cx='300' cy='300' r='160'/><circle cx='300' cy='300' r='120'/><circle cx='300' cy='300' r='80'/><circle cx='300' cy='300' r='40'/><circle cx='300' cy='300' r='10' fill='%23ffd97a' stroke='none'/><polygon points='300,40 470,330 130,330'/><polygon points='300,560 130,270 470,270'/><polygon points='300,90 440,330 160,330'/><polygon points='300,510 160,270 440,270'/><polygon points='300,140 410,330 190,330'/><polygon points='300,460 190,270 410,270'/><polygon points='300,180 380,320 220,320'/><polygon points='300,420 220,280 380,280'/><line x1='20' y1='300' x2='580' y2='300'/><line x1='300' y1='20' x2='300' y2='580'/><line x1='100' y1='100' x2='500' y2='500'/><line x1='100' y1='500' x2='500' y2='100'/><g stroke='%23ffd97a' stroke-width='0.7' opacity='0.7'><circle cx='300' cy='300' r='292'/><circle cx='300' cy='300' r='298'/></g><g fill='%23ffd97a' stroke='none' opacity='0.85'><circle cx='300' cy='12' r='3'/><circle cx='300' cy='588' r='3'/><circle cx='12' cy='300' r='3'/><circle cx='588' cy='300' r='3'/><circle cx='88' cy='88' r='2.6'/><circle cx='512' cy='88' r='2.6'/><circle cx='88' cy='512' r='2.6'/><circle cx='512' cy='512' r='2.6'/></g></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 0 60px rgba(230, 192, 104, 0.45));
  opacity: 0.85;
  animation: mandala-spin 240s linear infinite;
}

/* Layer B: Giant ॐ glyph behind the card */
.login-shell::after {
  content: "ॐ";
  position: absolute;
  font-family: 'Tiro Devanagari Sanskrit', serif;
  font-size: clamp(140px, 22vw, 280px);
  background: linear-gradient(180deg, #ffd97a 0%, #b78a2f 60%, #6e0e1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 60px rgba(230, 192, 104, 0.35));
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  top: 50%; left: 50%;
  transform: translate(-50%, -52%);
  z-index: -1;
  opacity: 0.55;
  line-height: 1;
}

@keyframes mandala-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .login-shell::before { animation: none; }
}

.login-card {
  padding: 40px 32px 36px;
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  border-radius: 24px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(230, 192, 104, 0.35),
    0 0 60px rgba(230, 192, 104, 0.18);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(36, 22, 76, 0.86), rgba(14, 8, 32, 0.92));
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  animation: login-rise 0.7s cubic-bezier(0.22, 0.8, 0.32, 1) both;
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card::before {
  /* Inner double-border ornament */
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid var(--gold);
  border-radius: 18px;
  pointer-events: none;
  opacity: 0.55;
}
.login-card::after {
  /* Top-edge gold ribbon glow */
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  box-shadow: 0 0 18px rgba(230, 192, 104, 0.55);
}

.login-title {
  font-family: 'Cinzel', 'Cormorant Garamond', serif;
  font-size: clamp(1.85rem, 5vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-align: center;
  font-weight: 700;
  background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 55%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  margin: 0;
  position: relative;
  padding-bottom: 14px;
}
.login-title::after {
  /* Underline ornament */
  content: "❖";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 0.55em;
  text-shadow: 0 0 12px var(--gold-glow);
  background: none;
  -webkit-text-fill-color: var(--gold);
}

/* Login form inputs get a touch more padding & glow */
.login-card label {
  display: grid;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold);
}
.login-card input {
  padding: 13px 16px;
  font-size: 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(10, 6, 23, 0.7), rgba(18, 10, 38, 0.7));
  border: 1px solid var(--line);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.login-card input:focus {
  border-color: var(--gold-bright);
  background: rgba(18, 10, 38, 0.92);
  box-shadow: 0 0 0 3px rgba(230, 192, 104, 0.28),
              0 0 26px rgba(230, 192, 104, 0.22);
}
.login-card button {
  margin-top: 6px;
  padding: 14px 18px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  border-radius: 14px;
  box-shadow:
    0 10px 26px rgba(230, 192, 104, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.error-text {
  color: #ffb6b6;
  margin: 0;
  font-weight: 500;
  font-size: 0.88rem;
  text-align: center;
  text-shadow: 0 0 10px rgba(214, 48, 49, 0.4);
  background: rgba(110, 14, 26, 0.35);
  border: 1px solid rgba(255, 182, 182, 0.35);
  padding: 8px 12px;
  border-radius: 10px;
}

/* ───────── App Bar ───────── */
.app-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 16px 22px;
  position: relative;
  border-radius: var(--radius-md);
}
.app-bar::after {
  content: "❖";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  margin: 0 auto;
  width: 24px; height: 14px;
  text-align: center;
  color: var(--gold);
  font-size: 0.7rem;
  text-shadow: 0 0 8px var(--gold-glow);
}
.app-bar::before {
  content: "";
  position: absolute;
  left: 18px; right: 18px; bottom: 6px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.55;
}
.app-bar-title {
  display: grid;
  gap: 4px;
  min-width: 160px;
}
.app-bar-title strong {
  font-family: 'Cinzel', serif;
  font-size: 1.45rem;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 60%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-bar-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--gold);
  margin: 0;
  font-size: 0.6rem;
  font-weight: 700;
  font-family: 'Cinzel', serif;
}

.soft-copy { color: var(--ink-soft); font-size: 0.88rem; }

/* ───────── Quick summary chips ───────── */
.quick-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-summary span {
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(230, 192, 104, 0.18), rgba(110, 14, 26, 0.32));
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 244, 214, 0.18), 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* ───────── Sticky tab bar ───────── */
.sticky-tab-bar { position: sticky; top: 10px; z-index: 20; margin-bottom: 14px; }
.tab-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px;
  border-radius: var(--radius-md);
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab-button {
  white-space: nowrap;
  color: var(--ink-soft);
  background: linear-gradient(180deg, rgba(36, 22, 76, 0.6), rgba(18, 10, 38, 0.6));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.22s ease;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
}
.tab-button:hover {
  color: var(--gold-bright);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(230, 192, 104, 0.12), inset 0 0 12px rgba(230, 192, 104, 0.1);
  transform: translateY(-1px);
}
.tab-button small {
  width: 22px; height: 22px;
  background: rgba(230, 192, 104, 0.18);
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  font-family: 'Spectral', serif;
}
.tab-button.active {
  color: #1a1038;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(230, 192, 104, 0.22), 0 8px 22px rgba(230, 192, 104, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.5);
}
.tab-button.active small {
  background: var(--maroon);
  color: var(--gold-bright);
  border-color: var(--gold-deep);
}

/* ───────── Panels & cards ───────── */
.panel {
  padding: 20px;
  position: relative;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  position: relative;
}
.panel-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.5;
}

.action-row { display: flex; align-items: end; gap: 10px; }

/* ───────── Forms ───────── */
.app-bar-tools label,
.editor-grid label,
.utility-card label,
.inline-filter {
  color: var(--ink-soft);
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.78rem;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

textarea, input, select, .editor-body, .compact-textarea {
  box-sizing: border-box;
  color: var(--ink);
  width: 100%;
  font: inherit;
  font-family: 'Spectral', serif;
  background: linear-gradient(180deg, rgba(10, 6, 23, 0.6), rgba(18, 10, 38, 0.6));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
textarea::placeholder, input::placeholder { color: rgba(232, 216, 168, 0.45); }
textarea:focus, input:focus, select:focus, .editor-body:focus, .compact-textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(18, 10, 38, 0.85);
  box-shadow: 0 0 0 3px rgba(230, 192, 104, 0.22), 0 0 22px rgba(230, 192, 104, 0.18);
}
textarea, .editor-body { resize: vertical; min-height: 90px; }
.compact-textarea { resize: vertical; min-height: 60px; }

select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 13px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* ───────── Stat grid ───────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid article {
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
}
.stat-grid article::before {
  content: "";
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 217, 122, 0.22), transparent 70%);
}
.stat-grid strong {
  display: block;
  color: var(--gold-bright);
  font-size: 1.55rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  text-shadow: 0 0 14px rgba(230, 192, 104, 0.35);
  letter-spacing: 0.02em;
}

/* ───────── Layouts ───────── */
.dashboard, .tab-layout { display: grid; gap: 14px; }
.tab-layout.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ───────── Buttons & chips ───────── */
.chip-row, .meta-pill-row, .share-strip, .timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip, button, .admin-badge {
  color: #1a1038;
  font: inherit;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.74rem;
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, var(--gold-deep));
  border: 1px solid var(--gold-bright);
  border-radius: 999px;
  padding: 10px 18px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s;
  box-shadow: 0 6px 16px rgba(230, 192, 104, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.6);
}
button:hover, .chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 24px rgba(230, 192, 104, 0.42), 0 0 0 3px rgba(230, 192, 104, 0.18);
}
button:active { transform: translateY(0); }
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.3);
  box-shadow: none;
}

.ghost-button {
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(230, 192, 104, 0.1), rgba(230, 192, 104, 0.04));
  border: 1px solid var(--gold);
  text-shadow: 0 0 8px rgba(230, 192, 104, 0.4);
  box-shadow: inset 0 0 12px rgba(230, 192, 104, 0.1);
}
.ghost-button:hover {
  background: linear-gradient(180deg, rgba(230, 192, 104, 0.22), rgba(230, 192, 104, 0.08));
  filter: none;
  color: #fff;
}

.admin-badge {
  align-self: start;
  background: linear-gradient(180deg, var(--maroon), #3a0510);
  color: var(--gold-bright);
  border-color: var(--gold);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 12px rgba(110, 14, 26, 0.45), inset 0 1px 0 rgba(255, 244, 214, 0.12);
}

/* ───────── Result / admin / utility cards ───────── */
.result-grid, .admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.duo-strip {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 12px;
  margin: 12px 0;
}
.duo-card, .path-card {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}
.compact-strip { grid-template-columns: 1.1fr 0.9fr; }
.compact-hero { min-height: unset; }
.hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.streak-card {
  background:
    radial-gradient(220px 140px at 100% 0%, rgba(255, 217, 122, 0.32), transparent 70%),
    linear-gradient(180deg, rgba(110, 14, 26, 0.5), rgba(36, 22, 76, 0.78));
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(230, 192, 104, 0.22) inset;
}

/* ───────── Progress ───────── */
.progress-shell {
  display: grid;
  gap: 6px;
  min-width: 120px;
}
.progress-bar {
  background: rgba(10, 6, 23, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 100%;
  height: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}
.progress-fill {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--saffron), var(--gold-bright), var(--jade));
  height: 100%;
  transition: width 0.32s ease;
  box-shadow: 0 0 14px rgba(255, 217, 122, 0.55);
}

/* ───────── Path grid ───────── */
.path-grid { display: grid; gap: 10px; margin-bottom: 12px; }
.compact-path-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.path-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
}
.path-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--glow-gold);
  border-color: var(--gold);
}
.path-card.done {
  border-color: rgba(123, 227, 157, 0.5);
  background:
    linear-gradient(180deg, rgba(123, 227, 157, 0.14), rgba(36, 22, 76, 0.78));
}
.path-card.done::before {
  content: "✓";
  position: absolute;
  top: 6px; right: 10px;
  color: var(--jade);
  font-weight: 700;
}
.path-card { position: relative; }
.path-index {
  color: #1a1038;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-deep));
  border: 1px solid var(--gold-bright);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(230, 192, 104, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ───────── Result / utility / admin / editor cards ───────── */
.result-card, .utility-card, .admin-card, .editor-card {
  padding: 16px;
  border-radius: var(--radius-sm);
}
.result-card ul {
  color: var(--ink-soft);
  padding-left: 22px;
  margin: 8px 0 0;
}
.result-card ul li { margin: 4px 0; }
.result-top {
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  font-style: italic;
  letter-spacing: 0.04em;
}

.meta-pill-row span {
  color: var(--lotus);
  background: linear-gradient(180deg, rgba(255, 196, 225, 0.16), rgba(110, 14, 26, 0.32));
  border: 1px solid rgba(255, 196, 225, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ───────── Notebook ───────── */
.notebook-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
}
.note-list {
  display: grid;
  gap: 10px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 6px;
}
.note-list::-webkit-scrollbar { width: 8px; }
.note-list::-webkit-scrollbar-track { background: transparent; }
.note-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-deep), var(--maroon));
  border-radius: 999px;
}

.note-card {
  text-align: left;
  color: var(--ink);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  font-family: 'Spectral', serif;
}
.note-card:hover {
  border-color: var(--gold);
  transform: translateX(3px);
  box-shadow: var(--shadow-sm), var(--glow-gold);
}
.note-card.active {
  background:
    linear-gradient(180deg, rgba(230, 192, 104, 0.18), rgba(110, 14, 26, 0.45));
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold-bright), var(--glow-gold);
}
.note-card strong {
  font-family: 'Cormorant Garamond', serif;
  color: var(--gold-bright);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.note-card span, .note-card small { color: var(--muted); font-size: 0.76rem; }

/* ───────── Editor ───────── */
.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.editor-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}
.editor-actions { display: flex; gap: 10px; }
.editor-actions button { flex: none; }

/* ───────── Utility / Timer ───────── */
.utility-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.timer-display {
  margin: 14px 0 18px;
  font-size: clamp(2.6rem, 7vw, 4rem);
  font-weight: 700;
  font-family: 'Cinzel', serif;
  text-align: center;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 50%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(230, 192, 104, 0.45);
  filter: drop-shadow(0 8px 22px rgba(230, 192, 104, 0.25));
}

/* ───────── Muhurat list ───────── */
.muhurat-list { display: grid; gap: 10px; }
.muhurat-list article {
  border-bottom: 1px dashed var(--line);
  display: grid;
  gap: 4px;
  padding: 10px 0;
}
.muhurat-list article:last-child { border-bottom: none; }
.muhurat-list span, .muhurat-list small { color: var(--ink-soft); font-size: 0.84rem; }

/* ───────── Checkbox row ───────── */
.checkbox-row {
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.checkbox-row input { width: auto; accent-color: var(--gold); }

/* ───────── Mobile bottom nav ───────── */
.mobile-bottom-nav { display: none; }
.mobile-nav-button {
  color: var(--ink-soft);
  background: linear-gradient(180deg, rgba(36, 22, 76, 0.7), rgba(18, 10, 38, 0.7));
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mobile-nav-button.active {
  color: #1a1038;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 60%, var(--gold-deep));
  border-color: var(--gold-bright);
  box-shadow: 0 6px 18px rgba(230, 192, 104, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 0 rgba(255, 244, 214, 0.5);
}

/* ───────── Typography ───────── */
h1, h2, h3 {
  color: var(--gold-bright);
  margin: 0;
  font-family: 'Cinzel', 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 16px rgba(230, 192, 104, 0.18);
}
h1 {
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  line-height: 1.05;
  background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 60%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; line-height: 1.55; color: var(--ink-soft); }
.app-bar-title strong { font-size: 1.05rem; }
.note-card strong, .result-card h3, .admin-card strong { font-size: 1rem; }

.soft-copy,
.note-card span,
.note-card small,
.result-card p,
.result-card li,
.muhurat-list span,
.muhurat-list small,
.stat-grid small,
.stat-grid span { font-size: 0.84rem; }

/* ───────── Page-level scrollbar ───────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--night-1); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-deep), var(--maroon));
  border-radius: 999px;
  border: 2px solid var(--night-1);
}

/* ───────── Selection ───────── */
::selection { background: var(--gold); color: var(--night-0); }

/* ───────── Entry animation ───────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-bar, .panel, .login-card, .tab-nav { animation: rise 0.5s ease both; }
.panel { animation-delay: 0.05s; }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — tablet (≤1100) → mobile (≤720) → small (≤420)
   Mobile design pass v3: native-app polish, safe-area insets,
   iOS-input-zoom prevention, 44px touch targets, refined hierarchy.
   ───────────────────────────────────────────────────────────── */

/* Tablet — collapse 2-up layouts to single column */
@media (max-width: 1100px) {
  .app-bar,
  .notebook-layout,
  .utility-panel,
  .tab-layout.two-up,
  .overview-grid,
  .duo-strip,
  .compact-path-grid,
  .editor-grid,
  .stat-grid-wide { grid-template-columns: 1fr; }

  .notebook-layout .note-list {
    max-height: 40vh;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .notebook-layout .note-card { scroll-snap-align: start; }
}

/* ───────── MOBILE REDESIGN v6 — true custom sidebar ──────────────
   The mobile sidebar (#sv-sidebar) is fully owned by us — built in
   index.html, populated by drawer.js by mirroring React's .tab-button
   / .mobile-nav-button / logout control via click forwarding. This
   means the sidebar contents are guaranteed visible regardless of
   how React structures its own internal nav.

   React's own mobile chrome (.app-bar, .sticky-tab-bar,
   .mobile-bottom-nav) is hidden on mobile via display: none, except
   the .app-bar which is shown as an embedded settings panel inside
   the sidebar when the user taps the Settings disclosure.
   ─────────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { font-size: 15px; }

  .app-shell {
    padding:
      calc(max(8px, env(safe-area-inset-top)) + 60px) 10px
      calc(20px + env(safe-area-inset-bottom)) 10px;
  }

  /* Hide React's own mobile/desktop nav chrome on mobile —
     all navigation now lives in the custom sidebar. */
  .sticky-tab-bar { display: none !important; }
  .mobile-bottom-nav { display: none !important; }
  /* When .app-bar is in its React home (#root), hide it on mobile.
     drawer.js DOM-relocates it into #sv-side-settings-slot when the
     user taps Settings; the slot rule below restores normal display. */
  #root .app-bar {
    display: none !important;
  }
  /* When relocated into the sidebar slot, render it as a normal
     stacked panel: scrollable, full slot width, no fixed positioning. */
  #sv-side-settings-slot .app-bar {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 14px !important;
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(36, 22, 76, 0.7), rgba(14, 8, 32, 0.7)) !important;
    box-shadow: var(--shadow-sm) !important;
    grid-template-columns: 1fr !important;
    overflow: visible !important;
    transform: none !important;
    animation: none !important;
    z-index: auto !important;
  }
  #sv-side-settings-slot .app-bar::before,
  #sv-side-settings-slot .app-bar::after { display: none !important; }
  #sv-side-settings-slot .app-bar-title {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 4px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }
  #sv-side-settings-slot .app-bar-tools {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  #sv-side-settings-slot .app-bar-tools > * { flex: none; width: 100%; }

  /* Settings slot inside the sidebar */
  .sv-side-settings-slot {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 4px;
    margin: 4px -2px;
    border-top: 1px dashed rgba(230, 192, 104, 0.18);
    border-bottom: 1px dashed rgba(230, 192, 104, 0.18);
  }
  .sv-side-settings-slot[hidden] { display: none !important; }
  /* When settings is shown, hide the tabs section so the slot has
     room to breathe. */
  body.sv-show-settings .sv-side-tabs { display: none !important; }

  /* ─── Top brand crest (outside React) ─── */
  #sv-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    left: 56px;
    right: 56px;
    height: 44px;
    z-index: 39;
    pointer-events: none;
    line-height: 1;
  }
  #sv-brand em {
    display: block;
    font-style: normal;
    font-family: 'Cinzel', serif;
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 3px;
  }
  #sv-brand strong {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 60%, var(--gold-deep));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  /* ─── Hamburger button (outside React) ─── */
  #sv-menu {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    left: 10px;
    z-index: 10001;
    pointer-events: auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(36, 22, 76, 0.92), rgba(10, 6, 23, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md), 0 0 0 1px rgba(230, 192, 104, 0.18),
                inset 0 1px 0 rgba(255, 244, 214, 0.08);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* override default v2 button gold gradient */
    text-shadow: none;
    min-height: 0;
  }
  #sv-menu:hover { transform: none; filter: none; }
  #sv-menu span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--gold-bright);
    box-shadow: 0 0 8px rgba(230, 192, 104, 0.55);
    transition: transform 0.25s ease, opacity 0.18s ease;
  }
  body.sv-sidebar-open #sv-menu span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.sv-sidebar-open #sv-menu span:nth-child(2) { opacity: 0; }
  body.sv-sidebar-open #sv-menu span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* ─── Backdrop ─── */
  #sv-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(5, 3, 14, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  body.sv-sidebar-open #sv-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.sv-sidebar-open { overflow: hidden; }

  /* ─── CUSTOM SIDEBAR (#sv-sidebar) ─── */
  #sv-sidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 320px);
    max-width: 86vw;
    z-index: 9999;
    pointer-events: auto;
    padding:
      calc(max(14px, env(safe-area-inset-top)) + 14px) 16px
      calc(max(14px, env(safe-area-inset-bottom)) + 12px) 16px;
    background: linear-gradient(180deg, rgba(26, 16, 56, 0.98), rgba(10, 6, 23, 0.98));
    border-right: 1px solid var(--line);
    border-radius: 0 22px 22px 0;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.65),
                0 0 0 1px rgba(230, 192, 104, 0.22);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    transform: translateX(-105%);
    transition: transform 0.34s cubic-bezier(0.22, 0.8, 0.32, 1);
    overflow: hidden;
  }
  body.sv-sidebar-open #sv-sidebar { transform: translateX(0); }

  /* Force every direct & nested clickable inside the sidebar to be
     hit-testable, even if a base rule somewhere set pointer-events. */
  #sv-sidebar,
  #sv-sidebar * { pointer-events: auto; }

  .sv-side-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0 4px 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
    flex: none;
  }
  .sv-side-head em {
    font-style: normal;
    font-family: 'Cinzel', serif;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
  }
  .sv-side-head strong {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(180deg, #fff4d6, var(--gold-bright) 60%, var(--gold-deep));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .sv-side-section {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 2px;
  }
  .sv-side-tabs {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -2px 4px;
    padding: 6px 4px;
    border-bottom: 1px dashed rgba(230, 192, 104, 0.18);
    border-top: 1px dashed rgba(230, 192, 104, 0.18);
  }
  .sv-side-tabs::-webkit-scrollbar { width: 4px; }
  .sv-side-tabs::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 999px; }

  .sv-side-empty {
    color: var(--muted);
    font-size: 0.78rem;
    font-style: italic;
    padding: 8px 6px;
    margin: 0;
  }

  /* Tab buttons inside the sidebar */
  .sv-side-tab {
    /* override the v2 base "all buttons are gold pills" rule */
    display: flex !important;
    align-items: center;
    gap: 11px;
    width: 100%;
    text-align: left;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--ink-soft) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    padding: 11px 12px !important;
    border-radius: 12px !important;
    font-family: 'Cinzel', serif !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    text-transform: none !important;
    min-height: 44px !important;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  }
  .sv-side-tab:hover, .sv-side-tab:active {
    background: rgba(230, 192, 104, 0.08) !important;
    border-color: rgba(230, 192, 104, 0.22) !important;
    color: var(--gold-bright) !important;
    transform: none;
  }
  .sv-side-tab.active {
    background: linear-gradient(180deg, rgba(230, 192, 104, 0.18), rgba(110, 14, 26, 0.45)) !important;
    border-color: var(--gold) !important;
    color: var(--gold-bright) !important;
    box-shadow: inset 3px 0 0 var(--gold-bright) !important;
  }
  .sv-side-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
    flex: none;
  }
  .sv-side-tab-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Action buttons (snapshot, settings, logout) */
  .sv-side-actions {
    flex: none;
    gap: 8px;
    padding-top: 12px;
  }
  .sv-side-btn {
    /* override base button gradient */
    display: flex !important;
    align-items: center;
    gap: 11px;
    width: 100%;
    text-align: left;
    background: linear-gradient(180deg, rgba(36, 22, 76, 0.7), rgba(18, 10, 38, 0.7)) !important;
    border: 1px solid var(--line) !important;
    color: var(--ink) !important;
    text-shadow: none !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    font-family: 'Cinzel', serif !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    min-height: 46px !important;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
  }
  .sv-side-btn:hover, .sv-side-btn:active {
    background: linear-gradient(180deg, rgba(46, 30, 96, 0.85), rgba(28, 16, 50, 0.85)) !important;
    border-color: var(--gold) !important;
    color: var(--gold-bright) !important;
    transform: none;
  }
  .sv-side-btn[hidden] { display: none !important; }
  .sv-side-btn span[aria-hidden="true"] {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--gold-bright);
    text-shadow: 0 0 10px var(--gold-glow);
    flex: none;
  }
  .sv-side-btn .sv-side-btn-label { flex: 1 1 auto; }
  .sv-side-btn small {
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--muted);
  }
  .sv-side-snapshot { color: #1a1038 !important; background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, var(--gold-deep)) !important; border-color: var(--gold-bright) !important; box-shadow: 0 6px 16px rgba(230, 192, 104, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.45) !important; }
  .sv-side-snapshot:hover, .sv-side-snapshot:active { color: #1a1038 !important; filter: brightness(1.06); }
  .sv-side-snapshot span[aria-hidden="true"] { color: #1a1038 !important; text-shadow: none; }
  .sv-side-snapshot small { color: rgba(26, 16, 56, 0.72); }

  .sv-side-settings.active {
    background: linear-gradient(180deg, rgba(46, 30, 96, 0.85), rgba(28, 16, 50, 0.85)) !important;
    border-color: var(--gold) !important;
    color: var(--gold-bright) !important;
  }

  .sv-side-logout {
    border-color: rgba(214, 48, 49, 0.45) !important;
    color: #ffb6b6 !important;
  }
  .sv-side-logout:hover { background: linear-gradient(180deg, rgba(110, 14, 26, 0.6), rgba(60, 6, 14, 0.7)) !important; color: #fff !important; border-color: rgba(214, 48, 49, 0.7) !important; }
  .sv-side-logout span[aria-hidden="true"] { color: #ffb6b6; text-shadow: 0 0 10px rgba(214, 48, 49, 0.5); }

  .sv-side-foot {
    flex: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px 0;
    margin-top: 8px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  /* Hide the floating snapshot button on mobile — it lives in the sidebar */
  #sv-snapshot { display: none !important; }

  .app-bar-title .eyebrow { font-size: 0.6rem; }
  .app-bar-title strong { font-size: 1.3rem; }
  .app-bar-tools label { font-size: 0.7rem; width: 100%; }
  .quick-summary { justify-content: flex-start; gap: 6px; }
  .quick-summary span { font-size: 0.66rem; padding: 4px 10px; }

  /* Panels */
  .panel {
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 0;
  }
  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .dashboard, .tab-layout { gap: 8px; }

  /* Hero / path stack */
  .hero-card,
  .path-card {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 12px;
  }
  .duo-strip { gap: 8px; }
  .duo-card { padding: 12px; }

  /* Stats */
  .stat-grid { gap: 7px; }
  .stat-grid article { padding: 10px 12px; border-radius: 11px; }
  .stat-grid strong { font-size: 1.15rem; }
  .stat-grid article::before { width: 60px; height: 60px; top: -16px; right: -16px; }

  .path-index { width: 26px; height: 26px; font-size: 0.78rem; }

  /* Forms — 16px font is mandatory to prevent iOS zoom; everything else compact */
  textarea, input, select, .editor-body, .compact-textarea {
    font-size: 16px;
    padding: 9px 12px;
    border-radius: 10px;
    min-height: 40px;
  }
  textarea, .editor-body { min-height: 84px; }
  .compact-textarea { min-height: 56px; }

  /* Buttons — compact but still touch-friendly (≥38px) */
  .chip, button, .admin-badge {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    border-radius: 999px;
  }
  .ghost-button { padding: 8px 14px; }
  .chip-row, .meta-pill-row, .share-strip, .timer-actions { gap: 6px; }
  .editor-actions { flex-wrap: wrap; gap: 6px; }
  .editor-actions button { flex: 1 1 auto; min-width: 110px; }

  /* Notebook → horizontal swipe carousel */
  .notebook-layout { grid-template-columns: 1fr; gap: 10px; }
  .note-list {
    max-height: none;
    grid-auto-flow: column;
    grid-auto-columns: 78%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding: 2px 2px 6px;
    margin: 0 -2px;
  }
  .note-card {
    scroll-snap-align: start;
    padding: 10px 12px;
    border-radius: 12px;
  }
  .note-card strong { font-size: 0.9rem; }
  .note-card span, .note-card small { font-size: 0.7rem; }
  .note-card:hover { transform: none; }

  /* Editor cards */
  .editor-grid { gap: 10px; }
  .editor-card { padding: 12px; border-radius: 14px; gap: 8px; }

  /* Typography — toned-down hierarchy */
  h1 { font-size: clamp(1.1rem, 4.6vw, 1.4rem); line-height: 1.15; }
  h2 { font-size: 0.96rem; }
  h3 { font-size: 0.86rem; }
  .eyebrow { font-size: 0.54rem; letter-spacing: 0.16em; }
  p, .soft-copy { font-size: 0.8rem; line-height: 1.45; }

  /* Result/admin/utility cards */
  .result-card, .utility-card, .admin-card {
    padding: 12px;
    border-radius: 12px;
  }
  .result-card h3, .admin-card strong { font-size: 0.9rem; }
  .result-card ul li { font-size: 0.78rem; margin: 2px 0; }
  .result-grid, .admin-grid, .overview-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .meta-pill-row span { font-size: 0.62rem; padding: 3px 9px; }

  /* Timer — large but proportional */
  .timer-display {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
    margin: 12px 0 14px;
    letter-spacing: 0.04em;
  }
  .timer-actions { justify-content: center; gap: 6px; }
  .timer-actions button { flex: 1 1 calc(50% - 6px); }

  /* Muhurat list */
  .muhurat-list { gap: 6px; }
  .muhurat-list article { padding: 6px 0; gap: 2px; }
  .muhurat-list span, .muhurat-list small { font-size: 0.74rem; }

  /* Checkbox */
  .checkbox-row { font-size: 0.78rem; gap: 6px; }

  /* Snapshot button — small floating */
  #sv-snapshot {
    bottom: calc(78px + env(safe-area-inset-bottom));
    right: 10px;
    padding: 8px 11px;
    font-size: 0.6rem;
    border-radius: 999px;
    gap: 5px;
  }
  #sv-snapshot small { font-size: 0.54rem; }


  /* Login card */
  .login-shell { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
  .login-card { padding: 22px 18px; gap: 12px; border-radius: 18px; }
  .login-title { font-size: clamp(1.4rem, 6vw, 1.8rem); }

  html, body { overscroll-behavior-y: contain; }
}

/* ───────── Small phones (≤420px) ───────── */
@media (max-width: 420px) {
  :root { font-size: 14.5px; }
  .app-shell { padding-left: 8px; padding-right: 8px; }
  .app-bar { padding: 8px 10px 10px; }
  .app-bar-title strong { font-size: 0.94rem; }
  .panel { padding: 11px; border-radius: 13px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-grid strong { font-size: 1.2rem; }
  .timer-display { font-size: clamp(2.1rem, 11vw, 2.8rem); }
  .tab-button { padding: 6px 10px; font-size: 0.66rem; min-height: 34px; }
  .chip, button, .admin-badge { padding: 7px 12px; font-size: 0.64rem; min-height: 36px; }
  .mobile-nav-button { min-width: 50px; font-size: 0.56rem; min-height: 40px; }
  .login-card { padding: 20px 16px; }
  .editor-actions button, .timer-actions button { flex: 1 1 100%; }
}

/* Disable hover lifts on touch devices (sticky-state bug) */
@media (hover: none) {
  .path-card:hover,
  .note-card:hover,
  .tab-button:hover,
  button:hover,
  .chip:hover,
  #sv-snapshot:hover { transform: none; filter: none; }
  .path-card:active,
  .note-card:active,
  .tab-button:active,
  button:active,
  .chip:active { transform: scale(0.98); transition: transform 0.08s ease; }
}
