:root {
  --ink: #fbfbfb; /* page background */
  --bg-contrast: #ffffff;
  --bone: #111217; /* main text */
  --ash: #5a5f66; /* secondary text */
  --dim: #f3f4f6;
  --rule: #e6e9ee; /* borders / rules */
  --accent: #1767b1; /* primary accent (blue) */
  --accent-glow: rgba(23,103,177,0.12);
  --green: #0a9d58;
  --cyan: #0aa3d8;
}

  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: linear-gradient(180deg,var(--ink),var(--bg-contrast));
  color: var(--bone);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: default;
}

    /* NOISE OVERLAY */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
}

    /* SCROLL PROGRESS */
 #progress-line {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg,var(--accent),#ff6b6b);
  box-shadow: 0 0 8px var(--accent-glow);
  z-index: 8999;
  transition: width 0.12s linear;
}

    /* =====================
       GATE / LOADING
    ===================== */
    #gate {
      position: fixed;
      inset: 0;
      background: #000;
      z-index: 9999;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 40px;
      transition: opacity 2s ease;
    }

    .gate-studio {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(4rem, 12vw, 9rem);
      letter-spacing: 0.15em;
      color: transparent;
      -webkit-text-stroke: 1px #222;
      animation: gate-breathe 4s ease-in-out infinite;
    }

    @keyframes gate-breathe {
      0%, 100% { -webkit-text-stroke: 1px #1a1a1a; }
      50% { -webkit-text-stroke: 1px #3a3a3a; }
    }

    .gate-status {
      font-family: 'Space Mono', monospace;
      font-size: 0.65rem;
      color: #2a2a2a;
      letter-spacing: 0.5em;
      text-transform: uppercase;
      text-align: center;
      line-height: 2.5;
      animation: slow-appear 2s ease forwards;
    }

    .gate-bar-wrap {
      width: 280px;
      height: 1px;
      background: #111;
      position: relative;
      overflow: hidden;
    }

    .gate-bar {
      height: 100%;
      width: 0%;
      background: var(--accent);
      transition: width 0.2s ease;
    }

    @keyframes slow-appear {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    /* =====================
       MAIN
    ===================== */
    main {
      opacity: 0;
      transition: opacity 1.5s ease;
    }
    main.visible { opacity: 1; }

    /* NAV */
    nav {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 500;
      padding: 24px 48px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid transparent;
      transition: border-color 0.4s, background 0.4s;
    }

    nav.scrolled {
      border-color: var(--rule);
      background: rgba(8,8,8,0.92);
      backdrop-filter: blur(12px);
    }

    .nav-logo {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 1.4rem;
      letter-spacing: 0.2em;
      color: var(--bone);
      text-decoration: none;
    }

    .nav-links {
      display: flex;
      align-items: center;
      gap: 40px;
      list-style: none;
    }

    .nav-links li {
      display: flex;
      align-items: center;
    }

    .nav-links a {
      font-family: 'Space Mono', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.4em;
      text-transform: uppercase;
      color: var(--ash);
      text-decoration: none;
      transition: color 0.3s;
    }

    .nav-links a:hover { color: var(--bone); }

    /* FIX: auth-nav as a proper flex item */
    #auth-nav {
      display: none;
      align-items: center;
      gap: 16px;
    }

    #auth-nav a {
      font-family: 'Space Mono', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.4em;
      text-transform: uppercase;
      color: var(--green);
      text-decoration: none;
    }

    #signed-in-indicator {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #444;
      letter-spacing: 0.2em;
    }

    /* =====================
       HERO
    ===================== */
    #hero {
      min-height: 100vh;
      display: grid;
      grid-template-rows: 1fr auto 1fr;
      grid-template-columns: 1fr 1fr 1fr;
      padding: 120px 48px 80px;
      border-bottom: 1px solid var(--rule);
      position: relative;
      align-items: center;
    }

    .hero-left {
      grid-row: 2;
      grid-column: 1;
      align-self: center;
    }

    .hero-center {
      grid-row: 1 / 4;
      grid-column: 2;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .hero-right {
      grid-row: 2;
      grid-column: 3;
      text-align: right;
      align-self: center;
    }

    .hero-tag {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #333;
      letter-spacing: 0.5em;
      text-transform: uppercase;
      display: block;
      margin-bottom: 16px;
    }

    .hero-body {
      font-family: 'IM Fell English', serif;
      font-style: italic;
      font-size: clamp(0.9rem, 1.5vw, 1.1rem);
      color: #555;
      line-height: 2;
    }

    .hero-title {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(5rem, 14vw, 11rem);
      letter-spacing: 0.05em;
      color: transparent;
      -webkit-text-stroke: 1px #2a2a2a;
      line-height: 0.9;
      writing-mode: vertical-rl;
      text-orientation: mixed;
      user-select: none;
      animation: title-breathe 9s ease-in-out infinite;
    }

    @keyframes title-breathe {
      0%, 100% { -webkit-text-stroke: 1px #222; }
      50% { -webkit-text-stroke: 1px #2e0808; }
    }

    .scroll-cue {
      position: absolute;
      bottom: 36px;
      left: 50%;
      transform: translateX(-50%);
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #252525;
      letter-spacing: 0.5em;
      text-transform: uppercase;
      animation: cue 3s ease-in-out infinite;
    }

    @keyframes cue {
      0%, 100% { opacity: 0.2; }
      50% { opacity: 0.6; }
    }

    /* =====================
       ABOUT SECTION
    ===================== */
    #about {
      max-width: 760px;
      margin: 0 auto;
      padding: 140px 48px;
      border-bottom: 1px solid var(--rule);
    }

    .section-num {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #222;
      letter-spacing: 0.5em;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 20px;
      margin-bottom: 70px;
    }

    .section-num::after {
      content: '';
      flex: 1;
      height: 1px;
      background: #181818;
    }

    .about-big {
      font-family: 'IM Fell English', serif;
      font-size: clamp(1.6rem, 3.5vw, 2.6rem);
      line-height: 1.5;
      color: var(--bone);
      margin-bottom: 50px;
    }

    .about-big em { color: var(--ash); }

    .about-small {
      font-family: 'Space Mono', monospace;
      font-size: 0.75rem;
      line-height: 2.3;
      color: #404040;
      letter-spacing: 0.03em;
    }

    /* =====================
       STATS
    ===================== */
    #stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      border-top: 1px solid var(--rule);
      border-bottom: 1px solid var(--rule);
    }

    .stat-cell {
      padding: 80px 60px;
      border-right: 1px solid var(--rule);
    }
    .stat-cell:last-child { border-right: none; }

    .stat-num {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(4rem, 8vw, 6rem);
      letter-spacing: 0.05em;
      color: transparent;
      -webkit-text-stroke: 1px #2a2a2a;
      display: block;
      line-height: 1;
      margin-bottom: 16px;
    }

    .stat-label {
      font-family: 'Space Mono', monospace;
      font-size: 0.6rem;
      color: #333;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      display: block;
    }

    .stat-sub {
      font-family: 'IM Fell English', serif;
      font-style: italic;
      font-size: 0.9rem;
      color: #2a2a2a;
      margin-top: 10px;
      display: block;
    }

    /* =====================
       FOOTER
    ===================== */
    footer {
      padding: 70px 48px 50px;
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      border-top: 1px solid var(--rule);
    }

    .footer-logo {
      font-family: 'Bebas Neue', sans-serif;
      font-size: clamp(3rem, 8vw, 6rem);
      letter-spacing: 0.08em;
      color: transparent;
      -webkit-text-stroke: 1px #1c1c1c;
      display: block;
      line-height: 1;
      margin-bottom: 20px;
    }

    .footer-copy {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #282828;
      letter-spacing: 0.3em;
      text-transform: uppercase;
    }

    .footer-right {
      text-align: right;
    }

    .footer-links {
      display: flex;
      flex-direction: column;
      gap: 12px;
      align-items: flex-end;
    }

    .footer-links a {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #2a2a2a;
      letter-spacing: 0.4em;
      text-transform: uppercase;
      text-decoration: none;
      transition: color 0.3s;
    }

    .footer-links a:hover { color: var(--ash); }

    /* =====================
       LOGIN MODAL
    ===================== */
    #login-trigger {
      position: fixed;
      left: 32px;
      bottom: 32px;
      z-index: 800;
      width: 54px;
      height: 54px;
      border: 1px solid rgba(21, 21, 21, 0.8);
      background: rgba(255, 255, 255, 0.78);
      border-radius: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), inset 0 1px rgba(255, 255, 255, 0.7);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      transition: all 0.28s ease;
    }

    #login-trigger:hover {
      border-color: var(--accent);
      transform: translateY(-2px);
      box-shadow: 0 20px 42px rgba(17, 17, 17, 0.18), 0 0 0 4px rgba(23, 103, 177, 0.08);
    }
    #login-trigger svg {
      width: 20px;
      height: 20px;
      stroke: #343434;
      transition: stroke 0.3s ease, transform 0.3s ease;
    }
    #login-trigger:hover svg { stroke: var(--accent); transform: scale(1.04); }

    #login-modal {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.85);
      backdrop-filter: blur(20px);
      z-index: 5000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.4s ease;
    }

    #login-modal.open {
      opacity: 1;
      pointer-events: all;
    }

    .login-panel {
      position: relative;
      width: 380px;
      max-width: 90vw;
      background: var(--dim);
      border: 1px solid #1e1e1e;
      padding: 48px 40px;
    }

    .login-close {
      position: absolute;
      top: 18px; right: 18px;
      background: none;
      border: none;
      color: #333;
      font-family: 'Space Mono', monospace;
      font-size: 0.7rem;
      letter-spacing: 0.3em;
      cursor: pointer;
      transition: color 0.3s;
    }
    .login-close:hover { color: var(--accent); }

    .login-label {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #333;
      letter-spacing: 0.5em;
      text-transform: uppercase;
      margin-bottom: 12px;
    }

    .login-title {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 2.8rem;
      letter-spacing: 0.1em;
      color: var(--bone);
      margin-bottom: 8px;
    }

    .login-sub {
      font-family: 'IM Fell English', serif;
      font-style: italic;
      font-size: 0.95rem;
      color: var(--ash);
      margin-bottom: 40px;
      line-height: 1.6;
    }

    .login-field { margin-bottom: 6px; }

    .login-field input {
      width: 100%;
      padding: 14px 0;
      background: transparent;
      border: none;
      border-bottom: 1px solid #1e1e1e;
      color: var(--bone);
      font-family: 'Space Mono', monospace;
      font-size: 0.8rem;
      letter-spacing: 0.05em;
      outline: none;
      transition: border-color 0.3s;
    }

    .login-field input::placeholder { color: #2a2a2a; }
    .login-field input:focus { border-color: #444; }
    .login-field input.invalid { border-color: var(--accent); }

    .field-error {
      font-family: 'Space Mono', monospace;
      font-size: 0.6rem;
      color: var(--accent);
      letter-spacing: 0.1em;
      min-height: 22px;
      padding: 4px 0 8px;
    }

    .login-submit {
      width: 100%;
      padding: 16px;
      background: transparent;
      border: 1px solid #2a2a2a;
      color: var(--bone);
      font-family: 'Space Mono', monospace;
      font-size: 0.7rem;
      letter-spacing: 0.4em;
      text-transform: uppercase;
      cursor: pointer;
      margin-top: 20px;
      transition: all 0.3s ease;
    }

    .login-submit:hover:not(:disabled) {
      border-color: var(--bone);
      background: var(--bone);
      color: var(--ink);
    }

    .login-submit:disabled {
      opacity: 0.3;
      cursor: not-allowed;
    }

    .login-divider {
      display: flex;
      align-items: center;
      gap: 16px;
      margin: 24px 0;
    }

    .login-divider::before, .login-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: #1a1a1a;
    }

    .login-divider span {
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #2a2a2a;
      letter-spacing: 0.3em;
    }

    .google-btn {
      width: 100%;
      padding: 14px;
      background: transparent;
      border: 1px solid #1e1e1e;
      color: #555;
      font-family: 'Space Mono', monospace;
      font-size: 0.65rem;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      transition: all 0.3s ease;
    }

    .google-btn:hover {
      border-color: #333;
      color: var(--bone);
    }

    .login-footer {
      margin-top: 28px;
      font-family: 'Space Mono', monospace;
      font-size: 0.55rem;
      color: #282828;
      letter-spacing: 0.2em;
      text-align: center;
    }

    .login-footer a {
      color: #444;
      text-decoration: none;
      transition: color 0.3s;
    }

    .login-footer a:hover { color: var(--bone); }

    /* TOS MODAL */
    #tosModal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.88);
      backdrop-filter: blur(16px);
      z-index: 9998;
      align-items: center;
      justify-content: center;
      padding: 2rem;
    }

    .tos-panel {
      background: var(--dim);
      border: 1px solid var(--rule);
      padding: 48px 40px;
      max-width: 560px;
      width: 100%;
    }

    .tos-title {
      font-family: 'Bebas Neue', sans-serif;
      font-size: 2rem;
      letter-spacing: 0.1em;
      color: var(--bone);
      margin-bottom: 20px;
    }

    .tos-body {
      font-family: 'IM Fell English', serif;
      font-style: italic;
      font-size: 1rem;
      color: var(--ash);
      line-height: 1.8;
      margin-bottom: 32px;
    }

    .tos-body a { color: var(--bone); }

    .tos-actions {
      display: flex;
      gap: 12px;
      justify-content: flex-end;
    }

    .tos-btn {
      padding: 12px 28px;
      font-family: 'Space Mono', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      border: 1px solid #2a2a2a;
      background: transparent;
      color: #444;
      cursor: pointer;
      transition: all 0.3s;
    }

    .tos-btn.accept {
      border-color: var(--bone);
      color: var(--bone);
    }

    .tos-btn:hover { opacity: 0.7; }
    .tos-btn.accept:hover {
      background: var(--bone);
      color: var(--ink);
      opacity: 1;
    }

    /* RESPONSIVE */
    @media (max-width: 768px) {
      #hero {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: auto;
        padding: 96px 24px 72px;
        text-align: center;
      }
      .hero-left, .hero-right { grid-column: 1; grid-row: auto; text-align: center; }
      .hero-center { grid-column: 1; grid-row: 1; }
      .hero-title {
        writing-mode: horizontal-tb;
        font-size: clamp(3.1rem, 15vw, 5.2rem);
        letter-spacing: 0.03em;
      }
      .hero-left { margin-top: 48px; }
      .hero-right { margin-top: 36px; }
      #stats { grid-template-columns: 1fr; }
      .stat-cell { border-right: none; border-bottom: 1px solid var(--rule); }
      footer { flex-direction: column; gap: 40px; }
      .footer-right { text-align: left; }
      .footer-links { align-items: flex-start; }
      nav { padding: 20px 32px; }

      #login-trigger {
        top: 80px !important;
        left: 20px !important;
        right: auto !important;
        bottom: auto !important;
        width: 48px;
        height: 48px;
        border-radius: 14px;
      }

      #about { padding: 96px 24px; }
      .section-num { margin-bottom: 44px; }
      .about-small { line-height: 2; }
      .stat-cell { padding: 56px 24px; }
      footer { padding: 56px 24px 40px; }
    }

    @media (max-width: 480px) {
      .hero-title { font-size: clamp(2.8rem, 14vw, 4.4rem); }
      .hero-body { line-height: 1.8; }
      .about-big { font-size: 1.65rem; }
      .about-small { font-size: 0.68rem; }
      .footer-logo { font-size: 2.8rem; }
    }