  :root {
    --bg: #0D1821; --bg2: #03080f; --lime: #beee62; --teal: #03BFD8;
    --ink: #EDF4F8; --ink2: #A9BFCD; --ink3: #7692A4;
    --card: #13202c; --line: #24384a;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    background: var(--bg2);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100dvh;
  }
  .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.14em;
          text-transform: uppercase; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
             clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  :focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

  /* ---- hero stage ---- */
  .hero {
    position: relative;
    height: min(78dvh, 820px);
    min-height: 430px;
    background:
      radial-gradient(90% 70% at 50% 62%, rgba(3, 191, 216, 0.10), transparent 62%),
      radial-gradient(70% 55% at 50% 70%, rgba(21, 36, 47, 0.9), transparent 75%),
      linear-gradient(var(--bg2), #060f18 55%, var(--bg2));
    overflow: hidden;
  }
  .hero canvas { position: absolute; inset: 0; width: 100%; height: 100%;
                 display: block; cursor: grab; touch-action: pan-y; }

  .topbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 4;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(rgba(3, 8, 15, 0.75), transparent);
    pointer-events: none;
  }
  .topbar > * { pointer-events: auto; }
  .brand { display: flex; align-items: center; gap: 10px; }
  .brand svg { height: 16px; width: auto; display: block; color: var(--ink); }
  .brandhome { display: block; color: var(--ink); padding: 14px 0; margin: -14px 0; }
  .brandhome:hover svg, .brandhome:focus-visible svg { color: #fff; }
  .brandname { position: relative; font-size: 12px; color: var(--teal); padding-left: 10px; line-height: 16px;
               border-left: 1px solid rgba(3, 191, 216, 0.35); text-decoration: none; }
  /* a taller tap area without moving the divider line */
  .brandname::after { content: ""; position: absolute; inset: -14px -8px; }

  .caption {
    position: absolute; left: 16px; right: 176px; bottom: 64px; z-index: 3; pointer-events: none;
  }
  .toast { position: absolute; left: 50%; bottom: 64px; z-index: 5; transform: translateX(-50%);
           padding: 8px 14px; border-radius: 999px; background: rgba(3, 8, 15, 0.88);
           border: 1px solid rgba(3, 191, 216, 0.45); color: var(--ink); font-size: 13px;
           pointer-events: none; opacity: 0; transition: opacity 0.2s ease-out; }
  .toast.show { opacity: 1; }
  .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
            pointer-events: none; transition: opacity 0.35s ease-out; }
  .poster.gone { opacity: 0; }
  /* portrait phones: show the whole 16:9 still rather than crop the bodies */
  @media (max-aspect-ratio: 1/1) { .poster { object-fit: contain; } }
  .posname { margin: 0; font-size: clamp(20px, 4.2vw, 30px); font-weight: 700; letter-spacing: -0.02em;
             text-transform: capitalize; text-wrap: balance;
             text-shadow: 0 2px 18px rgba(3, 8, 15, 0.9); }
  .doing { color: var(--teal); font-size: 11px; min-height: 16px; margin-top: 3px;
           font-family: ui-monospace, "SF Mono", Menlo, monospace;
           letter-spacing: 0.12em; text-transform: uppercase;
           text-shadow: 0 1px 8px rgba(3, 8, 15, 0.9); }

  .transport {
    position: absolute; left: 0; right: 0; bottom: 12px; z-index: 4;
    display: flex; justify-content: center; gap: 10px; pointer-events: none;
  }
  .ctl {
    pointer-events: auto;
    width: 40px; height: 40px; border-radius: 999px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
    background: rgba(13, 24, 33, 0.72); border: 1px solid var(--line); color: var(--ink2);
    backdrop-filter: blur(6px);
    transition: border-color 0.2s ease-out, color 0.2s ease-out;
  }
  .ctl svg { width: 15px; height: 15px; display: block; }
  .ctl:hover { color: var(--teal); border-color: rgba(3, 191, 216, 0.5); }
  .ctl:active { transform: translateY(1px); }
  .ctl.on { color: var(--teal); border-color: rgba(3, 191, 216, 0.5); }

  .minimap { position: absolute; right: 12px; bottom: 58px; z-index: 4; width: 150px; height: 92px;
             padding: 0; border-radius: 12px; border: 1px solid var(--line);
             background: rgba(9, 20, 32, 0.72); backdrop-filter: blur(6px); cursor: pointer;
             overflow: hidden; }
  .minimap svg { width: 100%; height: 100%; display: block; pointer-events: none; }
  .minimap:hover { border-color: rgba(3, 191, 216, 0.5); }

  .mapoverlay { position: fixed; inset: 0; z-index: 50; background: #03080f;
                display: none; flex-direction: column; }
  .mapoverlay.show { display: flex; }
  .mapbar { display: flex; justify-content: space-between; align-items: center;
            padding: 12px 16px 8px; gap: 10px; }
  .mapsearch { flex: 1; min-width: 0; background: var(--card); color: var(--ink);
               border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
               font: inherit; font-size: 15px; }
  .mapsearch:focus { border-color: rgba(3, 191, 216, 0.6); }
  /* the faded edge says the row scrolls */
  .mapfams { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px;
             scrollbar-width: none; -webkit-overflow-scrolling: touch;
             mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
  .mapfams::-webkit-scrollbar { display: none; }
  .mapfams button { flex: none; background: var(--card); color: var(--ink2); border: 1px solid var(--line);
                    border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
  .mapfams button:hover, .mapfams button:focus-visible { border-color: rgba(3, 191, 216, 0.5); color: var(--ink); }
  .mapbody { position: relative; flex: 1; min-height: 0; display: flex; }
  #wmfull { flex: 1; width: 100%; touch-action: none; cursor: grab; --u: 1; }
  .mapresults { position: absolute; z-index: 2; top: 0; left: 16px; right: 16px; max-height: 60%;
                overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: rgba(9, 20, 32, 0.97);
                border: 1px solid var(--line); border-radius: 12px; }
  .mapresults button { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px;
                       background: none; border: 0; border-radius: 8px; padding: 10px; color: var(--ink);
                       font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
  .mapresults button:hover, .mapresults button:focus-visible { background: rgba(3, 191, 216, 0.1); }
  .mapresults span { flex: none; color: var(--ink3); font-size: 12px; }
  .mapnone { color: var(--ink3); font-size: 14px; padding: 10px; }
  .mapcard { position: absolute; z-index: 2; left: 16px; right: 16px; bottom: 16px; max-width: 520px; margin: 0 auto;
             background: rgba(9, 20, 32, 0.97); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
  .mapcardfam { font-size: 10px; color: var(--teal); }
  .mapcardname { font-weight: 700; font-size: 16px; margin: 3px 0 8px; }
  .mapcardrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .mapcardhops { color: var(--ink2); font-size: 13px; }
  .mapgo { background: rgba(3, 191, 216, 0.12); border: 1px solid rgba(3, 191, 216, 0.4); color: #67dbe9;
           border-radius: 10px; padding: 9px 16px; font: inherit; font-size: 14px; cursor: pointer; }
  .mapgo:disabled { opacity: 0.4; cursor: default; }

  .wm-edge { stroke: #24384a; stroke-width: 0.5; opacity: 0.16; }
  .minimap .wm-edge { opacity: 0.3; stroke-width: 1; }
  .minimap .wm-node { opacity: 0.9; }
  .wm-node { fill: #35516b; opacity: 0.75; }
  svg.wm-zoom .wm-edge { opacity: 0.3; }
  /* map text keeps a fixed on-screen size: --u is map units per screen px */
  .wm-label { display: none; font-size: calc(11px * var(--u)); fill: #a9bfcd; pointer-events: none;
              stroke: #03080f; stroke-width: calc(3px * var(--u));
              paint-order: stroke; stroke-linejoin: round; }
  .wm-label.on { display: block; }
  .wm-hub { font-size: calc(12px * var(--u)); letter-spacing: 0.12em; fill: #c9d6de; text-transform: uppercase;
            font-family: ui-monospace, "SF Mono", Menlo, monospace; pointer-events: none;
            stroke: #03080f; stroke-width: calc(4px * var(--u)); paint-order: stroke; stroke-linejoin: round; }
  .wm-pick { fill: none; stroke: var(--teal); stroke-width: calc(2px * var(--u)); r: calc(9px * var(--u));
             pointer-events: none; }
  .wm-trail { stroke: #03BFD8; stroke-width: 1.4; }
  .wm-path { stroke: var(--lime); stroke-width: 1.6; stroke-dasharray: 6 5; opacity: 0.85;
             pointer-events: none; animation: wmFlow 0.9s linear infinite; }
  .wm-dest { fill: none; stroke: var(--lime); stroke-width: 1.4; pointer-events: none; }
  @keyframes wmFlow { to { stroke-dashoffset: -11; } }
  .wm-cur { fill: var(--lime); filter: drop-shadow(0 0 6px rgba(190, 238, 98, 0.9)); pointer-events: none; }
  .wm-halo { fill: none; stroke: var(--lime); opacity: 0; pointer-events: none; }
  .wm-cur-on .wm-halo { animation: wmPulse 2.2s ease-out 3; }
  @keyframes wmPulse { 0% { r: 7; opacity: 0.8; } 70% { r: 20; opacity: 0; } 100% { r: 20; opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .wm-path, .wm-cur-on .wm-halo { animation: none; } }

  .vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none;
              background:
                radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(3, 8, 15, 0.55) 100%),
                linear-gradient(rgba(3, 8, 15, 0.35), transparent 18%, transparent 78%, rgba(3, 8, 15, 0.5));
  }

  /* ---- below the fold ---- */
  .wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 44px; }
  .learn { margin-top: 16px; background: var(--card); border: 1px solid var(--line);
           border-radius: 14px; padding: 13px 15px; }
  .learnlabel { font-size: 10px; color: var(--teal); }
  .learnname { font-weight: 700; font-size: 15px; margin: 3px 0 4px; }
  .learntext { color: var(--ink2); font-size: 13px; line-height: 1.55; margin: 0;
               display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .learnbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
  .learnbtns a { color: var(--teal); text-decoration: none; font-size: 13px; padding: 8px 4px; }
  .learnbtns button { background: rgba(3, 191, 216, 0.10); border: 1px solid rgba(3, 191, 216, 0.30);
                      color: #67dbe9; border-radius: 10px; padding: 8px 13px; font: inherit;
                      font-size: 13px; cursor: pointer; }
  #learnPlayer { margin-top: 10px; }
  #learnPlayer mux-player { width: 100%; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; }

  .moveslabel { font-size: 10px; color: var(--ink3); margin: 20px 0 8px; }
  .moves { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
           scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .moves::-webkit-scrollbar { display: none; }
  .moves button {
    flex: none; background: var(--card); color: var(--ink2); border: 1px solid var(--line);
    border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 13px; cursor: pointer;
    text-transform: capitalize; white-space: nowrap;
    transition: border-color 0.2s ease-out, color 0.2s ease-out;
  }
  .moves button:hover:not(:disabled) { border-color: rgba(3, 191, 216, 0.5); color: var(--ink); }
  .moves button:disabled { opacity: 0.4; cursor: default; }
  .moves a { flex: none; color: var(--ink2); border: 1px solid var(--line); border-radius: 999px;
             padding: 9px 14px; font-size: 13px; text-decoration: none; white-space: nowrap; }
  .moves .rev { color: var(--ink3); }

  .sitelinks { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 16px; margin-top: 28px;
               padding-top: 2px; border-top: 1px solid rgba(36, 56, 74, 0.5); }
  .sitelinks .mono { font-size: 10px; color: var(--ink3); margin-right: 4px; }
  .sitelinks a { color: var(--ink2); font-size: 13px; text-decoration: none; padding: 12px 0; }
  .sitelinks a:hover, .sitelinks a:focus-visible { color: var(--teal); }
  .sitelinks + .footer { margin-top: 0; border-top: 0; padding-top: 0; }
  .footer { margin-top: 30px; color: var(--ink3); font-size: 12px; line-height: 1.7;
            border-top: 1px solid rgba(36, 56, 74, 0.5); padding-top: 14px; }
  .footer a { color: var(--teal); text-decoration: none; }
