/* ==========================================================================
   ARENA OPERATING SYSTEM — core stylesheet
   Invasion | Civil War  ·  RTL / Arabic-first
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #04060a;
  --bg-2: #070b12;
  --bg-3: #0b111b;
  --panel: rgba(10, 16, 26, 0.72);
  --panel-solid: #0a1019;
  --line: rgba(120, 165, 210, 0.16);
  --line-strong: rgba(140, 190, 235, 0.34);

  /* type */
  --text: #dce7f4;
  --text-2: #9fb2c6;
  --dim: #6d7f93;

  /* brand */
  --red: #ff2f2f;
  --red-deep: #aa0000;
  --cyan: #22d3ee;
  --cyan-dim: #0e7490;

  /* category palette — brand hex from the brief, plus an on-dark glow tone */
  --c-characters: #7738b4;
  --g-characters: #b06cf5;
  --c-attack: #aa0000;
  --g-attack: #ff4040;
  --c-defense: #0972c8;
  --g-defense: #45b6f8;
  --c-resources: #008d00;
  --g-resources: #2fd45a;
  --c-events: #c49e31;
  --g-events: #f2c94c;
  --c-support: #00a8a8;
  --g-support: #34d8d8;
  --c-trap: #de6c23;
  --g-trap: #ff9243;

  /* geometry */
  --r: 4px;
  --shell: 1240px;
  --nav-h: 62px;

  --mono: "Share Tech Mono", "Consolas", ui-monospace, monospace;
  --ar: "Cairo", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ar);
  font-size: 16px;
  line-height: 1.85;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ambient background: grid + vignette + slow drift */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(170, 0, 0, 0.16), transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(9, 114, 200, 0.12), transparent 70%),
    linear-gradient(#04060a, #04060a);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 170, 220, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 220, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 35%, #000 25%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 35%, #000 25%, transparent 85%);
}

/* height:auto keeps the intrinsic ratio when only width is styled — the
   width/height HTML attributes would otherwise pin the height and stretch. */
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { font-weight: 800; line-height: 1.35; margin: 0; letter-spacing: 0; }

::selection { background: rgba(255, 47, 47, 0.32); color: #fff; }

/* focus ring — visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* ---------- layout helpers ---------- */
.shell { width: min(var(--shell), 100% - 2.4rem); margin-inline: auto; }
.shell-wide { width: min(1480px, 100% - 2.4rem); margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }

/* ---------- mono / HUD text ---------- */
.mono {
  font-family: var(--mono);
  letter-spacing: 0.09em;
  direction: ltr;
  unicode-bidi: isolate;
}
.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
  direction: ltr;
  unicode-bidi: isolate;
}

/* ==========================================================================
   HUD panel — the recurring bracketed frame
   ========================================================================== */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 1px solid var(--line-strong);
  pointer-events: none;
}
.panel::before { inset-block-start: -1px; inset-inline-start: -1px; border-inline-end: 0; border-block-end: 0; }
.panel::after  { inset-block-end: -1px; inset-inline-end: -1px; border-inline-start: 0; border-block-start: 0; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  border-block-end: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 47, 47, 0.07), transparent 60%);
}
.panel-head .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  flex: none;
}
.panel-head h2, .panel-head h3 {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: #cfe0f0;
  font-weight: 700;
}
.panel-head .right { margin-inline-start: auto; }
.panel-body { padding: 1rem 1.05rem; }

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-inline: clamp(0.9rem, 3vw, 2rem);
  background: rgba(4, 6, 10, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 0.6rem; flex: none; }
.topbar .brand img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(255,47,47,.5)); }
.topbar .brand b {
  font-family: var(--mono);
  font-size: 0.94rem;
  letter-spacing: 0.2em;
  color: #f2f6fb;
  direction: ltr;
}
.topbar .brand span {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  color: var(--dim);
  display: block;
  direction: ltr;
}

.nav { display: flex; gap: 0.15rem; margin-inline-start: auto; align-items: center; }
.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: color 0.18s, background 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav a[aria-current="page"] {
  color: #fff;
  border-color: rgba(255, 47, 47, 0.5);
  background: rgba(255, 47, 47, 0.1);
}
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline: 22%;
  bottom: -1px;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

.nav-toggle {
  display: none;
  margin-inline-start: auto;
  width: 42px; height: 38px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(5, 8, 13, 0.98);
    border-block-end: 1px solid var(--line);
    padding: 0.5rem;
    margin: 0;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 0.85rem 1rem; font-size: 1rem; }
  .nav a[aria-current="page"]::after { display: none; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.78rem 1.4rem;
  font-family: var(--ar);
  font-size: 0.95rem;
  font-weight: 700;
  color: #eaf2fb;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.07); }
.btn:active { transform: translateY(0); }
.btn .arrow { font-family: var(--mono); opacity: 0.8; }

.btn-red {
  border-color: rgba(255, 47, 47, 0.55);
  background: linear-gradient(180deg, rgba(255, 47, 47, 0.2), rgba(170, 0, 0, 0.12));
  box-shadow: 0 0 0 1px rgba(255, 47, 47, 0.1), 0 12px 34px -18px rgba(255, 47, 47, 0.8);
}
.btn-red:hover { box-shadow: 0 0 0 1px rgba(255, 47, 47, 0.25), 0 16px 40px -16px rgba(255, 47, 47, 0.9); }

.btn-cyan {
  border-color: rgba(34, 211, 238, 0.5);
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(14, 116, 144, 0.1));
  box-shadow: 0 12px 34px -18px rgba(34, 211, 238, 0.8);
}

.btn-lg { padding: 1.05rem 1.9rem; font-size: 1.05rem; width: 100%; }

/* sweep shimmer on big buttons */
.btn-sweep::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.14) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.75s;
}
.btn-sweep:hover::after { transform: translateX(120%); }

/* ==========================================================================
   HOME — boot / hero
   ========================================================================== */
.os-strip {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.45rem clamp(0.9rem, 3vw, 2rem);
  border-block-end: 1px solid var(--line);
  background: rgba(6, 10, 16, 0.7);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: var(--dim);
  direction: ltr;
  flex-wrap: wrap;
}
.os-strip .ok { color: #2fd45a; }
.os-strip .sep { opacity: 0.35; }
.os-strip .live {
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.os-strip .live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2fd45a; box-shadow: 0 0 8px #2fd45a;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.hero {
  position: relative;
  padding: clamp(2.4rem, 7vw, 5rem) 0 clamp(1.6rem, 4vw, 2.6rem);
  text-align: center;
  overflow: hidden;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: saturate(0.6) contrast(1.05) brightness(0.5);
  z-index: -1;
}
.hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 55% 60% at 50% 45%, rgba(4, 6, 10, 0.82), transparent 75%),
    radial-gradient(ellipse at center, transparent 18%, var(--bg) 80%);
}
.hero-mark {
  width: clamp(78px, 12vw, 116px);
  margin: 0 auto 1rem;
  filter: drop-shadow(0 0 26px rgba(255, 47, 47, 0.55));
  animation: float 7s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

.hero h1 {
  font-family: var(--mono);
  font-size: clamp(2.3rem, 9vw, 5.4rem);
  letter-spacing: 0.14em;
  line-height: 1;
  margin: 0;
  direction: ltr;
  background: linear-gradient(180deg, #ffffff 8%, #b9c9da 55%, #6b7b8d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(255, 47, 47, 0.22);
}
.hero .sub {
  font-family: var(--mono);
  font-size: clamp(0.62rem, 2.1vw, 0.95rem);
  letter-spacing: 0.5em;
  color: var(--red);
  margin-top: 0.5rem;
  direction: ltr;
}
.hero .kicker {
  margin-top: 1.1rem;
  color: var(--text-2);
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  max-width: 56ch;
  margin-inline: auto;
}

/* player status card */
.status-grid {
  display: grid;
  grid-template-columns: 128px 1fr 150px;
  gap: 1rem;
  align-items: center;
}
.status-face {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: url("../img/thumbs/card-back.webp") center/cover, #0a0f18;
  position: relative;
  overflow: hidden;
}
.status-face::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(255, 47, 47, 0.22));
}
.status-rows { display: grid; gap: 0.42rem; }
.srow {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  direction: ltr;
}
.srow > span:first-child { color: var(--dim); letter-spacing: 0.14em; font-size: 0.68rem; }
.srow b { color: #eaf2fb; letter-spacing: 0.1em; font-weight: 400; }
.hpbar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.hpbar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--cyan), #7dd3fc);
  box-shadow: 0 0 12px var(--cyan);
  animation: hpfill 1.6s cubic-bezier(.2,.9,.2,1) both;
}
@keyframes hpfill { from { width: 0; } }
.status-hp {
  text-align: center;
  border-inline-start: 1px solid var(--line);
  padding-inline-start: 1rem;
}
.status-hp .num {
  font-family: var(--mono);
  font-size: 2.1rem;
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(34, 211, 238, 0.55);
  line-height: 1;
}
.ekg { width: 100%; height: 34px; overflow: visible; }
.ekg path {
  fill: none; stroke: var(--cyan); stroke-width: 1.6;
  filter: drop-shadow(0 0 5px var(--cyan));
  stroke-dasharray: 300;
  animation: sweep 2.6s linear infinite;
}
@keyframes sweep { from { stroke-dashoffset: 300; } to { stroke-dashoffset: 0; } }

@media (max-width: 640px) {
  .status-grid { grid-template-columns: 92px 1fr; }
  .status-hp { grid-column: 1 / -1; border-inline-start: 0; border-block-start: 1px solid var(--line); padding: 0.6rem 0 0; }
}

/* story teaser row */
.teaser {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.05rem;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.teaser:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); transform: translateY(-2px); }
.teaser .ic {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(34, 211, 238, 0.07);
  font-size: 1.3rem;
}
.teaser b { display: block; font-size: 1rem; }
.teaser p { margin: 0.15rem 0 0; color: var(--dim); font-size: 0.87rem; }
.teaser .go { margin-inline-start: auto; font-family: var(--mono); color: var(--cyan); flex: none; }

/* ---------- tile grid (the 6 database tiles) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
@media (min-width: 780px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  position: relative;
  display: block;
  padding: 1.15rem 1rem 1.25rem;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.25s;
  --accent: var(--cyan);
}
.tile::before {
  content: "";
  position: absolute;
  inset-block-start: 0; inset-inline: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.55;
}
.tile:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 22px 50px -30px var(--accent), inset 0 0 60px -40px var(--accent);
}
.tile img,
.tile .glyph {
  display: block;
  width: 42px; height: 42px;
  margin: 0 auto 0.7rem;
  object-fit: contain;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 65%, transparent));
  transition: transform 0.25s;
}
.tile .glyph {
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 1.5rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 50%;
  filter: none;
  box-shadow: inset 0 0 18px -8px var(--accent);
}
.tile:hover img, .tile:hover .glyph { transform: scale(1.12); }
.tile b {
  display: block;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  direction: ltr;
}
.tile .ar { display: block; font-size: 1.05rem; font-weight: 800; margin-top: 0.2rem; }
.tile p { margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--dim); line-height: 1.6; }

/* system message */
.sysmsg {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.1rem;
  border: 1px solid rgba(255, 47, 47, 0.28);
  background: linear-gradient(90deg, rgba(255, 47, 47, 0.09), transparent);
  border-radius: var(--r);
}
.sysmsg .ic { font-size: 1.6rem; flex: none; filter: drop-shadow(0 0 10px var(--red)); }
.sysmsg q {
  display: block;
  font-family: var(--mono);
  color: #ff8f8f;
  font-size: 0.95rem;
  line-height: 1.7;
  quotes: "\"" "\"";
}
.sysmsg cite { font-style: normal; font-size: 0.66rem; letter-spacing: 0.2em; color: var(--dim); font-family: var(--mono); }

/* ==========================================================================
   Section headers used on inner pages
   ========================================================================== */
.page-head {
  padding: clamp(2rem, 6vw, 3.6rem) 0 clamp(1.2rem, 3vw, 2rem);
  text-align: center;
  position: relative;
}
.page-head .eyebrow {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  color: var(--red);
  direction: ltr;
}
.page-head h1 {
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  margin: 0.5rem 0 0;
}
.page-head p { color: var(--text-2); max-width: 66ch; margin: 0.7rem auto 0; }
.rule-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  margin: 1.4rem 0;
}

.sec { padding-block: clamp(1.6rem, 4vw, 2.6rem); }
.sec-title {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.sec-title .n {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--red);
  border: 1px solid rgba(255, 47, 47, 0.4);
  border-radius: var(--r);
  padding: 0.15rem 0.5rem;
  flex: none;
  direction: ltr;
}
.sec-title h2 { font-size: clamp(1.25rem, 3.6vw, 1.7rem); }
.sec-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

/* content prose */
.prose { color: var(--text-2); }
.prose p { margin: 0 0 0.9rem; }
.prose strong, .prose b { color: #eef4fb; font-weight: 700; }
.prose ul { margin: 0 0 1rem; padding-inline-start: 1.15rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--red); }
.prose .lead { color: var(--text); font-size: 1.06rem; }

/* checklist (arena setup) */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.checks li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.checks li::before {
  content: "▸";
  color: var(--red);
  font-family: var(--mono);
  flex: none;
  line-height: 1.7;
}

/* callout */
.callout {
  padding: 0.9rem 1rem;
  border-inline-start: 3px solid var(--accent, var(--cyan));
  background: rgba(34, 211, 238, 0.06);
  border-radius: var(--r);
  font-size: 0.92rem;
}
.callout.warn { --accent: var(--red); background: rgba(255, 47, 47, 0.07); }
.callout b { color: #fff; }

/* ---------- board diagram ---------- */
.board-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, 0.85fr);
  gap: 1.4rem;
  align-items: center;
}
@media (max-width: 860px) { .board-wrap { grid-template-columns: 1fr; } }

.board {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(60, 20, 60, 0.55), rgba(12, 10, 30, 0.9) 70%),
    #08060f;
  border: 2px solid rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 70px -20px rgba(34, 211, 238, 0.35), inset 0 0 90px -30px rgba(150, 40, 160, 0.6);
  overflow: hidden;
}
.board .core {
  position: absolute;
  inset: 22%;
  background: url("../img/icons/arena-mark.webp") center/contain no-repeat;
  opacity: 0.3;
}
.zone {
  position: absolute;
  border: 1px solid;
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: clamp(0.5rem, 1.2vw, 0.68rem);
  text-align: center;
  padding: 2px;
  line-height: 1.2;
  background: rgba(6, 10, 20, 0.72);
  cursor: default;
  transition: box-shadow 0.2s, transform 0.2s;
}
.zone:hover, .zone.hot { transform: scale(1.06); z-index: 3; }
.zone span { display: block; font-family: var(--ar); font-size: 0.86em; }

.z1 { border-color: #45b6f8; color: #9ad7fb; box-shadow: inset 0 0 18px -8px #45b6f8; }
.z2 { border-color: #b06cf5; color: #d3aefb; box-shadow: inset 0 0 18px -8px #b06cf5; }
.z3 { border-color: #45b6f8; color: #9ad7fb; box-shadow: inset 0 0 18px -8px #45b6f8; }
.z4 { border-color: #ff4040; color: #ff9c9c; box-shadow: inset 0 0 18px -8px #ff4040; }
.z5 { border-color: #2fd45a; color: #96e8ab; box-shadow: inset 0 0 18px -8px #2fd45a; }
.zone.hot { box-shadow: 0 0 26px -4px currentColor, inset 0 0 20px -8px currentColor; }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.legend li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.legend li:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line-strong); }
.legend .k {
  width: 25px; height: 25px; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 0.75rem;
  border: 1px solid currentColor;
  border-radius: 3px;
}
.legend li b { font-size: 0.93rem; color: var(--text); }
.legend li small { display: block; color: var(--dim); font-size: 0.76rem; line-height: 1.5; }

/* ---------- turn phases (rules) ---------- */
.phases { display: grid; gap: 0.85rem; counter-reset: ph; }
.phase {
  position: relative;
  padding: 1rem 1.1rem 1rem 1.1rem;
  padding-inline-start: 3.3rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.phase::before {
  counter-increment: ph;
  content: counter(ph);
  position: absolute;
  inset-inline-start: 0.85rem;
  top: 0.95rem;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--red);
  border: 1px solid rgba(255, 47, 47, 0.45);
  border-radius: 50%;
  background: rgba(255, 47, 47, 0.08);
}
.phase h3 { font-size: 1.02rem; }
.phase ul { margin: 0.5rem 0 0; padding-inline-start: 1.1rem; color: var(--text-2); }

/* ---------- arena phases timeline ---------- */
.timeline { display: grid; gap: 0.7rem; }
.tl {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  --accent: var(--c-events);
  transition: transform .2s, border-color .2s;
}
.tl:hover { transform: translateX(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.tl .art {
  width: 78px; aspect-ratio: 5/7;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.tl .stage {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  direction: ltr;
}
.tl h3 { font-size: 1.02rem; margin-top: 0.1rem; }
.tl p { margin: 0.3rem 0 0; color: var(--dim); font-size: 0.88rem; }
.tl.locked { border-style: dashed; opacity: 0.92; --accent: var(--red); }
.tl.locked .art {
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, rgba(255,47,47,.08) 0 8px, transparent 8px 16px);
  font-size: 1.6rem;
}

/* ==========================================================================
   DATABASE
   ========================================================================== */
.db-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 40;
  padding: 0.75rem clamp(0.6rem, 2vw, 1rem);
  background: rgba(5, 8, 13, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-block-end: 1px solid var(--line);
  display: grid;
  gap: 0.7rem;
}
.db-search {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.03);
}
.db-search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--ar);
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
}
.db-search input::placeholder { color: var(--dim); }
.db-search .cnt { font-family: var(--mono); font-size: 0.7rem; color: var(--dim); flex: none; direction: ltr; }

.chips { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.42rem;
  padding: 0.42rem 0.8rem;
  font-family: var(--ar);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.chip:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.chip[aria-pressed="true"] {
  color: #fff;
  border-color: color-mix(in srgb, var(--accent, var(--cyan)) 60%, transparent);
  background: color-mix(in srgb, var(--accent, var(--cyan)) 16%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, var(--cyan)) 22%, transparent);
}
.chip[aria-pressed="true"] i { color: var(--accent, var(--cyan)); box-shadow: 0 0 8px currentColor; }

.group-head {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 2rem 0 0.9rem;
  --accent: var(--cyan);
}
.group-head img { width: 30px; height: 30px; object-fit: contain; filter: drop-shadow(0 0 10px var(--accent)); }
.group-head h2 { font-size: 1.3rem; }
.group-head .hex {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em;
  color: var(--accent); border: 1px solid currentColor; border-radius: 3px;
  padding: 0.1rem 0.4rem; direction: ltr; opacity: .8;
}
.group-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.45; }
.group-sub { color: var(--dim); font-size: 0.9rem; margin: -0.4rem 0 1rem; }

/* sub-family header inside a category */
.sub-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.8rem;
  padding-block-end: 0.5rem;
  border-block-end: 1px dashed var(--line);
  --accent: var(--cyan);
}
.sub-head b {
  font-size: 0.95rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 99px;
  padding: 0.12rem 0.65rem;
  flex: none;
}
.sub-head span { color: var(--dim); font-size: 0.86rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 0.9rem;
}
@media (min-width: 700px) { .card-grid { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); } }

.card {
  display: block;
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: start;
  border-radius: 6px;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1);
  --accent: var(--cyan);
  font-family: inherit;
  color: inherit;
}
.card:hover, .card:focus-visible { transform: translateY(-6px) scale(1.015); }
.card .art {
  display: block;
  position: relative;
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #080c13;
  box-shadow: 0 14px 30px -22px #000;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.card:hover .art, .card:focus-visible .art {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 20px 44px -24px color-mix(in srgb, var(--accent) 90%, transparent);
}
.card .art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card .art .glow {
  display: block;
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%);
  opacity: 0; transition: opacity 0.25s;
}
.card:hover .art .glow { opacity: 1; }
.card .meta { display: block; padding: 0.5rem 0.15rem 0; }
.card .meta b { display: block; font-size: 0.94rem; line-height: 1.4; }
.card .meta span {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.9;
}
.card .pw {
  position: absolute;
  inset-block-start: 6px; inset-inline-start: 6px;
  font-family: var(--mono);
  font-size: 0.66rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(4, 6, 10, 0.82);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff;
  direction: ltr;
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.empty .big { font-family: var(--mono); font-size: 1.1rem; color: var(--red); }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 4, 7, 0.86);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.modal.open { display: grid; animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal-box {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  position: relative;
  animation: rise 0.28s cubic-bezier(.2,.9,.2,1);
  --accent: var(--cyan);
  box-shadow: 0 40px 90px -30px #000, 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
@keyframes rise { from { transform: translateY(22px) scale(0.98); opacity: 0; } }
.modal-box::before {
  content: "";
  position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.modal-close {
  position: absolute;
  inset-block-start: 0.6rem; inset-inline-end: 0.6rem;
  z-index: 3;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: rgba(4, 6, 10, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.4rem;
  padding: 1.5rem;
}
@media (max-width: 720px) {
  .modal-grid { grid-template-columns: 1fr; padding: 1.1rem; gap: 1rem; }
  .modal-grid .figure { max-width: 240px; margin-inline: auto; }
}
.modal-grid .figure img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 0 50px -18px color-mix(in srgb, var(--accent) 90%, transparent);
}
.modal h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
.modal .kind {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  direction: ltr;
}
.stat-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.85rem 0; }
.stat {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.82rem;
}
.stat span { display: block; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.16em; color: var(--dim); direction: ltr; }
.stat b { color: #fff; font-size: 1rem; }

.field { margin-top: 1rem; }
.field > .lbl {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--dim);
  display: block;
  margin-bottom: 0.35rem;
  direction: ltr;
}
.field p { margin: 0; color: var(--text); }
.field .val { color: var(--text); }

/* FAQ / accordion */
.faq { display: grid; gap: 0.55rem; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}
.faq summary {
  padding: 0.8rem 0.95rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.94rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "؟";
  font-family: var(--mono);
  color: var(--cyan);
  flex: none;
  width: 20px;
  text-align: center;
}
.faq details[open] summary { background: rgba(34, 211, 238, 0.06); color: #fff; }
.faq .ans {
  padding: 0.2rem 0.95rem 0.9rem 2.55rem;
  color: var(--text-2);
  font-size: 0.92rem;
  border-block-start: 1px solid var(--line);
  padding-block-start: 0.75rem;
}
.faq .ans b { color: var(--red); }
.faq .src {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin-inline-start: 0.4rem;
  direction: ltr;
}

/* ==========================================================================
   STORY
   ========================================================================== */
.chapter { position: relative; }
.chapter + .chapter { margin-top: clamp(2.4rem, 6vw, 4rem); }
.chapter-head {
  display: flex; align-items: baseline; gap: 0.9rem;
  padding-bottom: 0.7rem;
  border-block-end: 1px solid var(--line);
  margin-bottom: 1.3rem;
}
.chapter-head .num {
  font-family: var(--mono);
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: rgba(255, 47, 47, 0.28);
  line-height: 1;
  direction: ltr;
}
.chapter-head h2 { font-size: clamp(1.5rem, 4.6vw, 2.2rem); }
.chapter-head .en {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.24em;
  color: var(--dim); margin-inline-start: auto; direction: ltr;
}

.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
@media (max-width: 820px) { .cols2 { grid-template-columns: 1fr; gap: 1rem; } }

.council { display: grid; gap: 0.5rem; }
.council li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--red);
  border-radius: var(--r);
  background: rgba(255, 47, 47, 0.04);
  font-size: 0.93rem;
}
.council li:last-child { border-inline-start-color: var(--cyan); background: rgba(34, 211, 238, 0.06); }
.council li .k { font-family: var(--mono); font-size: 0.7rem; color: var(--dim); direction: ltr; }
.council { list-style: none; margin: 0; padding: 0; }

.spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.spec-list li {
  display: flex; gap: 0.6rem; align-items: flex-start;
  font-size: 0.92rem; color: var(--text-2);
}
.spec-list li::before { content: "◈"; color: var(--cyan); flex: none; font-size: 0.7rem; line-height: 2.1; }

/* character roster */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.25s;
  --accent: var(--g-characters);
  display: block;
  cursor: pointer;
  text-align: start;
  padding: 0;
  color: inherit;
  font-family: inherit;
  width: 100%;
}
.hero-card:hover, .hero-card:focus-visible {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 24px 50px -28px color-mix(in srgb, var(--accent) 95%, transparent);
}
.hero-card .art { display: block; aspect-ratio: 5/7; position: relative; overflow: hidden; }
.hero-card .art img.portrait { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.hero-card:hover .art img.portrait { transform: scale(1.04); }
.hero-card .art img.crest {
  position: absolute;
  inset-block-start: 8px; inset-inline-end: 8px;
  width: 30px; height: 30px;
  object-fit: contain;
  z-index: 2;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 80%, transparent));
}
.hero-card .cap {
  display: block;
  padding: 0.7rem 0.85rem 0.85rem;
  border-block-start: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent);
}
.hero-card .cap .nm { display: block; font-size: 1.1rem; font-weight: 800; line-height: 1.4; }
.hero-card .cap .alias {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  direction: ltr;
}
.hero-card .cap .full { display: block; color: var(--dim); font-size: 0.79rem; line-height: 1.6; }

/* bio modal body */
.bio { line-height: 1.95; color: var(--text-2); }
.bio p { margin: 0 0 0.85rem; }

/* ==========================================================================
   UPDATES
   ========================================================================== */
.log { display: grid; gap: 1rem; position: relative; }
.entry {
  position: relative;
  padding: 1.15rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  --accent: var(--cyan);
}
.entry::before {
  content: "";
  position: absolute;
  inset-inline-start: 0; inset-block: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.7;
}
.entry.major { --accent: var(--red); }
.entry-top {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.ver {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0.1rem 0.45rem;
  direction: ltr;
}
.entry-top time { font-family: var(--mono); font-size: 0.7rem; color: var(--dim); direction: ltr; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.14rem 0.5rem;
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.entry h3 { font-size: 1.1rem; margin-bottom: 0.4rem; }
.entry ul { margin: 0.5rem 0 0; padding-inline-start: 1.1rem; color: var(--text-2); font-size: 0.93rem; }
.entry ul li { margin-bottom: 0.35rem; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  margin-top: clamp(2.6rem, 7vw, 5rem);
  border-block-start: 1px solid var(--line);
  background: rgba(4, 6, 10, 0.6);
  padding: 2.2rem 0 1.2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 1.6rem;
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.footer h4 {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  color: var(--dim);
  margin-bottom: 0.7rem;
  direction: ltr;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.footer a { color: var(--text-2); font-size: 0.9rem; }
.footer a:hover { color: var(--red); }
.footer .fbrand { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; }
.footer .fbrand img { width: 34px; }
.footer .fbrand b { font-family: var(--mono); letter-spacing: 0.16em; font-size: 1rem; direction: ltr; }
.footer p { color: var(--dim); font-size: 0.86rem; margin: 0; max-width: 44ch; }
.footer-base {
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-block-start: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--dim);
  direction: ltr;
}

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s, transform 0.6s; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* utility */
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.center { text-align: center; }
.mt0 { margin-top: 0; }
.hidden { display: none !important; }

/* skip link */
.skip {
  position: absolute;
  inset-inline-start: 50%;
  top: -60px;
  transform: translateX(50%);
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--red);
  color: #fff;
  border-radius: var(--r);
  transition: top 0.2s;
}
.skip:focus { top: 8px; }
