* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #0f1320;
  color: #e7eaf3;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

#topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 4px;
}

.tb-spacer {
  flex: 1;
}

.tb-btn {
  background: #1c2340;
  border: 1px solid #2a3358;
  color: #e7eaf3;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tb-btn:active {
  transform: scale(0.95);
}

.ib-label {
  margin-left: 2px;
}

@media (max-width: 359px) {
  .ib-label {
    display: none;
  }
}

.ios-step {
  font-size: 14px;
  line-height: 1.5;
  color: #c6cbe0;
}

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  min-height: 56px;
}

.hud-box {
  text-align: center;
  min-width: 80px;
}

.hud-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b93b8;
}

.hud-value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#combo-badge {
  background: linear-gradient(135deg, #ffb020, #ff5d6c);
  color: #1a1026;
  font-weight: 900;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s, transform 0.15s;
}

#combo-badge.visible {
  opacity: 1;
  transform: scale(1);
}

#canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

#game-canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
}

#hint {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  background: rgba(10, 13, 25, 0.85);
  border: 1px solid #2a3358;
  border-radius: 14px;
  padding: 14px 20px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
  transition: opacity 0.3s;
}

#hint.hidden {
  opacity: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 20, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(3px);
}

.overlay.hidden {
  display: none;
}

.panel {
  background: #171c30;
  border: 1px solid #2a3358;
  border-radius: 20px;
  padding: 26px 24px;
  width: min(320px, 86vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel h1 {
  font-size: 24px;
}

.record {
  color: #ffe066;
  font-weight: 700;
}

.record.hidden {
  display: none;
}

.go-stats {
  display: flex;
  justify-content: center;
  gap: 36px;
  margin: 6px 0;
}

.go-stats span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.go-stats small {
  color: #8b93b8;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
}

#go-daily-streak {
  color: #8b93b8;
  font-size: 13px;
}

.btn {
  background: #232a49;
  border: 1px solid #33406e;
  color: #e7eaf3;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, #4da3ff, #7c5cff);
  border: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn.hidden,
.hidden {
  display: none;
}

.ad-overlay {
  position: fixed;
  inset: 0;
  background: #05060d;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.ad-label {
  color: #8b93b8;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #232a49;
  border: 1px solid #33406e;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 40;
}

#toast.hidden {
  display: none;
}
