/* Theme tokens and page shell */
:root {
  --accent: #8bd450;
  --accent-ink: #11180c;
  --bg: #0c100f;
  --surface: #151c18;
  --surface-2: #202a22;
  --ink: #ecf0e7;
  --ink-2: #a2aea1;
  --line: #344135;
  --radius: 16px;
  --max: 1140px;
  --font-display: Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

body {
  background: radial-gradient(ellipse at 10% 0, #26352655, transparent 65%), var(--bg);
}

.app-header {
  position: relative;
  padding: 18px 28px;
}

.app-header .brand {
  font-family: var(--font);
  letter-spacing: -.04em;
  font-size: 1.35rem;
}

.app-main {
  padding-top: 16px;
}

.eyebrow, footer, .status {
  font: 10px/1.5 var(--font-mono);
  letter-spacing: .16em;
  color: var(--ink-2);
}

.heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.heading p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.heading strong {
  color: var(--ink);
  font-weight: 500;
}

.status {
  color: var(--accent);
  white-space: nowrap;
}

.status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  box-shadow: 0 0 16px var(--accent);
}

.tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 16px;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.chip {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 13px;
}

.tabs .chip {
  border: 0;
  background: transparent;
  color: var(--ink-2);
}

.tabs [aria-selected="true"] {
  background: var(--surface-2);
  color: var(--accent);
}

/* Watch layout and illustrated outer fence */
.watch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
}

.card {
  border: 1px solid #2c392c;
  box-shadow: none;
  padding: 22px;
}

.horde-card {
  padding: 0;
  overflow: hidden;
}

.fight-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.fight-status strong {
  color: var(--accent);
}

.fight-status .mono {
  flex-shrink: 0;
}

.between {
  justify-content: space-between;
}

.horde {
  display: block;
  position: relative;
  width: 100%;
  height: 292px;
  background: linear-gradient(#17241c, #293d27 68%, #121a14);
  border: 0;
  margin-top: 0;
  overflow: hidden;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.horde:active {
  filter: brightness(1.2);
}

.moon {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #a0b79033;
  box-shadow: 0 0 60px #8bd45022;
  top: 30px;
  right: 18%;
}

.skyline {
  position: absolute;
  bottom: 95px;
  width: 100%;
  height: 80px;
  background: #111c16;
  clip-path: polygon(0 30%,
    8% 30%,
    8% 5%,
    15% 5%,
    15% 60%,
    27% 60%,
    27% 0,
    38% 0,
    38% 40%,
    43% 40%,
    43% 20%,
    57% 20%,
    57% 65%,
    65% 65%,
    65% 15%,
    76% 15%,
    76% 50%,
    90% 50%,
    90% 30%,
    100% 30%,
    100% 100%,
    0 100%);
}

.figures {
  position: absolute;
  inset: 85px 0 65px;
  display: flex;
  justify-content: space-around;
  align-items: end;
}

.zombie {
  display: block;
  position: relative;
  background: #080f0b;
  width: 36px;
  height: 85px;
  border-radius: 35% 35% 0 0;
  transform: rotate(-5deg);
  animation: sway 4s ease-in-out infinite alternate;
}

.zombie:before {
  content: '';
  position: absolute;
  top: -23px;
  left: 5px;
  width: 26px;
  height: 30px;
  background: #080f0b;
  border-radius: 45%;
}

.zombie:after {
  content: '';
  position: absolute;
  left: -16px;
  top: 15px;
  width: 66px;
  height: 15px;
  background: #080f0b;
  border-radius: 10px;
  transform: rotate(-20deg);
}

.z1, .z4 {
  height: 66px;
  animation-delay: -2s;
}

.z2, .z6 {
  height: 96px;
  animation-delay: -1s;
}

.fence {
  position: absolute;
  inset: 145px 0 0;
  background: repeating-linear-gradient(90deg,
    transparent 0 62px,
    #61735a50 63px 65px),
    linear-gradient(transparent 25px,
    #61735a50 26px 28px,
    transparent 29px);
}

.fight-label {
  position: absolute;
  bottom: 17px;
  left: 0;
  right: 0;
  font: 700 24px var(--font);
  text-shadow: 0 2px 8px #000;
}

.fight-label small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #c0cebb;
  margin-top: 5px;
}

.count {
  text-align: center;
  padding: 18px;
  background: #111812;
}

.count > span:last-child {
  font-size: 12px;
  color: var(--ink-2);
}

/* Probability panel and squad condition */
.odds .chance {
  font: clamp(1.75rem, 8vw, 3.25rem)/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--accent);
  margin: 6px 0;
}

.odds > p {
  color: var(--ink-2);
  font-size: 13px;
}

.rule {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.odds .row {
  font-size: 13px;
  margin-bottom: 10px;
}

.odds b {
  font-family: var(--font-mono);
}

.attributes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.attributes span {
  display: block;
  font-size: 11px;
  color: var(--ink-2);
}

.attributes strong {
  overflow-wrap: anywhere;
  font: 22px var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.card h2 {
  font: 20px var(--font-display);
}

/* Field notes and footer */
.log {
  margin-top: 18px;
}

.log .section-title {
  margin: 0 0 14px;
}

.log p {
  font: 12px/1.7 var(--font-mono);
  color: var(--ink-2);
  border-top: 1px solid #283528;
  padding-top: 10px;
}

.log p:first-of-type {
  color: var(--accent);
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
  gap: 12px;
  font-size: 9px;
}

/* Long contract math and saved values must stay inside their cards. */
.contract-intro, .contract, .odds, .watch-grid > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Contract desk */
.contract-intro {
  max-width: 760px;
}

.contract-intro h2 {
  font-size: 30px;
  font-weight: 400;
}

.contract {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.contract h3 {
  font-size: 24px;
  font-weight: 400;
}

.contract p {
  margin: 0;
}

.contract .math {
  font: 13px/1.6 var(--font-mono);
  color: var(--accent);
  flex: 1;
}

.contract .btn {
  width: 100%;
  margin-top: 10px;
  font-size: 13px;
}

.signed {
  border-color: var(--accent);
}

/* Recovery story */
.story-mode {
  --accent: #e6bb6a;
  --accent-ink: #251b0b;
  background: radial-gradient(ellipse at top, #46331c44, transparent 70%), var(--bg);
}

.story {
  max-width: 780px;
  margin: 0 auto;
  padding: 38px;
}

.story h2 {
  font-size: 40px;
  font-weight: 400;
  margin: 16px 0;
}

.prose {
  font: 20px/1.9 Georgia, serif;
  margin: 24px 0;
}

.last {
  font-style: italic;
  color: var(--accent);
}

.standings {
  display: flex;
  gap: 20px;
  text-transform: capitalize;
  flex-wrap: wrap;
  color: var(--ink-2);
  font-size: 13px;
  margin: 24px 0;
}

.standings b {
  color: var(--accent);
  font-family: var(--font-mono);
  padding-left: 5px;
}

.choices {
  display: grid;
  gap: 12px;
}

.choices .btn {
  border-radius: 10px;
  justify-content: space-between;
  padding: 14px 18px;
  text-align: left;
  font-size: 15px;
  gap: 18px;
}

.choices small {
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}

.locked-art {
  font-size: 80px;
  color: var(--accent);
}

/* Offline summary */
.away {
  margin-bottom: 18px;
}

.away .btn {
  margin-left: 12px;
}

/* Gentle horde motion */
@keyframes sway {
  to {
    transform: rotate(5deg) translateX(4px);
  }
}

/* Phone layout */
@media (max-width: 700px) {
  .watch-grid {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding-top: 12px;
  }

  .app-header {
    padding: 14px 16px;
  }

  .heading {
    gap: 6px;
  }

  .heading .status {
    display: inline-block;
    margin-top: 0;
  }

  .tabs {
    width: 100%;
    gap: 2px;
  }

  .chip {
    padding: 0 6px;
    font-size: 11px;
    flex: 1;
  }

  .horde {
    height: 255px;
  }

  .card {
    padding: 18px;
  }

  .horde-card {
    padding: 0;
  }

  .attributes {
    gap: 8px;
  }

  .story {
    padding: 22px;
  }

  .story h2 {
    font-size: 32px;
  }

  .prose {
    font-size: 18px;
  }

  .choices .btn {
    display: block;
  }

  .choices small {
    display: block;
    margin-top: 8px;
  }

  footer {
    align-items: flex-start;
  }

  .status {
    font-size: 10px;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .zombie {
    animation: none;
  }
}
