@font-face {
  font-family: 'Noto Sans SC';
  src: url('../fonts/NotoSansSC.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Pixelated Elegance';
  src: url('../fonts/PixelatedElegance.ttf') format('truetype');
  font-display: swap;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans SC', Arial, sans-serif;
  min-height: 100vh;
  padding: 24px;
}

#app { width: 100%; display: flex; align-items: center; justify-content: center; }

.screen {
  width: min(94vw, 680px);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* plain look, used for welcome and the distractor screens */
body.theme-neutral { background: #f4f4f4; color: #111; }
.theme-neutral .panel {
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 48px 40px;
  text-align: center;
}

/* plain white version, no game stuff */
body.theme-nongamified { background: #ffffff; color: #111; }
.theme-nongamified .panel {
  background: #ffffff;
  border: 1px solid #999;
  border-radius: 4px;
  padding: 48px 40px;
  text-align: center;
}

/* dark arcade/crt look with the neon border and stars */
body.theme-gamified { background: #0b0b10; color: #fff; }
.theme-gamified .panel {
  position: relative;
  background: #0d0d13;
  border: 3px solid #ff2fd6;
  box-shadow: 0 0 0 2px #00e5ff inset, 0 0 30px rgba(255, 47, 214, 0.35);
  padding: 48px 40px;
  text-align: center;
  overflow: hidden;
}
.theme-gamified .corner {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ff2fd6;
}
.theme-gamified .corner-tl { top: -3px; left: -3px; }
.theme-gamified .corner-tr { top: -3px; right: -3px; }
.theme-gamified .corner-bl { bottom: -3px; left: -3px; }
.theme-gamified .corner-br { bottom: -3px; right: -3px; }

.theme-gamified .scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0px,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.5;
}

.theme-gamified .stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.theme-gamified .star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle 2.2s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.panel-content { position: relative; z-index: 1; }

.title {
  font-weight: bold;
  font-size: 1.5rem;
  margin: 0 0 8px;
}
.theme-gamified .title { color: #ff2fd6; letter-spacing: 2px; }
.theme-nongamified .title, .theme-neutral .title { color: #111; }

.title-underline {
  width: 120px;
  height: 3px;
  margin: 0 auto 24px;
}
.theme-gamified .title-underline { background: #ff2fd6; }
.theme-nongamified .title-underline, .theme-neutral .title-underline { background: #111; }

.body-text {
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-line;
  margin: 0 0 28px;
}

.hint {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 20px;
}
.theme-gamified .hint { color: #ff2fd6; }

.continue-btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
}
.theme-neutral .continue-btn, .theme-nongamified .continue-btn {
  background: #111;
  color: #fff;
}
.theme-gamified .continue-btn {
  background: #ff2fd6;
  color: #0d0d13;
  font-weight: bold;
  box-shadow: 0 0 12px rgba(255, 47, 214, 0.6);
}
.continue-btn:hover { opacity: 0.9; }
.continue-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.response-input {
  font-family: 'Noto Sans SC', Arial, sans-serif;
  font-size: 1.3rem;
  text-align: center;
  width: 220px;
  padding: 10px;
  border-radius: 4px;
  margin: 8px 0 4px;
}
.theme-nongamified .response-input, .theme-neutral .response-input {
  border: 1px solid #999;
  background: #eee;
  color: #111;
}
.theme-gamified .response-input {
  border: 2px solid #00e5ff;
  background: #171722;
  color: #fff;
}

form { margin: 0; }

.char-stim {
  font-size: 3.4rem;
  font-weight: bold;
  margin-bottom: 8px;
}
.theme-gamified .char-stim { color: #fff; }
.theme-nongamified .char-stim { color: #111; }

.translation-box {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 24px;
  border-radius: 4px;
  font-weight: bold;
}
.theme-gamified .translation-box {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid #00e5ff;
  color: #fff;
}
.theme-nongamified .translation-box {
  background: #eee;
  border: 1px solid #999;
  color: #111;
}

.story-text { text-align: left; }
.story-text p { margin: 0 0 14px; line-height: 1.7; }

.score-banner {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #131333;
  border: 2px solid #00e5ff;
  border-radius: 4px;
  padding: 8px 18px;
  text-align: center;
  font-family: 'Pixelated Elegance', monospace;
  color: #fff;
  z-index: 10;
}
.score-banner .label { font-size: 0.7rem; color: #00e5ff; letter-spacing: 1px; }
.score-banner .value { font-size: 1.4rem; }

.trial-counter {
  position: fixed;
  top: 20px;
  left: 20px;
  font-family: 'Pixelated Elegance', monospace;
  color: #00e5ff;
  font-size: 1rem;
  z-index: 10;
}

.feedback-panel .feedback-msg {
  font-size: 1.4rem;
  font-weight: bold;
  white-space: pre-line;
  margin: 12px 0 20px;
}
.feedback-correct { color: #4ade80; }
.feedback-incorrect { color: #f87171; }
.theme-nongamified .feedback-correct { color: #2e7d32; }
.theme-nongamified .feedback-incorrect { color: #111; }
.theme-nongamified .fb-indicator {
  height: 4px;
  width: 100%;
  margin-bottom: 24px;
}

.leaderboard-list { list-style: none; padding: 0; margin: 16px 0 0; text-align: left; }
.leaderboard-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  margin-bottom: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid #4a4a5a;
}
.leaderboard-row.is-you {
  background: rgba(74, 222, 128, 0.15);
  border-color: #4ade80;
  font-weight: bold;
}
.leaderboard-rank { opacity: 0.6; margin-right: 10px; }

.distractor-list {
  text-align: left;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  line-height: 2.1;
  outline: none;
  margin: 12px 0;
  white-space: pre;
}
.distractor-row { padding: 2px 8px; border-radius: 3px; }
.distractor-row.is-active { background: rgba(0, 0, 0, 0.08); font-weight: bold; }

.judgement-input { width: 100px; }

/* on-screen numeric keypad for the distractor task - lets touchscreen users
   answer the math problems without a physical keyboard, since the problem
   list itself is just a styled div (not a real <input>) so no on-screen
   keyboard would ever pop up on its own */
.keypad { margin-top: 18px; }
.keypad-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
}
.keypad-btn {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.15rem;
  min-width: 48px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #999;
  background: #fff;
  color: #111;
  cursor: pointer;
}
.keypad-btn:active { background: #e5e5e5; }
.keypad-wide { min-width: 76px; font-size: 0.95rem; }
.keypad-next {
  margin-top: 6px;
  width: 100%;
  max-width: 280px;
  min-height: 48px;
}

/* tighten things up on small/phone screens so the panel, list, and keypad
   all comfortably fit without needing to scroll or pinch-zoom */
@media (max-width: 480px) {
  body { padding: 12px; }
  .theme-neutral .panel,
  .theme-nongamified .panel,
  .theme-gamified .panel {
    padding: 28px 18px;
  }
  .char-stim { font-size: 2.4rem; }
  .response-input { width: 100%; max-width: 220px; }
  .distractor-list { font-size: 0.92rem; line-height: 1.9; }
  .keypad-btn { min-width: 42px; min-height: 44px; font-size: 1.05rem; }
  .keypad-wide { min-width: 64px; }
}
