:root {
      --bg: #0b0b12;
      --card: #14141f;
      --ink: #f2f2f7;
      --mut: #9a9ab0;
      --acc: #ff3b4e;
      --acc2: #ffb020;
      --line: #262638;
      box-sizing: border-box;
      padding-top: env(safe-area-inset-top, 0px);
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    @media (prefers-color-scheme: light) {
      :root:not([data-theme="dark"]) {
        --bg: #f5f5f9;
        --card: #fff;
        --ink: #14141f;
        --mut: #5b5b70;
        --line: #dcdce8;
      }
    }

    * {
      box-sizing: border-box;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--ink);
      font: 16px/1.6 system-ui, -apple-system, Segoe UI, sans-serif;
      overflow-x: hidden;
    }

    #bg {
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      background: 
        radial-gradient(60% 50% at 80% 0, rgba(255, 59, 78, .18), transparent), 
        radial-gradient(50% 50% at 10% 100%, rgba(255, 176, 32, .12), transparent);
    }

    main {
      position: relative;
      z-index: 1;
      max-width: 980px;
      margin: 0 auto;
      padding: 0 20px 80px;
    }

    h1 {
      font-size: clamp(2.2rem, 7vw, 4.5rem);
      line-height: 1.05;
      margin: 0 0 12px;
      letter-spacing: -.03em;
    }

    h1 span {
      background: linear-gradient(90deg, var(--acc), var(--acc2));
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    h2 {
      margin: 0 0 8px;
      font-size: 1.5rem;
    }

    .hero {
      min-height: 70vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .pill {
      display: inline-block;
      border: 1px solid var(--line);
      padding: 4px 12px;
      border-radius: 99px;
      color: var(--mut);
      font-size: .8rem;
      margin-bottom: 16px;
      width: fit-content;
    }

    .sub {
      color: var(--mut);
      max-width: 560px;
    }

    .card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 22px;
      margin: 22px 0;
      opacity: 0;
      transform: translateY(30px);
      transition: .7s cubic-bezier(.2, .8, .2, 1);
    }

    .card.in {
      opacity: 1;
      transform: none;
    }

    .n {
      color: var(--acc);
      font-weight: 700;
      font-size: .8rem;
      letter-spacing: .15em;
    }

    button {
      background: var(--acc);
      color: #fff;
      border: 0;
      border-radius: 10px;
      padding: 10px 18px;
      font: inherit;
      font-weight: 600;
      cursor: pointer;
      transition: transform .15s, box-shadow .2s;
    }

    button:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(255, 59, 78, .35);
    }

    button.ghost {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--ink);
    }

    input, textarea {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--ink);
      border-radius: 8px;
      padding: 8px 10px;
      font: inherit;
      width: 100%;
    }

    textarea {
      min-height: 80px;
    }

    .point-input {
      max-width: 100px;
    }

    input:focus, textarea:focus {
      outline: 2px solid var(--acc);
      outline-offset: 0;
    }

    .scroll {
      overflow-x: auto;
    }

    table {
      border-collapse: collapse;
      width: 100%;
      min-width: 420px;
    }

    th, td {
      padding: 6px 8px;
      border-bottom: 1px solid var(--line);
      text-align: left;
      font-size: .9rem;
    }

    th {
      color: var(--mut);
      font-weight: 500;
    }

    .grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 16px;
    }

    .eq {
      font: 600 clamp(1.2rem, 4vw, 2rem)/1.3 ui-monospace, Menlo, monospace;
      color: var(--acc2);
      min-height: 2.6rem;
    }

    canvas.ch {
      width: 100%;
      height: 300px;
      display: block;
    }

    .row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
      margin: 10px 0;
    }

    .out {
      min-height: 1.6em;
      color: var(--acc2);
    }

    /* drive-down crash */
    #gl {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 6;
    }

    .hero {
      min-height: 175vh;
      justify-content: flex-start;
      padding-top: 16vh;
    }

    .ch {
      display: inline-block;
      will-change: transform;
    }

    main.shake {
      animation: shake .35s infinite;
    }

    @keyframes shake {
      20% { transform: translate(-7px, 4px) }
      40% { transform: translate(7px, -5px) }
      60% { transform: translate(-5px, 3px) }
      80% { transform: translate(4px, -2px) }
    }

    #hud {
      position: fixed;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 7;
      display: none;
      gap: 12px;
      align-items: center;
      font-weight: 700;
      color: #fff;
      background: rgba(10, 10, 20, .82);
      padding: 8px 16px;
      border-radius: 99px;
      width: min(92%, 520px);
    }

    #bbar {
      height: 8px;
      flex: 1;
      background: #ffffff26;
      border-radius: 9px;
      overflow: hidden;
    }

    #bbar i {
      display: block;
      height: 100%;
      width: 0;
      background: linear-gradient(90deg, #4ade80, #ffb020, #ff3b4e);
    }

    #cap {
      position: fixed;
      bottom: 5%;
      left: 50%;
      transform: translateX(-50%);
      z-index: 7;
      width: min(88%, 640px);
      text-align: center;
      font-weight: 800;
      font-size: clamp(1.05rem, 3.6vw, 1.6rem);
      line-height: 1.25;
      color: #fff;
      background: rgba(10, 10, 20, .82);
      padding: 10px 18px;
      border-radius: 16px;
      transition: opacity .25s;
      opacity: 0;
      pointer-events: none;
    }

    #flash2 {
      position: fixed;
      inset: 0;
      background: #fff;
      opacity: 0;
      pointer-events: none;
      z-index: 8;
    }

    @media (prefers-reduced-motion: reduce) {
      * {
        animation: none !important;
        transition: none !important;
      }
      .card {
        opacity: 1;
        transform: none;
      }
    }
