:root {
  --ink: #111514;
  --paper: #fff7df;
  --muted: #aab4aa;
  --acid: #c9f45f;
  --mint: #3de0a4;
  --blue: #69b7ff;
  --danger: #ff5a4f;
  --gold: #ffd166;
  --panel: rgba(15, 21, 19, 0.78);
  --line: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: #101513;
  color: var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #17231d;
  cursor: crosshair;
}

.hud {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 0.8fr);
  align-items: start;
  gap: 12px;
  pointer-events: none;
}

.brand,
.stat-strip,
.energy-shell,
.side-panel,
.toast {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.brand {
  padding: 13px 15px;
}

.brand span,
.brand strong {
  display: block;
}

.brand span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.2vw, 3.2rem);
  line-height: 0.92;
}

.brand strong {
  margin-top: 5px;
  color: var(--acid);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  min-width: 360px;
}

.stat-strip div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.stat-strip div:last-child {
  border-right: 0;
}

.stat-strip span,
.energy-shell span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.stat-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.02rem;
}

.energy-shell {
  padding: 12px 14px;
}

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

.pause-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 900;
  pointer-events: auto;
}

.pause-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.energy-bar {
  height: 18px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.energy-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--acid), var(--gold));
  transition: width 120ms linear;
}

.side-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100vw - 36px));
  padding: 14px;
  pointer-events: auto;
  transition:
    transform 180ms ease,
    width 180ms ease,
    padding 180ms ease;
}

.side-panel section + section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel-toggle {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: var(--paper);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-content {
  margin-top: 12px;
}

.side-panel.collapsed {
  width: 156px;
  padding: 8px;
}

.side-panel.collapsed .panel-content {
  display: none;
}

.side-panel.collapsed .panel-toggle {
  min-height: 42px;
}

.buff-strip {
  position: absolute;
  left: 18px;
  bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  max-width: min(540px, calc(100vw - 210px));
  gap: 8px;
  pointer-events: none;
}

.buff-chip {
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(15, 21, 19, 0.78);
  color: var(--paper);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  font-size: 0.78rem;
  font-weight: 900;
  backdrop-filter: blur(14px);
}

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

h2 {
  margin-bottom: 10px;
  color: var(--acid);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.trait {
  padding: 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trait span,
.trait strong {
  display: block;
}

.trait span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.trait strong {
  margin-top: 3px;
  font-size: 1.15rem;
}

#fieldNote {
  margin-bottom: 0;
  color: #eef6e6;
  font-size: 0.95rem;
  line-height: 1.42;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 36px));
  padding: 12px 14px;
  color: #fffbe7;
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 50%, rgba(49, 82, 58, 0.24), rgba(2, 5, 4, 0.74));
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(720px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(20, 31, 26, 0.98), rgba(12, 17, 16, 0.98)),
    #101513;
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.45);
}

.start-card {
  padding: clamp(24px, 5vw, 48px);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--acid);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.start-card h1 {
  margin-bottom: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 10vw, 6.7rem);
  line-height: 0.86;
}

.start-card p,
.draft-card p {
  color: #eaf1e6;
  font-size: 1.05rem;
  line-height: 1.48;
}

.rules {
  display: grid;
  gap: 8px;
  margin: 22px 0;
  padding-left: 20px;
  color: #dbe8d7;
}

.primary,
.secondary,
.card-button {
  min-height: 52px;
  border: 0;
  cursor: pointer;
  font-weight: 950;
}

.primary,
.card-button {
  background: var(--acid);
  color: #101513;
}

.primary {
  padding: 0 22px;
}

.secondary {
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.primary:hover,
.card-button:hover {
  background: #e1ff7f;
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.tutorial-dots {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.tutorial-dot {
  width: 38px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
}

.tutorial-dot.active {
  background: var(--acid);
}

.tutorial-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.pause-card {
  width: min(520px, 100%);
  padding: 28px;
}

.pause-card h2 {
  margin-bottom: 10px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-transform: none;
}

.pause-card p {
  color: #eaf1e6;
  line-height: 1.48;
}

.draft-card {
  padding: 28px;
}

.draft-card h2 {
  margin-bottom: 8px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-transform: none;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.mutation-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 230px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  text-align: left;
}

.mutation-card h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.mutation-card p {
  margin-bottom: 14px;
  color: #dce8d9;
  font-size: 0.9rem;
}

.mutation-card small {
  display: block;
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.35;
}

.card-button {
  width: 100%;
}

@media (max-width: 920px) {
  .hud {
    grid-template-columns: 1fr;
  }

  .stat-strip {
    min-width: 0;
  }

  .side-panel {
    right: 10px;
    bottom: 10px;
    width: min(320px, calc(100vw - 20px));
  }

  .side-panel.collapsed {
    width: 140px;
  }

  .buff-strip {
    left: 10px;
    bottom: 64px;
    max-width: calc(100vw - 20px);
  }

  .card-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hud {
    left: 10px;
    right: 10px;
    top: 10px;
    gap: 8px;
  }

  .brand span {
    font-size: 2rem;
  }

  .stat-strip {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .stat-strip div {
    padding: 9px;
  }

  .stat-strip strong {
    font-size: 0.85rem;
  }
}
