:root {
  --navy: #0b1f4b;
  --navy-muted: #5a6b8a;
  --orange: #ff8c42;
  --pink: #e84393;
  --gradient-brand: linear-gradient(135deg, var(--orange) 0%, #ff6b6b 48%, var(--pink) 100%);
  --bg: #ffffff;
  --surface: #f4f6fb;
  --surface-elevated: #ffffff;
  --text: var(--navy);
  --muted: var(--navy-muted);
  --border: rgba(11, 31, 75, 0.1);
  --gold: #f5c542;
  --silver: #b8c4d4;
  --bronze: #d4956a;
  --danger: #dc2626;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tap-min: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 24px);
  line-height: 1.45;
}

.app-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 22%;
  box-shadow: 0 12px 32px rgba(11, 31, 75, 0.12);
}

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  text-align: center;
  letter-spacing: -0.03em;
  color: var(--navy);
}

.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 8px;
}

.attempts-badge {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 4px;
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-block;
  width: 100%;
  background: var(--surface);
  color: var(--navy);
}

.stopwatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 28px 0 20px;
}

.stopwatch-ring {
  position: relative;
  padding: 8px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 8px 40px rgba(11, 31, 75, 0.08);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.stopwatch-ring.is-running {
  background: linear-gradient(var(--bg), var(--bg)) padding-box,
    var(--gradient-brand) border-box;
  border: 3px solid transparent;
  box-shadow: 0 12px 48px rgba(232, 67, 147, 0.2);
  animation: pulse-ring 1.8s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.stopwatch {
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 22vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--navy);
  padding: 16px 24px;
  min-width: 200px;
  text-align: center;
  transition: color 0.2s ease;
}

.stopwatch-ring.is-running .stopwatch {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.goal-hint {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.btn-primary {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  min-height: var(--tap-min);
  border: none;
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(232, 67, 147, 0.28);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-primary:active {
  filter: brightness(0.95);
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  min-height: var(--tap-min);
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--navy);
  font-size: 1rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.result-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
  border: 1px solid var(--border);
}

.result-card .big {
  font-size: 2.25rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 8px 0;
}

.best-today {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 8px;
}

.row-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

section {
  margin-top: 32px;
}

section h2 {
  font-size: 0.78rem;
  margin: 0 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
}

.leaderboard .lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
  border-radius: 14px;
  margin-bottom: 8px;
  min-height: var(--tap-min);
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.leaderboard .podium-gold {
  background: linear-gradient(90deg, rgba(245, 197, 66, 0.2), var(--surface));
  border-color: rgba(245, 197, 66, 0.45);
}

.leaderboard .podium-silver {
  background: linear-gradient(90deg, rgba(184, 196, 212, 0.35), var(--surface));
  border-color: rgba(184, 196, 212, 0.6);
}

.leaderboard .podium-bronze {
  background: linear-gradient(90deg, rgba(212, 149, 106, 0.25), var(--surface));
  border-color: rgba(212, 149, 106, 0.45);
}

.leaderboard .lb-self {
  border-style: dashed;
  border-color: var(--pink);
}

.leaderboard .lb-separator {
  text-align: center;
  color: var(--muted);
  padding: 4px;
  background: none;
  border: none;
}

.leaderboard .lb-empty {
  color: var(--muted);
  padding: 12px 0;
  background: none;
  border: none;
}

.leaderboard .rank {
  font-weight: 800;
  width: 2rem;
  font-size: 1.1rem;
}

.podium-gold .rank {
  color: #b8860b;
}

.podium-silver .rank {
  color: #708090;
}

.podium-bronze .rank {
  color: #a0622e;
}

.leaderboard .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.leaderboard .name small {
  font-weight: 500;
  color: var(--pink);
}

.leaderboard .score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.leaderboard .diff {
  color: var(--muted);
  font-weight: 500;
}

.friend-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.friend-row input {
  flex: 1;
  min-height: var(--tap-min);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 75, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface-elevated);
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 64px rgba(11, 31, 75, 0.18);
}

.modal h2 {
  margin: 0 0 8px;
  color: var(--navy);
}

.modal label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.modal input {
  width: 100%;
  min-height: var(--tap-min);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
  margin-bottom: 16px;
}

.modal .hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -4px 0 16px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 200;
  max-width: 90vw;
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin: 0;
}

.turnstile-wrap:has(iframe[style*="visibility: visible"]),
.turnstile-wrap:has(iframe:not([style*="visibility: hidden"])) {
  margin: 12px 0;
}

.profile-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  gap: 8px;
}

.profile-bar code {
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 800;
}

.logout-row {
  text-align: center;
  margin-top: 40px;
  padding-bottom: var(--safe-bottom);
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px;
}

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  color: inherit;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
}
.icon-btn:active { background: rgba(0, 0, 0, 0.06); }
.modal { position: relative; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: inherit;
  cursor: pointer;
}
.my-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 4px 0 18px;
  padding: 14px;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  border-radius: 14px;
  background: none;
  cursor: pointer;
  color: inherit;
}
.my-code code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* compact layout */
body { padding-top: calc(var(--safe-top) + 8px); padding-bottom: calc(var(--safe-bottom) + 12px); }
.app-logo { width: 48px; height: 48px; margin: 0 auto 6px; }
h1 { font-size: 1.3rem; margin: 0 0 2px; }
.subtitle { font-size: 0.82rem; margin: 0 0 6px; }
.profile-bar { margin-bottom: 4px; align-items: center; }
.stopwatch-wrap { margin: 12px 0 10px; }
.stopwatch { font-size: clamp(3.4rem, 18vw, 4.6rem); padding: 10px 20px; }
.goal-hint { margin: 6px 0 0; }
.result-card { padding: 14px; margin: 12px 0; }
.result-card .big { font-size: 1.9rem; }
section { margin-top: 16px; }
.lb-tabs { display: flex; gap: 6px; margin-bottom: 10px; background: rgba(0,0,0,0.05); padding: 4px; border-radius: 12px; }
.lb-tab { flex: 1; border: none; background: none; padding: 8px 4px; border-radius: 9px; font-size: 0.8rem; font-weight: 700; color: inherit; opacity: 0.6; cursor: pointer; }
.lb-tab.active { background: #fff; opacity: 1; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.leaderboard .lb-row { padding: 8px 12px; margin-bottom: 6px; min-height: 0; }
.logout-row { margin-top: 16px; }

.profile-bar { display: flex; justify-content: space-between; align-items: center; margin: 0 0 6px; }
#player-nick { font-weight: 700; font-size: 0.95rem; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.settings-wrap { position: relative; }
.settings-menu { position: absolute; right: 0; top: 100%; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.15); padding: 4px; z-index: 50; white-space: nowrap; }
.settings-menu .btn-link { padding: 10px 14px; font-size: 0.95rem; color: var(--danger, #d33); }

/* big red stopwatch button */
.btn-red {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 128px;
  height: 128px;
  margin: 6px auto 4px;
  border-radius: 50%;
  border: 6px solid #fff;
  background: radial-gradient(circle at 35% 30%, #ff6b6b, #e11d2a 60%, #b3121d);
  box-shadow: 0 0 0 3px #e11d2a33, 0 10px 24px rgba(225, 29, 42, 0.35);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-red:active { transform: scale(0.94); box-shadow: 0 0 0 3px #e11d2a33, 0 4px 10px rgba(225, 29, 42, 0.35); }
.btn-red:disabled { background: #c9ccd3; box-shadow: none; color: #fff; cursor: default; font-size: 0.9rem; }

/* physical push button */
.btn-red {
  position: relative;
  border: none;
  width: 136px;
  height: 136px;
  margin: 10px auto 18px;
  background: radial-gradient(circle at 40% 30%, #ff7a7a 0%, #ef2b36 45%, #c4121e 100%);
  box-shadow:
    0 12px 0 #8e0b14,
    0 0 0 10px #2b2f3a,
    0 0 0 13px #555b6a,
    0 22px 26px 10px rgba(0, 0, 0, 0.28),
    inset 0 -6px 10px rgba(0, 0, 0, 0.25),
    inset 0 6px 10px rgba(255, 255, 255, 0.35);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.35);
  transform: translateY(0);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
}
.btn-red:active,
.btn-red.pressed {
  transform: translateY(10px);
  box-shadow:
    0 2px 0 #8e0b14,
    0 0 0 10px #2b2f3a,
    0 0 0 13px #555b6a,
    0 8px 12px 6px rgba(0, 0, 0, 0.22),
    inset 0 -3px 8px rgba(0, 0, 0, 0.3),
    inset 0 4px 8px rgba(255, 255, 255, 0.25);
}
.btn-red.latched:not(.pressed) {
  transform: translateY(5px);
  box-shadow:
    0 7px 0 #8e0b14,
    0 0 0 10px #2b2f3a,
    0 0 0 13px #555b6a,
    0 14px 18px 8px rgba(0, 0, 0, 0.25),
    inset 0 -4px 9px rgba(0, 0, 0, 0.28),
    inset 0 5px 9px rgba(255, 255, 255, 0.3);
}
.btn-red:disabled {
  background: radial-gradient(circle at 40% 30%, #e3e5ea, #b9bdc6);
  box-shadow: 0 12px 0 #8d929d, 0 0 0 10px #2b2f3a, 0 0 0 13px #555b6a;
  transform: none;
}

/* settings menu */
.settings-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  padding: 6px;
  z-index: 50;
  transform-origin: top right;
  animation: menu-in 0.14s ease-out;
}
.settings-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid rgba(15, 23, 42, 0.06);
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  transform: rotate(45deg);
}
@keyframes menu-in {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.menu-head {
  display: flex;
  flex-direction: column;
  padding: 10px 12px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 4px;
}
.menu-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.55; }
.menu-nick { font-weight: 800; font-size: 1rem; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.menu-item:active { background: rgba(15, 23, 42, 0.05); }
.menu-item.danger { color: #e11d2a; }
.menu-item.danger:active { background: rgba(225, 29, 42, 0.08); }

/* ===== realistic push button v2 ===== */
.push-housing {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}
.push-bezel {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(from 210deg, #f4f5f7, #9aa1ad, #e9ebef, #7d8491, #f4f5f7, #a7adb8, #f4f5f7);
  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.28),
    0 3px 6px rgba(15, 23, 42, 0.18),
    inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -2px 3px rgba(0, 0, 0, 0.25);
}
.push-bezel::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2a2e37, #0d0f14 70%);
  box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.7);
}
.push-housing .btn-red {
  position: relative;
  z-index: 1;
  width: 126px;
  height: 126px;
  margin: 0;
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-shadow: 0 -1px 1px rgba(90, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.15);
  background:
    radial-gradient(ellipse 55% 38% at 50% 22%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 50% 60%, #ff3b47 0%, #e0121f 55%, #9c0611 100%);
  box-shadow:
    0 10px 0 #7a0710,
    0 12px 2px rgba(0, 0, 0, 0.55),
    0 16px 22px rgba(0, 0, 0, 0.45),
    inset 0 -8px 14px rgba(80, 0, 0, 0.45),
    inset 0 3px 3px rgba(255, 255, 255, 0.35);
  transform: translateY(-8px);
  transition: transform 0.05s ease-out, box-shadow 0.05s ease-out, filter 0.2s;
}
.push-housing .btn-red:active,
.push-housing .btn-red.pressed {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 #7a0710,
    0 2px 1px rgba(0, 0, 0, 0.6),
    0 3px 6px rgba(0, 0, 0, 0.4),
    inset 0 -4px 10px rgba(80, 0, 0, 0.55),
    inset 0 4px 10px rgba(0, 0, 0, 0.25);
  filter: brightness(0.92);
}
.push-housing .btn-red.latched:not(.pressed) {
  transform: translateY(-3px);
  box-shadow:
    0 5px 0 #7a0710,
    0 6px 2px rgba(0, 0, 0, 0.55),
    0 9px 14px rgba(0, 0, 0, 0.45),
    inset 0 -6px 12px rgba(80, 0, 0, 0.5),
    inset 0 3px 3px rgba(255, 255, 255, 0.3),
    0 0 26px 6px rgba(255, 40, 50, 0.55);
  animation: btn-glow 1s ease-in-out infinite alternate;
}
@keyframes btn-glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.18); }
}
.push-housing .btn-red:disabled {
  background:
    radial-gradient(ellipse 55% 38% at 50% 22%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 70%),
    radial-gradient(circle at 50% 60%, #d5d8de, #a9aeb8 60%, #7f8591);
  box-shadow: 0 6px 0 #6b707b, 0 9px 12px rgba(0, 0, 0, 0.35), inset 0 -6px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-5px);
  font-size: 0.8rem;
  animation: none;
  cursor: default;
}

/* ===== result tiers ===== */
.stopwatch-wrap { position: relative; }
.tier-banner {
  margin-top: 8px;
  font-weight: 900;
  font-size: 1.15rem;
  animation: banner-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes banner-pop {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.tier-banner.tier-perfect { color: #d4a000; font-size: 1.5rem; text-shadow: 0 0 18px rgba(255, 200, 0, 0.6); }
.tier-banner.tier-amazing { color: #ea580c; }
.tier-banner.tier-great { color: #16a34a; }
.tier-banner.tier-good { color: #ca8a04; }
.tier-banner.tier-meh { color: #64748b; }
.tier-banner.tier-bad { color: #e11d2a; }

.stopwatch-ring.tier-perfect { animation: ring-perfect 1.2s ease-in-out 3; box-shadow: 0 0 0 4px #ffd700, 0 0 40px 12px rgba(255, 215, 0, 0.6); }
.stopwatch-ring.tier-perfect .stopwatch { color: #c99700; }
@keyframes ring-perfect {
  0%, 100% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.12) rotate(-3deg); }
  50% { transform: scale(1.04) rotate(3deg); }
  75% { transform: scale(1.1) rotate(-2deg); }
}
.stopwatch-ring.tier-amazing { animation: ring-bounce 0.6s ease 2; box-shadow: 0 0 0 3px #fb923c, 0 0 30px 8px rgba(251, 146, 60, 0.5); }
.stopwatch-ring.tier-amazing .stopwatch { color: #ea580c; }
.stopwatch-ring.tier-great { animation: ring-bounce 0.6s ease 1; box-shadow: 0 0 0 3px #4ade80, 0 0 22px 4px rgba(74, 222, 128, 0.45); }
.stopwatch-ring.tier-great .stopwatch { color: #16a34a; }
@keyframes ring-bounce {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.1); }
  70% { transform: scale(0.97); }
}
.stopwatch-ring.tier-good { animation: ring-wobble 0.6s ease 1; }
.stopwatch-ring.tier-good .stopwatch { color: #ca8a04; }
@keyframes ring-wobble {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-4deg); }
  75% { transform: rotate(4deg); }
}
.stopwatch-ring.tier-meh { animation: ring-sink 0.7s ease both; }
.stopwatch-ring.tier-meh .stopwatch { color: #64748b; }
@keyframes ring-sink {
  0% { transform: translateY(0); }
  50% { transform: translateY(6px) scale(0.96); }
  100% { transform: translateY(0) scale(1); }
}
.stopwatch-ring.tier-bad { animation: ring-shake 0.5s ease 1; }
.stopwatch-ring.tier-bad .stopwatch { color: #e11d2a; }
@keyframes ring-shake {
  0%, 100% { transform: translateX(0); }
  15%, 55% { transform: translateX(-10px); }
  35%, 75% { transform: translateX(10px); }
}
body.tier-bad { animation: flash-red 0.6s ease 1; }
@keyframes flash-red {
  0%, 100% { background-color: #fff; }
  30% { background-color: #ffe4e6; }
}
body.tier-perfect { animation: flash-gold 1.5s ease 1; }
@keyframes flash-gold {
  0%, 100% { background-color: #fff; }
  30% { background-color: #fff7cc; }
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}
.confetti-layer span {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0.9; }
}
