/* ============================================================
   RIVALS CLANS — Styles
   Arena-FPS energy: charcoal/black base, neon crimson-pink + cyan,
   condensed headings, scanline/grid texture, color-tinted banners.
   Mobile-first → bottom nav. No web fonts, no images.
   ============================================================ */

:root {
  /* base */
  --bg:          #0a0a12;
  --bg2:         #11111c;
  --panel:       rgba(22, 22, 36, 0.78);
  --panel-solid: #161624;
  --panel-2:     #1c1c2e;
  --border:      rgba(255, 255, 255, 0.085);
  --border-lit:  rgba(255, 59, 107, 0.5);
  --text:        #f3f4fb;
  --muted:       #8b90b3;
  --muted-2:     #6b7099;

  /* brand */
  --accent:   #ff3b6b;   /* crimson-pink primary */
  --accent2:  #08d9d6;   /* electric cyan secondary */
  --accent3:  #9b5de5;   /* violet accent */
  --good:     #2ee6a6;
  --warn:     #ffb13b;
  --bad:      #ff4d6d;

  --radius: 16px;
  --glow: 0 0 0 1px rgba(255,59,107,.25), 0 12px 30px rgba(255,59,107,.22);
  --glow-cy: 0 0 0 1px rgba(8,217,214,.25), 0 12px 30px rgba(8,217,214,.18);

  /* condensed display + readable body (system fonts only) */
  --font-display: "Bahnschrift", "Arial Narrow", "Oswald", "Roboto Condensed", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- background texture ---------- */
.scanlines, .gridbg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.scanlines {
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: .5;
}
.gridbg {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,59,107,.16), transparent 70%),
    radial-gradient(900px 500px at 100% 0%, rgba(8,217,214,.10), transparent 70%),
    linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px) 0 0 / 44px 44px;
  opacity: .55;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 60%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 60%);
}

.wrap {
  position: relative; z-index: 1;
  max-width: 760px; margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--nav-h) + var(--safe-b) + 30px);
}

/* ---------- header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  font-size: 24px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  box-shadow: var(--glow);
}
.brand-txt { min-width: 0; }
.brand-txt h1 {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: 22px; letter-spacing: .5px; line-height: 1;
  background: linear-gradient(90deg, #fff 8%, var(--accent) 55%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  white-space: nowrap;
}
.brand-txt .sub { font-size: 11px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }
.hud { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .4px;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent3));
  padding: 11px 17px; border-radius: 12px; font-size: 14.5px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 8px 22px rgba(255,59,107,.28); transition: transform .12s ease, box-shadow .12s, filter .12s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.lg { padding: 14px 22px; font-size: 16px; min-height: 50px; }
.btn.sm { padding: 8px 13px; font-size: 13px; min-height: 38px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn.ghost { background: rgba(255,255,255,.05); border: 1px solid var(--border); box-shadow: none; color: var(--text); }
.btn.ghost:hover { border-color: var(--border-lit); background: rgba(255,255,255,.08); }
.btn.danger { background: linear-gradient(135deg, #ff4d6d, #c1121f); box-shadow: 0 8px 22px rgba(193,18,31,.3); }
.btn.ghost.danger { background: rgba(255,77,109,.08); border-color: rgba(255,77,109,.4); color: #ff8197; }
.btn[disabled] { opacity: .55; cursor: default; filter: grayscale(.3); }

/* ---------- cards / sections ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; backdrop-filter: blur(8px);
}
.section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .4px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.muted-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.lead { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 12.5px; }
.empty-card { text-align: center; color: var(--muted); padding: 26px 18px; }
.empty-mini { text-align: center; color: var(--muted); padding: 16px; font-size: 13.5px; }

.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.page-head .ph-ico {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-size: 24px;
  border-radius: 13px; background: var(--panel-solid); border: 1px solid var(--border);
}
.page-head h2 { margin: 0; font-family: var(--font-display); font-size: 22px; letter-spacing: .4px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.back-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; padding: 6px 2px; margin-bottom: 6px;
}
.back-btn:hover { color: var(--accent2); }

.inline-note { font-size: 13px; padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; }
.inline-note.warn { background: rgba(255,177,59,.1); border: 1px solid rgba(255,177,59,.3); color: #ffce82; }

/* ---------- spinner / loading / retry ---------- */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.14); border-top-color: var(--accent);
  display: inline-block; animation: spin .8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card { display: flex; align-items: center; gap: 12px; color: var(--muted); justify-content: center; }
.lp-loading { display: grid; place-items: center; padding: 18px; }
.retry { text-align: center; }
.retry .retry-ico { font-size: 32px; }
.retry .retry-msg { color: var(--muted); margin: 8px 0 14px; }

/* ---------- HERO (guest) ---------- */
.hero {
  text-align: center; padding: 26px 18px 6px;
  border-radius: 20px; margin-bottom: 18px;
  background:
    radial-gradient(600px 280px at 50% -20%, rgba(255,59,107,.28), transparent 70%),
    linear-gradient(180deg, rgba(28,28,46,.7), rgba(16,16,26,.4));
  border: 1px solid var(--border);
}
.hero-badge {
  display: inline-block; font-family: var(--font-display); font-weight: 700; font-size: 12px;
  letter-spacing: 3px; color: var(--accent2); padding: 5px 13px; border-radius: 99px;
  border: 1px solid rgba(8,217,214,.35); background: rgba(8,217,214,.07); margin-bottom: 14px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 9vw, 46px);
  line-height: 1.02; letter-spacing: .5px; margin: 0 0 12px;
}
.hero-title .hl {
  background: linear-gradient(90deg, var(--accent) 10%, var(--accent3) 60%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); max-width: 460px; margin: 0 auto 20px; font-size: 14.5px; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- no-clan CTA ---------- */
.noclan { text-align: center; margin-bottom: 16px; }
.noclan-head { padding: 22px 16px 6px; }
.noclan .nc-ico { font-size: 40px; }
.noclan h2 { font-family: var(--font-display); font-size: 24px; margin: 8px 0 6px; }
.noclan p { color: var(--muted); max-width: 420px; margin: 0 auto 18px; }
.nc-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- banner (clan) ---------- */
.banner {
  position: relative; overflow: hidden; border-radius: 18px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--clan, var(--accent)) 50%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--clan, var(--accent)) 30%, var(--panel-solid)), var(--panel-solid));
  margin-bottom: 16px;
}
.banner.big { padding: 20px; }
.banner-glow {
  position: absolute; inset: 0;
  background: radial-gradient(360px 160px at 0% 0%, color-mix(in srgb, var(--clan, var(--accent)) 45%, transparent), transparent 70%);
  opacity: .9; pointer-events: none;
}
.banner-row { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.banner-id { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; min-width: 0; }
.banner-tag {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: var(--clan, var(--accent)); text-shadow: 0 1px 10px color-mix(in srgb, var(--clan, var(--accent)) 60%, transparent);
}
.banner-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 6vw, 28px); letter-spacing: .3px; }
.banner-region { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 600; padding-top: 4px; }
.banner-motto { position: relative; color: #cdd2ec; font-style: italic; font-size: 13.5px; margin: 8px 0 2px; }
.banner-stats { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.bstat {
  background: rgba(0,0,0,.28); border: 1px solid var(--border); border-radius: 11px; padding: 9px 8px; text-align: center;
}
.bstat .bv { display: block; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.bstat .bl { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 2px; }

.npc-pill {
  font-family: var(--font-display); font-weight: 700; font-size: 10px; letter-spacing: 1px;
  color: var(--accent2); background: rgba(8,217,214,.1); border: 1px solid rgba(8,217,214,.4);
  padding: 2px 7px; border-radius: 99px; white-space: nowrap; align-self: center;
}
.npc-pill.sm { font-size: 9px; padding: 2px 6px; }
.npc-mini { font-size: 12px; }
.you-pill {
  font-family: var(--font-display); font-weight: 700; font-size: 9.5px; letter-spacing: 1px;
  color: #0a0a12; background: var(--accent2); padding: 2px 7px; border-radius: 99px;
}
.you-pill.sm { font-size: 9px; }

/* ---------- hub ---------- */
.hub-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-chip {
  display: flex; align-items: center; gap: 7px; background: var(--panel-solid); border: 1px solid var(--border);
  border-radius: 11px; padding: 9px 13px; font-size: 13px;
}
.meta-chip .mc-ico { font-size: 15px; }
.meta-chip b { color: var(--accent2); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  position: relative; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 15px; padding: 16px;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--border-lit); box-shadow: var(--glow); }
.tile .tile-ico { font-size: 26px; }
.tile .tile-t { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 6px; }
.tile .tile-s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile-badge, .nav-badge, .tile-badge {
  position: absolute; top: 10px; right: 10px; min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 12px;
  border-radius: 99px; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(255,59,107,.5);
}

/* ---------- ladder preview ---------- */
.ladder-preview .lp-head { display: flex; align-items: center; justify-content: space-between; }
.lp-list { display: flex; flex-direction: column; gap: 7px; }
.lp-row {
  display: grid; grid-template-columns: 26px 12px 1fr auto; align-items: center; gap: 10px;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-left: 3px solid var(--clan, var(--accent)); border-radius: 11px; padding: 10px 12px;
  cursor: pointer; text-align: left; color: var(--text); transition: border-color .12s, transform .1s;
}
.lp-row:hover { border-color: var(--border-lit); transform: translateX(2px); }
.lp-rank { font-family: var(--font-display); font-weight: 700; color: var(--muted); text-align: center; }
.lp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clan, var(--accent)); box-shadow: 0 0 8px var(--clan, var(--accent)); }
.lp-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-tr { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--accent2); white-space: nowrap; }

/* ---------- forms / create ---------- */
.fld { display: block; margin-bottom: 14px; }
.fld-lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.fld-lbl em { font-style: normal; color: var(--muted-2); text-transform: none; letter-spacing: 0; }
.create-form input, .data-io, .search-input {
  width: 100%; background: var(--panel-solid); border: 1px solid var(--border); color: var(--text);
  border-radius: 11px; padding: 12px 14px; font-size: 15px; font-family: var(--font-body);
}
.create-form input:focus, .search-input:focus, .data-io:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,59,107,.18); }

.preview-banner {
  border-radius: 16px; padding: 16px; margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--clan, var(--accent)) 55%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, var(--clan, var(--accent)) 32%, var(--panel-solid)), var(--panel-solid));
}
.pv-row { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.pv-tag { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--clan, var(--accent)); }
.pv-name { font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.pv-motto { color: #cdd2ec; font-style: italic; font-size: 13px; margin-top: 7px; }
.pv-region { font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 600; }

.swatches { display: flex; flex-wrap: wrap; gap: 9px; }
.swatch {
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; background: var(--sw);
  border: 2px solid transparent; box-shadow: 0 2px 8px rgba(0,0,0,.4); transition: transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--sw), 0 4px 12px var(--sw); }

.rchips { display: flex; flex-wrap: wrap; gap: 8px; }
.rchips.scrollx { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.rchip {
  cursor: pointer; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--muted);
  border-radius: 99px; padding: 8px 13px; font-family: var(--font-display); font-weight: 700; font-size: 12.5px;
  white-space: nowrap; min-height: 38px; transition: .12s;
}
.rchip:hover { border-color: var(--border-lit); color: var(--text); }
.rchip.sel { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent3)); border-color: transparent; }

.form-err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0 10px; text-align: center; }

/* ---------- browse ---------- */
.browse-controls { margin-bottom: 14px; }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-input { flex: 1; }
.clan-grid { display: flex; flex-direction: column; gap: 11px; }
.clan-card {
  position: relative; display: flex; align-items: center; gap: 12px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 13px 14px 13px 16px;
}
.clan-card .cc-stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--clan, var(--accent)); box-shadow: 0 0 14px var(--clan, var(--accent)); }
.cc-main { flex: 1; min-width: 0; }
.cc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-tag { font-family: var(--font-display); font-weight: 700; color: var(--clan, var(--accent)); font-size: 15px; }
.cc-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.cc-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.cc-stats span { white-space: nowrap; }
.cc-acts { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ---------- profile ---------- */
.manage-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.roster-list { display: flex; flex-direction: column; gap: 2px; }
.rmem {
  display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid var(--border);
}
.rmem:last-child { border-bottom: none; }
.rmem-rank { font-size: 17px; text-align: center; }
.rmem-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.rmem-name .self-tag { font-size: 10px; color: var(--accent2); border: 1px solid rgba(8,217,214,.4); border-radius: 6px; padding: 0 5px; margin-left: 5px; }
.rmem-role { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.rmem-ctrls { display: flex; gap: 5px; }
.rbtn {
  cursor: pointer; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  border-radius: 9px; min-width: 36px; height: 34px; font-size: 13px; display: grid; place-items: center; transition: .12s;
}
.rbtn:hover { border-color: var(--accent2); }
.rbtn.danger:hover { border-color: var(--bad); color: #ff8197; }

.warhist .log-feed { display: flex; flex-direction: column; gap: 2px; }
.log-row {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px;
  padding: 9px 6px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.log-row:last-child { border-bottom: none; }
.log-row .lr-ico { text-align: center; }
.log-row .lr-at { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.log-row.good .lr-txt b { color: var(--good); }
.log-row.bad .lr-txt b { color: var(--bad); }
.log-row .score { font-family: var(--font-display); font-weight: 700; color: var(--accent2); }
.log-row .delta { font-family: var(--font-display); font-weight: 700; font-size: 12px; }
.log-row .delta.up { color: var(--good); }
.log-row .delta.down { color: var(--bad); }

/* ---------- wars ---------- */
.incoming-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-left: 4px solid var(--clan, var(--accent)); border-radius: 12px; padding: 12px 14px; margin-bottom: 9px;
}
.ic-from { font-size: 14px; }
.ic-from b { font-family: var(--font-display); }
.ic-stake { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ic-stake b { color: var(--accent2); }
.ic-acts { display: flex; gap: 7px; flex: none; }

.dw-list { display: flex; flex-direction: column; gap: 8px; }
.dw-row {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-left: 3px solid var(--clan, var(--accent)); border-radius: 11px; padding: 10px 12px;
}
.dw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clan, var(--accent)); box-shadow: 0 0 8px var(--clan, var(--accent)); }
.dw-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-tr { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--accent2); white-space: nowrap; }

/* ---------- leaderboard ---------- */
.ladder-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.ltab {
  cursor: pointer; border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--muted);
  border-radius: 10px; padding: 9px 14px; font-family: var(--font-display); font-weight: 700; font-size: 13px;
  white-space: nowrap; min-height: 40px; transition: .12s;
}
.ltab.sel { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent3)); border-color: transparent; }
.ladder-goal {
  font-size: 12.5px; color: var(--muted); text-align: center; padding: 10px 12px; margin-bottom: 12px;
  border: 1px dashed rgba(255,209,102,.35); border-radius: 11px; background: rgba(255,209,102,.05);
}
.ladder-goal b { color: #ffd166; }
.ladder { display: flex; flex-direction: column; gap: 6px; }
.ladder-sep {
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--bk, var(--muted)); margin: 12px 0 2px; padding-left: 4px;
}
.ladder-row {
  display: grid; grid-template-columns: 30px 12px 1fr auto; align-items: center; gap: 11px;
  background: var(--panel-solid); border: 1px solid var(--border);
  border-left: 3px solid var(--clan, var(--accent)); border-radius: 11px; padding: 11px 13px;
  cursor: pointer; text-align: left; color: var(--text); transition: border-color .12s, transform .1s;
}
.ladder-row:hover { border-color: var(--border-lit); transform: translateX(2px); }
.ladder-row.mine { border: 1px solid var(--accent2); box-shadow: var(--glow-cy); background: linear-gradient(90deg, rgba(8,217,214,.08), var(--panel-solid)); }
.lad-rank { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--muted); text-align: center; }
.lad-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--clan, var(--accent)); box-shadow: 0 0 9px var(--clan, var(--accent)); }
.lad-id { min-width: 0; }
.lad-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lad-sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.lad-tr { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--accent2); white-space: nowrap; }

/* ---------- settings ---------- */
.set-card { }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: none; }
.set-info { min-width: 0; }
.set-title { font-weight: 700; font-size: 14.5px; }
.set-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.set-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.data-io { min-height: 90px; resize: vertical; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 12px; margin-top: 8px; }
.ver-line { font-family: var(--font-display); font-weight: 700; color: var(--muted); font-size: 12px; margin-top: 14px; }
.ver-sub { color: var(--muted-2); font-size: 11px; margin-top: 4px; }

.toggle {
  position: relative; width: 50px; height: 30px; border-radius: 99px; cursor: pointer; flex: none;
  background: var(--panel-2); border: 1px solid var(--border); transition: background .15s;
}
.toggle .toggle-dot { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .16s, background .16s; }
.toggle.on { background: linear-gradient(135deg, var(--accent), var(--accent3)); border-color: transparent; }
.toggle.on .toggle-dot { transform: translateX(20px); background: #fff; }

/* ---------- help ---------- */
.help-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.help-item { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.help-item summary { cursor: pointer; padding: 14px 16px; font-family: var(--font-display); font-weight: 700; font-size: 15px; list-style: none; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary::after { content: "＋"; float: right; color: var(--accent2); }
.help-item[open] summary::after { content: "－"; }
.help-item .help-a { padding: 0 16px 15px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.rank-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-row .rank-ico { font-size: 22px; }

/* ---------- gate ---------- */
.gate { text-align: center; }
.gate .gate-ico { font-size: 38px; }
.gate h2 { font-family: var(--font-display); font-size: 22px; margin: 8px 0 6px; }
.gate p { color: var(--muted); max-width: 420px; margin: 0 auto 18px; font-size: 13.5px; }

/* ---------- bottom nav ---------- */
.botnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: stretch;
  background: rgba(12,12,20,.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  position: relative; flex: 1; background: none; border: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--font-display); font-weight: 700; font-size: 11px; letter-spacing: .3px; padding: 6px 2px;
  transition: color .12s;
}
.nav-btn .ni { font-size: 21px; line-height: 1; transition: transform .12s; filter: grayscale(.4) brightness(.85); }
.nav-btn.active { color: var(--accent); }
.nav-btn.active .ni { transform: translateY(-1px) scale(1.12); filter: none; }
.nav-btn.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.nav-badge { top: 7px; right: calc(50% - 24px); min-width: 18px; height: 18px; font-size: 10.5px; }

/* ---------- footer ---------- */
.app-foot { text-align: center; color: var(--muted-2); font-size: 11.5px; margin-top: 22px; line-height: 1.7; }
.app-foot b { color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 24px);
  z-index: 200; max-width: calc(100% - 32px);
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-lit);
  border-radius: 13px; padding: 12px 18px; font-size: 14px; font-weight: 600;
  box-shadow: 0 14px 40px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(46,230,166,.5); }
.toast.warn { border-color: rgba(255,177,59,.5); }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 9000; display: none; align-items: center; justify-content: center; padding: 18px;
  background: rgba(5,4,10,.74); backdrop-filter: blur(5px);
}
.modal-wrap.show { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg2); border: 1px solid var(--border-lit); border-radius: 18px; max-width: 380px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.6); overflow: hidden; animation: pop .2s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-top { padding: 16px 18px; font-family: var(--font-display); font-weight: 700; font-size: 17px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.modal-body p { margin: 0 0 8px; }
.modal-body b { color: var(--text); }
.modal-acts { display: flex; gap: 9px; padding: 0 18px 18px; }
.modal-acts .btn { flex: 1; }

/* ---------- war reveal ---------- */
.war-reveal .reveal {
  position: relative; text-align: center; max-width: 380px; width: 100%; padding: 26px 22px;
  border-radius: 20px; background: var(--bg2); overflow: hidden;
  animation: pop .24s ease;
}
.war-reveal .reveal.win { border: 2px solid var(--good); box-shadow: 0 0 60px rgba(46,230,166,.3); }
.war-reveal .reveal.loss { border: 2px solid var(--bad); box-shadow: 0 0 60px rgba(255,77,109,.25); }
.war-reveal .reveal.forfeit { border: 2px solid var(--warn); box-shadow: 0 0 50px rgba(255,177,59,.22); }
.reveal-banner { font-family: var(--font-display); font-weight: 700; font-size: 34px; letter-spacing: 2px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.reveal.win .reveal-banner { color: var(--good); }
.reveal.loss .reveal-banner { color: var(--bad); }
.reveal.forfeit .reveal-banner { color: var(--warn); }
.reveal-vs { color: var(--muted); font-size: 13px; margin: 4px 0 14px; }
.reveal-score { font-family: var(--font-display); font-weight: 700; font-size: 56px; letter-spacing: 2px; display: flex; align-items: center; justify-content: center; gap: 12px; line-height: 1; }
.reveal-score.forfeit-mark { font-size: 30px; color: var(--warn); }
.reveal-score .rs-you { color: var(--accent2); }
.reveal-score .rs-them { color: #fff; }
.reveal-score .rs-dash { color: var(--muted); }
.reveal-score .pop { animation: scorepop .18s ease; }
@keyframes scorepop { 0% { transform: scale(1); } 50% { transform: scale(1.22); } 100% { transform: scale(1); } }
.reveal-delta { font-family: var(--font-display); font-weight: 700; font-size: 22px; margin-top: 14px; }
.reveal-delta.up { color: var(--good); }
.reveal-delta.down { color: var(--bad); }
.reveal-delta .rd-total { font-size: 14px; color: var(--muted); }
.reveal-note { color: var(--muted); font-size: 12.5px; margin: 10px 0 4px; font-style: italic; }
.reveal #reveal-close { margin-top: 18px; min-width: 150px; }
.reveal.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ---------- accessibility / focus ---------- */
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 6px; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 380px) {
  .banner-stats { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .bstat .bv { font-size: 14px; }
}
@media (min-width: 620px) {
  .botnav { max-width: 760px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner { animation: spin .8s linear infinite !important; }
}

/* fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .banner, .preview-banner { border-color: var(--clan, var(--accent)); background: linear-gradient(135deg, rgba(255,59,107,.18), var(--panel-solid)); }
}
