/* Temple Tower — phone-first. Portrait is the design; landscape gets its own HUD. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #140f1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: #f4e9d8;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  width: 100vw;
}

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

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 10;
}

#height-wrap { text-align: center; }

#height {
  font-size: 46px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,.65);
  font-variant-numeric: tabular-nums;
}
#height .unit { font-size: 20px; font-weight: 600; opacity: .75; margin-left: 2px; }

#best {
  font-size: 12px;
  opacity: .55;
  margin-top: 2px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#tier-badge {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(244,233,216,.10);
  border: 1px solid rgba(244,233,216,.18);
  backdrop-filter: blur(8px);
  transition: background .35s, color .35s, border-color .35s;
}
#tier-badge.weight { background: rgba(220,150,60,.22); border-color: rgba(255,190,90,.55); color: #ffd9a0; }
#tier-badge.grip   { background: rgba(90,180,220,.20); border-color: rgba(120,210,255,.55); color: #b6e9ff; }
#tier-badge.both   { background: rgba(210,80,190,.24); border-color: rgba(255,140,240,.6);  color: #ffc2f4; }

#tier-next {
  font-size: 10px;
  opacity: .45;
  margin-top: 5px;
  letter-spacing: .05em;
}

/* ---------- combo + toast ---------- */
#combo {
  position: absolute;
  top: 46%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 26px;
  font-weight: 800;
  color: #ffe08a;
  text-shadow: 0 2px 16px rgba(255,180,60,.5);
  pointer-events: none;
  z-index: 12;
  animation: pop .6s ease-out forwards;
}
@keyframes pop {
  0%   { transform: translate(-50%,-50%) scale(.6); opacity: 0; }
  25%  { transform: translate(-50%,-50%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%,-62%) scale(1); opacity: 0; }
}

#toast {
  position: absolute;
  top: 30%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(20,14,26,.82);
  border: 1px solid rgba(244,233,216,.16);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
  max-width: 80vw;
  pointer-events: none;
  z-index: 12;
  animation: fadein .35s ease-out;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%,-44%); } to { opacity: 1; } }

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px calc(env(safe-area-inset-left,0px) + 24px) calc(env(safe-area-inset-bottom,0px) + 24px);
  background: radial-gradient(120% 80% at 50% 30%, rgba(38,24,44,.72), rgba(14,10,18,.94));
  backdrop-filter: blur(3px);
  z-index: 20;
  text-align: center;
}

.screen h1 {
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 900;
  letter-spacing: .06em;
  background: linear-gradient(180deg, #ffe9c4, #d9a34f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.screen h2 {
  font-size: clamp(20px, 6vw, 28px);
  font-weight: 800;
  letter-spacing: .06em;
  color: #ffb4a0;
}
.tag { font-size: 14px; opacity: .72; margin-bottom: 14px; }

.big-btn {
  min-width: 200px;
  min-height: 56px;
  padding: 16px 34px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .10em;
  color: #1a1220;
  background: linear-gradient(180deg, #ffe0a8, #e0a752);
  border: none;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(224,167,82,.35), inset 0 1px 0 rgba(255,255,255,.5);
  cursor: pointer;
  transition: transform .1s;
}
.big-btn:active { transform: scale(.96); }

.hint { font-size: 12px; opacity: .45; margin-top: 6px; letter-spacing: .08em; }
.best-line { font-size: 13px; opacity: .6; margin-top: 4px; letter-spacing: .05em; }

.score-big {
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  color: #ffe08a;
  text-shadow: 0 4px 26px rgba(255,190,90,.35);
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
}
.score-big .unit { font-size: 26px; opacity: .7; margin-left: 3px; }

#tap-hint {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 42px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  opacity: .5;
  pointer-events: none;
  z-index: 11;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .28; } 50% { opacity: .62; } }

.hidden { display: none !important; }

/* ---------- landscape: its own layout, not a stretched portrait ---------- */
@media (orientation: landscape) and (max-height: 480px) {
  #hud {
    padding: calc(env(safe-area-inset-top,0px) + 6px) calc(env(safe-area-inset-right,0px) + 14px) 0 0;
    align-items: flex-end;
  }
  #height { font-size: 32px; }
  #height .unit { font-size: 15px; }
  #tier-badge { margin-top: 4px; font-size: 9px; padding: 3px 9px; }
  #tier-next { font-size: 9px; }
  .screen h1 { font-size: clamp(22px, 5vw, 32px); }
  .score-big { font-size: 46px; }
  .big-btn { min-height: 48px; padding: 12px 28px; font-size: 16px; min-width: 170px; }
  #tap-hint { bottom: calc(env(safe-area-inset-bottom,0px) + 14px); font-size: 10px; }
}

/* lives: three pips, bottom of the HUD. Filled = left, hollow = spent. */
.lives {
  position: absolute; right: 12px; bottom: 8px;
  font-size: 15px; letter-spacing: 3px; line-height: 1;
  color: #e8d9bf; opacity: .92;
}
.lives.low { color: #ff8a6b; }
