*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #fef4ff 0%, #ffe8f5 30%, #e4f7ff 100%);
  color: #222;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  max-width: 640px;
  margin: 0 auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.level-tabs {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.level-tab {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  background: rgba(255, 255, 255, 0.7);
  color: #555;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.level-tab--active {
  background: linear-gradient(135deg, #ffd36a, #ff9a9a);
  color: #452100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.level-tab:active {
  transform: scale(0.97);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-icon {
  font-size: 1.4rem;
}

.brand-text {
  font-family: 'Baloo 2', system-ui, cursive;
  font-size: 1.05rem;
  font-weight: 600;
}

.meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.7rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.meta-label {
  opacity: 0.7;
}

.meta-value {
  font-weight: 700;
  margin-top: 0.1rem;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hero-section {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.mascot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.mascot-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #fff, #ffd6a0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.mascot-badge {
  font-size: 0.7rem;
  background: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.mascot-speech {
  flex: 1;
}

.mascot-speech p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  background: #ffffff;
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.game-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.game-section--crossing {
  justify-content: center;
}

.crossing-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.road {
  width: 90%;
  max-width: 360px;
  height: 90px;
  border-radius: 16px;
  background: linear-gradient(180deg, #555 0%, #222 100%);
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35);
  margin-bottom: 0.4rem;
}

.zebra {
  position: absolute;
  inset: 16px 24px;
  display: flex;
  justify-content: space-between;
}

.zebra .stripe {
  flex: 1;
  margin: 0 3px;
  background: #fdfdfd;
  border-radius: 4px;
  opacity: 0.9;
}

.kid {
  position: absolute;
  bottom: 4px;
  left: 8px;
  font-size: 1.6rem;
}

.cross-sequence {
  margin: 0.2rem 0 0;
  font-weight: 700;
  color: #444;
}

.crossing-buttons {
  margin-top: 0.2rem;
}

.btn-cross {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  touch-action: manipulation;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-cross[data-cross='left'],
.btn-cross[data-cross='right'] {
  background: #e3f4ff;
  color: #144d7f;
}

.btn-cross[data-cross='cross'] {
  background: #e8ffe5;
  color: #1a7a1a;
}

.btn-cross:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.game-section--signs {
  justify-content: flex-start;
}

.signs-grid {
  width: 100%;
  max-width: 460px;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.signs-row {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

.sign-card,
.meaning-card {
  flex: 1;
  min-height: 72px;
  border-radius: 16px;
  border: none;
  padding: 0.5rem 0.4rem;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.sign-card .sign-icon {
  font-size: 1.5rem;
}

.sign-card .sign-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.meaning-card {
  font-size: 0.8rem;
}

.sign-card--selected,
.meaning-card--selected {
  border: 2px solid #5a8bff;
  background: #edf3ff;
}

.sign-card--matched,
.meaning-card--matched {
  opacity: 0.6;
  background: #e9ffe8;
  border-color: #4caf50;
}

.is-hidden {
  display: none;
}

.signal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.signal-body {
  width: 80px;
  padding: 0.4rem 0.25rem;
  border-radius: 24px;
  background: linear-gradient(180deg, #1f2733 0%, #151a23 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.signal-light {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111;
  opacity: 0.35;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
  transition: opacity 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.signal-light.active.red {
  background: radial-gradient(circle at 30% 20%, #ffe5e5, #ff4b4b);
  opacity: 1;
  box-shadow: 0 0 14px rgba(255, 75, 75, 0.8);
}

.signal-light.active.yellow {
  background: radial-gradient(circle at 30% 20%, #fff9d9, #ffc933);
  opacity: 1;
  box-shadow: 0 0 14px rgba(255, 201, 51, 0.8);
}

.signal-light.active.green {
  background: radial-gradient(circle at 30% 20%, #e0ffe8, #18d36a);
  opacity: 1;
  box-shadow: 0 0 14px rgba(24, 211, 106, 0.8);
}

.signal-pole {
  width: 14px;
  height: 70px;
  margin-top: 0.25rem;
  border-radius: 10px;
  background: linear-gradient(180deg, #394656 0%, #151a23 100%);
}

.question-area {
  text-align: center;
  padding: 0 0.3rem;
}

.question-area h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
}

.answer-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  max-width: 420px;
}

.btn-answer {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  touch-action: manipulation;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-answer[data-action='stop'] {
  background: #ffe1e1;
  color: #b30000;
}

.btn-answer[data-action='slow'] {
  background: #fff7d6;
  color: #b38700;
}

.btn-answer[data-action='go'] {
  background: #ddffe7;
  color: #0c7a34;
}

.btn-answer:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.feedback-section {
  margin-top: 0.2rem;
}

.feedback-bubble {
  padding: 0.45rem 0.7rem;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.app-footer {
  padding-top: 0.35rem;
}

.btn-primary {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(135deg, #ffb057, #ff7a7a);
  color: #411302;
  box-shadow: 0 5px 14px rgba(255, 122, 122, 0.45);
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(255, 122, 122, 0.4);
}

@media (min-width: 720px) {
  .app {
    margin-top: 0.75rem;
  }

  .hero-section {
    max-width: 520px;
    margin: 0 auto;
  }

  .game-section {
    max-width: 520px;
    margin: 0.2rem auto 0;
  }
}

