body.app-hidden {
  visibility: hidden;
}

* {
  box-sizing: border-box;
}

.game-panel {
  position: relative;
  border-radius: 28px;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 29, 37, 0.94), rgba(12, 18, 24, 0.94));
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.field-shell {
  position: relative;
  z-index: 1;
  min-height: 0;
  height: 100%;
  padding: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(10, 22, 33, 0.96), rgba(6, 12, 19, 0.96)),
    linear-gradient(130deg, rgba(143, 245, 255, 0.1), transparent 28%);
  border: 1px solid var(--field-border);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 24px 64px rgba(0, 0, 0, 0.38);
}

.mini-stat.is-game-over {
  background: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

.mini-stat.is-game-over .mini-stat-label {
  color: #fff;
}

.mini-stat.is-game-over .mini-stat-value {
  color: #fff;
  text-shadow: none;
}

.mini-stat.is-combat-score {
  background: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

.mini-stat.is-combat-score .mini-stat-label {
  color: #fff;
}

.mini-stat.is-combat-score .mini-stat-value {
  color: #fff;
  text-shadow: none;
}

.mini-stat.is-gold-active .mini-stat-label {
  color: inherit;
}

.mini-stat.is-gold-active .mini-stat-value {
  color: inherit;
  text-shadow: none;
}

.mini-stat.is-gold-active {
  background: var(--accent);
  border-color: transparent;
  box-shadow: none;
}

.mini-stat.is-disabled {
  opacity: 0.5;
}

.mini-stat.is-disabled.is-gold-active {
  opacity: 1;
}

#game {
  position: relative;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  height: auto;
  flex: 0 0 auto;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  border-radius: 18px;
  border: 1px solid rgba(188, 206, 219, 0.18);
  background: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 8px 26px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  touch-action: none;
}

#game canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.three-label-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.tower-stat-label,
.waypoint-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1;
}

.tower-stat-label {
  color: #fff;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.95),
    1px -1px 0 rgba(0, 0, 0, 0.95),
    -1px 1px 0 rgba(0, 0, 0, 0.95),
    1px 1px 0 rgba(0, 0, 0, 0.95),
    0 2px 6px rgba(0, 0, 0, 0.45);
}

.waypoint-label {
  font-size: 28px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.32);
}

.special-tile-label {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.95),
    1px -1px 0 rgba(0, 0, 0, 0.95),
    -1px 1px 0 rgba(0, 0, 0, 0.95),
    1px 1px 0 rgba(0, 0, 0, 0.95),
    0 0 10px rgba(0, 0, 0, 0.34);
}

button {
  width: 100%;
  border: 1px solid rgba(155, 220, 255, 0.18);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(16, 31, 46, 0.98), rgba(12, 21, 34, 0.98)),
    linear-gradient(130deg, rgba(143, 245, 255, 0.08), transparent 40%);
  border-radius: 15px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
}

button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tower-btn {
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.tower-btn.active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent), 0 16px 28px rgba(0, 0, 0, 0.18);
}

.leaderboard-panel {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid rgba(162, 222, 238, 0.14);
  background: linear-gradient(180deg, rgba(13, 24, 38, 0.88), rgba(9, 17, 28, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
}

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

.leaderboard-columns,
.leaderboard-entry {
  display: grid;
  gap: 10px;
  align-items: center;
}

.leaderboard-head {
  margin-bottom: 12px;
  justify-content: space-between;
}

.leaderboard-head button,
.leaderboard-toolbar button {
  width: auto;
  min-width: 0;
  padding-inline: 12px;
}

.leaderboard-copy {
  min-width: 0;
  text-align: center;
}

.leaderboard-title {
  margin: 3px 0 0;
  font-size: 20px;
  font-weight: 800;
  color: #fbfeff;
}

.leaderboard-head {
  align-items: center;
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.leaderboard-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.leaderboard-tab.active {
  background: transparent;
  color: var(--accent-strong);
}

.leaderboard-tab-icon {
  height: 20px;
  display: block;
  flex: 0 0 auto;
  image-rendering: crisp-edges;
}

.leaderboard-toolbar {
  margin-bottom: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.leaderboard-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.leaderboard-status.ok {
  color: var(--mint);
}

.leaderboard-status.danger {
  color: var(--rose);
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.leaderboard-entry {
  padding: 10px 12px;
  border-radius: 0;
  border: 0;
  background: transparent;
  grid-template-columns: max-content minmax(0, 1fr) 64px 116px;
}

.leaderboard-entry[data-layout="player"] {
  grid-template-columns: max-content minmax(0, 1fr) 64px 116px 72px;
}

.leaderboard-entry[data-layout="global"] {
  grid-template-columns: max-content minmax(0, 1fr) 84px;
}

.leaderboard-columns[data-layout="popular"],
.leaderboard-entry[data-layout="popular"] {
  grid-template-columns: max-content minmax(0, 1.15fr) minmax(0, 1fr) 64px 116px 56px;
}

.leaderboard-columns[data-layout="recent"],
.leaderboard-entry[data-layout="recent"] {
  grid-template-columns: max-content minmax(0, 1.15fr) minmax(0, 1fr) 64px 116px;
}

.leaderboard-entry.empty {
  display: flex;
  justify-content: center;
  color: var(--muted);
  font-weight: 700;
}

.leaderboard-rank {
  width: auto;
  color: #90b8c8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  justify-self: start;
}

.leaderboard-name {
  min-width: 0;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 800;
  text-align: left;
}

.leaderboard-score-detail {
  color: var(--muted);
  font-weight: 700;
}

.leaderboard-seed {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #fbfeff;
  font-size: 14px;
  font-weight: 800;
}

.leaderboard-played {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 2px 6px;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
 background: var(--accent-soft);
}

.leaderboard-flag {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.leaderboard-submitted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  width: 116px;
}

.leaderboard-cell {
  min-width: 0;
}

.leaderboard-panel,
.leaderboard-head,
.leaderboard-tabs,
.leaderboard-toolbar,
.leaderboard-entry {
  min-width: 0;
}

.leaderboard-entry {
  transition: background-color 120ms ease;
}

.leaderboard-entry:hover,
.leaderboard-entry:focus-visible {
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-entry[data-seed] {
  cursor: pointer;
}

.leaderboard-entry.is-you {
  background: var(--accent-soft);
}

.page-shell {
  width: 100vw;
  max-width: none;
  margin: 0;
  display: block;
  min-height: calc(100vh - 10px + var(--leaderboard-scroll-offset));
}

.streamlined-panel {
  padding: 10px;
  border-radius: 24px;
  min-height: calc(100vh - 10px + var(--leaderboard-scroll-offset));
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, calc(100vh - 320px)) auto auto;
  gap: 10px;
  align-items: stretch;
}

.stream-topbar,
.stream-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.stream-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-content: stretch;
  align-items: start;
  width: min(1440px, calc(100vw - 20px));
  max-width: 100%;
  margin-inline: auto;
  margin-bottom: 0;
}

.stream-footer {
  margin-top: 0;
  align-items: stretch;
  flex-direction: row;
  width: min(1440px, calc(100vw - 20px));
  max-width: 100%;
  margin-inline: auto;
  justify-content: center;
}

.stream-stats,
.stream-actions,
.speed-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.stream-stats {
  grid-column: 1;
}

.stream-actions {
  grid-column: 2;
  justify-content: center;
}

.speed-buttons {
  grid-column: 3;
  justify-content: flex-end;
  justify-self: end;
}

.mini-stat {
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(184, 203, 214, 0.12);
  background: linear-gradient(180deg, rgba(22, 31, 39, 0.92), rgba(15, 22, 29, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 60px;
}

.mini-stat-button {
  width: auto;
  min-width: 60px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.mini-stat-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.mini-stat-button:disabled {
  cursor: default;
  transform: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.score-stat-button:disabled {
  opacity: 1;
}

.gold-change-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

.gold-change-text {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: #fbfeff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.72),
    0 -1px 0 rgba(0, 0, 0, 0.78),
    1px -1px 0 rgba(0, 0, 0, 0.72),
    -1px 0 0 rgba(0, 0, 0, 0.78),
    1px 0 0 rgba(0, 0, 0, 0.84),
    -1px 1px 0 rgba(0, 0, 0, 0.82),
    0 1px 0 rgba(0, 0, 0, 0.88),
    1px 1px 0 rgba(0, 0, 0, 0.92),
    2px 2px 0 rgba(0, 0, 0, 0.7),
    3px 3px 10px rgba(0, 0, 0, 0.32);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.96);
}

.gold-change-text.is-positive .gold-change-delta {
  color: #8ff5c7;
}

.gold-change-text.is-negative .gold-change-delta {
  color: #ffd0d0;
}

.gold-change-text.is-visible {
  animation: gold-change-float 1120ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gold-change-float {
  0% {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.96);
  }

  14% {
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -34px) scale(1.02);
  }
}

.mini-stat-label {
  color: #90b8c8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mini-stat-value {
  color: #fbfeff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.seed-stat-value {
  display: flex;
  min-height: 20px;
}

.seed-stat-icon {
  width: 20px;
  height: 20px;
  display: block;
  image-rendering: crisp-edges;
}

.stream-actions button,
.speed-buttons button {
  width: auto;
  min-width: 0;
  min-height: 56px;
  padding-inline: 14px;
}

.speed-btn {
  min-width: 58px;
}

.speed-btn.active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent), 0 16px 28px rgba(0, 0, 0, 0.18);
}

.pathery-auto-finish-btn {
  min-width: 118px;
}

.tower-strip {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 110px));
  gap: 8px;
  width: max-content;
  max-width: 100%;
  justify-content: center;
  justify-self: center;
}

.score-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 28px));
  max-width: calc(100% - 28px);
  padding: 24px 24px 22px;
  background: color-mix(in srgb, var(--accent) 30%, #24303b);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: auto;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
}

.score-popup.visible {
  opacity: 1;
  visibility: visible;
}

.score-popup-value {
  margin-top: 0;
  color: #edf2f7;
  font-family: 'Sora', sans-serif;
  font-size: clamp(50px, 9vw, 82px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: none;
  text-align: center;
}

.score-popup-field {
  margin-top: 16px;
  display: block;
}

.score-popup-input {
  width: 100%;
  min-height: 48px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid rgba(155, 220, 255, 0.16);
  border-radius: 0;
  background: transparent;
  color: #edf3f7;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  box-shadow: none;
}

.score-popup-input:focus {
  border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.score-popup-input::placeholder {
  color: #7f919e;
}

.score-popup-actions {
  display: flex;
  margin-top: 16px;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.score-popup-retry {
  min-width: 160px;
  min-height: 58px;
  padding-inline: 22px;
  font-size: 18px;
  font-weight: 800;
  pointer-events: auto;
  align-items: center;
  justify-content: center;
}

.score-popup-retry:not(:disabled) {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.score-popup-retry:not(:disabled):hover {
  background: var(--accent-strong);
  box-shadow: none;
}

.tower-btn {
  width: 100%;
  padding: 0;
  min-height: 0;
  height: auto;
  align-self: start;
  border: 1px solid color-mix(in srgb, var(--tower-accent, var(--accent)) 60%, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  background: color-mix(in srgb, var(--tower-accent, var(--accent)) 24%, #0f1620);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.tower-btn-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 4px 6px;
  min-height: 34px;
}

.tower-btn-info {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2px;
  min-width: 0;
  min-height: 100%;
}

.tower-name-row {
  display: block;
  margin: 0;
}

.tower-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  color: var(--tower-accent, var(--accent));
  text-wrap: balance;
}

.tower-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-self: end;
}

.tower-card-stat {
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  align-items: flex-end;
}

.tower-card-stat.is-secondary {
  justify-content: flex-end;
  text-align: right;
}

.tower-card-stat-label {
  display: block;
  margin-bottom: 1px;
  color: color-mix(in srgb, var(--tower-accent, var(--accent)) 72%, #b7c7d6);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
}

.tower-card-stat-value {
  display: block;
  color: var(--tower-accent, var(--accent));
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.tower-card-stat-unit {
  font-size: 8px;
  letter-spacing: -0.01em;
}

.creep-chip-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 14px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.creep-chip {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.creep-chip-button {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
  width: 10px;
  height: 10px;
  min-width: 10px;
  min-height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.creep-chip-button.is-disabled {
  opacity: 0.28;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  filter: grayscale(0.65);
}

@media (max-width: 760px) {
  .page-shell {
    width: 100vw;
    max-width: none;
    margin: 0;
    gap: 12px;
  }

  .streamlined-panel {
    min-height: auto;
    height: auto;
    display: block;
  }

  .field-shell {
    min-height: 58vh;
    height: auto;
  }

  .score-popup {
    top: 50%;
    width: min(360px, calc(100% - 20px));
    max-width: calc(100% - 20px);
    padding: 20px 16px 16px;
  }

  .score-popup-retry {
    width: 100%;
    min-width: 0;
  }

  #game {
    width: 100vw;
    max-width: none;
    max-height: 58vh;
  }

  .game-panel {
    border-radius: 22px;
    padding: 14px;
  }

  .stream-topbar,
  .stream-footer {
    display: grid;
  }

  .stream-topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .stream-footer {
    width: 100%;
    max-width: none;
    margin-inline: 0;
  }

  .stream-stats,
  .stream-actions,
  .speed-buttons {
    grid-column: 1;
    width: 100%;
    justify-self: stretch;
  }

  .stream-stats {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-self: stretch;
  }

  .stream-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .speed-buttons {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    justify-self: stretch;
  }

  .stream-actions button,
  .stream-stats > .mini-stat,
  .stream-stats > .mini-stat-button,
  .speed-buttons button {
    width: 100%;
    min-width: 0;
  }

  .stream-stats > .mini-stat,
  .stream-stats > .mini-stat-button {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px;
  }

  .stream-stats .mini-stat-label,
  .stream-stats .mini-stat-value {
    white-space: nowrap;
  }

  .stream-stats .mini-stat-label {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .stream-stats .mini-stat-value {
    font-size: 13px;
  }

  .stream-stats .mini-stat-value {
    text-align: right;
  }

  .speed-buttons button {
    padding-inline: 0;
  }

  .tower-strip {
    grid-template-columns: repeat(auto-fit, minmax(110px, 110px));
  }

  .leaderboard-head,
  .leaderboard-toolbar {
    display: grid;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .field-shell {
    min-height: clamp(500px, calc(100vh - 260px), 1100px);
    height: auto;
  }

  .stream-topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .tower-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

:root {
  --ink: #edf2f7;
  --muted: #8ea0b3;
  --gold: #64b5f6;
  --accent: #64b5f6;
  --accent-strong: #90caf9;
  --accent-soft: rgba(100, 181, 246, 0.18);
  --mint: #66bb6a;
  --rose: #ef5350;
  --page-bg: #101010;
  --panel-border: transparent;
  --field-border: transparent;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

html {
  color-scheme: dark;
}

body,
button {
  font-family: 'Space Grotesk', sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page-bg);
  overflow-x: hidden;
  overflow-y: auto;
}

.page-shell {
  width: 100vw;
  max-width: none;
  margin: 0;
  min-height: calc(100dvh - 20px + 90px);
}

.streamlined-panel {
  min-height: calc(100dvh - 20px + 90px);
  height: auto;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  padding: 0;
  border-radius: 0;
}

.game-panel,
.leaderboard-panel,
.mini-stat,
.tower-btn,
button,
.field-shell,
#game {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.game-panel {
  background: transparent;
}

.stream-topbar,
.stream-footer,
.leaderboard-head,
.leaderboard-toolbar {
  gap: 8px;
}

.stream-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 4px;
  align-content: start;
  width: 100%;
  margin-inline: 0;
}

.stream-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(60px, max-content));
  gap: 6px;
  justify-content: start;
}

#creepStat.is-expanded {
  grid-column: span 2;
}

.mini-stat {
  min-height: 40px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--accent) 30%, #24303b);
}

.mini-stat-button {
  padding: 8px 10px;
}

.stream-actions button,
.speed-buttons button {
  min-height: 46px;
  height: 46px;
  padding: 9px 14px;
}

@media (max-width: 760px) {
  .stream-actions button,
  .speed-buttons button {
    min-height: 36px;
    height: 36px;
    padding: 6px 10px;
  }
}

.mini-stat-label,
.leaderboard-rank {
  color: #8ea0b3;
}

.mini-stat-value,
.leaderboard-title {
  color: #edf2f7;
}

.leaderboard-title {
  font-family: 'Sora', sans-serif;
  letter-spacing: 0.02em;
}

button {
  width: auto;
  padding: 9px 14px;
  min-height: 40px;
  color: #dfe7ef;
  background: color-mix(in srgb, var(--accent) 30%, #24303b);
  font-weight: 600;
  transition: background-color 120ms ease, color 120ms ease;
}

button:hover,
.mini-stat-button:hover {
  transform: none;
  background: color-mix(in srgb, var(--accent) 26%, #2b3946);
  box-shadow: none;
}

.speed-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.tower-btn.active {
  background: color-mix(in srgb, var(--tower-accent, var(--accent)) 38%, #10161e);
  box-shadow: none;
}

.tower-btn.is-level-disabled {
  opacity: 0.42;
  filter: grayscale(0.9);
}

.tower-btn {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0;
  width: auto;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: color-mix(in srgb, var(--tower-accent, var(--accent)) 18%, #f7fbff);
  background: color-mix(in srgb, var(--tower-accent, var(--accent)) 24%, #121923);
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.tower-btn::before {
  content: none;
}

.tower-btn:hover {
  background: color-mix(in srgb, var(--tower-accent, var(--accent)) 30%, #151e28);
  box-shadow: none;
}

.field-shell {
  padding: 0;
  background: transparent;
  min-height: 0;
  height: auto;
  align-content: start;
  gap: 4px;
}

.tower-strip {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 100px));
  gap: 8px;
  width: max-content;
  max-width: 100%;
  justify-content: center;
  justify-self: center;
  align-items: start;
}

.tower-btn-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 5px 11px 8px;
  min-height: 52px;
  min-width: 0;
  font-family: 'Sora', sans-serif;
}

.tower-name-row {
  min-width: 0;
  white-space: nowrap;
  margin-bottom: 10px;
}

.tower-name {
  flex: 0 0 auto;
  color: var(--tower-accent, var(--accent));
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.tower-card-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
  white-space: nowrap;
}

.tower-card-stat-value {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  justify-self: start;
  text-align: left;
  color: color-mix(in srgb, var(--tower-accent, var(--accent)) 84%, #dfe7ef);
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variant-numeric: proportional-nums;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tower-card-stat-number {
  color: var(--tower-accent, var(--accent));
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
}

.tower-card-stat-unit {
  color: var(--tower-accent, var(--accent));
  font-family: inherit;
  font-size: 7px;
  font-weight: 700;
  font-variant-numeric: normal;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.tower-card-stat-unit-g {
  font-size: 10px;
}

.tower-card-stat-value.is-secondary {
  justify-self: end;
  text-align: right;
  color: color-mix(in srgb, var(--tower-accent, var(--accent)) 42%, #8ea0b3);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .tower-strip {
    grid-template-columns: repeat(auto-fit, minmax(100px, 100px));
  }

  .tower-btn-content {
    gap: 4px;
    padding: 5px 9px 7px;
    min-height: 48px;
  }

  .tower-name {
    font-size: 13px;
  }

  .tower-card-stat-value {
    font-size: 11px;
  }

  .tower-card-stat-number {
    font-size: 16px;
  }

  .tower-card-stat-value.is-secondary {
    font-size: 10px;
  }

  .tower-card-stat-unit {
    font-size: 9px;
  }
}

.leaderboard-panel {
  padding: 0;
  background: transparent;
  margin-top: 12px;
  min-height: 500px;
  overflow: auto;
  max-width: 520px;
  width: fit-content;
  margin-inline: auto;
}

.leaderboard-head {
  align-items: center;
  margin-bottom: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.leaderboard-toolbar {
  margin-bottom: 6px;
}

.leaderboard-tabs {
  margin-bottom: 8px;
  justify-content: center;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.leaderboard-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}

.leaderboard-columns {
  display: none;
}

  .leaderboard-list {
    gap: 0;
  }

.leaderboard-entry {
  padding: 10px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.leaderboard-entry:last-child {
  border-bottom: 0;
}

@media (max-width: 760px) {
  .leaderboard-panel {
    min-height: 220px;
    width: calc(100% - 24px);
    max-width: none;
    margin-inline: auto;
  }

  .page-shell {
    width: 100vw;
    max-width: none;
    margin: 0;
  }

  .streamlined-panel {
    min-height: auto;
    height: auto;
  }

  .stream-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .stream-topbar,
  .stream-footer,
  .leaderboard-head,
  .leaderboard-toolbar {
    display: grid;
  }

  .leaderboard-head,
  .leaderboard-toolbar {
    justify-content: stretch;
  }

  .leaderboard-tabs {
    justify-content: center;
  }

  .leaderboard-tab {
    gap: 5px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .leaderboard-tab-icon {
    width: 12px;
    height: 12px;
  }

  .leaderboard-entry,
  .leaderboard-entry[data-layout="popular"],
  .leaderboard-entry[data-layout="global"] {
    gap: 6px;
    padding: 10px 6px;
  }

  .leaderboard-entry {
    grid-template-columns: max-content minmax(0, 1fr) 58px 82px;
  }

  .leaderboard-entry[data-layout="global"] {
    grid-template-columns: max-content minmax(0, 1fr) 64px;
  }

  .leaderboard-columns[data-layout="popular"],
  .leaderboard-entry[data-layout="popular"] {
    grid-template-columns: max-content minmax(0, 0.9fr) minmax(0, 0.8fr) 58px 82px 44px;
  }

  .leaderboard-columns[data-layout="recent"],
  .leaderboard-entry[data-layout="recent"] {
    grid-template-columns: max-content minmax(0, 0.9fr) minmax(0, 0.8fr) 58px 82px;
  }

  .leaderboard-name,
  .leaderboard-seed {
    font-size: 12px;
  }

  .leaderboard-score {
    font-size: 13px;
    text-align: right;
  }

  .leaderboard-submitted {
    width: 82px;
    font-size: 10px;
    text-align: right;
  }
}
