/* ═══════════════════════════════════════════════════════════
   TRUSTYBULL — base.css v3.0
   Design tokens · Reset · Shell · Rail · SPA transitions
   Nothing else. No components. No page-specific styles.
═══════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ──────────────────────────────────────── */
:root {
  /* Background layers */
  --c-bg:      #08090d;
  --c-bg2:     #0f1117;
  --c-bg3:     #161a24;
  --c-bg4:     #1c2030;

  /* Borders */
  --c-border:  rgba(255,255,255,.07);
  --c-border2: rgba(255,255,255,.13);

  /* Text */
  --c-text1:   #eceef3;
  --c-text2:   #8b92a8;
  --c-text3:   #4e5568;

  /* Brand */
  --c-red:     #e5091a;
  --c-red2:    #b91318;
  --c-green:   #16c784;
  --c-blue:    #2962ff;
  --c-blue2:   #5b8ff9;

  /* Layout */
  --rail-w:    70px;

  /* Typography */
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  /* Speed */
  --t-fast: .12s ease;
  --t-base: .2s ease;
}

/* ── JUNIOR MODE SKIN ── */
body.mode-junior {
    --c-red:     #f59e0b;
    --c-bg:      #080c1a;
    --c-bg2:     #0e1428;
    --c-bg3:     #141d35;
    --c-bg4:     #1a2440;
    --c-border:  rgba(255,255,255,.07);
    --c-border2: rgba(255,255,255,.12);
}


/* ── FONTS ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=DM+Mono:wght@400;500&display=swap');

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text1);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

/* ── APP SHELL ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── MAIN CONTENT AREA ──────────────────────────────────── */
.tb-main {
  margin-left: var(--rail-w);
  width: calc(100% - var(--rail-w));
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--c-bg);
  scrollbar-width: none;
}
.tb-main::-webkit-scrollbar { display: none; }

/* ── SPA PAGE TRANSITIONS ───────────────────────────────── */
.tb-main.page-exit          { opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.tb-main.page-enter         { opacity: 0; }
.tb-main.page-enter-active  { opacity: 1; transition: opacity .18s ease; }

/* ── ICON RAIL — DESKTOP ────────────────────────────────── */
.icon-rail {
  position: fixed;
  top: 0; left: 0;
  width: var(--rail-w);
  height: 100vh;
  height: 100dvh;
  background: var(--c-bg2);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 16px;
  gap: 2px;
  z-index: 1000;
}

/* ── LOGO ───────────────────────────────────────────────── */
.rail-logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 30px; flex-shrink: 0;
  transition: transform var(--t-fast);
}
.rail-logo:hover { transform: scale(1.05); }

/* ── NAV ICON ───────────────────────────────────────────── */
.rail-icon {
  width: 54px; height: 54px;
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  color: var(--c-text2);
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.rail-icon svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  transition: transform var(--t-fast);
}
.rail-icon span {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
}
@media (min-width: 901px) {
  .rail-icon span { display: none; }

  /* ── Cinematic dark-glass tooltip ── */
  .rail-icon::after {
    content: attr(aria-label);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);

    /* Glass pill */
    padding: 7px 14px;
    border-radius: 8px;
    background: rgba(12, 13, 20, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(229, 9, 26, 0.25);

    /* Left red accent glow */
    box-shadow:
      -2px 0 0 0 rgba(229, 9, 26, 0.7),
      0 0 0 0 rgba(229, 9, 26, 0),
      0 8px 24px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);

    /* Type */
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--c-text1);
    white-space: nowrap;

    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transition:
      opacity .18s ease,
      transform .18s cubic-bezier(.2, .9, .2, 1),
      box-shadow .18s ease;
  }

  /* Pointer arrow */
  .rail-icon::before {
    content: '';
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) scaleX(0.6);
    width: 0; height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid rgba(229, 9, 26, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
  }

  .rail-icon:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    box-shadow:
      -2px 0 0 0 rgba(229, 9, 26, 0.9),
      0 0 12px rgba(229, 9, 26, 0.15),
      0 8px 24px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .rail-icon:hover::before {
    opacity: 1;
    transform: translateY(-50%) scaleX(1);
  }

  /* Active icon — accent gold on tooltip border instead of red */
  .rail-icon.active::after {
    border-color: rgba(229, 9, 26, 0.45);
    box-shadow:
      -2px 0 0 0 var(--c-red),
      0 0 16px rgba(229, 9, 26, 0.2),
      0 8px 24px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: var(--c-red);
  }

  /* Don't override the active pip (::before) */
  .rail-icon.active::before {
    border-right-color: rgba(229, 9, 26, 0.6);
  }
}
.rail-icon:hover {
  background: var(--c-bg3);
  color: var(--c-text1);
  transform: translateY(-1px);
}
.rail-icon:hover svg { transform: scale(1.08); }

/* Active state: red tint + left accent pip */
.rail-icon.active {
  background: rgba(229,9,26,.12);
  color: var(--c-red);
}
.rail-icon.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--c-red);
  box-shadow: 0 0 8px rgba(229,9,26,.5);
}

/* ── DIVIDER ────────────────────────────────────────────── */
.rail-divider {
  width: 34px;
  margin: 6px 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}
/* Top gradient arm */
.rail-divider::before {
  content: '';
  display: block;
  width: 1px;
  height: 14px;
  background: linear-gradient(to bottom, transparent, rgba(229,9,26,.35));
}
/* Glowing center dot */
.rail-divider-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(229,9,26,.55);
  box-shadow:
    0 0 6px rgba(229,9,26,.45),
    0 0 14px rgba(229,9,26,.15);
  flex-shrink: 0;
}
/* Bottom gradient arm */
.rail-divider::after {
  content: '';
  display: block;
  width: 1px;
  height: 14px;
  background: linear-gradient(to top, transparent, rgba(229,9,26,.35));
}

.rail-spacer { flex: 1; }

/* ── ICON RAIL — MOBILE BOTTOM NAV ─────────────────────── */
@media (max-width: 900px) {
  .icon-rail {
    position: fixed;
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 62px;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 6px 4px;
    border-right: none;
    border-top: 1px solid var(--c-border);
    gap: 0;
    z-index: 99999;
  }
  .rail-logo    { display: none; }
  .rail-spacer  { display: none; }
  .rail-divider { display: none; }
  .rail-icon    { flex: 1; width: auto; height: 100%; border-radius: 10px; }
  .rail-icon.active::before { display: none; } /* no left pip on mobile */
  .tb-main      { margin-left: 0; width: 100%; padding-bottom: 70px; }

  /* Mobile active: bottom glow instead */
  .rail-icon.active::after {
    content: '';
    position: absolute;
    bottom: 3px; left: 50%;
    transform: translateX(-50%);
    width: 18px; height: 2px;
    border-radius: 2px;
    background: var(--c-red);
    box-shadow: 0 0 6px rgba(229,9,26,.5);
  }

  /* Hide desktop-only items on mobile */
  .rail-desktop-only { display: none !important; }
}

/* ── MORE BUTTON (mobile only) ──────────────────────────── */
.rail-more { display: none; }

@media (max-width: 900px) {
  .rail-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1; height: 100%;
    color: var(--c-text2);
    cursor: pointer;
    border: none; background: none;
    font-family: var(--font-body);
    border-radius: 10px;
    transition: color var(--t-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .rail-more:hover  { color: var(--c-text1); }
  .rail-more.active { color: var(--c-red); }
  .rail-more span   { font-size: 8.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .rail-more-dots   { display: flex; flex-direction: column; gap: 3px; align-items: center; height: 17px; justify-content: center; }
  .rail-more-dot    { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
}

/* ── MORE OVERLAY ───────────────────────────────────────── */
.rail-overlay {
  position: fixed; inset: 0;
  background: rgba(8,9,13,.97);
  z-index: 99998;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.2,.9,.2,1);
  overflow-y: auto;
}
.rail-overlay.open { transform: translateY(0); }

.rail-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.rail-overlay-title {
  font-family: var(--font-display);
  font-size: 32px; color: var(--c-text1); letter-spacing: .04em;
}
.rail-overlay-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c-bg3); border: 1px solid var(--c-border2);
  color: var(--c-text1); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body); transition: background var(--t-fast);
}
.rail-overlay-close:hover { background: var(--c-bg4); }

.rail-overlay-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 20px 24px;
}
.rail-overlay-card {
  background: var(--c-bg2); border: 1px solid var(--c-border2);
  border-radius: var(--r-lg); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; text-decoration: none; color: var(--c-text1);
  transition: background var(--t-fast);
}
.rail-overlay-card:hover { background: var(--c-bg3); }
.rail-overlay-card-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rail-overlay-card-icon svg { width: 16px; height: 16px; }
.rail-overlay-card-name { font-size: 13px; font-weight: 700; color: var(--c-text1); }
.rail-overlay-card-sub  { font-size: 11px; color: var(--c-text3); margin-top: 1px; }

.rail-overlay-section {
  padding: 4px 24px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c-text3);
}
.rail-overlay-links {
  display: flex; flex-direction: column;
  padding: 0 24px; gap: 0;
}
.rail-overlay-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  cursor: pointer; text-decoration: none;
  color: var(--c-text2); font-size: 14px; font-weight: 500;
  transition: color var(--t-fast);
}
.rail-overlay-link:last-child { border-bottom: none; }
.rail-overlay-link:hover { color: var(--c-text1); }
.rail-overlay-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.rail-overlay-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 12px;
}
.rail-overlay-version { font-size: 11px; color: var(--c-text3); flex: 1; }
.rail-overlay-signout {
  font-size: 12px; font-weight: 700; color: #ff8f8f;
  background: none; border: none; cursor: pointer;
  font-family: var(--font-body);
  display: flex; align-items: center; gap: 6px;
  transition: opacity var(--t-fast);
}
.rail-overlay-signout:hover { opacity: .8; }
.rail-overlay-signout svg { width: 13px; height: 13px; }

/* ── KEYFRAME: PULSE ────────────────────────────────────── */
@keyframes tb-pulse {
  0%, 100% { opacity: 1;  transform: scale(1); }
  50%       { opacity: .4; transform: scale(.82); }
}
.tb-pulse { animation: tb-pulse 1.8s ease-in-out infinite; }