:root {
  color-scheme:dark;
  --bg:#101b1e;
  --panel:#172529;
  --line:#2b3b3d;
  --text:#eef1df;
  --muted:#9caca8;
  --green:#c1f48b;
  --orange:#ecaa79;
  --purple:#b5a3e8;
  font-family:Arial,Helvetica,sans-serif;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  background:radial-gradient(ellipse at 45% -30%,#29413b 0,transparent 55%),var(--bg);
  color:var(--text);
  min-height:100vh;
}

button,a {
  -webkit-tap-highlight-color:transparent;
}

button {
  font:inherit;
  cursor:pointer;
}

button:focus-visible,a:focus-visible {
  outline:3px solid var(--green);
  outline-offset:4px;
}

button:disabled {
  cursor:not-allowed;
}

button {
  color:inherit;
}

a {
  color:inherit;
  text-decoration:none;
}

.app {
  max-width:1536px;
  margin:auto;
  padding:27px 52px 20px;
}

.header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-bottom:24px;
  border-bottom:1px solid var(--line);
}

.brand {
  display:flex;
  align-items:center;
  gap:12px;
  font-size:20px;
  font-weight:700;
  letter-spacing:-.5px;
}

.brand img {
  border-radius:13px;
}

.brand small {
  display:block;
  font-size:9px;
  font-weight:500;
  letter-spacing:2.15px;
  color:var(--muted);
  margin-top:6px;
}

.header-actions {
  display:flex;
  gap:24px;
  align-items:center;
}

.lab-tag {
  font-size:10px;
  letter-spacing:1.5px;
  color:var(--muted);
  display:flex;
  gap:9px;
  align-items:center;
}

.lab-tag i,.field-title i,.live-dot {
  width:6px;
  height:6px;
  background:var(--green);
  display:inline-block;
  border-radius:50%;
  box-shadow:0 0 10px #c1f43333;
}

.icon-button {
  width:34px;
  height:34px;
  border:1px solid #41504c;
  border-radius:50%;
  background:transparent;
  font-size:17px;
  color:var(--muted);
}

.intro {
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  padding:30px 0 27px;
  gap:20px;
}

.eyebrow {
  font-size:9px;
  letter-spacing:1.9px;
  font-weight:700;
  color:var(--green);
  margin:0 0 12px;
}

.intro h1 {
  font-size:clamp(28px,3vw,42px);
  line-height:1.1;
  letter-spacing:-1.5px;
  font-weight:500;
  margin:0;
}

.intro h1 span {
  color:var(--green);
}

.intro-text {
  font-size:13px;
  line-height:1.8;
  color:var(--muted);
  margin:0 0 1px;
}

.stats {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  border:1px solid var(--line);
  border-radius:13px;
  background:#182629;
  margin-bottom:23px;
}

.stat {
  min-height:90px;
  padding:18px;
  display:flex;
  gap:14px;
  align-items:center;
  position:relative;
}

.stat+.stat {
  border-left:1px solid var(--line);
}

.stat-icon {
  font-size:29px;
  width:26px;
  text-align:center;
}

.bio-icon {
  color:var(--green);
}

.heart-icon {
  color:#e49c87;
  font-size:25px;
}

.wave-icon {
  color:var(--purple);
  font-size:33px;
}

.enemy-icon {
  color:var(--orange);
}

.stat-label {
  font-size:10px;
  display:block;
  color:var(--muted);
  margin-bottom:7px;
}

.stat strong {
  font-size:28px;
  line-height:1;
  font-weight:500;
  font-variant-numeric:tabular-nums;
}

.stat-max {
  font-size:16px;
  color:#718681;
}

.stat-hint {
  font-size:9px;
  color:#81958f;
  margin-left:auto;
  align-self:flex-end;
  white-space:nowrap;
}

.hearts {
  font-size:9px;
  letter-spacing:2px;
  color:#da9c89;
  margin-left:auto;
  max-width:72px;
  overflow-wrap:anywhere;
  line-height:1.8;
}

.wave-dots {
  display:flex;
  gap:5px;
  margin-left:auto;
}

.wave-dots i {
  width:6px;
  height:6px;
  border-radius:50%;
  background:#42524d;
}

.wave-dots i.active {
  background:var(--purple);
}

.wave-dots i.done {
  background:var(--green);
}

.game-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 312px;
  gap:22px;
  align-items:start;
}

.field-panel {
  border:1px solid var(--line);
  border-radius:13px;
  overflow:hidden;
  background:#14282a;
}

.field-toolbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:13px 18px;
  border-bottom:1px solid var(--line);
  background:#1a2a2b;
}

.field-title {
  font-size:9px;
  letter-spacing:1.5px;
  display:flex;
  align-items:center;
  gap:8px;
  color:#bac9bb;
}

.playback {
  display:flex;
  gap:12px;
}

.text-button {
  border:0;
  background:none;
  padding:5px 0;
  color:var(--muted);
  font-size:11px;
}

.text-button:hover {
  color:var(--green);
}

.text-button:disabled {
  opacity:.4;
}

.board {
  position:relative;
  aspect-ratio:1000/580;
  isolation:isolate;
  background:#122b2d;
}

.board canvas {
  display:block;
  width:100%;
  height:100%;
}

.pads {
  position:absolute;
  inset:0;
}

.pad {
  position:absolute;
  transform:translate(-50%,-50%);
  width:clamp(28px,4.5%,45px);
  height:auto;
  aspect-ratio:1;
  border:1px dashed #83ad985e;
  border-radius:50%;
  background:#1c39378c;
  color:#a6c3ab;
  font-size:20px;
  line-height:1;
  display:flex;
  justify-content:center;
  align-items:center;
  transition:background .15s,border-color .15s,box-shadow .15s;
  padding:0;
}

.pad:hover,.pad.focused {
  background:#b5ed8730;
  border-color:var(--green);
  box-shadow:0 0 0 4px #b5ed8710;
}

.pad.occupied {
  background:transparent;
  border:0;
  color:transparent;
}

.pad.occupied:hover,.pad.occupied.focused {
  box-shadow:0 0 0 3px #c1f48b55;
}

.pad.unaffordable {
  border-color:#79968945;
  color:#728b7d;
  background:#16323155;
}

.pad:disabled {
  opacity:.6;
}

.board-note {
  position:absolute;
  bottom:18px;
  left:18px;
  display:flex;
  align-items:center;
  gap:8px;
  font-size:9px;
  color:#9cbbac;
  pointer-events:none;
}

.board-scale {
  position:absolute;
  bottom:18px;
  right:18px;
  color:#718f85;
  font-size:8px;
  display:flex;
  gap:8px;
  align-items:center;
}

.board-scale i {
  width:45px;
  border:1px solid #718f85;
  height:5px;
  border-top:0;
}

.field-footer {
  display:flex;
  gap:16px;
  padding:14px 18px;
  background:#172729;
  border-top:1px solid var(--line);
  font-size:9px;
  color:var(--muted);
  align-items:center;
}

.legend-dot {
  display:inline-block;
  width:6px;
  height:6px;
  border-radius:50%;
  margin-right:5px;
}

.ally {
  background:var(--green);
}

.hostile {
  background:var(--orange);
}

.field-coordinate {
  margin-left:auto;
  font-size:8px;
  letter-spacing:1px;
  color:#71877e;
}

.sidebar {
  display:flex;
  flex-direction:column;
  gap:15px;
}

.build-panel,.wave-panel {
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:13px;
  padding:19px;
}

.section-heading {
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
  margin-bottom:9px;
}

.section-heading h2 {
  font-size:15px;
  letter-spacing:-.3px;
  font-weight:500;
  margin:0;
}

.section-heading>span {
  font-size:8px;
  color:var(--muted);
  letter-spacing:1px;
}

.muted {
  font-size:11px;
  line-height:1.7;
  color:var(--muted);
  margin:0 0 14px;
}

.muted b {
  color:var(--green);
}

.tower-card {
  position:relative;
  display:flex;
  align-items:center;
  text-align:left;
  width:100%;
  gap:10px;
  border:1px solid #39484a;
  background:#1c2c2e;
  padding:14px 10px;
  border-radius:8px;
  margin:10px 0 0;
  transition:background .15s,border-color .15s;
}

.tower-card.selected {
  border-color:var(--green);
  background:#26382d;
}

.tower-card:hover {
  background:#2a3b32;
}

.tower-info {
  display:flex;
  flex-direction:column;
  gap:5px;
  flex:1;
}

.tower-info>strong {
  font-size:11px;
  font-weight:500;
}

.tower-info>span {
  font-size:9px;
  color:var(--muted);
}

.tower-info>.tower-values {
  font-size:8px;
  color:#8da295;
}

.price {
  font-size:16px;
  align-self:flex-start;
}

.price small {
  font-size:11px;
  color:var(--green);
}

.selected-check {
  position:absolute;
  right:10px;
  bottom:10px;
  font-size:10px;
  color:var(--green);
  visibility:hidden;
}

.selected .selected-check {
  visibility:visible;
}

.cell-art {
  width:36px;
  height:38px;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}

.cell-art:before {
  content:"";
  position:absolute;
  inset:4px 1px;
  border:2px solid #ccf5a3;
  border-radius:39% 51% 44% 57%;
  background:#a5d97e;
  transform:rotate(-25deg);
  box-shadow:0 0 15px #b4ed871f;
}

.cell-art i {
  width:13px;
  height:16px;
  border-radius:50%;
  background:#35715a;
  z-index:1;
  transform:rotate(35deg);
}

.enzyme-art:before {
  background:#b19acb;
  border-color:#d4baec;
  border-radius:42% 57% 40% 55%;
  transform:rotate(28deg);
}

.enzyme-art i {
  background:#615075;
  width:16px;
  height:15px;
}

.selection-info {
  font-size:9px;
  color:#9ab89b;
  line-height:1.6;
  border-top:1px solid var(--line);
  padding-top:12px;
  margin-top:13px;
  min-height:42px;
}

.wave-panel .muted {
  min-height:36px;
}

.wave-progress {
  height:4px;
  background:#324139;
  overflow:hidden;
  border-radius:4px;
  margin:16px 0;
}

.wave-progress span {
  display:block;
  height:100%;
  background:var(--green);
  width:0;
  transition:width .2s;
}

.primary-button {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  width:100%;
  border:0;
  border-radius:7px;
  padding:13px 15px;
  background:var(--green);
  color:#203122;
  font-weight:600;
  font-size:12px;
  transition:background .15s;
}

.primary-button:hover {
  background:#d2ffa8;
}

.primary-button:disabled {
  background:#36473d;
  color:#8a9e8e;
}

.primary-button span {
  font-size:16px;
}

.evolution-panel {
  border:1px solid #3b4538;
  border-radius:11px;
  padding:17px 18px;
  display:flex;
  gap:12px;
  background:linear-gradient(130deg,#25352a,#1b2a27);
}

.evolution-symbol {
  color:#a1bd82;
  font-size:25px;
}

.evolution-panel .eyebrow {
  font-size:8px;
  letter-spacing:1.5px;
  color:#9dae8c;
  margin:1px 0 8px;
}

.evolution-panel strong {
  font-size:11px;
  font-weight:500;
}

.evolution-panel p:last-child {
  color:#8b9e8c;
  font-size:9px;
  line-height:1.7;
  margin:7px 0 0;
}

.evolution-panel.evolved {
  border-color:#85a76d;
}

.evolution-panel.evolved strong {
  color:var(--green);
}

.page-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin-top:20px;
  color:#839b90;
  font-size:10px;
}

.page-footer p {
  display:flex;
  gap:8px;
  align-items:center;
  margin:0;
  flex-wrap:wrap;
}

.page-footer p span {
  font-size:8px;
  color:var(--green);
  font-weight:700;
}

.page-footer i {
  color:#536c60;
  font-style:normal;
  margin:0 5px;
}

.toast {
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translate(-50%,15px);
  opacity:0;
  pointer-events:none;
  padding:13px 20px;
  max-width:90vw;
  min-width:220px;
  text-align:center;
  background:#e3f3cd;
  color:#203421;
  border-radius:8px;
  font-size:12px;
  z-index:10;
  box-shadow:0 8px 40px #0005;
  transition:opacity .2s,transform .2s;
}

.toast.visible {
  opacity:1;
  transform:translate(-50%,0);
}

.modal {
  color:var(--text);
  border:1px solid #52634c;
  border-radius:17px;
  background:radial-gradient(ellipse at top,#30422c,transparent 70%),#18272a;
  padding:35px;
  max-width:850px;
  width:calc(100% - 36px);
  max-height:90dvh;
  overflow:auto;
  box-shadow:0 25px 100px #0008;
}

.modal::backdrop {
  background:#061317d9;
  backdrop-filter:blur(7px);
}

.modal h2 {
  font-size:36px;
  font-weight:500;
  letter-spacing:-1.2px;
  margin:16px 0;
}

.modal-lead {
  font-size:13px;
  line-height:1.8;
  color:#aebcac;
}

.modal-topline {
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:#7e9b80;
  font-size:10px;
}

.modal-topline .eyebrow {
  margin:0;
}

.evolution-options {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px;
  margin-top:26px;
}

.upgrade-card {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  text-align:left;
  background:#172a27;
  border:1px solid #425646;
  padding:22px 17px;
  border-radius:10px;
  gap:15px;
  transition:transform .15s,border-color .15s;
}

.upgrade-card:hover {
  border-color:var(--green);
  transform:translateY(-4px);
  background:#293d2a;
}

.upgrade-art {
  font-size:40px;
  color:var(--green);
}

.upgrade-card .eyebrow {
  font-size:8px;
  margin:0;
  color:#a1b291;
}

.upgrade-card strong {
  font-size:17px;
  line-height:1.4;
  font-weight:500;
}

.upgrade-card>span:not(.upgrade-art):not(.eyebrow):not(.upgrade-choose) {
  color:#aab8a2;
  font-size:11px;
  line-height:1.9;
}

.upgrade-card b {
  color:var(--green);
  font-weight:500;
}

.upgrade-card em {
  font-style:normal;
  color:#deb28d;
}

.upgrade-choose {
  font-size:9px;
  color:var(--green);
  padding-top:10px;
  margin-top:auto;
}

.modal-footnote {
  font-size:10px;
  color:#8c9e8c;
  text-align:center;
  margin:24px 0 0;
}

.result-modal {
  max-width:465px;
  text-align:center;
  padding:35px;
}

.result-art {
  font-size:64px;
  color:var(--green);
  margin:0 0 20px;
}

.result-modal h2 {
  font-size:32px;
}

.result-stats {
  display:flex;
  justify-content:center;
  gap:45px;
  padding:22px 0 30px;
}

.result-stats div {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.result-stats strong {
  font-size:32px;
  font-weight:500;
  color:var(--green);
}

.result-stats span {
  font-size:10px;
  color:var(--muted);
}

.help-modal {
  max-width:560px;
}

.help-modal ol {
  padding-left:18px;
  color:var(--muted);
  font-size:13px;
  line-height:1.8;
}

.help-modal li {
  padding:0 0 12px 5px;
}

.help-modal b {
  color:var(--text);
  font-weight:500;
}

.close-button {
  position:absolute;
  top:15px;
  right:20px;
  font-size:25px;
  border:0;
  background:none;
  color:var(--muted);
}

@media(min-width:1500px) {
  .game-layout {
    grid-template-columns:minmax(0,1fr) 330px;
  }
  .tower-info>strong {
    font-size:12px;
  }
  .sidebar {
    gap:20px;
  }
  .build-panel,.wave-panel {
    padding:23px;
  }
  .tower-card {
    padding:18px 12px;
  }
  .intro {
    padding-top:34px;
    padding-bottom:34px;
  }
}

@media(max-width:1150px) {
  .app {
    padding:23px 26px;
  }
  .game-layout {
    grid-template-columns:minmax(0,1fr) 285px;
    gap:16px;
  }
  .stat {
    padding:16px 12px;
    gap:10px;
  }
  .stat-hint,.field-coordinate {
    display:none;
  }
  .field-footer {
    gap:12px;
    font-size:8px;
    padding:12px;
  }
  .hearts {
    font-size:8px;
    max-width:45px;
  }
  .build-panel,.wave-panel {
    padding:16px;
  }
  .tower-card {
    padding:12px 8px;
    gap:7px;
  }
  .tower-info>strong {
    font-size:10px;
  }
  .tower-info>.tower-values {
    font-size:7px;
  }
  .cell-art {
    width:31px;
  }
  .intro-text {
    font-size:12px;
  }
  .field-toolbar {
    padding:11px 12px;
  }
  .field-title {
    font-size:8px;
    letter-spacing:1px;
  }
  .board-note {
    font-size:8px;
    bottom:12px;
    left:12px;
  }
  .board-scale {
    bottom:12px;
    right:12px;
  }
}

@media(max-width:900px) {
  .game-layout {
    grid-template-columns:1fr;
  }
  .sidebar {
    display:grid;
    grid-template-columns:1.2fr 1fr;
    gap:15px;
  }
  .build-panel {
    grid-row:span 2;
  }
  .tower-info>strong {
    font-size:12px;
  }
  .tower-info>.tower-values {
    font-size:9px;
  }
  .cell-art {
    width:38px;
  }
  .tower-card {
    padding:14px 10px;
    gap:10px;
  }
  .evolution-panel {
    align-self:start;
  }
  .stats {
    margin-bottom:16px;
  }
  .stat {
    min-height:80px;
  }
  .intro h1 {
    font-size:34px;
  }
  .field-coordinate {
    display:block;
  }
  .wave-panel .muted {
    min-height:0;
  }
  .wave-dots {
    display:none;
  }
}

@media(max-width:580px) {
  .app {
    padding:18px 14px;
  }
  .brand {
    font-size:16px;
    gap:9px;
  }
  .brand img {
    width:37px;
    height:37px;
  }
  .brand small {
    font-size:7px;
    letter-spacing:1.7px;
  }
  .header {
    padding-bottom:18px;
  }
  .header-actions {
    gap:8px;
  }
  .lab-tag {
    display:none;
  }
  .icon-button {
    width:30px;
    height:30px;
  }
  .intro {
    padding:23px 0 20px;
    display:block;
  }
  .intro h1 {
    font-size:31px;
  }
  .eyebrow {
    font-size:8px;
    letter-spacing:1.4px;
  }
  .intro-text {
    margin-top:14px;
    font-size:11px;
    line-height:1.6;
  }
  .desktop-break {
    display:none;
  }
  .stats {
    grid-template-columns:1fr 1fr;
    border-radius:10px;
  }
  .stat {
    min-height:74px;
    padding:13px 14px;
  }
  .stat+.stat {
    border-left:0;
  }
  .stat:nth-child(even) {
    border-left:1px solid var(--line);
  }
  .stat:nth-child(n+3) {
    border-top:1px solid var(--line);
  }
  .stat strong {
    font-size:25px;
  }
  .stat-label {
    font-size:9px;
  }
  .stat-icon {
    font-size:24px;
  }
  .stat-max {
    font-size:14px;
  }
  .hearts {
    max-width:none;
    font-size:7px;
    letter-spacing:1px;
  }
  .sidebar {
    display:flex;
    gap:12px;
  }
  .build-panel {
    padding:16px;
  }
  .tower-card {
    padding:14px 12px;
  }
  .tower-info>strong {
    font-size:12px;
  }
  .tower-info>.tower-values {
    font-size:9px;
  }
  .tower-info>span {
    font-size:10px;
  }
  .cell-art {
    width:40px;
  }
  .section-heading h2 {
    font-size:15px;
  }
  .muted {
    font-size:11px;
  }
  .tower-card .price {
    font-size:18px;
  }
  .field-title {
    font-size:7px;
    letter-spacing:.7px;
  }
  .playback {
    gap:9px;
  }
  .text-button {
    font-size:10px;
  }
  .field-toolbar {
    padding:10px;
  }
  .board {
    aspect-ratio:1000/650;
  }
  .board canvas {
    object-fit:fill;
  }
  .pad {
    width:29px;
    font-size:17px;
  }
  .board-note {
    bottom:9px;
    left:9px;
    font-size:6px;
    gap:5px;
  }
  .board-scale {
    font-size:6px;
    bottom:9px;
    right:9px;
  }
  .board-scale i {
    width:22px;
  }
  .field-footer {
    font-size:7px;
    gap:10px;
    padding:11px 9px;
  }
  .field-coordinate {
    display:none;
  }
  .page-footer {
    display:block;
    margin-top:17px;
  }
  .page-footer p {
    font-size:8px;
    gap:5px;
  }
  .page-footer i {
    margin:0 1px;
  }
  .page-footer>button {
    margin-top:13px;
  }
  .modal {
    padding:25px 20px;
    max-height:92dvh;
  }
  .modal h2 {
    font-size:29px;
  }
  .modal-lead {
    font-size:12px;
  }
  .evolution-options {
    grid-template-columns:1fr;
    gap:8px;
    margin-top:20px;
  }
  .upgrade-card {
    padding:15px;
    display:grid;
    grid-template-columns:40px 1fr 1fr;
    gap:6px 12px;
  }
  .upgrade-art {
    grid-row:span 3;
    font-size:32px;
    align-self:center;
  }
  .upgrade-card .eyebrow {
    font-size:6px;
    grid-column:2;
  }
  .upgrade-card strong {
    font-size:13px;
    grid-column:2;
  }
  .upgrade-card>span:not(.upgrade-art):not(.eyebrow):not(.upgrade-choose) {
    font-size:9px;
    grid-column:3;
    grid-row:1/span 2;
    align-self:center;
  }
  .upgrade-choose {
    font-size:8px;
    grid-column:2/span 2;
    padding-top:3px;
  }
  .modal-footnote {
    font-size:9px;
    margin-top:17px;
  }
  .result-modal {
    padding:28px 23px;
  }
  .result-stats {
    gap:30px;
  }
  .help-modal ol {
    font-size:12px;
  }
  .selection-info {
    font-size:10px;
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    transition:none!important;
    scroll-behavior:auto!important;
  }
}

