:root {
  --bg-top: #f4fbff;
  --bg-bottom: #e4f4ff;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: #ffffff;
  --text: #183153;
  --text-soft: #5c7494;
  --primary: #ff8a5b;
  --primary-strong: #ff7043;
  --secondary: #48c7c8;
  --secondary-strong: #2ba7ab;
  --accent: #ffd766;
  --accent-strong: #ffc83d;
  --success: #29b36a;
  --error: #dc5b6b;
  --shadow: 0 24px 60px rgba(62, 110, 149, 0.18);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-title: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  --font-body: Verdana, "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(255, 215, 102, 0.65), transparent 26%),
    radial-gradient(circle at right center, rgba(72, 199, 200, 0.25), transparent 24%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 28px 16px;
}

.sky {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.8;
  pointer-events: none;
}

.sky-left {
  top: -110px;
  left: -80px;
  width: 240px;
  height: 240px;
  background: rgba(255, 215, 102, 0.35);
}

.sky-right {
  right: -70px;
  bottom: 40px;
  width: 220px;
  height: 220px;
  background: rgba(72, 199, 200, 0.28);
}

.app-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 40px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 28px;
}

.screen {
  display: none;
}

.screen-active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 26px;
}

.eyebrow,
.mini-label,
.question-tag {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
}

.eyebrow,
.mini-label {
  color: var(--secondary-strong);
}

.question-tag {
  color: var(--primary-strong);
}

h1,
h2,
h3 {
  font-family: var(--font-title);
  margin: 0;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.hero-text,
.panel-head p,
.result-message {
  color: var(--text-soft);
  line-height: 1.65;
}

.hero-badges {
  display: grid;
  gap: 14px;
  justify-items: end;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 14px 20px;
  border-radius: 22px;
  font-family: var(--font-title);
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(39, 88, 121, 0.12);
}

.badge-sun {
  background: #fff2c5;
  color: #7b5700;
  width: 180px;
  transform: rotate(-4deg);
}

.badge-star {
  background: #dffaf5;
  color: #0f6f72;
  width: 220px;
  transform: rotate(3deg);
}

.badge-cloud {
  background: #ffe3da;
  color: #983e1f;
  width: 250px;
  transform: rotate(-2deg);
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  background: var(--card-strong);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: 0 10px 30px rgba(66, 110, 146, 0.08);
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin-bottom: 6px;
  font-size: 1.5rem;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choice-pill {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: #eef7ff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.choice-pill:hover,
.choice-pill:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(66, 110, 146, 0.14);
}

.choice-pill.selected {
  background: linear-gradient(135deg, var(--secondary), #63d6d7);
  color: #ffffff;
}

.table-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.table-row label {
  font-weight: 700;
}

select {
  min-width: 210px;
  border: 2px solid #d7e7f5;
  border-radius: 16px;
  background: #f9fcff;
  color: var(--text);
  padding: 12px 16px;
}

select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cta-row {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.primary-button,
.secondary-button,
.ghost-button {
  border: 0;
  border-radius: 20px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible {
  transform: translateY(-2px);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(255, 112, 67, 0.26);
}

.secondary-button {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-strong));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(43, 167, 171, 0.24);
}

.ghost-button {
  background: #edf6ff;
  color: var(--text);
}

.large-button {
  min-width: 280px;
  min-height: 60px;
  font-size: 1.1rem;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-radius: 999px;
  background: #fff5d8;
  color: #8a5f00;
  font-weight: 700;
}

.progress-card,
.question-card,
.result-card {
  background: var(--card-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 28px rgba(66, 110, 146, 0.08);
}

.progress-card {
  margin-top: 24px;
  padding: 16px 20px;
}

.progress-copy {
  margin-bottom: 12px;
}

.progress-copy-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.progress-copy h2 {
  font-size: clamp(1.2rem, 2.6vw, 1.9rem);
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e7f0fa;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 220ms ease;
}

.question-card {
  margin-top: 22px;
  padding: 24px 28px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.question-card h3 {
  margin-top: 10px;
  font-size: clamp(2rem, 4.4vw, 3rem);
}

.answer-label {
  display: block;
  margin-top: 18px;
  margin-bottom: 10px;
  font-weight: 700;
}

#answer-input {
  width: min(280px, 100%);
  margin: 0 auto;
  display: block;
  text-align: center;
  border: 3px solid #dce9f6;
  border-radius: 20px;
  padding: 18px 16px;
  font-size: 1.8rem;
  color: var(--text);
  background: #f9fcff;
}

#answer-input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 4px rgba(72, 199, 200, 0.18);
}

.game-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.game-actions.centered {
  justify-content: center;
}

.feedback {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
}

.feedback-popup {
  --bubble-top: 16%;
  --bubble-left: 8%;
  --bubble-width: 48%;
  --bubble-min-height: 24%;
  --bubble-text-color: #183153;
  margin: 22px auto 0;
  width: min(100%, 640px);
  transform-origin: bottom center;
  animation: feedback-pop 220ms ease-out;
}

.feedback-popup.success {
  --bubble-text-color: #16613a;
}

.feedback-popup.error {
  --bubble-text-color: #9f3041;
}

.feedback-scene {
  position: relative;
  width: 100%;
}

.feedback-character {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 14px 20px rgba(66, 110, 146, 0.18));
  user-select: none;
}

.feedback-overlay {
  position: absolute;
  top: var(--bubble-top);
  left: var(--bubble-left);
  width: var(--bubble-width);
  min-height: var(--bubble-min-height);
  display: grid;
  place-items: center;
  padding: 12px 14px;
  text-align: center;
  font-size: clamp(0.94rem, 1.4vw, 1.08rem);
  color: var(--bubble-text-color);
  white-space: pre-line;
  pointer-events: none;
  overflow-wrap: anywhere;
}

@keyframes feedback-pop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-card {
  padding: 32px;
  text-align: center;
}

.result-score {
  font-family: var(--font-title);
  font-size: clamp(2rem, 6vw, 4rem);
  margin: 18px 0 8px;
  color: var(--primary-strong);
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 26px 0 8px;
  flex-wrap: wrap;
}

.result-stars span {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff3c6;
  color: #9b6b00;
  font-size: 1.6rem;
  box-shadow: 0 8px 16px rgba(255, 200, 61, 0.18);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .app-card {
    padding: 20px;
    border-radius: 28px;
  }

  .hero,
  .menu-grid {
    grid-template-columns: 1fr;
  }

  .hero-badges {
    justify-items: stretch;
  }

  .badge {
    width: auto;
    transform: none;
  }

  .progress-copy {
    margin-bottom: 10px;
  }

  .progress-copy-main {
    flex-direction: column;
    align-items: start;
  }

  .game-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .feedback-popup {
    width: 100%;
    align-items: center;
  }

  .status-pill,
  .ghost-button {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 14px;
  }

  .app-card {
    padding: 16px;
  }

  .question-card,
  .result-card,
  .progress-card,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .feedback-popup {
    width: 100%;
  }

  .feedback-overlay {
    padding: 10px 12px;
    font-size: clamp(0.86rem, 3.1vw, 0.98rem);
  }

  .large-button {
    min-width: 0;
  }
}
