/* APEX LEGEND FIELD MANUAL 3.0 · Respawn Tactical Dossier Style */
:root {
  --bg: #f4efe6;
  --paper: #fffdf9;
  --paper2: #f6ecdc;
  --text: #24252a;
  --muted: #66635e;
  --line: #ded3c1;
  --line2: #cbbea8;
  --accent: #c0392c;
  --accent-hover: #9c271b;
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.08);
  --gold: #b45309;
  --gold-soft: rgba(180, 83, 9, 0.08);
  --danger-soft: rgba(192, 57, 44, 0.08);
  --shadow: 0 4px 20px -2px rgba(60, 40, 20, 0.06), 0 1px 3px rgba(60, 40, 20, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: 
    radial-gradient(circle at 85% 0%, rgba(192, 57, 44, 0.06), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.88;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration: none;
  transition: color 0.18s;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
strong, b { font-weight: 750; }

/* Header Banner */
header {
  border-bottom: 2px solid var(--line);
  background: linear-gradient(135deg, #fdfbf7 0%, #faede0 65%, #f4dec8 100%);
  padding: 36px max(24px, calc((100vw - 1240px)/2)) 42px;
  position: relative;
  overflow: hidden;
}
header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--accent) 0%, #e85a4f 70%, transparent 100%);
}
.home {
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--accent);
  background: rgba(192, 57, 44, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(192, 57, 44, 0.2);
}
.home:hover {
  text-decoration: none;
  background: var(--accent);
  color: #ffffff;
}
.eyebrow {
  color: var(--accent);
  font-size: 11.5px;
  letter-spacing: .22em;
  font-weight: 900;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(32px, 4.5vw, 56px);
  line-height: 1.18;
  margin: 12px 0 16px;
  letter-spacing: -.04em;
  color: #1a1815;
}
header p {
  max-width: 820px;
  color: #584f46;
  margin: 0;
  font-size: 16.5px;
  line-height: 1.8;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}
.tags span {
  font-size: 12.5px;
  font-weight: 750;
  border: 1px solid #d8c3b0;
  border-radius: 999px;
  padding: 4px 14px;
  background: rgba(255, 253, 248, 0.85);
  color: #634f3e;
  box-shadow: 0 1px 4px rgba(70, 50, 20, 0.04);
}

/* Layout with Sticky Rail */
.layout {
  max-width: 1240px;
  margin: auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 48px;
  padding: 40px 24px 90px;
}
.rail {
  align-self: start;
  position: sticky;
  top: 24px;
  display: grid;
  gap: 3px;
  padding: 16px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.rail a {
  font-size: 13.5px;
  font-weight: 700;
  display: block;
  text-decoration: none;
  color: #5c564f;
  border-radius: 9px;
  padding: 8px 12px;
  transition: all 0.18s;
  line-height: 1.4;
}
.rail a:hover, .rail a:focus-visible {
  background: var(--paper2);
  color: var(--accent);
  transform: translateX(2px);
}
.rail a[aria-current="location"] {
  background: var(--danger-soft);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

main { min-width: 0; }
section {
  scroll-margin-top: 24px;
  margin-bottom: 54px;
}
h2 {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -.03em;
  margin: 0 0 20px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
  color: #1a1815;
}
h3 {
  font-size: 20px;
  margin: 26px 0 12px;
  color: #2e261e;
}
h4 {
  font-size: 16.5px;
  margin: 0 0 10px;
  color: #3b3024;
}
p {
  margin: 10px 0 14px;
  font-size: 16px;
}
ul, ol {
  padding-left: 24px;
  margin: 12px 0;
}
li {
  margin: 8px 0;
}
li::marker {
  color: var(--accent);
}
.lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

/* Callout Cards */
.card {
  padding: 24px 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 18px 0;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  box-shadow: 0 8px 26px rgba(60, 40, 20, 0.08);
}
.card h3:first-child, .card h4:first-child { margin-top: 0; }
.note {
  border-left: 5px solid var(--gold);
  background: linear-gradient(135deg, var(--paper) 0%, rgba(254, 243, 199, 0.2) 100%);
}
.danger {
  border-left: 5px solid var(--accent);
  background: linear-gradient(135deg, var(--paper) 0%, rgba(254, 226, 226, 0.2) 100%);
}
.good {
  border-left: 5px solid var(--green);
  background: linear-gradient(135deg, var(--paper) 0%, rgba(220, 252, 231, 0.2) 100%);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.grid .card { margin: 0; }

/* Data Tables */
.scroll {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  margin: 18px 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-size: 14.5px;
  min-width: 600px;
}
th, td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #f0e4d2;
  color: #4b3d30;
  font-weight: 750;
  letter-spacing: 0.02em;
}
tr:last-child td { border-bottom: none; }
tr:hover td {
  background: rgba(192, 57, 44, 0.02);
}

/* Keycaps & Code */
code, kbd {
  background: #ede3d3;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: .88em;
  color: #8c3222;
  font-family: ui-monospace, monospace;
}
kbd {
  background: linear-gradient(180deg, #ffffff, #ede3d3);
  border: 1px solid #d2c5b0;
  border-bottom: 2px solid #b3a48e;
  font-weight: 750;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.sub {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* Navigation Pills */
.pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}
.pills a {
  border: 1px solid #d8c3b0;
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 750;
  background: var(--paper);
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  transition: all 0.2s;
}
.pills a:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Scenario Sequence Cards */
.scenario {
  padding: 22px 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
.scenario h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 18.5px;
}
.scenario .flow {
  font-weight: 750;
  color: #1e5a42;
  font-size: 15px;
  padding: 10px 14px;
  background: #ecf4ef;
  border-radius: 9px;
  margin: 10px 0 14px;
  border: 1px solid #d2e4d8;
  display: block;
}

.check li {
  padding: 4px 0;
}

footer {
  max-width: 1240px;
  padding: 30px 24px 70px;
  margin: auto;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}
.source a {
  overflow-wrap: anywhere;
}

/* Responsive */
@media(max-width: 860px) {
  .layout { display: block; padding: 24px 18px 60px; }
  .rail { position: static; display: flex; flex-wrap: wrap; margin-bottom: 28px; gap: 6px; }
  .rail a { background: var(--paper2); }
  header { padding: 28px 20px 32px; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  table { font-size: 13.5px; }
}
@media print {
  header, .rail { position: static; }
  body { background: #fff; }
  .card, .scenario { break-inside: avoid; box-shadow: none; }
  .layout { display: block; }
  .rail { display: none; }
  a { color: #222; }
}