:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1020;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

html,
body,
#gameRoot {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  background: #0b1020;
  touch-action: none;
  user-select: none;
}

#gameRoot {
  position: relative;
  isolation: isolate;
}

#gameCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
  background: #0b1020;
}

#hud {
  position: fixed;
  z-index: 3;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand-lockup,
.meter {
  border: 1px solid rgba(34, 211, 238, 0.48);
  background: rgba(5, 8, 22, 0.78);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(250, 204, 21, 0.1);
  backdrop-filter: blur(8px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(590px, 48vw);
  padding: 12px 16px;
  border-radius: 8px;
}

.mark {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #102a43;
  border: 2px solid #22d3ee;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.28), 0 0 22px rgba(34, 211, 238, 0.34);
}

.mark::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 8px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 18px 0 -4px #fb923c;
}

.mark::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  height: 4px;
  border-radius: 99px;
  background: #facc15;
}

h1,
h2,
p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: clamp(1.14rem, 2vw, 1.92rem);
  line-height: 1;
  letter-spacing: 0;
}

.brand-lockup p {
  margin-top: 5px;
  color: rgba(248, 250, 252, 0.84);
  font-weight: 760;
  line-height: 1.25;
}

.meter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 10px;
  min-width: min(520px, 52vw);
}

.meter {
  position: relative;
  min-height: 56px;
  padding: 9px 12px 13px;
  border-radius: 8px;
  overflow: hidden;
}

.meter span {
  display: block;
  color: rgba(248, 250, 252, 0.72);
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.meter b {
  display: block;
  margin-top: 3px;
  color: #f8fafc;
  font-size: 1.3rem;
  line-height: 1.05;
}

.meter i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  width: var(--fill, 100%);
  background: #22d3ee;
}

.meter.score i {
  background: #facc15;
}

.meter.balls i {
  background: #34d399;
}

.meter.locks i {
  background: #fb7185;
}

.meter.multi i {
  background: #8b5cf6;
}

#touchControls {
  position: fixed;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.flipper-button,
.launch-button,
.nudge-button,
#modalPrimary {
  border: 0;
  border-radius: 8px;
  min-width: 128px;
  min-height: 64px;
  color: #050816;
  font: inherit;
  font-weight: 950;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.3), inset 0 -4px 0 rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.36);
}

.flipper-button {
  background: linear-gradient(180deg, #fed7aa, #fb923c);
}

.launch-button {
  background: linear-gradient(180deg, #fde68a, #facc15);
}

.nudge-button {
  background: linear-gradient(180deg, #a7f3d0, #34d399);
}

.flipper-button:active,
.launch-button:active,
.nudge-button:active,
#modalPrimary:active {
  transform: translateY(5px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.32), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

#modal {
  position: fixed;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(34, 211, 238, 0.18), rgba(11, 16, 32, 0.74) 46%, rgba(11, 16, 32, 0.94));
}

#modal.hidden {
  display: none;
}

.modal-frame {
  width: min(600px, calc(100vw - 36px));
  border: 2px solid rgba(250, 204, 21, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 42, 67, 0.98), rgba(5, 8, 22, 0.98));
  padding: 22px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5), 0 0 38px rgba(34, 211, 238, 0.22);
}

.titleplate {
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-areas: "icon eyebrow" "icon title";
  gap: 2px 14px;
  align-items: center;
}

.cabinet-emblem {
  grid-area: icon;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #102a43;
  border: 2px solid #22d3ee;
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.28), 0 0 22px rgba(34, 211, 238, 0.36);
}

.titleplate p {
  color: #22d3ee;
  font-weight: 950;
  text-transform: uppercase;
}

.titleplate h2 {
  color: #f8fafc;
  font-size: clamp(2rem, 5vw, 3.65rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.brief {
  margin-top: 18px;
  color: rgba(248, 250, 252, 0.86);
  font-size: 1.04rem;
  font-weight: 750;
  line-height: 1.45;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0 22px;
}

.brief-grid span {
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 8px;
  padding: 10px 8px;
  color: #facc15;
  background: rgba(5, 8, 22, 0.72);
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
}

#modalPrimary {
  width: 100%;
  background: linear-gradient(180deg, #facc15, #fb923c);
  font-size: 1.04rem;
}

@media (max-width: 820px) {
  #hud {
    gap: 8px;
    align-items: stretch;
  }

  .brand-lockup {
    max-width: 49vw;
    padding: 9px;
  }

  .mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .mark::before {
    left: 9px;
    top: 6px;
    width: 15px;
    height: 15px;
    box-shadow: 0 13px 0 -3px #fb923c;
  }

  .mark::after {
    left: 7px;
    right: 7px;
    bottom: 6px;
  }

  .brand-lockup h1 {
    font-size: 1rem;
  }

  .brand-lockup p {
    display: none;
  }

  .meter-row {
    grid-template-columns: repeat(2, minmax(74px, 1fr));
    min-width: 45vw;
    gap: 7px;
  }

  .meter {
    min-height: 48px;
    padding: 8px 9px 12px;
  }

  .meter b {
    font-size: 1.04rem;
  }

  #touchControls {
    display: grid;
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    padding: 0 10px;
    gap: 7px;
  }

  .flipper-button,
  .launch-button,
  .nudge-button {
    min-width: 0;
    min-height: 58px;
    font-size: 0.72rem;
    padding: 0 4px;
  }
}
