* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #eaeae2;
  color: #333;
  min-height: 100vh;
  padding: 1.2vh;
  touch-action: manipulation;
}

.home-btn {
  position: fixed;
  top: 2vh;
  left: 2vh;
  background: rgba(255, 255, 255, 0.95);
  color: #4A90E2;
  border: 0.2vh solid #4A90E2;
  border-radius: 1vh;
  padding: 0.8vh 1.6vh;
  font-size: 1.8vh;
  font-family: inherit;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 0.4vh 1.2vh rgba(74, 144, 226, 0.2);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  height: auto;
}

.home-btn:hover {
  background: #f0f5fd;
  color: #4A90E2;
  transform: translateY(-3px);
  box-shadow: 0 0.6vh 1.6vh rgba(74, 144, 226, 0.2);
}

.app {
  max-width: 100vh;
  margin: 0 auto;
  padding-top: 7vh;
}

.header {
  text-align: center;
  margin-bottom: 3vh;
}

.header h1 {
  font-family: 'Luckiest Guy', 'Comic Sans MS', 'Comic Sans', sans-serif;
  letter-spacing: 3px;
  font-size: 5.2vh;
  color: #000000;
  text-shadow: 0 0.3vh 0.6vh rgba(74, 144, 226, 0.15);
  margin: 0;
}

.subtitle {
  font-size: 1.6vh;
  color: #4b5563;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ==================== Start Screen ==================== */
.screen {
  animation: fadeIn 0.5s ease-in;
}

.screen[style*="animation: none"] {
  animation: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(1vh);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.start-content {
  background: white;
  border-radius: 1.2vh;
  padding: 3vh;
  box-shadow: 0 0.4vh 1.6vh rgba(0, 0, 0, 0.08);
  text-align: center;
}

.instructions {
  font-size: 1.8vh;
  line-height: 1.6;
  color: #555;
  margin-bottom: 2.4vh;
}

/* ==================== Countdown Screen ==================== */
#countdownScreen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#countdownScreen.show {
  display: flex;
}

.countdown-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.countdown-number {
  font-size: 15vh;
  font-weight: bold;
  color: #4A90E2;
  display: block;
  transform-origin: center center;
  line-height: 1;
  margin: 0;
  padding: 0;
}

@keyframes countdownPulse {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.countdown-text {
  font-size: 2.4vh;
  color: #333;
  margin-top: 2vh;
  font-weight: 600;
}

.start-btn {
  background: #4A90E2;
  color: white;
  border: none;
  padding: 1.2vh 2.5vh;
  border-radius: 1vh;
  font-size: 1.8vh;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4.4vh;
  box-shadow: 0 0.4vh 1.2vh rgba(74, 144, 226, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.start-btn:hover {
  background: #20B2AA;
  transform: translateY(-3px);
  box-shadow: 0 0.6vh 1.8vh rgba(32, 178, 170, 0.4);
}

/* ==================== Game Screen ==================== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.4vh;
  background: white;
  padding: 1.4vh 2vh;
  border-radius: 0.8vh;
  box-shadow: 0 0.4vh 1.2vh rgba(0, 0, 0, 0.08);
}

.timer {
  font-size: 2.4vh;
  font-weight: bold;
  color: #4A90E2;
  font-variant-numeric: tabular-nums;
  min-width: 8vh;
}

.progress-section {
  display: flex;
  align-items: center;
  gap: 1.5vh;
  flex: 1;
  margin-left: 3vh;
}

.progress-container {
  flex: 1;
  min-width: 30vh;
}

.progress-bar {
  width: 100%;
  height: 0.8vh;
  background-color: #ddd;
  border-radius: 0.4vh;
  overflow: hidden;
  box-shadow: inset 0 0.1vh 0.3vh rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90E2 0%, #20B2AA 100%);
  width: 0%;
  transition: width 0.3s ease-out;
  border-radius: 0.4vh;
}

.question-counter {
  font-size: 1.4vh;
  color: #666;
  font-weight: 600;
  min-width: 5vh;
  text-align: right;
}

.question-box {
  background: white;
  border-radius: 1.2vh;
  padding: 3vh;
  margin-bottom: 2.4vh;
  box-shadow: 0 0.4vh 1.6vh rgba(0, 0, 0, 0.08);
  text-align: center;
}

.question {
  font-size: 3.6vh;
  font-weight: bold;
  color: #333;
  margin-bottom: 2vh;
}

.answer-input {
  width: 100%;
  padding: 1.2vh;
  font-size: 2.4vh;
  border: 2px solid #d0d0d0;
  border-radius: 0.8vh;
  text-align: center;
  font-weight: 600;
  transition: border-color 0.3s;
  min-height: 5.5vh;
  touch-action: manipulation;
}

.answer-input:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.answer-input::placeholder {
  color: #aaa;
}

/* ==================== Controls ==================== */
.controls {
  background: white;
  border-radius: 1.2vh;
  padding: 2vh;
  box-shadow: 0 0.4vh 1.6vh rgba(0, 0, 0, 0.08);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1vh;
  margin-bottom: 2vh;
}

.key-btn {
  background: #f0f5fd;
  border: 2px solid #d0d0d0;
  color: #333;
  padding: 1.4vh;
  border-radius: 0.8vh;
  font-size: 1.8vh;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 6vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-btn:hover {
  background: #e0f4f0;
  border-color: #20B2AA;
  transform: translateY(-2px);
  box-shadow: 0 0.4vh 0.8vh rgba(32, 178, 170, 0.15);
}

.key-btn:active {
  transform: translateY(0);
}

.key-btn[data-key="0"] {
  grid-column: 2;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 1vh;
}

.btn-compact {
  font-size: 1.4vh;
  min-height: 5vh;
}

.btn-large {
  grid-column: span 1;
  font-size: 1.8vh;
  min-height: 5.5vh;
  background: #20B2AA;
  box-shadow: 0 0.4vh 1.2vh rgba(32, 178, 170, 0.4);
  position: relative;
}

.btn-large:hover {
  background: #1A9B8E;
  box-shadow: 0 0.6vh 1.8vh rgba(32, 178, 170, 0.6);
}

.btn-primary,
.btn-secondary {
  padding: 1.2vh 2.5vh;
  border-radius: 1vh;
  font-size: 1.8vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4.4vh;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: #4A90E2;
  color: white;
  box-shadow: 0 0.4vh 1.2vh rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
  background: #20B2AA;
  transform: translateY(-3px);
  box-shadow: 0 0.6vh 1.8vh rgba(32, 178, 170, 0.4);
}

#playAgainBtn {
  padding: 1.2vh 2.5vh;
  font-size: 1.8vh;
  min-height: 4.4vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-bar {
  display: flex;
  gap: 1.6vh;
  margin-top: 2.4vh;
  justify-content: center;
  align-items: center;
}

.action-bar #playAgainBtn,
.action-bar #shareBtn {
  flex: 1;
  padding: 1.2vh 2.5vh;
  font-size: 1.8vh;
  min-height: 4.4vh;
  max-width: 22vh;
}

.btn-secondary {
  background: white;
  color: #20B2AA;
  border: 2px solid #20B2AA;
}

.btn-secondary:hover {
  background: #e0f4f0;
  box-shadow: 0 0.4vh 1.2vh rgba(32, 178, 170, 0.2);
  transform: translateY(-3px);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f5f5f5;
  border-color: #d0d0d0;
  color: #999;
}

/* ==================== Results Screen ==================== */
.results-header {
  text-align: center;
  margin-bottom: 1.6vh;
}

.results-header h2 {
  font-size: 2.8vh;
  color: #333;
  margin-bottom: 2vh;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.final-time {
  font-size: 5vh;
  font-weight: bold;
  color: #4A90E2;
  background: linear-gradient(135deg, #f0f5fd 0%, #e8f1ff 100%);
  padding: 2.4vh 3.6vh;
  border-radius: 1.6vh;
  display: inline-block;
  box-shadow: 0 0.8vh 2.4vh rgba(74, 144, 226, 0.15);
  margin: 0 auto;
  margin-bottom: 1.6vh;
}

.percentile-text {
  font-size: 2vh;
  color: #000000;
  font-weight: 600;
  margin: 2vh 0;
  letter-spacing: 0.3px;
  position: relative;
  padding: 1.6vh 0;
}

.percentile-text::before,
.percentile-text::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #20B2AA, transparent);
}

.percentile-text::before {
  top: 0;
}

.percentile-text::after {
  bottom: 0;
}

.percentile-text strong {
  font-weight: 800;
  color: #000000;
}

.results-box {
  background: white;
  border-radius: 1.2vh;
  padding: 1.6vh;
  margin-bottom: 1.6vh;
  box-shadow: 0 0.4vh 1.6vh rgba(0, 0, 0, 0.08);
  max-height: 20vh;
  overflow-y: auto;
  flex-shrink: 1;
  min-height: 0;
}

.results-questions {
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
}

.result-item {
  padding: 1.6vh;
  border-radius: 1vh;
  border-left: 5px solid #ddd;
  animation: slideIn 0.5s ease-out forwards;
  opacity: 0;
  background: #fafafa;
  transition: all 0.3s;
}

.result-item:hover {
  transform: translateX(0.4vh);
  box-shadow: 0 0.2vh 0.8vh rgba(0, 0, 0, 0.06);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-2vh);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.result-item.correct {
  background: rgba(76, 175, 80, 0.08);
  border-left-color: #4CAF50;
}

.result-item.correct:hover {
  background: rgba(76, 175, 80, 0.12);
}

.result-item.incorrect {
  background: rgba(244, 67, 54, 0.08);
  border-left-color: #F44336;
}

.result-item.incorrect:hover {
  background: rgba(244, 67, 54, 0.12);
}

.result-question {
  font-size: 1.8vh;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.8vh;
}

.result-answer {
  font-size: 1.6vh;
  color: #666;
  line-height: 1.5;
}

.result-answer-user {
  font-weight: 600;
  color: #333;
}

.result-correct {
  color: #4CAF50;
  font-weight: 700;
}

.result-incorrect {
  color: #F44336;
  font-weight: 700;
}



#shareBtn {
  margin-bottom: 0;
  font-family: inherit;
  font-weight: 700;
}

#shareBtn:hover {
  transform: translateY(-3px);
}

/* ==================== Leaderboard ==================== */
.leaderboard-section {
  background: white;
  border-radius: 1.6vh;
  padding: 2.4vh;
  box-shadow: 0 0.4vh 1.6vh rgba(0, 0, 0, 0.08);
}

.leaderboard-title {
  font-size: 2.2vh;
  font-weight: 700;
  color: #333;
  letter-spacing: -0.3px;
  margin: 0;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.6vh;
  gap: 1.6vh;
}

.leaderboard-tabs {
  display: flex;
  gap: 1.2vh;
  margin-bottom: 2.4vh;
  border-bottom: 2px solid #e8e8e8;
}

.tab-btn {
  background: none;
  border: none;
  padding: 1.2vh 2vh;
  font-size: 1.6vh;
  font-weight: 700;
  color: #999;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.tab-btn.active {
  color: #20B2AA;
  border-bottom-color: #20B2AA;
}

.tab-btn:hover {
  color: #20B2AA;
}

.leaderboard-box {
  max-height: 40vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 0.8vh;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.4vh 1.6vh;
  background: linear-gradient(90deg, #f9f9f9 0%, #fafafa 100%);
  border-radius: 0.8vh;
  border-left: 4px solid #ddd;
  transition: all 0.3s;
}

.leaderboard-item:hover {
  background: linear-gradient(90deg, #f5f5f5 0%, #f7f7f7 100%);
  transform: translateX(0.4vh);
}

.leaderboard-item:nth-child(1) {
  border-left-color: #FFD700;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 215, 0, 0.04) 100%);
}

.leaderboard-item:nth-child(2) {
  border-left-color: #C0C0C0;
  background: linear-gradient(90deg, rgba(192, 192, 192, 0.08) 0%, rgba(192, 192, 192, 0.04) 100%);
}

.leaderboard-item:nth-child(3) {
  border-left-color: #CD7F32;
  background: linear-gradient(90deg, rgba(205, 127, 50, 0.08) 0%, rgba(205, 127, 50, 0.04) 100%);
}

.leaderboard-rank {
  font-size: 1.6vh;
  font-weight: bold;
  color: #20B2AA;
  min-width: 4vh;
  text-align: center;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
  color: #FFD700;
  font-size: 1.8vh;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  color: #C0C0C0;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  color: #CD7F32;
}

.leaderboard-username {
  flex: 1;
  padding: 0 1.4vh;
  font-size: 1.6vh;
  font-weight: 700;
  color: #333;
}

.leaderboard-time {
  font-size: 1.6vh;
  font-weight: 700;
  color: #666;
  font-variant-numeric: tabular-nums;
  background: rgba(32, 178, 170, 0.1);
  padding: 0.6vh 1.2vh;
  border-radius: 0.6vh;
  color: #20B2AA;
  font-weight: 700;
}

.leaderboard-item.user-score {
  border: 2px solid #4A90E2;
  border-left: 4px solid #4A90E2;
  background: linear-gradient(90deg, rgba(74, 144, 226, 0.08) 0%, rgba(74, 144, 226, 0.04) 100%);
  box-shadow: 0 0.2vh 0.8vh rgba(74, 144, 226, 0.15);
}

.reset-countdown {
  font-size: 1.4vh;
  color: #999;
  text-align: right;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* ==================== Toast ==================== */
.toast.show {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ==================== Mobile Responsiveness ==================== */
@media (max-width: 480px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: 0.6vh;
  }

  .app {
    padding-top: 4vh;
    height: 100dvh;
    overflow: hidden;
  }

  .home-btn {
    top: 1.2vh;
    left: 1.2vh;
    font-size: 1.5vh;
    padding: 0.8vh 1.6vh;
  }

  .start-content {
    padding: 2vh;
  }

  .instructions {
    font-size: 1.6vh;
    margin-bottom: 1.6vh;
  }

  .header h1 {
    font-size: 3.6vh;
    letter-spacing: 2px;
  }

  .subtitle {
    font-size: 1.3vh;
  }

  .game-header {
    flex-direction: row;
    gap: 0.8vh;
    padding: 0.8vh;
    margin-bottom: 1.2vh;
  }

  .timer {
    font-size: 1.8vh;
    min-width: 6vh;
  }

  .progress {
    font-size: 1.4vh;
  }

  .question {
    font-size: 2.4vh;
  }

  .question-box {
    padding: 1.4vh;
    margin-bottom: 1.2vh;
  }

  .answer-input {
    min-height: 5.5vh;
    padding: 1vh;
    font-size: 1.6vh;
    margin-bottom: 1vh;
  }

  .controls {
    padding: 1.2vh;
  }

  .keypad {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8vh;
    margin-bottom: 1vh;
  }

  .key-btn {
    min-height: 5.5vh;
    padding: 1vh;
    font-size: 1.6vh;
  }

  .action-buttons {
    grid-template-columns: 1fr 1fr 1.5fr;
    gap: 0.6vh;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 5vh;
    padding: 0.8vh 1.4vh;
    font-size: 1.4vh;
  }

  .result-question {
    font-size: 1.4vh;
  }

  .result-answer {
    font-size: 1.2vh;
  }

  .final-time {
    font-size: 3.2vh;
    padding: 1.4vh 2vh;
    margin-bottom: 0.8vh;
  }

  .results-header h2 {
    font-size: 2.2vh;
    margin-bottom: 1vh;
  }

  #percentileText {
    font-size: 1.6vh;
    margin: 0.8vh 0;
    padding: 0.8vh 0;
  }

  .results-box {
    padding: 1.2vh;
    margin-bottom: 1.2vh;
    max-height: 13vh;
  }

  .leaderboard-section {
    padding: 1.2vh;
    margin-bottom: 1.2vh;
  }

  .leaderboard-title {
    font-size: 1.8vh;
    margin: 0;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4vh;
    margin-bottom: 0.8vh;
  }

  .leaderboard-tabs {
    gap: 1vh;
    margin-bottom: 0.8vh;
    border-bottom: 2px solid #e8e8e8;
  }

  .tab-btn {
    padding: 0.8vh 1.2vh;
    font-size: 1.4vh;
    min-height: auto;
  }

  .leaderboard-box {
    max-height: 19vh;
  }

  .leaderboard-item {
    padding: 0.8vh;
  }

  .leaderboard-username {
    padding: 0 0.6vh;
    font-size: 1.2vh;
  }

  .leaderboard-time {
    font-size: 1.2vh;
  }

  .action-bar {
    gap: 0.8vh;
    margin-top: 0.8vh;
    flex-direction: row;
    flex-shrink: 0;
  }

  .action-bar #playAgainBtn,
  .action-bar #shareBtn {
    flex: 1;
    max-width: none;
    min-height: 5vh;
    padding: 1vh 1.4vh;
    font-size: 1.4vh;
  }

  .reset-countdown {
    font-size: 1.2vh;
    text-align: left;
  }
}

@media (max-width: 360px) {
  body {
    height: 100dvh;
    overflow: hidden;
    padding: 0.4vh;
  }

  .app {
    padding-top: 3.2vh;
  }

  .home-btn {
    top: 1vh;
    left: 1vh;
    font-size: 1.3vh;
    padding: 0.7vh 1.4vh;
  }

  .start-content {
    padding: 1.4vh;
  }

  .instructions {
    font-size: 1.4vh;
    margin-bottom: 1.2vh;
  }

  .header h1 {
    font-size: 3.2vh;
    letter-spacing: 1.5px;
    margin-bottom: 0.4vh;
  }

  .subtitle {
    font-size: 1.2vh;
  }

  .question {
    font-size: 2.2vh;
    margin-bottom: 1.2vh;
  }

  .question-box {
    padding: 1.2vh;
    margin-bottom: 1vh;
  }

  .answer-input {
    font-size: 1.6vh;
    min-height: 5vh;
    padding: 0.8vh;
    margin-bottom: 0.8vh;
  }

  .game-header {
    gap: 0.6vh;
    padding: 0.6vh;
    margin-bottom: 1vh;
  }

  .timer {
    font-size: 1.6vh;
  }

  .keypad {
    gap: 0.6vh;
    margin-bottom: 0.8vh;
  }

  .key-btn {
    min-height: 5vh;
    padding: 0.8vh;
    font-size: 1.4vh;
  }

  .action-buttons {
    gap: 0.5vh;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 4.6vh;
    padding: 0.6vh 1vh;
    font-size: 1.2vh;
  }

  .controls {
    padding: 1vh;
  }

  .results-box {
    padding: 1vh;
    max-height: 11vh;
    margin-bottom: 1vh;
  }

  .result-question {
    font-size: 1.2vh;
    margin-bottom: 0.4vh;
  }

  .result-answer {
    font-size: 1.1vh;
  }

  .final-time {
    font-size: 2.8vh;
    padding: 1.2vh 1.6vh;
    margin-bottom: 0.6vh;
  }

  .results-header h2 {
    font-size: 1.8vh;
    margin-bottom: 0.8vh;
  }

  #percentileText {
    font-size: 1.4vh;
    margin: 0.6vh 0;
    padding: 0.6vh 0;
  }

  .percentile-text::before,
  .percentile-text::after {
    width: 4vh;
    height: 1px;
  }

  .leaderboard-section {
    padding: 1vh;
    margin-bottom: 1vh;
  }

  .leaderboard-title {
    font-size: 1.6vh;
    margin: 0;
  }

  .leaderboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3vh;
    margin-bottom: 0.6vh;
  }

  .leaderboard-tabs {
    gap: 0.6vh;
    margin-bottom: 0.6vh;
  }

  .tab-btn {
    padding: 0.6vh 1vh;
    font-size: 1.2vh;
    min-height: auto;
  }

  .leaderboard-box {
    max-height: 16vh;
  }

  .leaderboard-item {
    padding: 0.6vh;
  }

  .leaderboard-username {
    font-size: 1.1vh;
    padding: 0;
  }

  .leaderboard-time {
    font-size: 1.1vh;
  }

  .action-bar {
    gap: 0.6vh;
    margin-top: 0.6vh;
    flex-direction: row;
    flex-shrink: 0;
  }

  .action-bar #playAgainBtn,
  .action-bar #shareBtn {
    flex: 1;
    min-height: 4.6vh;
    padding: 0.8vh 1vh;
    font-size: 1.2vh;
  }

  .reset-countdown {
    font-size: 1.1vh;
    text-align: left;
  }
}

@media (hover: hover) {
  .key-btn:hover {
    background: #e0f4f0;
    border-color: #20B2AA;
    transform: translateY(-2px);
    box-shadow: 0 0.4vh 0.8vh rgba(32, 178, 170, 0.15);
  }

  .btn-primary:hover {
    background: #20B2AA;
    transform: translateY(-3px);
    box-shadow: 0 0.6vh 1.8vh rgba(32, 178, 170, 0.4);
  }

  .btn-secondary:hover {
    background: #e0f4f0;
    box-shadow: 0 0.4vh 1.2vh rgba(32, 178, 170, 0.2);
    transform: translateY(-3px);
  }

  .btn-secondary:hover {
    background: #e0f4f0;
    box-shadow: 0 0.4vh 1.2vh rgba(32, 178, 170, 0.2);
    transform: translateY(-3px);
  }

  .result-item:hover {
    transform: translateX(0.4vh);
    box-shadow: 0 0.2vh 0.8vh rgba(0, 0, 0, 0.06);
  }

  .leaderboard-item:hover {
    background: linear-gradient(90deg, #f5f5f5 0%, #f7f7f7 100%);
    transform: translateX(0.4vh);
  }
}

@media (hover: hover) and (max-width: 480px) {
  .key-btn:active {
    transform: translateY(0);
  }

  .btn-primary:active {
    background: #18A69A;
    transform: translateY(0);
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .app {
    padding-top: 3vh;
  }

  .header {
    margin-bottom: 1.2vh;
  }

  .header h1 {
    font-size: 2.8vh;
  }

  .question {
    font-size: 2.2vh;
  }

  .question-box {
    padding: 1.2vh;
    margin-bottom: 1.2vh;
  }

  .controls {
    padding: 1.2vh;
  }

  .keypad {
    gap: 0.6vh;
    margin-bottom: 1.2vh;
  }

  .key-btn {
    min-height: 4.2vh;
    font-size: 1.4vh;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 4.2vh;
    font-size: 1.4vh;
  }
}
