:root {
  color-scheme: dark;
  --bg: #0a0f1d;
  --bg-soft: #151d31;
  --panel: #162035;
  --panel-strong: #11192a;
  --line: #35507a;
  --text: #edf6ff;
  --muted: #9fb6d9;
  --accent: #ffd166;
  --accent-strong: #ff8c42;
  --mint: #7bd389;
  --danger: #ff6b6b;
  --shadow: 0 0 0 2px #0b1120, 0 0 0 4px rgba(83, 123, 173, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Courier New", "Lucida Console", monospace;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, #0b1020 0%, #11192b 100%);
  background-size: 14px 14px, 14px 14px, auto;
  color: var(--text);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.sky-glow,
.bubble-field,
.bubble-field::before,
.bubble-field::after {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.sky-glow,
.bubble-field::before,
.bubble-field::after {
  content: "";
  opacity: 0.15;
}

.sky-glow-a {
  background:
    linear-gradient(90deg, transparent 0 25%, rgba(123, 211, 137, 0.18) 25% 30%, transparent 30% 100%);
}

.sky-glow-b {
  background:
    linear-gradient(90deg, transparent 0 72%, rgba(255, 209, 102, 0.16) 72% 77%, transparent 77% 100%);
}

.bubble-field::before {
  background:
    linear-gradient(0deg, transparent 0 85%, rgba(255, 255, 255, 0.08) 85% 100%);
  background-size: 100% 36px;
}

.bubble-field::after {
  background:
    linear-gradient(90deg, transparent 0 85%, rgba(255, 255, 255, 0.05) 85% 100%);
  background-size: 36px 100%;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1460px;
  margin: 0 auto;
  padding: 14px 14px 20px;
}

.topbar,
.headline-strip,
.game-grid {
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 10px;
}

.topbar h1,
.hero-copy h2,
.panel-heading h3 {
  margin: 0;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: clamp(1.28rem, 2vw, 2rem);
  line-height: 1;
  text-shadow: 3px 3px 0 #0b1120;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 0.56rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ghost-button,
.prestige-button,
.venture-buy,
.shop-item,
.snail-button {
  border: 2px solid #0b1120;
  transition:
    transform 120ms steps(2, end),
    background-color 120ms steps(2, end),
    opacity 120ms steps(2, end),
    box-shadow 120ms steps(2, end);
  box-shadow: 0 0 0 2px var(--line);
}

.ghost-button {
  padding: 7px 10px;
  border-radius: 0;
  background: #24314f;
  color: var(--text);
  cursor: pointer;
  font-size: 0.72rem;
}

.ghost-button:hover {
  transform: translate(-2px, -2px);
  background: #304168;
}

.ghost-button.danger {
  background: #5a2635;
  color: #ffd4dc;
}

.headline-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.metric-card,
.hero-panel,
.column-panel,
.subpanel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
}

.metric-card {
  border-radius: 0;
  padding: 8px 10px;
  min-height: 76px;
}

.metric-card strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
}

.mini-toggle {
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 0;
  border: 2px solid #0b1120;
  box-shadow: 0 0 0 2px var(--line);
  background: #24314f;
  color: var(--text);
  cursor: pointer;
  font-size: 0.64rem;
  transition:
    transform 120ms steps(2, end),
    background-color 120ms steps(2, end),
    border-color 120ms steps(2, end);
}

.mini-toggle:hover {
  transform: translate(-1px, -1px);
  background: #304168;
}

.mini-toggle.active {
  background: #335c4c;
  border-color: #0b1120;
}

.metric-label,
.metric-subtle,
.panel-tag,
.venture-meta,
.venture-owned {
  display: block;
}

.metric-label,
.panel-tag,
.venture-owned,
.venture-meta,
.metric-subtle {
  color: var(--muted);
  font-size: 0.66rem;
}

.game-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.95fr;
  gap: 12px;
  align-items: start;
}

.hero-panel,
.column-panel,
.subpanel {
  border-radius: 0;
}

.hero-panel {
  padding: 14px;
  position: sticky;
  top: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto 0 0 auto;
  width: 180px;
  height: 100%;
  background:
    linear-gradient(180deg, transparent 0 30%, rgba(255, 209, 102, 0.08) 30% 34%, transparent 34% 100%);
}

.hero-copy {
  max-width: 24rem;
}

.hero-copy h2 {
  font-size: clamp(1.2rem, 1.6vw, 1.7rem);
  margin-bottom: 6px;
}

.hero-copy p:last-child {
  color: var(--muted);
  line-height: 1.3;
  margin: 0;
  font-size: 0.78rem;
}

.click-stage {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: center;
}

.snail-button {
  position: relative;
  width: min(100%, 248px);
  aspect-ratio: 1 / 0.82;
  background: #0d1526;
  cursor: pointer;
  border-radius: 0;
  transition: transform 90ms steps(2, end), box-shadow 140ms steps(2, end), filter 140ms steps(2, end);
}

.snail-button:hover {
  transform: translate(-3px, -3px);
}

.snail-button:active {
  transform: translate(2px, 2px);
}

.shell-shadow,
.snail-ring,
.snail-body {
  position: absolute;
  inset: 0;
}

.shell-shadow {
  inset: auto 16px 10px 16px;
  height: 16px;
  background: rgba(0, 0, 0, 0.25);
  animation: pulseShadow 1.8s steps(2, end) infinite;
}

.snail-ring {
  inset: 10px;
  border-radius: 0;
  border: 2px dashed rgba(123, 211, 137, 0.35);
  animation: blinkFrame 1.2s steps(2, end) infinite;
}

.snail-button[data-snail-stage="tiny"] {
  box-shadow: inset 0 0 0 2px rgba(123, 211, 137, 0.18);
}

.snail-button[data-snail-stage="shell"] {
  box-shadow: inset 0 0 0 2px rgba(241, 180, 106, 0.18);
}

.snail-button[data-snail-stage="festival"] {
  box-shadow: inset 0 0 0 2px rgba(255, 214, 122, 0.25);
}

.snail-button[data-snail-stage="royal"] {
  box-shadow: inset 0 0 0 2px rgba(255, 207, 92, 0.35);
  filter: saturate(1.05);
}

.snail-button[data-snail-stage="astral"] {
  box-shadow: inset 0 0 0 2px rgba(135, 215, 255, 0.35);
  filter: saturate(1.08);
}

.snail-button[data-snail-stage="crown"] {
  box-shadow: inset 0 0 0 2px rgba(255, 242, 168, 0.4);
  filter: saturate(1.12);
}

.snail-button[data-snail-stage="royal"] .snail-ring,
.snail-button[data-snail-stage="crown"] .snail-ring {
  border-color: rgba(255, 207, 92, 0.45);
}

.snail-button[data-snail-stage="astral"] .snail-ring {
  border-color: rgba(135, 215, 255, 0.45);
}

.snail-button[data-snail-stage="crown"] .shell-shadow {
  background: rgba(255, 207, 92, 0.16);
}

.snail-body svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  animation: floaty 1.2s steps(2, end) infinite;
}

.click-burst-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.coin-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 6px 8px;
  border-radius: 0;
  background: #24314f;
  border: 2px solid var(--accent);
  color: #fff2a8;
  font-weight: 800;
  transform: translate(-50%, -50%);
  animation: burstUp 700ms steps(6, end) forwards;
  white-space: nowrap;
}

.hero-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.hero-footer > div {
  padding: 7px 8px;
  background: #1b2842;
  border-radius: 0;
  border: 2px solid rgba(83, 123, 173, 0.5);
}

.column-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.right-stack {
  display: grid;
  gap: 12px;
}

.subpanel {
  padding: 12px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}

.venture-toolbar {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 4px;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 4px;
}

.bulk-buy-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bulk-buy-button {
  padding: 4px 8px;
  border: 2px solid #0b1120;
  box-shadow: 0 0 0 2px var(--line);
  background: #24314f;
  color: var(--text);
  border-radius: 0;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.66rem;
}

.bulk-buy-button.active {
  background: #335c4c;
  box-shadow: 0 0 0 2px var(--mint);
}

.bulk-buy-button.attention {
  background: #5a4a1f;
  color: #fff2a8;
  box-shadow: 0 0 0 2px var(--accent);
}

.panel-heading h3 {
  font-size: 1.08rem;
}

.venture-list,
.stack-list,
.achievement-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.venture-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 720px;
}

.stack-list {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  max-height: 360px;
}

.achievement-list {
  max-height: 316px;
  overflow-y: auto;
  padding-right: 4px;
}

.venture-list::-webkit-scrollbar,
.stack-list::-webkit-scrollbar,
.achievement-list::-webkit-scrollbar {
  width: 10px;
}

.venture-list::-webkit-scrollbar-track,
.stack-list::-webkit-scrollbar-track,
.achievement-list::-webkit-scrollbar-track {
  background: #10182c;
  border: 2px solid #0b1120;
}

.venture-list::-webkit-scrollbar-thumb,
.stack-list::-webkit-scrollbar-thumb,
.achievement-list::-webkit-scrollbar-thumb {
  background: #35507a;
  border: 2px solid #0b1120;
}

.venture-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 102px;
  padding: 12px;
  border-radius: 0;
  background: #1a2740;
  border: 2px solid rgba(83, 123, 173, 0.5);
}

.venture-card.locked,
.shop-item.locked,
.achievement-card.locked {
  opacity: 0.48;
}

.venture-icon {
  width: 56px;
  height: 56px;
  border-radius: 0;
  background:
    linear-gradient(0deg, #26435a 0 20%, transparent 20% 100%),
    linear-gradient(90deg, transparent 0 20%, rgba(255, 255, 255, 0.06) 20% 24%, transparent 24% 100%),
    #10182c;
  position: relative;
  overflow: hidden;
  border: 2px solid #0b1120;
}

.venture-icon::before,
.venture-icon::after {
  content: "";
  position: absolute;
}

.venture-icon::before {
  inset: 14px 14px 18px 16px;
  background: #f1b46a;
}

.venture-icon::after {
  inset: 30px 8px 10px 12px;
  background: #7bd389;
}

.venture-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 4px;
}

.venture-header h4,
.shop-name,
.achievement-name {
  margin: 0;
  font-size: 0.84rem;
}

.venture-description,
.shop-description,
.achievement-description,
.prestige-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.25;
  font-size: 0.76rem;
}

.venture-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.venture-bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.venture-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--mint));
  transition: width 140ms linear;
}

.venture-buy,
.prestige-button {
  cursor: pointer;
  border-radius: 0;
  padding: 8px 10px;
  background: #314668;
  color: var(--text);
  font-weight: 800;
  font-size: 0.72rem;
}

.venture-buy:hover,
.prestige-button:hover,
.shop-item:hover {
  transform: translate(-2px, -2px);
  box-shadow: 0 0 0 2px #0b1120, 0 0 0 4px var(--accent);
}

.venture-buy:disabled,
.prestige-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.shop-item {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: 0;
  background: #1a2740;
  color: var(--text);
  cursor: pointer;
}

.shop-cost {
  flex: none;
  color: #ffe6ae;
  font-weight: 800;
}

.achievement-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 0;
  background: #1a2740;
  border: 2px solid rgba(83, 123, 173, 0.5);
}

.achievement-card.unlocked {
  background: #243a2e;
  border-color: var(--mint);
}

.achievement-seal {
  width: 46px;
  height: 46px;
  border-radius: 0;
  background:
    linear-gradient(90deg, transparent 0 72%, rgba(255, 255, 255, 0.1) 72% 100%),
    linear-gradient(0deg, #ffcf5c 0 28%, #f08b4f 28% 100%);
  box-shadow: inset 0 0 0 2px #0b1120;
}

.prestige-panel {
  background:
    linear-gradient(90deg, transparent 0 82%, rgba(255, 209, 102, 0.1) 82% 100%),
    var(--panel-strong);
}

.hero-prestige-panel {
  margin-top: 6px;
}

.prestige-copy {
  margin-bottom: 10px;
}

.prestige-button {
  width: 100%;
}

.achievement-notifications {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 28px));
  pointer-events: none;
}

.achievement-toast {
  background: #243a2e;
  border: 2px solid var(--mint);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  color: var(--text);
  animation: achievementToastIn 180ms steps(3, end);
}

.achievement-toast strong,
.achievement-toast span {
  display: block;
}

.achievement-toast strong {
  font-size: 0.84rem;
  margin-bottom: 4px;
}

.achievement-toast span {
  font-size: 0.7rem;
  color: #d7f6de;
  line-height: 1.3;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes pulseShadow {
  0%,
  100% {
    transform: scaleX(0.9);
    opacity: 0.5;
  }
  50% {
    transform: scaleX(1);
    opacity: 0.75;
  }
}

@keyframes blinkFrame {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes burstUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--offset-x)), calc(-100% + var(--offset-y)));
  }
}

@keyframes achievementToastIn {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .hero-panel {
    position: relative;
    top: auto;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px 12px 22px;
  }

  .topbar,
  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .venture-toolbar {
    align-items: start;
  }

  .panel-actions {
    align-items: start;
  }

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

  .hero-panel,
  .column-panel,
  .subpanel {
    border-radius: 0;
  }

  .click-stage {
    min-height: 220px;
  }

  .venture-card {
    grid-template-columns: 56px 1fr;
  }

  .venture-buy {
    grid-column: span 2;
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 580px) {
  .headline-strip,
  .hero-footer {
    grid-template-columns: 1fr;
  }
}
