/* REZZX MODS — red on black, phone-shaped control panel. */

/* Chakra Petch: angular and technical, self-hosted so there is no third-party
   request and no flash of unstyled text. Latin subset only, ~10 KB a weight. */
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/chakra-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/chakra-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/chakra-700.woff2') format('woff2');
}

:root {
  --bg: #08080c;
  --bg-deep: #030305;
  --panel: #0e0e14;
  --panel-2: #14141c;
  --line: #22222c;
  --line-soft: #1a1a22;

  --red: #ff2340;
  --red-deep: #c00c24;
  --red-glow: rgba(255, 35, 64, .5);
  --cyan: #00e5ff;
  --magenta: #ff00c8;
  --green: #19d67a;

  --text: #f4f4f7;
  --dim: #8d8d9c;
  --dimmer: #5c5c6b;

  --display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --phone-w: 440px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* The panel scrolls inside .scroll; the document itself never does, so a
     drag on the page cannot fight the pane for the gesture. */
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── phone frame ─────────────────────────────────────────────────────────── */

.frame {
  height: 100%;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 35, 64, .11), transparent 62%),
    radial-gradient(90% 45% at 50% 108%, rgba(255, 35, 64, .07), transparent 62%),
    var(--bg-deep);
}

.phone {
  width: 100%;
  max-width: var(--phone-w);
  /* A bounded height is what makes the inner pane scrollable at all. */
  height: 100%;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}

@media (min-width: 560px) {
  .frame { align-items: center; padding: 26px 16px; }
  .phone {
    height: min(900px, 100%);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow:
      0 0 0 1px rgba(255, 35, 64, .08),
      0 28px 80px rgba(0, 0, 0, .8),
      0 0 60px rgba(255, 35, 64, .06);
  }
}

.phone::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none; z-index: 60;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .014) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN — premium black/red access gate.
   Scoped to .screen-login so none of it can touch the panel (app.html), which
   loads this same stylesheet. Logo + wordmark float above a single glass card
   that carries the key field and the unlock action; a slow ambient aura and a
   fine grain do the atmosphere so the chrome itself stays restrained.
   ═══════════════════════════════════════════════════════════════════════════ */

.screen-login .frame {
  background:
    radial-gradient(130% 70% at 50% -15%, rgba(255, 35, 64, .16), transparent 60%),
    radial-gradient(100% 55% at 50% 115%, rgba(255, 35, 64, .08), transparent 62%),
    var(--bg-deep);
}

/* The login panel is not a scrolling pane — it centres its contents. */
.screen-login .phone {
  justify-content: center;
  gap: clamp(22px, 5vh, 40px);
  padding: clamp(26px, 6vh, 56px) clamp(22px, 7vw, 40px)
           calc(clamp(26px, 6vh, 56px) + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(255, 35, 64, .07), transparent 55%),
    var(--bg);
  overflow: hidden;
}

@media (min-width: 560px) {
  .screen-login .phone { height: min(820px, 100%); }
}

/* Ambient aura — a soft, slowly breathing red bloom behind the crest. */
.aura {
  position: absolute;
  top: clamp(40px, 12vh, 110px); left: 50%;
  width: min(460px, 92%); aspect-ratio: 1;
  transform: translateX(-50%);
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 35, 64, .22), transparent 58%);
  filter: blur(26px);
  opacity: .9;
  animation: auraBreathe 7s ease-in-out infinite;
}
@keyframes auraBreathe {
  0%, 100% { opacity: .55; transform: translateX(-50%) scale(.96); }
  50%      { opacity: .95; transform: translateX(-50%) scale(1.04); }
}

/* ── hero: crest + wordmark ─────────────────────────────────────────────── */

.hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}

.crest {
  position: relative;
  width: clamp(116px, 30vw, 150px); aspect-ratio: 1;
  display: grid; place-items: center;
  margin-bottom: clamp(16px, 3vh, 26px);
}
.crest-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 35, 64, .35);
  box-shadow:
    inset 0 0 30px rgba(255, 35, 64, .18),
    0 0 36px rgba(255, 35, 64, .14);
  animation: ringSpin 18s linear infinite;
}
.crest-ring-2 {
  inset: 12%;
  border-style: dashed;
  border-color: rgba(255, 35, 64, .22);
  box-shadow: none;
  animation: ringSpin 26s linear infinite reverse;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }

.crest-logo {
  position: relative; z-index: 1;
  width: 66%; height: 66%;
  object-fit: contain;
  border-radius: 20px;
  filter: drop-shadow(0 6px 22px rgba(255, 35, 64, .45));
}

/* Wordmark: clean, heavy, confident — no glitch. */
.brand {
  margin: 0;
  font-size: clamp(30px, 8.5vw, 40px);
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 2px 20px rgba(0, 0, 0, .6);
}
.brand span {
  background: linear-gradient(180deg, #ff5368, var(--red) 55%, var(--red-deep));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* Hairline rule with a lit centre node. */
.brand-rule {
  display: flex; align-items: center; gap: 10px;
  width: min(220px, 70%);
  margin: clamp(12px, 2.4vh, 18px) 0 clamp(9px, 1.8vh, 13px);
}
.brand-rule i {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 35, 64, .5));
}
.brand-rule i:last-child { transform: scaleX(-1); }
.brand-rule b {
  width: 5px; height: 5px; flex: none;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

.tagline {
  margin: 0;
  font-size: clamp(10px, 2.6vw, 11.5px);
  font-weight: 600;
  letter-spacing: .42em; text-indent: .42em;
  color: var(--dim);
}

/* ── auth card ──────────────────────────────────────────────────────────── */

.auth {
  position: relative; z-index: 1;
  width: 100%;
  display: flex; flex-direction: column;
  padding: clamp(18px, 3.2vh, 24px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 40%),
    linear-gradient(180deg, rgba(20, 20, 28, .9), rgba(10, 10, 15, .92));
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .06),
    0 1px 0 rgba(255, 35, 64, .08),
    0 24px 60px rgba(0, 0, 0, .6);
}
/* Thin red light along the top edge of the card. */
.auth::before {
  content: "";
  position: absolute; top: -1px; left: 16%; right: 16%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: .7;
}

.auth-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 11px;
}
.auth-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .28em;
  color: var(--dim);
}
.auth-secure {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  padding: 4px 9px 4px 8px;
  border: 1px solid rgba(25, 214, 122, .35); border-radius: 999px;
  background: rgba(25, 214, 122, .08);
  color: var(--green);
  white-space: nowrap;
}
.auth-secure::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--green); box-shadow: 0 0 8px var(--green);
}

/* Key field + inline paste, joined as one control. */
.key-wrap {
  position: relative;
  display: flex; align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-deep);
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s;
}
.key-wrap:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 35, 64, .14), inset 0 0 20px rgba(255, 35, 64, .05);
}
.key-input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px; letter-spacing: .08em;
  padding: 15px 14px;
}
.key-input::placeholder { color: var(--dimmer); letter-spacing: .06em; }
.key-input:read-only { opacity: .7; }

.paste-btn {
  flex: none;
  padding: 0 16px;
  border: 0; border-left: 1px solid var(--line);
  background: var(--panel); color: var(--dim);
  font-family: var(--display);
  font-size: 11px; font-weight: 600; letter-spacing: .14em;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.paste-btn:hover { color: var(--red); background: var(--panel-2); }
.paste-btn:active { background: var(--bg-deep); }

/* Turnstile widget — centred under the key field. Empty (CAPTCHA off) it
   collapses to nothing, so the layout is unchanged until a key is configured. */
.ts-wrap {
  display: flex; justify-content: center;
  margin-top: 14px;
}
.ts-wrap:empty { margin-top: 0; }

/* Status line — reserves its own row so the layout never jumps. */
.msg {
  min-height: 16px;
  margin: 11px 2px 0;
  font-size: 11.5px; line-height: 1.4;
  letter-spacing: .01em;
  color: #ff7a8c;
}
.msg.ok { color: var(--green); }

/* Primary action. */
.unlock {
  position: relative; overflow: hidden;
  margin-top: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px;
  border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #ff3a54, var(--red) 45%, var(--red-deep));
  color: #fff;
  font-size: 13px; letter-spacing: .26em; text-indent: .26em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 35, 64, .32), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .12s, filter .15s, box-shadow .2s;
}
.unlock:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 12px 34px rgba(255, 35, 64, .42), inset 0 1px 0 rgba(255, 255, 255, .25); }
.unlock:active:not(:disabled) { transform: translateY(1px); }
.unlock:disabled { cursor: progress; filter: saturate(.8) brightness(.95); }
/* Moving sheen across the button face. */
.unlock::after {
  content: "";
  position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent);
  transform: skewX(-18deg);
  animation: sheen 4.5s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { left: -45%; }
  85%, 100% { left: 130%; }
}

.unlock-label { position: relative; z-index: 1; }
.unlock .spinner {
  position: relative; z-index: 1;
  display: none;
  width: 15px; height: 15px; margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.unlock:disabled .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── maintenance card (login page, while the bot has maintenance on) ────── */

.auth[hidden] { display: none; }
.maint { align-items: center; text-align: center; }
.maint .auth-head { width: 100%; }
.maint-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9px; font-weight: 700; letter-spacing: .16em;
  padding: 4px 9px 4px 8px;
  border: 1px solid rgba(255, 176, 32, .4); border-radius: 999px;
  background: rgba(255, 176, 32, .09);
  color: #ffb020;
  white-space: nowrap;
}
.maint-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: #ffb020; box-shadow: 0 0 8px #ffb020;
  animation: maint-pulse 1.6s ease-in-out infinite;
}
.maint-ico {
  display: grid; place-items: center;
  width: 64px; height: 64px; margin: 8px auto 12px;
  border: 1px solid rgba(255, 176, 32, .35); border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 32, .16), transparent 70%);
  color: #ffb020;
  box-shadow: 0 0 28px rgba(255, 176, 32, .18);
}
.maint-ico .ico { width: 30px; height: 30px; animation: spin 6s linear infinite; }
.maint-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 17px; font-weight: 700; letter-spacing: .2em; text-indent: .2em;
  color: var(--text);
}
.maint-msg {
  margin: 0 0 14px;
  font-size: 13px; line-height: 1.55;
  color: var(--text); opacity: .86;
  white-space: pre-line; overflow-wrap: anywhere;
}
.maint-msg:empty { display: none; }
.maint-row {
  display: flex; align-items: flex-start; gap: 9px;
  width: 100%; margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: 12px;
  background: rgba(0, 0, 0, .28);
  font-size: 11.5px; line-height: 1.45; text-align: start;
  color: var(--dim);
}
.maint-row[hidden] { display: none; }
.maint-row .ico { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--cyan); }
.maint-live {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 14px 0 0;
  font-size: 10.5px; letter-spacing: .06em;
  color: var(--dimmer);
}
.maint-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  animation: maint-pulse 1.6s ease-in-out infinite;
}
@keyframes maint-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .maint-ico .ico, .maint-badge::before, .maint-dot { animation: none; }
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.foot {
  position: relative; z-index: 1;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
}
.foot-q {
  margin: 0;
  font-size: 11.5px; letter-spacing: .04em;
  color: var(--dim);
}
.foot-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 9px;
}
.foot-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  font-family: var(--display);
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s, transform .12s;
}
.foot-links a:hover {
  color: var(--red); border-color: rgba(255, 35, 64, .5);
  background: rgba(255, 35, 64, .08);
}
.foot-links a:active { transform: translateY(1px); }
.foot-links .ico { width: 13px; height: 13px; }
.foot-note {
  margin: 0;
  font-size: 10px; letter-spacing: .1em;
  color: var(--dimmer);
}

/* Short screens: tighten the stack so nothing clips. */
@media (max-height: 640px) {
  .screen-login .phone { gap: 18px; justify-content: flex-start; padding-top: 28px; }
  .crest { width: 96px; margin-bottom: 12px; }
  .aura { top: 20px; }
}

/* ── top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: relative;
  flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 60%),
    linear-gradient(180deg, rgba(255, 35, 64, .1), transparent);
}
/* Thin red light along the bottom edge — the same signature as the login card. */
.topbar::before {
  content: "";
  position: absolute; left: 16px; right: 16px; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: .5;
}
.topbar-logo {
  width: 44px; height: 44px; flex: none;
  padding: 3px; border-radius: 13px;
  border: 1px solid rgba(255, 35, 64, .45);
  background: rgba(255, 35, 64, .08);
  /* A steady red halo, like a cast shadow — deliberately not animated. */
  box-shadow: 0 0 18px rgba(255, 35, 64, .35), 0 4px 12px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.topbar-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.topbar-id .topbar-name { align-self: flex-start; }

/* Connection state sits under the wordmark as a quiet status line: a lit dot
   and small tracked caps, coloured by state, no box around it. */
.topbar-id .pill {
  align-self: flex-start;
  gap: 7px; padding: 0;
  border: 0; background: none;
  font-size: 9px; font-weight: 600; letter-spacing: .22em;
}
.topbar-id .pill .led { width: 6px; height: 6px; }

/* The wordmark: big and heavy, chrome-white REZZX beside a glossy red MODS,
   with one bright band of light sweeping across both words. */
.topbar-name {
  display: inline-block;
  font-size: 20px; line-height: 1.1;
  white-space: nowrap;
  background: linear-gradient(105deg, #b9bac6 0%, #ffffff 22%, #8e8f9c 38%, #ffffff 46%, #ffffff 50%, #c9cad3 62%, #f4f4f7 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .7)) drop-shadow(0 0 10px rgba(255, 255, 255, .14));
  animation: brandSweep 4.5s ease-in-out infinite;
}
.topbar-name span {
  background: linear-gradient(105deg, #c4061e 0%, #ff2340 25%, #ff6b80 40%, #ffffff 48%, #ff6b80 56%, #ff2340 70%, #c4061e 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 35, 64, .8)) drop-shadow(0 0 16px rgba(255, 35, 64, .45));
  animation: brandSweep 4.5s ease-in-out infinite, modsGlow 2.4s ease-in-out infinite;
}
@keyframes brandSweep {
  0%, 15% { background-position: 100% 0; }
  65%, 100% { background-position: 0% 0; }
}
@keyframes modsGlow {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 35, 64, .7)) drop-shadow(0 0 12px rgba(255, 35, 64, .35)); }
  50%      { filter: drop-shadow(0 0 8px rgba(255, 35, 64, 1)) drop-shadow(0 0 22px rgba(255, 35, 64, .6)); }
}
.icon-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: 10px;
  color: var(--dim); font: inherit; font-size: 11px; letter-spacing: .14em;
  padding: 9px 13px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--red); border-color: rgba(255, 35, 64, .5); background: rgba(255, 35, 64, .06); }

/* ── status block ────────────────────────────────────────────────────────── */

.status {
  flex: none;
  padding: 13px 16px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10px; letter-spacing: .13em;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
  background: rgba(0, 0, 0, .35);
  white-space: nowrap;
}
.pill .led { width: 7px; height: 7px; border-radius: 50%; background: var(--dimmer); }
.pill.on { color: var(--green); border-color: rgba(25, 214, 122, .4); }
.pill.on .led { background: var(--green); box-shadow: 0 0 9px var(--green); animation: pulse 2s ease-in-out infinite; }
.pill.off { color: var(--red); border-color: rgba(255, 35, 64, .4); }
.pill.warn { color: #ffb020; border-color: rgba(255, 176, 32, .45); }
.pill.warn .led { background: #ffb020; box-shadow: 0 0 9px #ffb020; }
.pill.off .led { background: var(--red); box-shadow: 0 0 9px var(--red); }
@keyframes pulse { 50% { opacity: .45; } }


.expiry {
  position: relative; overflow: hidden;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 45%),
    linear-gradient(135deg, rgba(255, 35, 64, .09), transparent 70%),
    rgba(14, 14, 20, .85);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 24px rgba(0, 0, 0, .4);
}
/* Red light along the top edge, matching the login card and the header. */
.expiry::before {
  content: "";
  position: absolute; top: 0; left: 14%; right: 14%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: .6;
}
.expiry-k { font-size: 9px; letter-spacing: .18em; color: var(--dimmer); }
.expiry-v {
  font-size: 22px; font-weight: 800; letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.expiry-v.good { color: var(--green); }
.expiry-v.soon { color: #ffb020; }
.expiry-v.warn { color: var(--red); animation: pulse 1.6s ease-in-out infinite; }
.expiry-v.dead { color: var(--red); }
.expiry-on {
  margin-left: auto;
  font-size: 10px; color: var(--dimmer);
  font-variant-numeric: tabular-nums;
}

.btn-row { display: flex; gap: 10px; }
.btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 10px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02); color: var(--text);
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .13em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s, border-color .15s, filter .15s, background .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { border-color: rgba(255, 35, 64, .5); background: rgba(255, 35, 64, .05); }
.btn-primary {
  background: linear-gradient(180deg, #ff3a54, var(--red) 45%, var(--red-deep));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 22px rgba(255, 35, 64, .32), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover {
  filter: brightness(1.08); border-color: transparent; background: linear-gradient(180deg, #ff3a54, var(--red) 45%, var(--red-deep));
  box-shadow: 0 10px 28px rgba(255, 35, 64, .42), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.hint {
  margin: 10px 0 0;
  color: var(--dimmer); font-size: 10.5px; line-height: 1.5;
}

/* ── get happ (store badges) ───────────────────────────────────────────────── */

/* "Don't have Happ?" — a plain text link led by Happ's mark; it opens the
   download dialog rather than parking two store buttons on the main screen. */
.get-happ {
  display: inline-flex; align-items: center; gap: 9px;
  margin-top: 12px; padding: 2px 0;
  border: 0; background: none;
  color: var(--dim);
  font-family: var(--display);
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em;
  cursor: pointer;
  transition: color .15s;
}
.get-happ:hover { color: var(--text); }
.get-happ:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }
.get-happ-ico {
  width: 26px; height: 26px; flex: none;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 3px 8px rgba(0, 0, 0, .45);
}
.get-happ-go { width: 12px; height: 12px; flex: none; transition: transform .2s ease, color .2s; }
.get-happ:hover .get-happ-go { transform: translateX(2px); color: var(--red); }

/* Header of the download dialog: Happ's icon, name and the one next step. */
.happ-hero {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, .02);
}
.happ-hero-ico {
  width: 52px; height: 52px; flex: none;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .08);
}
.happ-hero-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.happ-hero-txt b { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.happ-hero-txt small { font-family: var(--display); font-size: 11px; line-height: 1.4; color: var(--dim); }
/* Store links as modern app cards: the store's mark in its own raised tile,
   the platform as a caption over the store name, and an arrow that nudges out
   on hover while a red-to-white hairline lights the edge. */
.store-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.store-btn {
  position: relative; isolation: isolate;
  min-width: 0;
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 55%),
    linear-gradient(160deg, #15151d, #0c0c12);
  color: var(--text); text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 18px rgba(0, 0, 0, .4);
  transition: transform .18s ease, border-color .18s, box-shadow .2s;
}
.store-btn::before {
  content: "";
  position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(255, 35, 64, .95), rgba(255, 35, 64, .15) 40%, transparent 60%, rgba(255, 255, 255, .55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.store-btn:hover {
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 12px 26px rgba(0, 0, 0, .5), 0 0 24px rgba(255, 35, 64, .18);
}
.store-btn:hover::before { opacity: 1; }
.store-btn:active { transform: translateY(0); }
.store-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.store-ico-wrap {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(180deg, #24242e, #111117);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 8px rgba(0, 0, 0, .5);
  transition: transform .2s ease;
}
.store-btn:hover .store-ico-wrap { transform: scale(1.06); }
.store-ico { width: 21px; height: 21px; }
#storeIos .store-ico { width: 18px; height: 21px; margin-top: -2px; color: #fff; }

.store-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.1; }
.store-txt small {
  font-family: var(--display);
  font-size: 8.5px; font-weight: 600; letter-spacing: .2em;
  color: var(--dimmer);
}
.store-txt b {
  font-family: var(--display);
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.store-go {
  flex: none;
  width: 15px; height: 15px;
  color: var(--dimmer);
  transition: transform .2s ease, color .2s;
}
.store-btn:hover .store-go { color: var(--red); transform: translate(2px, -2px); }

/* ── tabs ────────────────────────────────────────────────────────────────── */

/* A single inset track holding the tabs as segments — reads as one control. */
.tabs {
  flex: none;
  display: flex; gap: 5px;
  margin: 12px 16px;
  padding: 5px;
  border: 1px solid var(--line-soft); border-radius: 14px;
  background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
}
.tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 6px;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--dim);
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .16em;
  cursor: pointer;
  transition: color .16s, background .16s, box-shadow .16s;
}
.tab:hover:not([aria-selected="true"]) { color: var(--text); background: rgba(255, 255, 255, .03); }
.tab[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(180deg, #ff3a54, var(--red) 50%, var(--red-deep));
  box-shadow: 0 5px 16px rgba(255, 35, 64, .3), inset 0 1px 0 rgba(255, 255, 255, .2);
}

/* ── scrolling pane ──────────────────────────────────────────────────────── */

.scroll {
  flex: 1 1 auto;
  /* min-height:0 is what lets a flex child shrink below its content and
     actually scroll. Without it the pane grows to fit, the parent clips it,
     and a one-finger drag has nothing to move. */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.scroll::-webkit-scrollbar { width: 5px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.pane { display: none; }
.pane.active { display: grid; }

/* Tiles size themselves to the viewport: two per row on a narrow phone,
   three once there is room, without any breakpoint. */
.pane {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

/* ── feature tile ────────────────────────────────────────────────────────── */

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid #272730; border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%),
    linear-gradient(170deg, #17171f, #0f0f15);
  color: var(--text);
  font: inherit; text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 3px 10px rgba(0, 0, 0, .4);
  transition: transform .13s, border-color .18s, box-shadow .2s, background .18s;
}
.tile:hover:not(:disabled) { border-color: rgba(255, 35, 64, .4); }
.tile:active:not(:disabled) { transform: scale(.975); }
.tile:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.tile-name {
  font-size: 12px; font-weight: 700;
  letter-spacing: .02em; line-height: 1.3;
}

/* Small warning ribbon — the overlay says "Speed Halal - Risk" in the name;
   the tile carries it as a badge so the label stays short. */
.tile-badge {
  position: absolute; top: 9px; right: 9px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 35, 64, .5); border-radius: 5px;
  background: rgba(255, 35, 64, .14);
  color: #ff7a8c;
  font-size: 7.5px; font-weight: 800; letter-spacing: .16em; line-height: 1;
}
.tile-badge ~ .tile-name { padding-right: 46px; }
/* RTL (Arabic): the corner badge and the space the name reserves for it sit
   on the right in LTR; mirror both to the left so the badge no longer collides
   with the right-aligned name. */
[dir="rtl"] .tile-badge { right: auto; left: 9px; }
[dir="rtl"] .tile-badge ~ .tile-name { padding-right: 0; padding-left: 46px; }
.tile[aria-pressed="true"] .tile-badge {
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.tile-foot { display: flex; align-items: center; gap: 8px; }

/* Switch track: the visual cue that this tile is a toggle. */
.tile-sw {
  position: relative; flex: none;
  width: 34px; height: 18px;
  border-radius: 999px;
  background: #2a2a35;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
  transition: background .2s, box-shadow .2s;
}
.tile-sw::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #7a7a8a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  transition: transform .22s cubic-bezier(.4, 1.3, .5, 1), background .2s;
}

.tile-state {
  font-size: 9px; font-weight: 800; letter-spacing: .14em;
  color: var(--dimmer);
  transition: color .2s;
}

.tile[aria-pressed="true"] {
  border-color: rgba(255, 35, 64, .6);
  background: linear-gradient(170deg, rgba(255, 35, 64, .18), rgba(255, 35, 64, .04) 55%, #101017);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(255, 35, 64, .2), 0 6px 20px rgba(255, 35, 64, .16);
}
.tile[aria-pressed="true"] .tile-sw {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 0 12px var(--red-glow);
}
.tile[aria-pressed="true"] .tile-sw::after { transform: translateX(16px); background: #fff; }
.tile[aria-pressed="true"] .tile-state { color: var(--red); }

/* Disabled must still look like a button, just out of reach. */
.tile:disabled { opacity: .62; cursor: not-allowed; }
.tile:disabled .tile-name { color: var(--dim); }

/* ── chip row (marker style) ─────────────────────────────────────────────── */

.chips-card {
  grid-column: 1 / -1;
  border: 1px solid var(--line); border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 50%),
    rgba(14, 14, 20, .7);
  padding: 13px;
}
.chips-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 9.5px; letter-spacing: .18em;
  color: var(--dimmer);
  margin-bottom: 10px;
}
/* A chips card that carries its section's on/off toggle (Badge) reads as a
   section header, like the Name / Avatar cards. */
.chips-card.has-toggle .chips-title { color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  flex: 1 1 auto; min-width: 62px;
  padding: 10px 11px;
  border: 1px solid #2e2e3a; border-radius: 9px;
  background: linear-gradient(180deg, #1c1c25, #141419);
  color: var(--dim);
  font: inherit; font-size: 11px; font-weight: 700;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: color .15s, border-color .15s, background .15s, box-shadow .18s, transform .12s;
}
.chip:hover:not(:disabled) { border-color: #45454f; color: var(--text); }
.chip:active:not(:disabled) { transform: translateY(1px); }
.chip[aria-pressed="true"] {
  color: #fff; border-color: transparent;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 4px 14px rgba(255, 35, 64, .3);
}
.chip:disabled { opacity: .62; cursor: not-allowed; }

/* ── skin tab ────────────────────────────────────────────────────────────── */
/* Every control here spans the grid: these are sections, not tiles. */

.apply-btn, .bar, .wide-card { grid-column: 1 / -1; }

.apply-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 15px 12px;
  border: 1px solid var(--red); border-radius: 12px;
  background: linear-gradient(180deg, #8d0a1c, #5e0612);
  color: #fff;
  font: inherit; font-size: 13px; font-weight: 800; letter-spacing: .14em;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(255, 35, 64, .22);
  transition: transform .12s, filter .15s, box-shadow .2s;
}
.apply-btn:hover:not(:disabled) { filter: brightness(1.15); }
.apply-btn:active:not(:disabled) { transform: translateY(1px); }
.apply-btn.fired {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 0 26px var(--red-glow);
}
.apply-btn:disabled { opacity: .62; cursor: not-allowed; }

.bar {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 15px;
  border: 1px solid #272730; border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .04), transparent 40%),
    linear-gradient(170deg, #17171f, #0f0f15);
  color: var(--text);
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 3px 10px rgba(0, 0, 0, .4);
  transition: border-color .18s, background .18s, box-shadow .2s, transform .12s;
}
/* Accent rail down the leading edge, lit when the section is on. */
.bar::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #2e2e3a;
  transition: background .2s, box-shadow .2s;
}
.bar:hover:not(:disabled) { border-color: #45454f; }
.bar:active:not(:disabled) { transform: scale(.99); }
.bar:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.bar-name { flex: 1; min-width: 0; }
.bar-foot { display: flex; align-items: center; gap: 9px; flex: none; }
.bar-state {
  font-size: 9px; font-weight: 800; letter-spacing: .14em;
  color: var(--dimmer);
  transition: color .2s;
}

.bar[aria-pressed="true"] {
  border-color: rgba(255, 35, 64, .6);
  background: linear-gradient(170deg, rgba(255, 35, 64, .18), rgba(255, 35, 64, .04) 55%, #101017);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(255, 35, 64, .2), 0 6px 20px rgba(255, 35, 64, .16);
}
.bar[aria-pressed="true"]::before { background: var(--red); box-shadow: 0 0 12px var(--red-glow); }
.bar[aria-pressed="true"] .bar-state { color: var(--red); }
.bar[aria-pressed="true"] .tile-sw {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 0 12px var(--red-glow);
}
.bar[aria-pressed="true"] .tile-sw::after { transform: translateX(16px); background: #fff; }

.bar:disabled { opacity: .62; cursor: not-allowed; }

.wide-card {
  border: 1px solid var(--line); border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 50%),
    rgba(14, 14, 20, .7);
  padding: 13px;
}
.wide-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 9.5px; letter-spacing: .18em;
  color: var(--red);
  margin-bottom: 10px;
}

.text-in {
  width: 100%;
  background: #15151e; border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 13px;
  padding: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.text-in::placeholder { color: var(--dimmer); }
.text-in:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 35, 64, .12); }
.text-in:disabled { opacity: .62; }

.dots { display: flex; flex-wrap: wrap; gap: 9px; }
.dots-inline { margin-top: 12px; }   /* colour dots under the Name input, same card */

/* Name colour: hue slider — a white zone at the far left, then the spectrum. */
.hue-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.hue-label { font-size: 9.5px; letter-spacing: .18em; color: var(--dimmer); }
.hue-pick { display: inline-flex; align-items: center; gap: 8px; }
.hue-swatch {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #3a3a46; box-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.hue-hex { font-size: 12px; font-weight: 700; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.hue {
  direction: ltr;                 /* value 0 stays on the left in RTL languages too */
  width: 100%; margin-top: 10px;
  -webkit-appearance: none; appearance: none;
  height: 22px; background: transparent; cursor: pointer;
}
.hue:disabled { cursor: default; opacity: .45; }
.hue::-webkit-slider-runnable-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(to right, #fff 0 5.3%, #f00 5.3%, #ff0 21%, #0f0 37%, #0ff 53%, #00f 68.5%, #f0f 84.5%, #f00 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.hue::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%; margin-top: -5px;
  background: #fff; border: 3px solid #15151e;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 1px 4px rgba(0, 0, 0, .6);
  transition: transform .12s;
}
.hue:active::-webkit-slider-thumb { transform: scale(1.12); }
.hue::-moz-range-track {
  height: 10px; border-radius: 999px;
  background: linear-gradient(to right, #fff 0 5.3%, #f00 5.3%, #ff0 21%, #0f0 37%, #0ff 53%, #00f 68.5%, #f0f 84.5%, #f00 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.hue::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid #15151e;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 1px 4px rgba(0, 0, 0, .6);
}
.dot {
  width: 30px; height: 30px; padding: 0;
  border: 2px solid #3a3a46; border-radius: 50%;
  cursor: pointer;
  transition: border-color .15s, transform .13s, box-shadow .18s;
}
.dot:hover:not(:disabled) { transform: scale(1.1); }
.dot[aria-pressed="true"] {
  border-color: #fff;
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(255, 255, 255, .35);
}
.dot:disabled { opacity: .62; cursor: not-allowed; }

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 9px;
}
.item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 5px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #13131b;
  color: var(--dimmer);
  font: inherit; cursor: pointer;
  transition: border-color .16s, color .16s, background .16s, box-shadow .2s;
}
.item-img {
  width: 100%; height: auto; max-width: 64px;
  aspect-ratio: 1; object-fit: contain;
  border-radius: 6px;
}
.item-img.missing { opacity: .25; }
.item-name {
  font-size: 9.5px; line-height: 1.25; text-align: center;
  word-break: break-word;
}
.item[aria-pressed="true"] {
  color: #fff;
  border-color: var(--red);
  background: linear-gradient(180deg, rgba(255, 35, 64, .14), #13131b);
  box-shadow: 0 0 0 1px rgba(255, 35, 64, .25), 0 6px 16px rgba(255, 35, 64, .16);
}
.item:disabled { opacity: .62; cursor: not-allowed; }

/* Square "Show More" tile that sits in a slot grid like a skin cell, but dashed
   and centred; tapping it opens the skin picker modal for that slot. */
.item-more {
  justify-content: center;
  border-style: dashed;
  color: var(--dim);
}
.item-more:hover { border-color: var(--red); color: #fff; background: #13131b; }
.item-more-plus { font-size: 26px; font-weight: 300; line-height: 1; }
.item-more-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; }

/* ── skin picker modal ───────────────────────────────────────────────────── */
.skin-sheet { display: flex; flex-direction: column; max-height: 86vh; }
.skin-search {
  width: 100%; margin: 2px 0 12px;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #0f0f15; color: var(--text);
  font: inherit; font-size: 13px;
}
.skin-search::placeholder { color: var(--dimmer); }
.skin-search:focus { outline: none; border-color: var(--red); }

.skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 9px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 180px;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}
.skin-empty { text-align: center; color: var(--dimmer); padding: 32px 0; font-size: 13px; }

/* Rarity-tinted left border, so the grid reads at a glance. */
.skin-cell { position: relative; }
.rare-white, .rare-blue, .rare-green, .rare-purple, .rare-purple_plus,
.rare-orange, .rare-orange_plus, .rare-red { border-top-width: 2px; }
.rare-white       { border-top-color: #b9bfca; }
.rare-blue        { border-top-color: #3aa0ff; }
.rare-green       { border-top-color: #35c85a; }
.rare-purple,
.rare-purple_plus { border-top-color: #b14bff; }
.rare-red         { border-top-color: #ff3a44; }
.rare-orange,
.rare-orange_plus { border-top-color: #ffb020; }

.skin-pager {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding-top: 12px; margin-top: 10px;
  border-top: 1px solid var(--line);
}
.skin-nav {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(180deg, #1c1c25, #141419);
  color: var(--text);
  font-size: 22px; line-height: 1; cursor: pointer;
  transition: border-color .15s, color .15s, opacity .15s;
}
.skin-nav:hover:not(:disabled) { border-color: var(--red); color: #fff; }
.skin-nav:active:not(:disabled) { transform: translateY(1px); }
.skin-nav:disabled { opacity: .38; cursor: not-allowed; }
.skin-page { font-size: 12px; font-weight: 700; color: var(--dim); min-width: 68px; text-align: center; letter-spacing: .04em; }

/* Check badge on the chosen skin (quick-pick grid and modal). */
.item-check {
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--red); color: #fff;
  box-shadow: 0 0 0 2px #13131b, 0 2px 6px rgba(0, 0, 0, .5);
  font-size: 11px; font-weight: 800; line-height: 1;
}
.item-check .ico { width: 12px; height: 12px; stroke-width: 3; }
[dir="rtl"] .item-check { right: auto; left: 5px; }

/* Section on/off toggle, sitting inside a card header (not a separate bar). */
.section-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-inline-start: auto;
  padding: 0; border: 0; background: none; cursor: pointer;
}
.section-toggle .bar-state {
  font-size: 9px; font-weight: 800; letter-spacing: .14em; color: var(--dimmer); transition: color .2s;
}
.section-toggle[aria-pressed="true"] .bar-state { color: var(--red); }
.section-toggle[aria-pressed="true"] .tile-sw {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 0 12px var(--red-glow);
}
.section-toggle[aria-pressed="true"] .tile-sw::after { transform: translateX(16px); background: #fff; }
.section-toggle:disabled { opacity: .62; cursor: not-allowed; }

/* ── toast / modal ───────────────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 18px);
  background: #16161f; color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--red);
  border-radius: 10px;
  padding: 11px 17px;
  font-size: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .7);
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 100; max-width: min(380px, calc(100vw - 36px));
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-left-color: var(--green); }

.modal {
  position: fixed; inset: 0; z-index: 120;
  display: none; align-items: center; justify-content: center;
  padding: 22px;
  background: rgba(3, 3, 5, .82);
  backdrop-filter: blur(6px);
}
.modal.show { display: flex; }
.modal-box {
  width: 100%; max-width: 380px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 40%),
    linear-gradient(180deg, rgba(20, 20, 28, .95), rgba(10, 10, 15, .96));
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 24px 60px rgba(0, 0, 0, .6);
  padding: 22px;
}
.modal-title { font-size: 11px; letter-spacing: .2em; color: var(--dim); margin: 0 0 12px; }
.code {
  display: block;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 9px;
  color: var(--red); font: inherit; font-size: 11px;
  padding: 12px; margin-bottom: 14px;
  word-break: break-all; white-space: pre-wrap;
  max-height: 150px; overflow: auto;
}

/* ── settings button + account sheet ─────────────────────────────────────── */

[hidden] { display: none !important; }

.icon-btn.icon-only {
  position: relative;
  width: 38px; height: 38px; padding: 0;
  justify-content: center;
}
.icon-btn.icon-only .ico { width: 17px; height: 17px; }
#settingsBtn:hover .ico { transform: rotate(45deg); }
#logoutBtn:hover .ico { transform: translateX(2px); }
.icon-btn .ico { transition: transform .35s ease; }
/* Expiry is behind this button now — a lit dot says "look here" when it is close. */
.icon-btn.alert::after {
  content: "";
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 8px var(--red);
  animation: pulse 1.6s ease-in-out infinite;
}
[dir="rtl"] .icon-btn.alert::after { right: auto; left: 6px; }

.sheet { max-width: 400px; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-head .modal-title { margin: 0; }
.sheet-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255, 255, 255, .02); color: var(--dim);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.sheet-x:hover { color: var(--red); border-color: rgba(255, 35, 64, .5); background: rgba(255, 35, 64, .06); }
.sheet-x .ico { width: 15px; height: 15px; }

.info-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, .02);
}
.info-k {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font-family: var(--display);
  font-size: 9.5px; font-weight: 600; letter-spacing: .18em;
  color: var(--dimmer);
}
.info-k .ico { width: 13px; height: 13px; color: var(--dim); }
.info-v {
  min-width: 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em;
  color: var(--text); text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sheet-sec {
  margin-top: 6px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.sheet-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.sheet-sec-head .modal-title { margin: 0; }
/* The caption that trails a section title. Shared by SERVER and COMMUNITY. */
.sheet-sub { font-size: 9.5px; letter-spacing: .04em; color: var(--dimmer); }
.happ-note {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 11px; line-height: 1.5;
  color: var(--dim);
}
.info-list .info-row { margin-bottom: 8px; padding: 10px 13px; }
.info-list .info-row:last-child { margin-bottom: 0; }

/* The HWID is long: let it wrap, and make it a tap-to-copy target. */
.info-v.hwid {
  white-space: normal; word-break: break-all; text-align: right;
  border: 0; background: none; padding: 0;
  color: var(--red); cursor: copy;
}
.info-v.hwid:hover { text-decoration: underline; text-underline-offset: 3px; }

.pill.used { color: #ffb020; border-color: rgba(255, 176, 32, .4); }

/* DEVICE DETAILS — opens #deviceModal. A button, not the details themselves:
   the HWID stays off the sheet until the player asks for it. */
.device-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, .02); color: var(--text);
  font-family: var(--display); text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.device-btn[hidden] { display: none; }
.device-btn:hover { border-color: rgba(255, 176, 32, .45); background: rgba(255, 176, 32, .05); }
.device-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.device-btn-k {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 600; letter-spacing: .18em; color: var(--dim);
}
.device-btn-k .ico { width: 14px; height: 14px; color: #ffb020; }
.device-btn-go { flex: none; width: 15px; height: 15px; color: var(--dimmer); transition: transform .15s, color .15s; }
.device-btn:hover .device-btn-go { color: #ffb020; transform: translateX(2px); }
.pill.used .led { background: #ffb020; box-shadow: 0 0 9px #ffb020; }

/* ── community links ─────────────────────────────────────────────────────── */

/* Two links at the foot of the settings sheet. Deliberately lighter than the
   .store-btn cards in GET HAPP: those are the one thing a new player has to
   do, these are a side door they take once.
   Each sits in the panel's own greys and only takes its brand colour on
   hover — two foreign blues glowing inside a red-on-black panel would read as
   someone else's UI pasted in. The colour lives in --brand on the link, so
   the icon tile, border and arrow all follow from one declaration. */
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.social-btn {
  min-width: 0;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  color: var(--text); text-decoration: none;
  transition: transform .18s ease, border-color .18s, background .18s;
}
.social-btn.tg { --brand: #29a9eb; --brand-soft: rgba(41, 169, 235, .13); }
.social-btn.dc { --brand: #5865f2; --brand-soft: rgba(88, 101, 242, .13); }
.social-btn:hover {
  transform: translateY(-1px);
  background: var(--panel-2);
  border-color: var(--brand);
}
.social-btn:active { transform: translateY(0); }
.social-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.social-ico-wrap {
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(180deg, #20202a, #101016);
  border: 1px solid rgba(255, 255, 255, .07);
  color: var(--dim);
  transition: color .18s, background .18s, border-color .18s;
}
.social-btn:hover .social-ico-wrap {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand);
}
/* The marks are filled, not stroked, and come from different viewBoxes:
   Telegram's plane is 448x512, Discord's is square. Sized apart so both read
   as the same visual weight in the tile. */
.social-ico { width: 15px; height: 15px; }
.social-btn.tg .social-ico { width: 14px; height: 16px; margin-right: 1px; }

.social-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.1; }
.social-txt small {
  font-family: var(--display);
  font-size: 8px; font-weight: 600; letter-spacing: .18em;
  color: var(--dimmer);
}
.social-txt b {
  font-family: var(--display);
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.social-go {
  flex: none;
  width: 12px; height: 12px;
  color: var(--dimmer);
  transition: transform .18s ease, color .18s;
}
.social-btn:hover .social-go { color: var(--brand); transform: translate(1px, -1px); }

.skeleton {
  grid-column: 1 / -1;
  padding: 40px 0; text-align: center;
  color: var(--dimmer); font-size: 11px; letter-spacing: .16em;
}

/* Short screens: trim the chrome so the grid still gets room. */
@media (max-height: 680px) {
  .topbar { padding: 10px 16px; }
  .topbar-logo { width: 30px; height: 30px; }
  .status { padding: 10px 16px 11px; }
  .hint { display: none; }
  .tabs { margin: 9px 16px; }
  .tile { min-height: 74px; }
}

/* ── icons ───────────────────────────────────────────────────────────────── */
/* Drawn in currentColor, so each one follows the state of whatever holds it. */

.ico {
  flex: none;
  width: 14px; height: 14px;
  display: block;
  vertical-align: middle;
}

.tile-ico {
  width: 18px; height: 18px;
  color: var(--dim);
  transition: color .18s, filter .2s;
}
.tile[aria-pressed="true"] .tile-ico {
  color: var(--red);
  filter: drop-shadow(0 0 6px var(--red-glow));
}

.bar-ico {
  width: 17px; height: 17px;
  color: var(--dim);
  transition: color .18s;
}
.bar[aria-pressed="true"] .bar-ico { color: var(--red); }

.tab-ico { width: 14px; height: 14px; opacity: .85; }
.tab[aria-selected="true"] .tab-ico { opacity: 1; }

.title-ico { width: 12px; height: 12px; }

/* The tile now stacks icon, label and switch: keep them apart evenly. */
.tile { gap: 9px; min-height: 104px; }

/* ── type ────────────────────────────────────────────────────────────────── */

.brand,
.tagline,
.topbar-name,
.tab,
.btn,
.icon-btn,
.apply-btn,
.unlock,
.paste-btn,
.field-label,
.pill,
.expiry-k,
.wide-title,
.chips-title,
.chip,
.tile-name,
.tile-state,
.tile-badge,
.bar,
.item-name,
.modal-title,
.skeleton,
.foot,
.hint {
  font-family: var(--display);
}

/* The wordmark: heavy, tight, and optically balanced between the two words. */
.brand {
  font-weight: 700;
  letter-spacing: .07em;
  text-indent: .07em;
}
.topbar-name {
  font-weight: 700;
  letter-spacing: .12em;
}
.topbar-name span { font-weight: 700; }

.tab, .btn, .icon-btn, .apply-btn, .chip, .tile-state, .tile-badge { font-weight: 600; }
.tile-name, .bar, .item-name { font-weight: 600; }
.unlock { font-weight: 700; }

/* Numbers stay mono so they do not jitter as they tick. */
.expiry-v, .key-input, .code, .expiry-on { font-family: var(--mono); }

/* ── shine ───────────────────────────────────────────────────────────────── */
/* The same moving sheen as the login's UNLOCK, on every lit red surface, so
   the panel and the gate read as one product. */

.btn-primary,
.tab[aria-selected="true"] {
  position: relative; overflow: hidden; isolation: isolate;
}
.btn-primary::after,
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute; top: 0; left: -45%; width: 40%; height: 100%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent);
  transform: skewX(-18deg);
  animation: sheen 4.5s ease-in-out infinite;
}
.tab[aria-selected="true"]::after { animation-delay: 1.2s; }
.btn-primary .ico, .tab .ico { position: relative; }

/* A lit top edge on the panel frame, breathing slowly. */
.phone::before {
  content: "";
  position: absolute; top: 0; left: 12%; right: 12%; height: 1px;
  z-index: 61; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 35, 64, .9), #fff 50%, rgba(255, 35, 64, .9), transparent);
  box-shadow: 0 0 14px 1px rgba(255, 35, 64, .55);
  animation: edgeBreathe 4s ease-in-out infinite;
}
@keyframes edgeBreathe {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

/* Lit feature tiles get a soft breathing glow, so "on" is unmistakable. */
.tile[aria-pressed="true"],
.bar[aria-pressed="true"] {
  animation: tileGlow 2.8s ease-in-out infinite;
}
@keyframes tileGlow {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(255, 35, 64, .2), 0 6px 18px rgba(255, 35, 64, .14); }
  50%      { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .09), 0 0 0 1px rgba(255, 35, 64, .35), 0 6px 26px rgba(255, 35, 64, .3); }
}

/* Motion is decoration here: drop all of it for players who ask for less. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Narrow phones: tighter cards, and the arrow gives way to the name. */
@media (max-width: 390px) {
  .store-btn { gap: 9px; padding: 9px 10px 9px 9px; }
  .store-ico-wrap { width: 34px; height: 34px; border-radius: 10px; }
  .store-txt b { font-size: 13.5px; }
  .store-go { display: none; }
  /* Same trade as the store cards: two columns leave no room for both the
     arrow and "@rezzxmods", and the name is what identifies the link. */
  .social-btn { gap: 8px; padding: 8px 9px; }
  .social-ico-wrap { width: 27px; height: 27px; border-radius: 8px; }
  .social-txt b { font-size: 11.5px; }
  .social-go { display: none; }
}


/* ── server picker ────────────────────────────────────────────────────────── */

/* Which nodes exist, which one is carrying this player, and how busy each is.
   There is deliberately no latency column: the only latency that matters is
   measured from the phone, and Happ already shows it per server in its own
   list — a number taken here would be the browser's path, not the game's. */
/* The picker moved into the settings sheet on 2026-11-05, so it is wrapped in
   .sheet-sec and needs no page-level padding or divider of its own — those
   come from the sheet. Its caption now uses the shared .sheet-sub, declared
   with the sheet rules, since COMMUNITY took the same treatment. */

.server-list { display: grid; gap: 7px; }
.server {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--panel-2);
  font-family: var(--display); text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.server:hover:not(:disabled) { border-color: var(--line); background: var(--panel); }
.server:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.server.chosen { border-color: rgba(255, 35, 64, .5); background: rgba(255, 35, 64, .07); }
.server.down { opacity: .55; }
.server:disabled { cursor: not-allowed; }

.server-led { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--dimmer); }
.server-led.up { background: var(--green); box-shadow: 0 0 8px var(--green); }
.server-led.off { background: var(--red); box-shadow: 0 0 8px var(--red); }

.server-name { font-size: 11.5px; letter-spacing: .05em; color: var(--text); }
.server-meta { margin-left: auto; font-size: 10px; color: var(--dimmer); white-space: nowrap; }
.server-badge {
  flex: none;
  font-size: 9px; letter-spacing: .1em; padding: 3px 7px; border-radius: 999px;
  color: var(--red); border: 1px solid rgba(255, 35, 64, .45);
  white-space: nowrap;
}
.server-flag {
  flex: none; width: 18px; height: 12px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
}

/* Ping measured in the player's own browser (app.js → runPings). */
.server-ping {
  flex: none;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 10px; letter-spacing: .04em; padding: 3px 7px; border-radius: 999px;
  border: 1px solid var(--line-soft); color: var(--dimmer);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.server-ping.good { color: var(--green); border-color: rgba(25, 214, 122, .4); }
.server-ping.fair { color: #ffc23d; border-color: rgba(255, 194, 61, .4); }
.server-ping.poor { color: var(--red); border-color: rgba(255, 35, 64, .45); }
.server-ping.best { background: rgba(25, 214, 122, .12); font-weight: 600; }
.server-ping.best.fair { background: rgba(255, 194, 61, .1); }
.server-ping.best.poor { background: rgba(255, 35, 64, .1); }
.server-ping.wait { opacity: .6; }
.ping-note {
  margin: 8px 2px 0; font-size: 10.5px; line-height: 1.45; color: #ffc23d;
}
.ping-note[hidden] { display: none; }

/* ── range slider (auto_freeze_duration) ──────────────────────────────────────
   Same visual language as .tile-sw: a dark recessed track with a red thumb once
   it carries a value. Both engines need their own track/thumb pseudo-elements —
   there is no shared selector, so the two blocks below are deliberate copies. */
.range-row { display: flex; align-items: center; gap: 12px; }

.range {
  flex: 1; min-width: 0;
  -webkit-appearance: none; appearance: none;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
.range:disabled { cursor: default; opacity: .45; }

.range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: #2a2a35;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  margin-top: -6px;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  transition: transform .12s;
}
.range:active::-webkit-slider-thumb { transform: scale(1.12); }
.range:disabled::-webkit-slider-thumb { background: #7a7a8a; }

.range::-moz-range-track {
  height: 4px; border-radius: 999px;
  background: #2a2a35;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.range::-moz-range-thumb {
  width: 16px; height: 16px; border: 0; border-radius: 50%;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 1px 3px rgba(0, 0, 0, .55);
}
.range:disabled::-moz-range-thumb { background: #7a7a8a; }

.range-out {
  flex: none; min-width: 40px; text-align: right;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.range:disabled ~ .range-out { color: var(--dimmer); }