/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reset & Base */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #1a1a2e;
  --bg-mid: #16213e;
  --bg-card: #0f3460;
  --accent: #e94560;
  --accent-glow: #ff6b81;
  --gold: #ffd700;
  --green: #4ecdc4;
  --red: #e74c3c;
  --text: #f0f0f0;
  --text-dim: #8892a8;
  --cup-light: #d94035;
  --cup-mid: #b52620;
  --cup-dark: #8c1a14;
  --ball-light: #ffffff;
  --ball-mid: #e6e6db;
  --ball-dark: #b3b3a6;
  --cup-width: 80px;
  --cup-height: 110px;
  --cup-spacing: 24px;
  --game-area-height: 200px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui,
    sans-serif;
  background:
    radial-gradient(
      ellipse 60% 50% at 20% 15%,
      rgba(233, 69, 96, 0.18) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 40% at 85% 80%,
      rgba(78, 205, 196, 0.14) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 40% 30% at 75% 20%,
      rgba(255, 215, 0, 0.08) 0%,
      transparent 60%
    ),
    linear-gradient(
      180deg,
      var(--bg-dark) 0%,
      var(--bg-mid) 50%,
      var(--bg-dark) 100%
    );
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(
      circle at 25% 25%,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1.5px
    ),
    radial-gradient(
      circle at 75% 75%,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1.5px
    );
  background-size:
    48px 48px,
    72px 72px;
  background-position:
    0 0,
    24px 36px;
  opacity: 0.6;
}

body::after {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      circle 220px at 15% 90%,
      rgba(168, 85, 247, 0.10) 0%,
      transparent 70%
    ),
    radial-gradient(
      circle 180px at 90% 35%,
      rgba(52, 152, 219, 0.10) 0%,
      transparent 70%
    );
  animation: bgDrift 28s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, -1.5%, 0) scale(1.05);
  }
  100% {
    transform: translate3d(-1.5%, 2%, 0) scale(1.02);
  }
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
  position: relative;
  overflow: hidden;
  z-index: 1;
}

/* Header */
header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.sub-row {
  justify-content: center;
  gap: 20px;
}

.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
}

.score-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.score-value {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s ease;
}

.score-value.bump {
  transform: scale(1.3);
}

.score-block.hs-approaching {
  animation: hsPulse 1.5s ease-in-out infinite;
}

.score-block.hs-new .score-value {
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

@keyframes hsPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 4px 14px;
  border: 2px solid var(--accent);
}

.level-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
}

.level-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-glow);
}

.lives {
  display: flex;
  gap: 4px;
  font-size: 20px;
}

.lives .heart {
  transition:
    transform 0.2s ease,
    opacity 0.3s ease;
}

.lives .heart.lost {
  opacity: 0.2;
  transform: scale(0.8);
}

.lives .heart.bounce {
  animation: heartBounce 0.4s ease;
}

@keyframes heartBounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.4);
  }
  60% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.streak {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold);
  min-height: 20px;
}

.streak .flame {
  animation: flamePulse 0.6s ease-in-out infinite alternate;
}

@keyframes flamePulse {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

.round-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim, rgba(255, 255, 255, 0.5));
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Status */
.status-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  margin: 8px 0;
  min-height: 24px;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.status-text.active {
  color: var(--text);
}

/* Points popup */
.points-popup {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 900;
  color: var(--gold);
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.points-popup.show {
  animation: pointsFly 1s ease-out forwards;
}

.points-popup.combo-high {
  font-size: 38px;
  color: #ff6b35;
  text-shadow: 0 2px 12px rgba(255, 107, 53, 0.5);
}

.points-popup.combo-max {
  font-size: 44px;
  color: #ff4500;
  text-shadow:
    0 2px 16px rgba(255, 69, 0, 0.6),
    0 0 30px rgba(255, 69, 0, 0.3);
}

.points-multiplier {
  font-size: 0.6em;
  color: #ff6b35;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: super;
}

.reaction-time-label {
  font-size: 0.35em;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
  font-weight: 400;
}

.points-popup.reaction-lightning {
  color: #ffd700;
  text-shadow:
    0 2px 16px rgba(255, 215, 0, 0.6),
    0 0 30px rgba(255, 215, 0, 0.3);
}

@keyframes pointsFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.8);
  }
}

/* Game Area */
.game-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--cup-spacing);
  height: var(--game-area-height);
  width: 100%;
  position: relative;
  flex-shrink: 0;
  margin: 8px 0;
  padding-bottom: 16px;
}

/* Cup Container */
.cup-container {
  position: relative;
  width: var(--cup-width);
  height: calc(var(--cup-height) + 30px);
  cursor: default;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  z-index: 1;
}

.cup-container.clickable {
  cursor: pointer;
}

.cup-container.clickable:hover .cup-body {
  filter: brightness(1.1);
}

.cup-container.clickable:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 8px;
}

.cup-container.clickable:active .cup-inner {
  transform: scale(0.95);
}

.cup-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

/* Ball */
.ball {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 35%,
    var(--ball-light),
    var(--ball-mid) 60%,
    var(--ball-dark)
  );
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  position: absolute;
  bottom: 4px;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  z-index: 0;
}

.ball.visible {
  opacity: 1;
  transform: scale(1);
}

/* Cup */
.cup {
  position: relative;
  width: var(--cup-width);
  height: var(--cup-height);
  z-index: 1;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cup.lifted {
  transform: translateY(-55px);
}

.cup-body {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  /* Trapezoid shape via clip-path */
  clip-path: polygon(22% 0%, 78% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(
    90deg,
    var(--cup-light) 0%,
    var(--cup-mid) 50%,
    var(--cup-dark) 100%
  );
  border-radius: 0 0 6px 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: filter 0.15s ease;
}

.cup-shine {
  position: absolute;
  left: 0;
  top: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 100%
  );
  pointer-events: none;
}

.cup-rim {
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f04540 0%, #c02520 100%);
  z-index: 2;
}

/* Cup result indicators */
.cup-container.correct .cup-body {
  box-shadow:
    0 0 24px rgba(78, 205, 196, 0.7),
    inset 0 0 12px rgba(78, 205, 196, 0.2);
  filter: brightness(1.15);
}

.cup-container.wrong .cup-body {
  box-shadow:
    0 0 24px rgba(231, 76, 60, 0.7),
    inset 0 0 12px rgba(231, 76, 60, 0.2);
  filter: brightness(0.85);
}

/* Shake animation for wrong guess */
.cup-container.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  15% {
    transform: translateX(-8px);
  }
  30% {
    transform: translateX(7px);
  }
  45% {
    transform: translateX(-5px);
  }
  60% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
}

/* Difficulty Picker */
.difficulty-picker {
  display: flex;
  gap: 6px;
  margin: 8px 0;
  flex-shrink: 0;
}

.diff-btn {
  padding: 8px 14px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-btn:hover {
  background: rgba(15, 52, 96, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}

.diff-btn.selected {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.15);
  color: var(--accent-glow);
}

.diff-description {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  min-height: 18px;
  margin-bottom: 4px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

.difficulty-picker.hidden,
.diff-description.hidden {
  display: none;
}

/* Start Button */
.start-btn {
  padding: 14px 48px;
  border: none;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #c0392b 100%);
  color: white;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(233, 69, 96, 0.6);
}

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

.start-btn.hidden {
  display: none;
}

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

/* Result Overlay */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.result-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.result-card {
  background: var(--bg-mid);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.result-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.result-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-message {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.result-points {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
  min-height: 28px;
}

/* Game Over Stats Summary */
.game-over-stats {
  margin: 8px 0;
}
.game-over-stats.hidden {
  display: none;
}
.go-stats-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.go-stat {
  text-align: center;
  min-width: 52px;
}
.go-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.go-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.new-high-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  animation: glow 1s ease-in-out infinite alternate;
  margin-bottom: 12px;
}

.new-high-score.hidden {
  display: none;
}

.diff-promotion {
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gold);
}

.diff-promotion.hidden {
  display: none;
}

.diff-promotion-btn {
  background: var(--gold);
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

@keyframes glow {
  from {
    text-shadow: 0 0 4px rgba(255, 215, 0, 0.4);
  }
  to {
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.8);
  }
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.continue-btn {
  padding: 12px 32px;
  border: none;
  border-radius: 24px;
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

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

.extra-life-btn {
  padding: 10px 24px;
  border: 2px solid var(--red);
  border-radius: 24px;
  background: transparent;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.extra-life-btn:hover {
  background: rgba(231, 76, 60, 0.15);
}

.extra-life-btn.hidden {
  display: none;
}

.replay-btn {
  padding: 10px 24px;
  border: 2px solid #a855f7;
  border-radius: 24px;
  background: transparent;
  color: #a855f7;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.replay-btn:hover {
  background: rgba(168, 85, 247, 0.15);
}

.replay-btn.hidden {
  display: none;
}

.quick-restart-btn {
  padding: 10px 24px;
  border: 2px solid var(--accent);
  border-radius: 24px;
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-restart-btn:hover {
  background: rgba(52, 152, 219, 0.15);
}

.quick-restart-btn.hidden {
  display: none;
}

.share-btn {
  padding: 10px 24px;
  border: 2px solid var(--text-dim);
  border-radius: 24px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.share-btn.hidden {
  display: none;
}

/* Bottom Controls */
.bottom-controls {
  display: flex;
  gap: 16px;
  margin-top: auto;
  padding-top: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--bg-card);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.icon-btn:hover {
  background: rgba(15, 52, 96, 0.8);
}

.icon-btn:active {
  transform: scale(0.9);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-mid);
  border-radius: 20px;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Stats */
.stats-diff-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.stats-tab {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--bg-card);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.stats-tab.active {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.15);
}

.stats-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-glow);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.accuracy-bar {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
}

.accuracy-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.accuracy-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.accuracy-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

/* Settings */
/* Keyboard shortcuts */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.shortcut-row span {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.7);
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  font-size: 12px;
  font-family: inherit;
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  min-width: 24px;
  text-align: center;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 15px;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 28px;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-slider {
  background: var(--green);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.setting-action-btn {
  padding: 6px 16px;
  border: 1px solid var(--text-dim);
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.setting-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.setting-action-btn.danger {
  border-color: var(--red);
  color: var(--red);
}

.setting-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
}

.setting-row.hidden {
  display: none;
}

.setting-action-btn.danger:hover {
  background: rgba(231, 76, 60, 0.15);
}

.setting-action-group {
  display: flex;
  gap: 8px;
}

.setting-row-col {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.speed-mode-hint {
  padding-top: 0;
  margin-top: -8px;
}

.setting-hint {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
}

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}

.theme-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
  padding: 0;
}

.theme-swatch:hover:not(.locked) {
  transform: scale(1.08);
}

.theme-swatch.active {
  border-color: var(--gold);
}

.theme-swatch.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.theme-cup-preview {
  width: 65%;
  height: 60%;
  clip-path: polygon(22% 0%, 78% 0%, 100% 100%, 0% 100%);
  border-radius: 0 0 3px 3px;
}

.theme-lock {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 10px;
  line-height: 1;
}

.theme-check {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
}

.setting-version {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 300;
  animation: fadeIn 0.3s ease;
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-card {
  background: var(--bg-mid);
  border-radius: 24px;
  padding: 36px 28px 24px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-content {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tutorial-content .tutorial-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.tutorial-content .tutorial-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.tutorial-content .tutorial-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.5;
}

.tutorial-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 16px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.tutorial-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-skip {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tutorial-skip:hover {
  color: var(--text);
}

.tutorial-next {
  padding: 10px 28px;
  border: none;
  border-radius: 20px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tutorial-next:active {
  transform: scale(0.95);
}

/* Confetti Canvas */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 50, 0.95);
  color: var(--text);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 400;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
  max-width: 300px;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden {
  display: none;
}

/* Keyboard hint (desktop only) */
.key-hint {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  opacity: 0.5;
  margin-top: 4px;
  flex-shrink: 0;
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .key-hint {
    display: block;
  }
}

/* Tablet/Desktop scaling */
@media (min-width: 768px) {
  :root {
    --cup-width: 100px;
    --cup-height: 140px;
    --cup-spacing: 32px;
    --game-area-height: 260px;
  }

  .score-value {
    font-size: 32px;
  }
  .level-value {
    font-size: 28px;
  }
  .status-text {
    font-size: 18px;
  }
  .start-btn {
    font-size: 22px;
    padding: 16px 56px;
  }
  .ball {
    width: 40px;
    height: 40px;
  }
  .cup-rim {
    width: 58px;
    height: 14px;
  }
  .cup.lifted {
    transform: translateY(-70px);
  }
}

/* Small phones */
@media (max-height: 600px) {
  :root {
    --cup-width: 64px;
    --cup-height: 88px;
    --cup-spacing: 16px;
    --game-area-height: 160px;
  }

  .score-value {
    font-size: 22px;
  }
  .level-value {
    font-size: 20px;
  }
  .status-text {
    font-size: 14px;
  }
  .start-btn {
    font-size: 16px;
    padding: 10px 36px;
  }
  .ball {
    width: 26px;
    height: 26px;
  }
  .cup-rim {
    width: 38px;
    height: 10px;
  }
  .cup.lifted {
    transform: translateY(-45px);
  }
  .diff-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  #app {
    padding: 6px 12px;
  }
  header {
    gap: 2px;
  }
  .sub-row {
    gap: 12px;
  }
}

/* ==================== DAILY CHALLENGE ==================== */
.daily-btn {
  padding: 10px 28px;
  border: 2px solid var(--gold);
  border-radius: 20px;
  background: transparent;
  color: var(--gold);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.daily-btn:hover {
  background: rgba(255, 215, 0, 0.12);
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

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

.daily-btn.done {
  opacity: 0.65;
  border-color: var(--text-dim);
  color: var(--text-dim);
}

.daily-btn.hidden {
  display: none;
}

/* Daily round badge shown in header during daily mode */
.daily-badge {
  background: linear-gradient(135deg, #b8860b, var(--gold));
  color: #1a1a2e;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.daily-badge.hidden {
  display: none;
}

/* Daily Summary Overlay */
.daily-summary-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.daily-summary-overlay.hidden {
  display: none;
}

.daily-summary-card {
  background: linear-gradient(160deg, #1a2a4a 0%, #0f1f38 100%);
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 24px;
  padding: 32px 24px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 8px 40px rgba(255, 215, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.daily-summary-emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
}

.daily-summary-date {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.daily-summary-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 1px;
}

.daily-summary-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: -8px;
}

.daily-stats-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  width: 100%;
  margin: 8px 0;
}

.daily-stat-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.daily-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
}

.daily-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.daily-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 12px 0 4px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
}

.daily-countdown-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.daily-countdown-timer {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #7c4dff);
  letter-spacing: 1px;
}

.daily-summary-card .share-btn {
  width: 100%;
  margin: 4px 0 0;
}

.daily-summary-card .continue-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 14px;
  padding: 10px;
}

.daily-summary-card .continue-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

/* ==================== MODE BUTTONS ==================== */
.mode-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ==================== TIME TRIAL ==================== */
.time-trial-btn {
  padding: 10px 28px;
  border: 2px solid #66ccff;
  border-radius: 20px;
  background: transparent;
  color: #66ccff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.time-trial-btn:hover {
  background: rgba(102, 204, 255, 0.12);
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(102, 204, 255, 0.3);
}

.time-trial-btn:active {
  transform: scale(0.97);
}
.time-trial-btn.hidden {
  display: none;
}

/* Time trial badge in header */
.time-trial-badge {
  background: linear-gradient(135deg, #3399cc, #66ccff);
  color: #0a1020;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 0.3s ease;
}

.time-trial-badge.hidden {
  display: none;
}

.time-trial-badge.urgent {
  background: linear-gradient(135deg, #cc3333, #ff4444);
  color: white;
  animation: urgentPulse 0.5s ease infinite alternate;
}

@keyframes urgentPulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

.tt-timer-icon {
  font-size: 11px;
}
.tt-timer-value {
  font-weight: 900;
  font-size: 14px;
  font-family: monospace;
}
.tt-divider {
  opacity: 0.4;
  margin: 0 2px;
}
.tt-correct-icon {
  font-size: 10px;
}
.tt-correct-value {
  font-weight: 900;
}

/* Time Trial Result Overlay */
.time-trial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.time-trial-overlay.hidden {
  display: none;
}

.time-trial-card {
  background: linear-gradient(160deg, #0f1f38 0%, #0a1428 100%);
  border: 2px solid rgba(102, 204, 255, 0.5);
  border-radius: 24px;
  padding: 32px 24px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 8px 40px rgba(102, 204, 255, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tt-emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(102, 204, 255, 0.5));
}

.tt-title {
  font-size: 24px;
  font-weight: 800;
  color: #66ccff;
  letter-spacing: 1px;
}

.tt-new-best {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 2px;
}
.tt-new-best.hidden {
  display: none;
}

.tt-score-block {
  margin: 4px 0;
}

.tt-score-value {
  font-size: 48px;
  font-weight: 900;
  color: white;
  line-height: 1;
}

.tt-score-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

.tt-stats-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin: 4px 0;
}

.tt-stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tt-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #66ccff;
}

.tt-stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-trial-card .share-btn {
  width: 100%;
  margin: 4px 0 0;
  background: #66ccff;
  color: #0a1020;
}

.time-trial-card .share-btn:hover {
  background: #88ddff;
}

.time-trial-card .continue-btn {
  width: 100%;
}

.tt-done-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.15s ease;
}

.tt-done-btn:hover {
  color: var(--text);
}

/* ==================== CHALLENGE MODE ==================== */
.challenge-btn {
  padding: 10px 28px;
  border: 2px solid #a855f7;
  border-radius: 20px;
  background: transparent;
  color: #a855f7;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.challenge-btn:hover {
  background: rgba(168, 85, 247, 0.12);
  transform: scale(1.04);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

.challenge-btn:active {
  transform: scale(0.97);
}
.challenge-btn.hidden {
  display: none;
}

/* Challenge round badge shown in header during challenge mode */
.challenge-badge {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #f5f3ff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.challenge-badge.hidden {
  display: none;
}

/* Challenge Result Overlay */
.challenge-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.challenge-overlay.hidden {
  display: none;
}

.challenge-card {
  background: linear-gradient(160deg, #1e1040 0%, #130c2e 100%);
  border: 2px solid rgba(168, 85, 247, 0.5);
  border-radius: 24px;
  padding: 32px 24px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 8px 40px rgba(168, 85, 247, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.challenge-emoji {
  font-size: 52px;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.5));
}

.challenge-title {
  font-size: 22px;
  font-weight: 800;
  color: #a855f7;
  letter-spacing: 1px;
}

.challenge-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: -8px;
}

.challenge-verdict {
  font-size: 18px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 8px;
  margin: 8px 0;
}

.challenge-verdict.win {
  background: rgba(78, 205, 196, 0.2);
  color: var(--green);
}
.challenge-verdict.lose {
  background: rgba(231, 76, 60, 0.2);
  color: var(--red);
}
.challenge-verdict.tie {
  background: rgba(255, 215, 0, 0.2);
  color: var(--gold);
}
.challenge-verdict.hidden {
  display: none;
}

.challenge-card .share-btn {
  width: 100%;
  margin: 4px 0 0;
  background: #a855f7;
  color: #f5f3ff;
}

.challenge-card .share-btn:hover {
  background: #c084fc;
}

.challenge-card .continue-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 14px;
  padding: 10px;
}

.challenge-card .continue-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

/* ==================== PAUSE OVERLAY ==================== */
.pause-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 350;
  backdrop-filter: blur(8px);
}

.pause-overlay.hidden {
  display: none;
}

.pause-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.pause-emoji {
  font-size: 72px;
  line-height: 1;
}

.pause-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 2px;
}

.pause-card .continue-btn {
  min-width: 200px;
}

/* ==================== TIME TRIAL DURATION PICKER ==================== */
.time-trial-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.time-trial-picker-overlay.hidden {
  display: none;
}

.tt-picker-card {
  background: linear-gradient(160deg, #0f1f38 0%, #0a1428 100%);
  border: 2px solid rgba(102, 204, 255, 0.5);
  border-radius: 24px;
  padding: 32px 24px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(102, 204, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.tt-picker-title {
  font-size: 22px;
  font-weight: 800;
  color: #66ccff;
}

.tt-picker-subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: -8px;
}

.tt-picker-options {
  display: flex;
  gap: 10px;
  width: 100%;
}

.tt-picker-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(102, 204, 255, 0.2);
  border-radius: 14px;
  padding: 16px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  color: #66ccff;
}

.tt-picker-btn:hover {
  background: rgba(102, 204, 255, 0.1);
  border-color: rgba(102, 204, 255, 0.4);
}

.tt-picker-btn.selected {
  background: #66ccff;
  border-color: #66ccff;
  color: #0a1020;
}

.tt-picker-icon {
  font-size: 24px;
}
.tt-picker-value {
  font-size: 20px;
  font-weight: 900;
}
.tt-picker-label {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.7;
}

.tt-picker-start {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #66ccff, #3399cc);
  color: #0a1020;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.tt-picker-start:hover {
  transform: scale(1.02);
}
.tt-picker-start:active {
  transform: scale(0.98);
}

.tt-picker-cancel {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.15s ease;
}

.tt-picker-cancel:hover {
  color: var(--text);
}

/* ==================== REDUCED MOTION ==================== */
/* Daily History */
.dh-modal {
  max-width: 380px;
}

.dh-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.dh-nav-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dh-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.dh-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.dh-month-label {
  font-size: 16px;
  font-weight: 700;
}

.dh-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.dh-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  padding: 4px 0;
}

.dh-empty {
  aspect-ratio: 1;
}

.dh-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  cursor: default;
  position: relative;
  transition: transform 0.15s ease;
}

.dh-day.dh-future {
  opacity: 0.25;
}

.dh-day.dh-empty-day {
  opacity: 0.4;
}

.dh-day.dh-today {
  box-shadow: 0 0 0 2px var(--gold);
}

.dh-day.dh-perfect {
  background: #2ecc71;
  color: #000;
  cursor: pointer;
}

.dh-day.dh-great {
  background: #a8d65c;
  color: #000;
  cursor: pointer;
}

.dh-day.dh-good {
  background: #bab535;
  color: #000;
  cursor: pointer;
}

.dh-day.dh-ok {
  background: #e67e22;
  color: #000;
  cursor: pointer;
}

.dh-day.dh-miss {
  background: #e74c3c;
  color: #fff;
  cursor: pointer;
}

.dh-day[aria-label]:not(.dh-empty-day):not(.dh-future):hover {
  transform: scale(1.15);
  z-index: 1;
}

.dh-legend {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text-dim);
}

.dh-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dh-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dh-dot.dh-perfect {
  background: #2ecc71;
}
.dh-dot.dh-great {
  background: #a8d65c;
}
.dh-dot.dh-good {
  background: #bab535;
}
.dh-dot.dh-ok {
  background: #e67e22;
}
.dh-dot.dh-miss {
  background: #e74c3c;
}

.dh-stats {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.dh-stat {
  text-align: center;
}

.dh-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
}

.dh-stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.dh-detail {
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.dh-detail.hidden {
  display: none;
}

.dh-detail-date {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.dh-detail-score {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 8px;
}

.dh-detail-rounds {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}

.dh-detail-round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.dh-detail-round-label {
  font-size: 10px;
  color: var(--text-dim);
}

.dh-detail-round-icon {
  font-size: 20px;
}

.history-btn {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
  margin-top: 8px;
}

.history-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.stats-history-btn {
  margin-top: 16px;
}

.stats-daily-section {
  grid-column: 1 / -1;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-daily-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.stats-daily-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-top: 6px;
  margin-bottom: 4px;
}

.stats-daily-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* Game history list */
.game-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.game-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border-radius: 10px;
  padding: 8px 12px;
}

.game-history-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-history-icon {
  font-size: 18px;
}

.game-history-mode {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.game-history-date {
  font-size: 10px;
  color: var(--text-dim);
}

.game-history-right {
  text-align: right;
}

.game-history-score {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-glow);
}

.game-history-acc {
  font-size: 10px;
  color: var(--text-dim);
}

/* Offline indicator */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #e67e22, #d35400);
  color: #fff;
  text-align: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10000;
  transition: transform 0.3s ease;
}
.offline-banner.hidden {
  transform: translateY(-100%);
  pointer-events: none;
}

/* Daily round result grid */
.daily-round-grid {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
  font-size: 1.5rem;
}

.round-dot {
  display: inline-block;
  transition: transform 0.2s ease;
}

/* ==================== ACHIEVEMENTS ==================== */
.achievements-progress {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 400px) {
  .achievements-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.achievement-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  border: 1px solid transparent;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease;
}

.achievement-card.unlocked {
  border-color: rgba(255, 215, 0, 0.25);
}

.achievement-card.unlocked:hover {
  transform: scale(1.03);
}

.achievement-card.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.achievement-card.recently-unlocked {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.35);
  animation: achievementGlow 2s ease-in-out infinite alternate;
}

@keyframes achievementGlow {
  from {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
  }
  to {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.55);
  }
}

.achievement-icon {
  font-size: 28px;
  line-height: 1;
}

.achievement-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.achievement-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.3;
}

.achievement-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.achievement-progress-fill {
  height: 100%;
  background: rgba(255, 215, 0, 0.5);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.achievement-progress-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  font-family: monospace;
  margin-top: 2px;
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  /* Disable cup shuffle arc and spring animations */
  .cup-container {
    transition: transform 0.01s linear !important;
  }
  .cup {
    transition: transform 0.01s linear !important;
  }
  .ball {
    transition:
      opacity 0.01s linear,
      transform 0.01s linear !important;
  }

  /* Disable decorative animations */
  .cup-container.shake {
    animation: none !important;
  }
  .start-btn {
    animation: none !important;
  }
  .new-high-score {
    animation: none !important;
  }
  .streak .flame {
    animation: none !important;
  }
  .result-card {
    animation: none !important;
  }
  .result-overlay {
    animation: none !important;
  }
  .daily-btn {
    transition: none !important;
  }
  .time-trial-btn {
    transition: none !important;
  }
  .time-trial-badge.urgent {
    animation: none !important;
  }
  .challenge-btn {
    transition: none !important;
  }
  .diff-btn {
    transition: none !important;
  }
  .score-block.hs-approaching {
    animation: none !important;
  }

  /* Reduce overlay transition motion */
  .points-popup {
    transition: none !important;
  }
  .cup-body {
    transition: none !important;
  }
  .offline-banner {
    transition: none !important;
  }
  .level-up-banner {
    animation: none !important;
  }
  .zen-btn {
    transition: none !important;
  }

  /* Disable background drift */
  body::after {
    animation: none !important;
  }
}

/* ==================== ZEN MODE ==================== */
.zen-btn {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.zen-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 12px rgba(108, 92, 231, 0.4);
}

.zen-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.zen-badge[data-intensity="1"] {
  background: linear-gradient(135deg, #6c5ce7, #fd79a8);
}
.zen-badge[data-intensity="2"] {
  background: linear-gradient(135deg, #e17055, #fd79a8);
  animation: zenPulse 1.5s ease-in-out infinite;
}
.zen-badge[data-intensity="3"] {
  background: linear-gradient(135deg, #d63031, #e17055);
  animation: zenPulse 0.8s ease-in-out infinite;
}
@keyframes zenPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(253, 121, 168, 0.3); }
  50% { box-shadow: 0 0 12px rgba(253, 121, 168, 0.6); }
}
.zen-badge-divider {
  opacity: 0.5;
  margin: 0 2px;
}

.zen-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.zen-card {
  background: var(--card-bg, #1e1e3a);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.3s ease-out;
}
.zen-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}
.zen-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #a29bfe;
  margin-bottom: 16px;
}
.zen-stats-row {
  display: flex;
  justify-content: space-around;
  margin: 16px 0;
}
.zen-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
}
.zen-stat-label {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.zen-all-time {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 8px 0 16px;
}

/* ==================== LEVEL UP BANNER ==================== */
.level-up-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  pointer-events: none;
}
.level-up-banner.hidden {
  display: none;
}
.level-up-banner.show {
  display: block;
}
.level-up-text {
  display: block;
  font-size: 2.2rem;
  font-weight: 800;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5);
  animation: levelUpPop 0.8s ease-out forwards;
  white-space: nowrap;
}
@keyframes levelUpPop {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  30% {
    opacity: 1;
    transform: scale(1.15) translateY(0);
  }
  60% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.95) translateY(-30px);
  }
}

/* ==================== TIME TRIAL PACE INDICATOR ==================== */
.tt-pace {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 2px;
}
.tt-pace.hidden {
  display: none;
}
.tt-pace.ahead {
  background: rgba(78, 205, 196, 0.3);
  color: #4ecdc4;
}
.tt-pace.behind {
  background: rgba(231, 76, 60, 0.3);
  color: #e74c3c;
}
.tt-pace.tied {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.7);
}

/* ==================== STREAK HEAT ==================== */
.game-area.streak-warm {
  background: radial-gradient(ellipse at center bottom, rgba(255, 165, 0, 0.06) 0%, transparent 70%);
}
.game-area.streak-hot {
  background: radial-gradient(ellipse at center bottom, rgba(255, 100, 0, 0.1) 0%, transparent 70%);
}
.game-area.streak-fire {
  background: radial-gradient(ellipse at center bottom, rgba(255, 50, 0, 0.14) 0%, transparent 70%);
  animation: fireGlow 1.5s ease-in-out infinite alternate;
}
@keyframes fireGlow {
  from { background: radial-gradient(ellipse at center bottom, rgba(255, 50, 0, 0.14) 0%, transparent 70%); }
  to { background: radial-gradient(ellipse at center bottom, rgba(255, 80, 0, 0.08) 0%, transparent 70%); }
}

/* ==================== COMBO HUD ==================== */
.combo-hud {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 10px;
  padding: 2px 8px;
  letter-spacing: 0.5px;
  transition: transform 0.15s ease, color 0.2s ease;
}
.combo-hud.combo-high {
  color: #ff9500;
  background: rgba(255, 149, 0, 0.15);
  border-color: rgba(255, 149, 0, 0.3);
  transform: scale(1.05);
}
.combo-hud.combo-max {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.3);
  transform: scale(1.1);
  animation: comboPulse 0.8s ease-in-out infinite alternate;
}
@keyframes comboPulse {
  from { transform: scale(1.1); }
  to { transform: scale(1.15); }
}

/* ==================== DIFFICULTY RECOMMENDATION ==================== */
.diff-recommendation {
  font-size: 11px;
  color: var(--gold);
  text-align: center;
  margin-top: 4px;
  opacity: 0.8;
  animation: fadeInUp 0.3s ease-out;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 0.8; transform: translateY(0); }
}

/* ==================== LEADERBOARD ==================== */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 13px;
}
.leaderboard-row:first-child {
  background: rgba(255, 215, 0, 0.08);
}
.lb-rank {
  width: 24px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.lb-score {
  font-weight: 700;
  color: var(--gold);
  min-width: 48px;
}
.lb-detail {
  flex: 1;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}
.lb-date {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  flex-shrink: 0;
}

/* ==================== LEADERBOARD ==================== */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 13px;
}
.lb-rank {
  min-width: 24px;
  text-align: center;
}
.lb-score {
  font-weight: 700;
  color: var(--gold);
  min-width: 50px;
}
.lb-detail {
  flex: 1;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}
.lb-date {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
}
