:root {
  --bg: #14110e;
  --bg-2: #1c1814;
  --panel: #231e19;
  --panel-2: #2b251f;
  --ink: #f4efe6;
  --muted: #a89b8c;
  --line: rgba(244, 239, 230, 0.1);
  --gold: #e0b15a;
  --gold-ink: #2a1d0a;
  --blood: #d85a42;
  --ok: #8fbf73;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Manrope, system-ui, sans-serif;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(224, 177, 90, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(216, 90, 66, 0.12), transparent 50%),
    linear-gradient(180deg, #1a1612 0%, var(--bg) 40%, #0e0c0a 100%);
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px 28px;
  background: rgba(20, 17, 14, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.brand {
  font-family: Unbounded, sans-serif;
  letter-spacing: 0.14em;
  text-decoration: none;
  font-weight: 700;
}
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
}
.nav a.on, .nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.top-meta { margin-left: auto; color: var(--muted); font-size: 14px; }

.wrap { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 36px 0 80px; }
.kicker {
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
}
h1, h2, h3 { font-family: Unbounded, sans-serif; font-weight: 600; letter-spacing: -0.03em; }
.squad h2, .price, .tower header b { font-family: Manrope, sans-serif; font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(40px, 6vw, 72px); line-height: 0.95; margin: 10px 0 16px; }
h2 { font-size: 28px; margin: 0 0 8px; }
.lead { max-width: 640px; color: var(--muted); font-size: 18px; line-height: 1.5; }

.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger { background: var(--blood); color: white; }

.steps, .cards, .split { display: grid; gap: 14px; }
.steps { grid-template-columns: repeat(3, 1fr); margin-top: 36px; }
.cards { grid-template-columns: repeat(3, 1fr); }
.card, .panel, .player, .tower, .log {
  background: rgba(35, 30, 25, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card, .panel { padding: 18px; }
.card b { display: block; margin-bottom: 6px; }
.card p, .note { color: var(--muted); line-height: 1.5; margin: 0; }
.num { font-family: Unbounded, sans-serif; color: var(--gold); }

.market { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.tools { display: flex; gap: 10px; margin: 16px 0; }
.tools input, .tools select, .field input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.list { display: grid; gap: 8px; }
.player, .tower { padding: 14px; }
.player { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; }
.player .nick { font-weight: 700; }
.player .sub, .muted { color: var(--muted); font-size: 13px; }
.price { font-variant-numeric: tabular-nums; font-weight: 700; }
.squad { position: sticky; top: 86px; }
.slot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.slot button { background: none; border: 0; color: var(--muted); }

.form { display: grid; gap: 12px; max-width: 520px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: 13px; }

.roundbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.towers { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tower.you { outline: 1px solid var(--gold); }
.tower.down { opacity: 0.55; }
.tower header { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.tower h3 { margin: 0; font-size: 16px; }
.hp { height: 8px; border-radius: 99px; background: #3a312a; overflow: hidden; margin: 10px 0; }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, var(--blood), var(--gold)); }
.pips { display: flex; gap: 5px; margin: 8px 0 12px; }
.pips i { width: 18px; height: 6px; border-radius: 99px; background: #3a312a; }
.pips i.on { background: var(--gold); }
.roster-mini { list-style: none; padding: 0; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.roster-mini li { display: flex; justify-content: space-between; padding: 3px 0; }
.tag {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.log { margin-top: 16px; padding: 16px 18px; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log ul { list-style: none; margin: 0; padding: 0; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.72);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 8;
}
.sheet { width: min(560px, 100%); padding: 20px; }
.choices { display: grid; gap: 8px; margin: 14px 0; }
.choice {
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.choice.on { border-color: var(--gold); }

.warn {
  background: rgba(216, 90, 66, 0.12);
  border: 1px solid rgba(216, 90, 66, 0.35);
  color: #f0c2b8;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}

.war-wrap { width: min(1240px, calc(100% - 28px)); }
.war-wrap h1 { font-size: clamp(32px, 4vw, 48px); }
.war-layout { display: grid; grid-template-columns: 1fr 280px; gap: 14px; align-items: start; }
.field {
  position: relative;
  height: 700px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(224, 177, 90, 0.2);
  background:
    radial-gradient(460px 200px at 16% 78%, rgba(112, 86, 48, 0.45), transparent 70%),
    radial-gradient(380px 220px at 82% 20%, rgba(62, 84, 64, 0.4), transparent 72%),
    radial-gradient(640px 240px at 50% 110%, rgba(0, 0, 0, 0.5), transparent 58%),
    linear-gradient(180deg, #2c3a30 0%, #1b241e 46%, #12100e 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.5);
}
.field .ridge {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.28));
}
.field .road {
  position: absolute;
  left: 6%;
  right: 10%;
  top: 58%;
  height: 22px;
  border-radius: 99px;
  background: rgba(86, 68, 44, 0.55);
  transform: rotate(-7deg);
  box-shadow: 0 54px 0 -6px rgba(86, 68, 44, 0.38);
}
.field::after {
  content: "";
  position: absolute;
  left: -10%;
  top: 42%;
  width: 120%;
  height: 70px;
  background: rgba(62, 104, 112, 0.28);
  border-radius: 50%;
  transform: rotate(-8deg);
}
.pin {
  position: absolute;
  width: 120px;
  transform: translate(-50%, -94%);
  background: none;
  border: 0;
  padding: 0;
  text-align: center;
  z-index: 1;
}
.pin.selected { z-index: 2; }
.pin.selected .keep { filter: drop-shadow(0 0 16px rgba(224, 177, 90, 0.75)); }
.skyline {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 34px;
  min-height: 320px;
  margin: 8px 0 18px;
  padding: 12px 8px 0;
  border-bottom: 1px solid rgba(224, 177, 90, 0.22);
  background: linear-gradient(180deg, transparent 30%, rgba(42, 36, 28, 0.55));
}
.keep { position: relative; width: 96px; margin: 0 auto; }
.pennant {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 16px solid #8d2a24;
  z-index: 2;
}
.keep.you .pennant { border-left-color: var(--gold); }
.merlons { display: flex; justify-content: center; gap: 4px; height: 22px; }
.merlons i {
  width: 16px;
  height: 22px;
  background: linear-gradient(#8d7b66, var(--stone) 40%, #2a241c);
  box-shadow: inset 0 -5px 0 #241c16;
}
.shaft {
  width: 74px;
  margin: 0 auto;
  height: var(--h);
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  background:
    repeating-linear-gradient(180deg, transparent 0 16px, rgba(0, 0, 0, 0.22) 16px 18px),
    linear-gradient(90deg, #241c16 0%, var(--stone) 28%, #9a846c 50%, var(--stone) 72%, #241c16 100%);
  border-left: 3px solid #1a1511;
  border-right: 3px solid #1a1511;
  box-shadow: 14px 22px 0 rgba(0, 0, 0, 0.28);
  position: relative;
  transition: height 0.35s ease;
}
.shaft b {
  width: 12px;
  height: 18px;
  background: #f0c56a;
  box-shadow: 0 0 10px rgba(240, 197, 106, 0.8);
  border-radius: 1px;
}
.shaft em {
  position: absolute;
  left: 18%;
  top: 16%;
  width: 55%;
  height: 58%;
  background:
    linear-gradient(115deg, transparent 42%, rgba(20, 10, 8, 0.0) 42% 46%, transparent 46%),
    linear-gradient(68deg, transparent 30%, rgba(20, 10, 8, 0.85) 30% 34%, transparent 34%);
  opacity: 0;
  pointer-events: none;
}
.keep.scar .shaft em { opacity: 0.85; }
.keep.ruin .shaft em { opacity: 1; }
.keep.ruin .merlons i:nth-child(2),
.keep.ruin .merlons i:nth-child(4) { height: 9px; margin-top: 13px; }
.keep.ruin .shaft b:nth-child(odd) { background: #3a2a18; box-shadow: none; }
.keep.rubble .shaft { height: 34px; filter: grayscale(0.55); }
.keep.rubble .merlons { opacity: 0.35; transform: translateY(12px) rotate(-8deg); }
.keep.rubble .pennant { display: none; }
.plinth {
  height: 22px;
  margin: 0 -6px;
  background:
    repeating-linear-gradient(90deg, #3a3228 0 14px, #2a241c 14px 16px),
    linear-gradient(#4a4034, #211c17);
  border-radius: 2px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}
.shadow {
  height: 18px;
  margin: 10px 0 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
}
.hp-tag {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(12, 10, 8, 0.82);
  font-family: Manrope, sans-serif;
  font-size: 12px;
  font-weight: 700;
}
.hp-tag span {
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dossier { position: sticky; top: 86px; }
.dossier h2 { font-size: 22px; }

@media (max-width: 860px) {
  .steps, .cards, .market { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: 14px; }
  .top-meta { margin-left: 0; }
  .squad, .dossier { position: static; }
  .player { grid-template-columns: 1fr auto; }
  .war-layout { grid-template-columns: 1fr; }
  .field { height: 560px; }
  .skyline { gap: 12px; overflow: hidden; }
  .keep { width: 72px; }
  .skyline .flag { display: none; }
}
