:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #6b7a90;
  --blue: #4a90e2;
  --green: #27ae60;
  --red: #e74c3c;
  --shadow: 0 12px 30px rgba(31, 45, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100%;
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

.lock-card,
.home-card,
.result-card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: 28px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.app-title {
  font-size: 2rem;
  margin: 0 0 8px;
  letter-spacing: 0.05em;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
}

.lock-input {
  width: 100%;
  height: 56px;
  border: 2px solid #dfe6f0;
  border-radius: 16px;
  padding: 0 16px;
  font-size: 1.25rem;
  outline: none;
  background: #f9fbfe;
  text-align: center;
}

.lock-input:focus {
  border-color: var(--blue);
  background: #ffffff;
}

.lock-error {
  min-height: 1.4em;
  color: var(--red);
  font-size: 0.95rem;
  margin: 8px 0 12px;
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  background: #e8eef7;
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

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

.btn.primary {
  background: var(--blue);
  color: #ffffff;
}

.btn.block {
  width: 100%;
}

.btn.quit {
  background: #ffffff;
  color: var(--muted);
  border: 1px solid #dfe6f0;
  padding: 8px 14px;
  font-size: 0.95rem;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  border: 2px solid #e6edf7;
  background: #f9fbfe;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.08s;
}

.mode-btn:active {
  transform: scale(0.99);
}

.mode-btn:hover {
  border-color: #b9d4ff;
}

.mode-name {
  font-size: 1.2rem;
  font-weight: 700;
}

.mode-desc {
  font-size: 0.9rem;
  color: var(--muted);
}

.mode-best {
  font-size: 0.85rem;
  color: var(--blue);
  min-height: 1.2em;
}

#screen-quiz {
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 28px;
}

.quiz-top {
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-timer {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(31, 45, 61, 0.08);
}

.quiz-timer.urgent {
  color: var(--red);
  animation: pulse 0.9s infinite;
}

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

.quiz-progress {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  min-height: 1.2em;
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  max-width: 640px;
}

.question {
  font-size: clamp(72px, 18vw, 120px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.answers {
  display: flex;
  gap: 18px;
  justify-content: center;
  width: 100%;
}

.answer-btn {
  flex: 1;
  min-width: 0;
  min-height: 88px;
  border: none;
  border-radius: 22px;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 8px 20px rgba(31, 45, 61, 0.14);
  transition:
    transform 0.08s ease,
    filter 0.08s ease;
}

.answer-btn.correct {
  background: linear-gradient(180deg, #43d27c, #27ae60);
}

.answer-btn.wrong {
  background: linear-gradient(180deg, #ff7b7b, #e74c3c);
}

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

.answer-btn.flash-correct {
  animation: flashCorrect 0.15s ease;
}

.answer-btn.flash-wrong {
  animation: flashWrong 0.15s ease;
}

@keyframes flashCorrect {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.45);
    transform: scale(1.04);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes flashWrong {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.35);
    transform: scale(1.04);
  }
  100% {
    filter: brightness(1);
  }
}

.result-title {
  font-size: 1.5rem;
  margin: 0 0 18px;
}

.result-main {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
  color: var(--blue);
}

.big-number {
  font-size: 1.2em;
}

.big-unit {
  font-size: 0.45em;
  color: var(--muted);
  font-weight: 600;
}

.result-sub {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  gap: 12px;
}

.result-actions .btn {
  flex: 1;
}

@media (max-width: 420px) {
  .screen {
    padding: 14px;
  }

  .lock-card,
  .home-card,
  .result-card {
    padding: 26px 18px;
    border-radius: 24px;
  }

  .answers {
    gap: 12px;
  }

  .answer-btn {
    min-height: 84px;
    font-size: 1.1rem;
  }

  .question {
    font-size: clamp(64px, 20vw, 96px);
  }
}

@media (min-width: 768px) {
  .quiz-body {
    gap: 56px;
  }
}
