:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --primary: #ff6b6b;
  --primary-dark: #e85555;
  --secondary: #4ecdc4;
  --accent: #ffe66d;
  --text: #2d3436;
  --text-muted: #636e72;
  --success: #00b894;
  --error: #ff7675;
  --shadow: 0 8px 24px rgba(45, 52, 54, 0.12);
  --radius: 20px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: linear-gradient(160deg, #fff8f0 0%, #e8f8f5 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  min-height: 100vh;
}

.screen {
  display: none;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

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

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.mascot {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
}

h1 {
  font-size: 2rem;
  color: var(--primary);
}

.tagline {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 1rem;
}

.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  line-height: 1.8;
}

.stats-card strong {
  color: var(--secondary);
  font-size: 1.2rem;
}

.mode-grid {
  display: grid;
  gap: 16px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px 24px;
  border: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s, border-color 0.15s;
}

.mode-btn:hover {
  transform: translateY(-2px);
  border-color: var(--secondary);
}

.mode-btn:active {
  transform: translateY(0);
}

.mode-icon {
  font-size: 2rem;
}

.mode-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

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

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 8px;
}

.game-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stars {
  font-size: 1.2rem;
  min-width: 80px;
  text-align: right;
}

.btn-ghost,
.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 12px 20px;
  transition: transform 0.1s, background 0.15s;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  font-weight: 700;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid #dfe6e9;
  width: 100%;
}

.game-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.question {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
}

.answer-display {
  margin-top: 16px;
  font-size: 3rem;
  font-weight: 800;
  color: var(--secondary);
  min-height: 1.2em;
}

.feedback {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  min-height: 1.5em;
}

.feedback.correct {
  color: var(--success);
}

.feedback.wrong {
  color: var(--error);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button {
  border: none;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.5rem;
  font-weight: 700;
  padding: 18px 0;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.1s, background 0.1s;
}

.keypad button:hover {
  background: #f1f2f6;
}

.keypad button:active {
  transform: scale(0.96);
}

.keypad .key-clear {
  font-size: 1rem;
  color: var(--text-muted);
}

.keypad .key-submit {
  background: var(--secondary);
  color: white;
  font-size: 1.1rem;
}

.keypad .key-submit:hover {
  background: #3dbdb4;
}

.keypad.disabled button {
  pointer-events: none;
  opacity: 0.5;
}

.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 40px;
}

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

.result-card h2 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.result-score {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.result-score strong {
  color: var(--primary);
  font-size: 1.5rem;
}

.result-message {
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.6;
}

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

@media (min-width: 400px) {
  .question {
    font-size: 3rem;
  }
}
