:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-2: #0a1d33;
  --panel: rgba(8, 24, 43, 0.82);
  --panel-strong: rgba(10, 34, 62, 0.94);
  --line: rgba(121, 209, 255, 0.24);
  --text: #eef8ff;
  --muted: #94b8ce;
  --blue: #009ee3;
  --blue-light: #67d4ff;
  --yellow: #ffd23f;
  --danger: #ff5a76;
  --ok: #48f0a4;
  --card-accent: #67d4ff;
  --card-glow: #009ee3;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(0, 158, 227, 0.24), transparent 38rem),
    radial-gradient(circle at 80% 10%, rgba(255, 210, 63, 0.12), transparent 28rem),
    linear-gradient(140deg, var(--bg), #020611 72%);
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: '';
  background-image:
    linear-gradient(rgba(103, 212, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(103, 212, 255, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 88%);
}

button {
  font: inherit;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0.08;
  background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, #ffffff 4px);
  mix-blend-mode: overlay;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.panel,
.stat-card,
.game-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--panel), rgba(4, 12, 24, 0.88));
  padding: 24px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: 'ATT&CK';
  position: absolute;
  right: 24px;
  bottom: -26px;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.1em;
  color: rgba(103, 212, 255, 0.055);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--yellow);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 6vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  letter-spacing: -0.03em;
}

.hero-copy,
.campaign-description,
.stack-help,
.muted {
  color: var(--muted);
  line-height: 1.65;
}

.hero-copy {
  max-width: 780px;
  margin-bottom: 0;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.guide-link-button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: #06101d;
  font-weight: 850;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.primary-button,
.guide-link-button {
  background: linear-gradient(135deg, var(--yellow), #fff08a);
  box-shadow: 0 12px 30px rgba(255, 210, 63, 0.24);
}

.secondary-button {
  background: linear-gradient(135deg, var(--blue-light), var(--blue));
  box-shadow: 0 12px 30px rgba(0, 158, 227, 0.25);
}

.primary-button:hover,
.secondary-button:hover,
.guide-link-button:hover,
.game-card:not(:disabled):hover {
  transform: translateY(-2px);
}

.secondary-button:disabled,
.game-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.stat-card {
  min-height: 116px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(8, 31, 57, 0.9), rgba(5, 14, 28, 0.86));
  padding: 18px;
}

.stat-card span,
.turn-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.06em;
}

.risk-card strong {
  color: var(--danger);
}

.meter {
  overflow: hidden;
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.meter.large {
  height: 12px;
  margin: 18px 0;
}

.meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ok), var(--yellow), var(--danger));
  transition: width 240ms ease;
}

.campaign-fill {
  background: linear-gradient(90deg, var(--danger), #ff9c5a);
}

.battlefield {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.section-title-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.severity-pill,
.card-cost {
  display: inline-grid;
  min-width: 52px;
  place-items: center;
  border: 1px solid rgba(255, 210, 63, 0.4);
  border-radius: 999px;
  background: rgba(255, 210, 63, 0.13);
  color: var(--yellow);
  font-weight: 900;
}

.severity-pill {
  padding: 10px 12px;
  white-space: nowrap;
}

.mitre-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0 0;
}

.mitre-list div {
  border: 1px solid rgba(103, 212, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(103, 212, 255, 0.06);
  padding: 12px;
}

.mitre-list dt {
  margin-bottom: 5px;
  color: var(--blue-light);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mitre-list dd {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.hint-box {
  margin-bottom: 0;
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius-sm);
  background: rgba(255, 210, 63, 0.08);
  padding: 12px 14px;
  color: #ffe58a;
  line-height: 1.55;
}

.turn-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.turn-stats div {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.turn-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.played-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.played-chip {
  border: 1px solid rgba(72, 240, 164, 0.24);
  border-radius: 999px;
  background: rgba(72, 240, 164, 0.09);
  padding: 8px 10px;
  color: #9cffd0;
  font-size: 0.83rem;
  font-weight: 700;
}

.guide-panel {
  margin-bottom: 18px;
}

.guide-summary,
.card-legend {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  border: 1px solid rgba(103, 212, 255, 0.16);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at top right, rgba(103, 212, 255, 0.12), transparent 8rem),
    rgba(255, 255, 255, 0.045);
  padding: 16px;
}

.guide-steps strong {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 210, 63, 0.36);
  border-radius: 999px;
  background: rgba(255, 210, 63, 0.11);
  color: var(--yellow);
  font-weight: 950;
}

.guide-steps h3 {
  margin: 14px 0 8px;
  letter-spacing: -0.02em;
}

.guide-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.hand-panel,
.log-panel {
  margin-bottom: 18px;
}

.deck-counter {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 14px;
}

.game-card {
  position: relative;
  display: grid;
  min-height: 392px;
  gap: 10px;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--card-accent), transparent 62%), transparent 9rem),
    linear-gradient(160deg, rgba(11, 45, 80, 0.98), rgba(5, 14, 28, 0.96));
  color: var(--text);
  padding: 16px;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.game-card::after {
  content: '';
  position: absolute;
  inset: auto -20% -32% -20%;
  height: 110px;
  transform: rotate(-8deg);
  background: color-mix(in srgb, var(--card-glow), transparent 84%);
}

.game-card > * {
  position: relative;
  z-index: 1;
}

.game-card.is-counter {
  border-color: rgba(255, 210, 63, 0.74);
  box-shadow:
    0 0 0 1px rgba(255, 210, 63, 0.28),
    0 18px 48px rgba(255, 210, 63, 0.11);
}

.game-card:not(:disabled):hover {
  border-color: rgba(103, 212, 255, 0.8);
  box-shadow:
    0 0 0 1px rgba(103, 212, 255, 0.35),
    0 22px 60px rgba(0, 158, 227, 0.18);
}

.card-cost {
  width: 42px;
  height: 42px;
  min-width: 42px;
  font-size: 1.1rem;
}

.card-topline {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.card-role {
  width: max-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--card-accent), transparent 86%);
  padding: 5px 9px;
  color: var(--card-accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-art {
  position: relative;
  display: grid;
  min-height: 152px;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 62%);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 52%, color-mix(in srgb, var(--card-glow), transparent 52%), transparent 4.6rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 0 34px color-mix(in srgb, var(--card-glow), transparent 78%),
    0 16px 34px rgba(0, 0, 0, 0.18);
}

.card-art-grid {
  position: absolute;
  inset: 0;
  opacity: 0.45;
  background-image:
    linear-gradient(color-mix(in srgb, var(--card-accent), transparent 84%) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--card-accent), transparent 88%) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle, #000 0 58%, transparent 78%);
}

.card-art-ring {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 36%);
  border-radius: 50%;
  box-shadow: 0 0 22px color-mix(in srgb, var(--card-glow), transparent 60%);
}

.ring-one {
  width: 108px;
  height: 108px;
}

.ring-two {
  width: 72px;
  height: 72px;
  border-style: dashed;
  transform: rotate(24deg);
}

.card-art-node {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--card-accent);
  box-shadow: 0 0 18px var(--card-glow);
}

.node-a {
  top: 25px;
  left: 31px;
}

.node-b {
  right: 38px;
  bottom: 34px;
}

.node-c {
  top: 44px;
  right: 57px;
}

.card-art-symbol {
  display: inline-grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 28%);
  border-radius: 18px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--card-accent), transparent 74%), rgba(255, 255, 255, 0.08)),
    rgba(5, 14, 28, 0.74);
  color: #fff;
  font-size: 2.1rem;
  font-weight: 950;
  text-shadow: 0 0 20px var(--card-glow);
}

.card-art-title {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  overflow: hidden;
  color: color-mix(in srgb, var(--card-accent), #fff 20%);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.13em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-art-counters {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  max-width: 74%;
}

.card-art-counters span {
  border: 1px solid color-mix(in srgb, var(--card-accent), transparent 56%);
  border-radius: 999px;
  background: rgba(3, 9, 18, 0.52);
  padding: 3px 6px;
  color: color-mix(in srgb, var(--card-accent), #fff 16%);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.card-art-counters .is-matched {
  border-color: rgba(255, 210, 63, 0.72);
  background: rgba(255, 210, 63, 0.14);
  color: var(--yellow);
  box-shadow: 0 0 16px rgba(255, 210, 63, 0.24);
}

.game-card[data-visual-intensity='5'] .ring-two,
.game-card[data-visual-intensity='6'] .ring-two {
  width: 92px;
  height: 92px;
}

.game-card[data-visual-intensity='6'] .card-art-symbol {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--card-accent), transparent 54%),
    0 0 30px color-mix(in srgb, var(--card-glow), transparent 32%);
}

.card-name {
  font-size: 1.28rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.card-flavor,
.card-tags {
  color: var(--muted);
  line-height: 1.45;
}

.card-effect {
  align-self: end;
  border-radius: var(--radius-sm);
  background: rgba(255, 210, 63, 0.1);
  padding: 10px;
  color: #ffe68f;
  font-weight: 850;
}

.card-tags {
  position: relative;
  z-index: 1;
  font-size: 0.76rem;
}

.log-list {
  display: grid;
  gap: 9px;
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding-left: 1.3rem;
  color: var(--muted);
}

.log-list li::marker {
  color: var(--blue-light);
}

body[data-status='won'] .hero {
  border-color: rgba(72, 240, 164, 0.52);
}

body[data-status='lost'] .hero {
  border-color: rgba(255, 90, 118, 0.56);
}

@media (max-width: 980px) {
  .hero,
  .battlefield {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .status-grid,
  .mitre-list,
  .guide-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1480px);
    padding-top: 10px;
  }

  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .status-grid,
  .mitre-list,
  .turn-stats,
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .section-title-row {
    display: block;
  }

  .severity-pill,
  .deck-counter {
    margin-top: 10px;
  }
}
