:root {
  --bg-top: #56585c;
  --bg-bot: #2c2d30;
  --panel: #3a3c40;
  --accent: #ffce3a;
  --text: #f4f4f6;
  --pill: rgba(0,0,0,0.28);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-bot);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bot));
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
  gap: 10px;
  flex: 0 0 auto;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 84px;
  background: var(--pill);
  border-radius: 14px;
  padding: 7px 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.stat.right { }
.label { font-size: 10px; letter-spacing: 2px; opacity: 0.55; font-weight: 800; }
.value { font-size: 24px; font-weight: 800; line-height: 1.15; }

.brand {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
  background: var(--pill);
  padding: 6px 16px;
  border-radius: 14px;
}
.brand span { color: var(--accent); }

#game {
  flex: 1 1 auto;
  width: 100%;
  display: block;
  touch-action: none;
}

.combo {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 40px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 4px 18px rgba(0,0,0,0.6);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}
.combo.hidden { opacity: 0; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 4, 24, 0.78);
  backdrop-filter: blur(6px);
  z-index: 10;
  transition: opacity 0.25s;
}
.overlay.hidden { opacity: 0; pointer-events: none; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 32px 26px;
  width: min(86vw, 380px);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.panel h1 {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 14px;
}
.panel p { font-size: 15px; line-height: 1.5; opacity: 0.85; margin-bottom: 22px; }

.ov-scores {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin-bottom: 24px;
}
.ov-scores div { display: flex; flex-direction: column; }
.ov-scores .label { margin-bottom: 4px; }
.ov-scores span:last-child { font-size: 30px; font-weight: 800; }
.hidden { display: none; }
.overlay.hidden { display: flex; }

.btn {
  background: var(--accent);
  color: #2a1650;
  border: none;
  border-radius: 14px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 15px 44px;
  cursor: pointer;
  box-shadow: 0 8px 0 #c79b2c;
  transition: transform 0.05s, box-shadow 0.05s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #c79b2c; }

.btn.install {
  display: block;
  margin: 14px auto 0;
  background: #3fb6ff;
  color: #08233a;
  box-shadow: 0 8px 0 #2c84bd;
  font-size: 17px;
  padding: 13px 30px;
}
.btn.install:active { box-shadow: 0 4px 0 #2c84bd; }

.install-fab {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  background: #3fb6ff;
  color: #08233a;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 9px 15px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  cursor: pointer;
  animation: fabpulse 2.4s ease-in-out infinite;
}
@keyframes fabpulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.06); }
}

.ios-tip {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  transform: translateX(-50%);
  z-index: 11;
  background: #241338;
  background: #2b2d32;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 14px;
  padding: 12px 38px 12px 16px;
  border-radius: 14px;
  width: min(90vw, 340px);
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.ios-tip b { color: var(--accent); }
#ios-tip-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.6;
  cursor: pointer;
  font-size: 16px;
}
