:root {
  color-scheme: dark;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  background: #080a0f;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080a0f;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
  -webkit-user-select: none;
  user-select: none;
}

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

#game-shell {
  position: relative;
  width: min(100vw, 480px, calc(100dvh * .72));
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  isolation: isolate;
  background: #151827;
  box-shadow: 0 0 80px #000b;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 5;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 38px 1fr 1fr 38px;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}

.home, .round-button, .stat {
  height: 38px;
  border: 1px solid #fff4;
  border-radius: 12px;
  background: #090b12bb;
  box-shadow: inset 0 1px #fff2, 0 4px 14px #0004;
  backdrop-filter: blur(8px);
}

.home, .round-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  font: 900 12px/1 inherit;
  text-decoration: none;
  pointer-events: auto;
}

.round-button { cursor: pointer; }

.stat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 7px;
  padding: 6px 8px;
  color: white;
}

.stat span { font-size: 8px; font-weight: 900; letter-spacing: .14em; opacity: .66; }
.stat strong { font-size: 18px; line-height: 1; }

.floor-callout {
  position: absolute;
  z-index: 6;
  top: 19%;
  left: 50%;
  translate: -50% -8px;
  padding: 10px 16px;
  border: 1px solid #fff5;
  border-radius: 999px;
  color: white;
  background: #05070dd9;
  box-shadow: 0 8px 28px #0008;
  font-weight: 950;
  letter-spacing: .12em;
  opacity: 0;
  transition: opacity .18s, translate .18s;
  pointer-events: none;
}

.floor-callout.show { opacity: 1; translate: -50% 0; }

.first-hint {
  position: absolute;
  z-index: 4;
  top: 23%;
  left: 50%;
  translate: -50% 0;
  width: max-content;
  max-width: 80%;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fff;
  background: #05070d9c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  transition: opacity .35s;
  pointer-events: none;
}

.first-hint.hidden { opacity: 0; }

.overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 24px max(22px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 30%, #4b3171ee, #111522f7 58%, #080a0fff);
  text-align: center;
}

.overlay[hidden] { display: none; }

.start-overlay { align-content: center; }

.tower-mark {
  display: grid;
  align-items: end;
  grid-template-columns: repeat(3, 22px);
  gap: 7px;
  height: 72px;
  margin-bottom: 15px;
}

.tower-mark i {
  display: block;
  height: 36px;
  border: 3px solid #fff;
  border-radius: 11px 11px 3px 3px;
  background: #ff4bb8;
  box-shadow: 0 0 20px #ff4bb8;
}

.tower-mark i:nth-child(2) { height: 70px; background: #5ff5ff; box-shadow: 0 0 20px #5ff5ff; }
.tower-mark i:nth-child(3) { height: 52px; background: #ffe669; box-shadow: 0 0 20px #ffe669; }

.eyebrow {
  margin: 0 0 8px;
  color: #c8c9d4;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .24em;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(46px, 13vw, 68px);
  line-height: .82;
  letter-spacing: -.07em;
  text-shadow: 0 4px #7a2dd0, 0 8px 30px #0008;
}

.start-copy { color: #e8e6f0; font-size: 14px; line-height: 1.55; }

.primary-button, .secondary-button, .text-button {
  width: min(250px, 76vw);
  min-height: 48px;
  border: 0;
  border-radius: 15px;
  font: 900 13px/1 inherit;
  letter-spacing: .08em;
  cursor: pointer;
}

.primary-button {
  margin-top: 5px;
  color: #11131a;
  background: #fff;
  box-shadow: 0 7px 0 #a7a8b2, 0 12px 28px #0007;
}

.primary-button:active { translate: 0 5px; box-shadow: 0 2px 0 #a7a8b2; }

.control-copy, .seed-line {
  margin: 22px 0 0;
  color: #b7b5c2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .11em;
}

.seed-line { margin-top: 12px; opacity: .65; }

.pause-overlay { background: #05070bcb; backdrop-filter: blur(10px); }

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(310px, 88vw);
  padding: 26px 22px;
  border: 1px solid #fff3;
  border-radius: 24px;
  background: #171b28f5;
  box-shadow: 0 25px 70px #000b;
}

.panel h2 { margin: 0 0 15px; font-size: 30px; }
.panel .primary-button { margin-bottom: 12px; }

.secondary-button {
  min-height: 42px;
  margin: 4px 0;
  border: 1px solid #fff3;
  color: white;
  background: #fff1;
}

.text-button { min-height: 38px; color: #ff98ce; background: none; }

.touch-zones {
  position: absolute;
  z-index: 3;
  inset: 58px 0 0;
  display: flex;
}

.touch-zones > div { flex: 1; touch-action: none; }

@media (pointer: coarse) {
  .control-copy::after { content: " — hold either half to flip"; }
}

@media (max-height: 500px) {
  #game-shell { width: min(100vw, calc(100dvh * .72)); }
  .start-copy { margin: 8px 0; }
  .tower-mark { height: 44px; margin-bottom: 8px; }
  .tower-mark i:nth-child(2) { height: 44px; }
  .tower-mark i:nth-child(3) { height: 34px; }
  .tower-mark i { height: 26px; }
  .control-copy { margin-top: 14px; }
}
