:root {
  --ink: #17202a;
  --muted: #667085;
  --paper: #fffdf7;
  --panel: rgba(255, 255, 255, 0.9);
  --teal: #12b5a5;
  --coral: #ff6b5f;
  --gold: #f8c84e;
  --indigo: #3347a5;
  --green: #24a148;
  --red: #d92d20;
  --shadow: 0 24px 70px rgba(23, 32, 42, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(246, 241, 232, 0.58), rgba(246, 241, 232, 0.72)),
    url("rumah-nobita.jpg") center / cover fixed,
    linear-gradient(135deg, rgba(18, 181, 165, 0.18), transparent 30%),
    linear-gradient(315deg, rgba(255, 107, 95, 0.17), transparent 34%),
    #f6f1e8;
  overflow-x: hidden;
}

/* class background scene marker */
.background-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.scene-character {
  position: absolute;
  bottom: 0;
  max-height: min(36vh, 330px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 20px 22px rgba(23, 32, 42, 0.24));
  user-select: none;
  will-change: transform;
}

.doraemon-img {
  left: max(8px, 4vw);
  animation: floatDoraemon 7.5s ease-in-out infinite alternate;
}

.nobita-img {
  right: max(8px, 5vw);
  max-height: min(34vh, 310px);
  animation: floatNobita 8.5s ease-in-out infinite alternate;
  animation-delay: -1.8s;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 32, 42, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.055) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button {
  font: inherit;
}

.app-shell {
  width: min(980px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
  position: relative;
  z-index: 1;
}

.hidden {
  display: none !important;
}

.hero-panel,
.quiz-panel,
.result-panel {
  width: 100%;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-panel {
  min-height: min(620px, calc(100vh - 56px));
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(26px, 6vw, 72px);
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "日本語";
  position: absolute;
  right: clamp(18px, 7vw, 80px);
  bottom: clamp(12px, 5vw, 54px);
  font-size: clamp(4rem, 18vw, 13rem);
  font-weight: 900;
  color: rgba(51, 71, 165, 0.08);
  line-height: 1;
}

.brand-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 2.4rem;
  font-weight: 800;
  box-shadow: 10px 10px 0 var(--gold);
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--indigo);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: clamp(2.3rem, 7vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.primary-btn,
.answer-btn,
.tts-btn {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn {
  min-height: 54px;
  padding: 0 24px;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  font-weight: 850;
  box-shadow: 0 12px 0 rgba(217, 45, 32, 0.18), 0 18px 34px rgba(255, 107, 95, 0.32);
}

.primary-btn:hover,
.answer-btn:hover,
.tts-btn:hover {
  transform: translateY(-2px);
}

.quiz-panel,
.result-panel {
  padding: clamp(18px, 4vw, 34px);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.quiz-header h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

.score-chip {
  min-width: 92px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 850;
}

.timer-wrap {
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(23, 32, 42, 0.11);
  margin-bottom: 18px;
}

.timer-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  transform-origin: left center;
  transition: width 90ms linear;
}

.question-card {
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 8px;
  background: #fffaf0;
  padding: clamp(18px, 4vw, 32px);
  margin-bottom: 18px;
}

.question-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

#questionBadge {
  display: inline-grid;
  min-width: 88px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: rgba(248, 200, 78, 0.24);
  color: #8a6100;
  font-size: 0.84rem;
  font-weight: 850;
}

.tts-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--indigo);
  color: white;
  font-size: 1.15rem;
  box-shadow: 0 10px 18px rgba(51, 71, 165, 0.22);
}

.question-text {
  min-height: 86px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  font-size: clamp(2rem, 7vw, 4.7rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.reading-text {
  min-height: 28px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 750;
}

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

.answer-btn {
  min-height: 72px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(23, 32, 42, 0.12);
  background: white;
  color: var(--ink);
  font-weight: 800;
  font-size: clamp(0.98rem, 2.2vw, 1.18rem);
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
  overflow-wrap: anywhere;
}

.answer-btn.correct {
  background: rgba(36, 161, 72, 0.14);
  border-color: var(--green);
  color: #12612d;
}

.answer-btn.wrong {
  background: rgba(217, 45, 32, 0.12);
  border-color: var(--red);
  color: #8f1f17;
}

.answer-btn:disabled {
  cursor: default;
  transform: none;
}

.feedback-line {
  min-height: 34px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.result-panel {
  max-width: 720px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-badge {
  width: max-content;
  margin: 0 auto 18px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 850;
}

.result-panel h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.3rem);
  letter-spacing: 0;
}

.final-score {
  margin: 8px 0 12px;
  color: var(--indigo);
  font-size: clamp(3.5rem, 13vw, 7rem);
  line-height: 1;
  font-weight: 950;
}

.result-message {
  max-width: 560px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 auto 20px;
}

.result-stats div {
  border: 1px solid rgba(23, 32, 42, 0.1);
  border-radius: 8px;
  background: white;
  padding: 16px 10px;
}

.result-stats span {
  display: block;
  font-size: 1.8rem;
  font-weight: 900;
}

.result-stats small,
.refresh-note {
  color: var(--muted);
  font-weight: 750;
}

.refresh-note {
  margin-bottom: 0;
}

.ending-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.firework {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  animation: burst 950ms ease-out forwards;
}

.sad-drop {
  position: absolute;
  top: -70px;
  font-size: 2rem;
  animation: sadRain linear forwards;
  filter: drop-shadow(0 8px 12px rgba(23, 32, 42, 0.15));
}

@keyframes burst {
  0% {
    transform: translate(0, 0) scale(0.5);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(1.5);
    opacity: 0;
  }
}

@keyframes sadRain {
  to {
    transform: translateY(calc(100vh + 120px)) rotate(20deg);
    opacity: 0.08;
  }
}

@keyframes floatDoraemon {
  0% {
    transform: translate(0, 4%) rotate(-2deg);
  }
  35% {
    transform: translate(30px, -16px) rotate(2deg);
  }
  70% {
    transform: translate(72px, 8px) rotate(-1deg);
  }
  100% {
    transform: translate(42px, -28px) rotate(3deg);
  }
}

@keyframes floatNobita {
  0% {
    transform: translate(0, 5%) rotate(2deg);
  }
  35% {
    transform: translate(-34px, -20px) rotate(-2deg);
  }
  70% {
    transform: translate(-78px, 8px) rotate(1deg);
  }
  100% {
    transform: translate(-44px, -30px) rotate(-3deg);
  }
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(rgba(246, 241, 232, 0.68), rgba(246, 241, 232, 0.82)),
      url("rumah-nobita.jpg") center / cover fixed,
      #f6f1e8;
  }

  .scene-character {
    max-height: 22vh;
    opacity: 0.85;
  }

  .app-shell {
    width: min(100% - 18px, 980px);
    padding: 9px 0;
  }

  .hero-panel {
    min-height: calc(100vh - 18px);
  }

  .quiz-header {
    align-items: stretch;
  }

  .score-chip {
    min-width: 74px;
  }

  .answer-grid,
  .result-stats {
    grid-template-columns: 1fr;
  }

  .answer-btn {
    min-height: 64px;
  }
}
