:root {
  --bg-top: #1b1035;
  --bg-bottom: #2f1c63;
  --panel-soft: rgba(40, 23, 81, 0.82);
  --panel-line: #8f78d8;
  --text: #f7f4ff;
  --muted: #cabfe9;
  --shadow: rgba(10, 6, 26, 0.42);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: url("./ChatGPT Image 25 mar 2026, 15_33_16.webp") center/cover no-repeat fixed;
  color: var(--text);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 7, 27, 0.04), rgba(11, 7, 27, 0.08));
}
body::after {
  content: none;
}
button, input { font: inherit; }
.app-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.screen { width: min(1040px, 100%); }
.hidden { display: none !important; }
.pixel-panel {
  background: var(--panel-soft);
  border: 3px solid var(--panel-line);
  border-radius: 22px;
  box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px var(--shadow);
}
.pixel-panel-subtle { background: rgba(29, 20, 58, 0.72); }
.hero-panel { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.hero-panel-centered { align-items: center; text-align: center; }
.screen-start { width: min(760px, 100%); margin: 0 auto; }
.screen-start .hero-panel { padding: 18px 28px 16px; gap: 12px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.78rem; color: #d9d2ff; }
.hero-panel h1, .hero-panel h2, .result-card h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); }
.screen-start .hero-panel h1 {
  font-family: "Courier New", "Lucida Console", monospace;
  font-weight: 900;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: 0.08em;
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow:
    1px 0 0 rgba(255, 226, 188, 0.14),
    -1px 0 0 rgba(112, 206, 255, 0.12),
    0 3px 0 rgba(21, 13, 43, 0.42);
}
.screen-start .hero-copy {
  max-width: 620px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.screen-start .hero-start-btn {
  width: min(220px, 100%);
  min-height: 46px;
  background: linear-gradient(180deg, #8a63ff, #5a39d4);
  border-color: rgba(206, 187, 255, 0.42);
  box-shadow: 0 0 16px rgba(142, 108, 255, 0.34);
}
.hero-copy, .architecture-note span, .prompt-card p, .result-message { margin: 0; color: var(--muted); line-height: 1.5; }
.hero-start-btn { width: min(320px, 100%); }
.flow-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
@media (min-width: 861px) {
  .flow-header-modes {
    position: relative;
    justify-content: center;
    text-align: center;
  }
  .flow-header-modes .nav-back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  .flow-header-modes > div {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}
.nav-back-btn {
  min-width: 118px;
  min-height: 46px;
  border-radius: 14px;
  border: 2px solid rgba(214, 205, 255, 0.22);
  background: linear-gradient(180deg, rgba(92, 73, 161, 0.96), rgba(53, 37, 110, 0.98));
  color: var(--text);
  cursor: pointer;
}
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mode-card, .difficulty-btn, .primary-btn, .secondary-btn, .touch-btn, .choice-answer-btn {
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.mode-card {
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(84, 63, 158, 0.95), rgba(43, 27, 90, 0.98));
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.mode-card:hover, .difficulty-btn:hover, .primary-btn:hover, .secondary-btn:hover, .touch-btn:hover, .nav-back-btn:hover, .choice-answer-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}
.mode-card[data-mode="word_collector"] { border-color: rgba(63, 221, 156, 0.36); }
.mode-card[data-mode="conversation_rush"] { border-color: rgba(255, 188, 92, 0.34); }
.mode-card[data-mode="true_false_dash"] { border-color: rgba(118, 206, 255, 0.34); }
.mode-card[data-mode="word_invaders"] { border-color: rgba(125, 209, 255, 0.34); }
.mode-card[data-mode="spell_bridge"] { border-color: rgba(255, 223, 108, 0.34); }
.mode-art {
  width: 100%;
  height: 132px;
  border-radius: 18px;
  border: 2px solid rgba(255,255,255,0.16);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}
.mode-art::before, .mode-art::after { content: ""; position: absolute; }
.mode-art-collector { background: linear-gradient(180deg, rgba(73, 48, 146, 0.96), rgba(37, 99, 118, 0.92)); }
.mode-art-collector::before {
  left: 20px; bottom: 18px; width: 78px; height: 38px; background: linear-gradient(180deg, #6d51d9, #4430a0);
  border-radius: 10px 10px 6px 6px; box-shadow: 120px -34px 0 -10px #6d51d9, 220px -10px 0 -6px #6d51d9;
}
.mode-art-collector::after {
  left: 28px; bottom: 56px; width: 18px; height: 26px; background: #ffd84a; border-radius: 6px;
  box-shadow: 126px -22px 0 0 #e9fff8, 228px 2px 0 0 #e9fff8, 6px -8px 0 10px #34286f;
}
.mode-art-conversation { background: linear-gradient(180deg, rgba(120, 58, 150, 0.96), rgba(58, 35, 110, 0.96)); }
.mode-art-conversation::before {
  left: 26px; bottom: 18px; width: 26px; height: 54px; background: #34286f; border-radius: 8px 8px 6px 6px;
  box-shadow: 170px -4px 0 0 #4b3898;
}
.mode-art-conversation::after {
  left: 92px; top: 22px; width: 132px; height: 58px; background: rgba(255,255,255,0.92); border-radius: 18px;
  box-shadow: inset 0 -8px 0 rgba(247, 194, 92, 0.18);
}
.mode-art-truefalse { background: linear-gradient(180deg, rgba(51, 69, 144, 0.98), rgba(31, 88, 121, 0.95)); }
.mode-art-truefalse::before {
  left: 34px; bottom: 20px; width: 76px; height: 72px; border-radius: 18px; background: linear-gradient(180deg, #34d392, #1e8b64);
  box-shadow: 180px 0 0 0 #ff6788;
}
.mode-art-truefalse::after {
  left: 62px; top: 28px; width: 18px; height: 38px; border: 5px solid #ffffff; border-top: 0; border-left: 0; transform: rotate(45deg);
  box-shadow: 180px -4px 0 -2px rgba(0,0,0,0), 205px 18px 0 -8px #ffffff, 164px 18px 0 -8px #ffffff;
}
.mode-art-invaders { background: linear-gradient(180deg, rgba(49, 74, 157, 0.98), rgba(24, 34, 88, 0.96)); }
.mode-art-invaders::before {
  left: 28px; bottom: 18px; width: 34px; height: 42px; background: #69d8ff;
  clip-path: polygon(50% 0, 100% 78%, 69% 62%, 50% 100%, 31% 62%, 0 78%);
  box-shadow: 136px -32px 0 -6px #fff8d8, 232px -6px 0 -6px #fff8d8;
}
.mode-art-invaders::after {
  left: 166px; top: 22px; width: 8px; height: 52px; background: #ffd96f;
  box-shadow: -118px 18px 0 -2px #ffd96f, 102px 8px 0 -2px #ffd96f;
}
.mode-art-spellbridge { background: linear-gradient(180deg, rgba(128, 87, 36, 0.96), rgba(73, 43, 17, 0.96)); }
.mode-art-spellbridge::before {
  left: 22px; bottom: 16px; width: 66px; height: 28px; background: #ffdd72; border-radius: 8px;
  box-shadow: 116px -30px 0 -2px #ffdd72, 220px -6px 0 -5px #ffdd72;
}
.mode-art-spellbridge::after {
  left: 44px; top: 24px; width: 194px; height: 46px; border-radius: 16px; background: rgba(255,255,255,0.92);
  box-shadow: inset 0 -8px 0 rgba(255, 206, 93, 0.22);
}
.screen-game[data-mode="word_collector"] .hud,
.screen-game[data-mode="word_collector"] .prompt-card { border-color: rgba(63, 221, 156, 0.34); }
.screen-game[data-mode="word_collector"] .prompt-row { display: none; }
.screen-game[data-mode="conversation_rush"] .hud,
.screen-game[data-mode="conversation_rush"] .prompt-card { border-color: rgba(255, 188, 92, 0.34); }
.screen-game[data-mode="conversation_rush"] .prompt-row { display: none; }
.screen-game[data-mode="conversation_rush"] #answerPanel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
.screen-game[data-mode="true_false_dash"] .hud,
.screen-game[data-mode="true_false_dash"] .prompt-card { border-color: rgba(118, 206, 255, 0.34); }
.screen-game[data-mode="true_false_dash"] .prompt-row { display: none; }
.screen-game[data-mode="true_false_dash"] #answerPanel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
.screen-game[data-mode="spell_bridge"] .hud,
.screen-game[data-mode="spell_bridge"] .prompt-card { border-color: rgba(255, 223, 108, 0.34); }
.screen-game[data-mode="spell_bridge"] .prompt-row { display: none; }
.screen-game[data-mode="word_collector"] .stage-wrap { box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px rgba(63, 221, 156, 0.08); }
.screen-game[data-mode="conversation_rush"] .stage-wrap { box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px rgba(255, 188, 92, 0.08); }
.screen-game[data-mode="true_false_dash"] .stage-wrap { box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px rgba(118, 206, 255, 0.08); }
.screen-game[data-mode="word_invaders"] .hud,
.screen-game[data-mode="word_invaders"] .prompt-card { border-color: rgba(125, 209, 255, 0.34); }
.screen-game[data-mode="word_invaders"] .prompt-row { display: none; }
.screen-game[data-mode="word_invaders"] .hud {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px 14px;
  gap: 8px;
}
.screen-game[data-mode="word_invaders"] .hud-mode,
.screen-game[data-mode="word_invaders"] .hud-objective { display: none; }
.screen-game[data-mode="word_invaders"] .hud > div strong { font-size: clamp(0.88rem, 1.2vw, 1rem); }
.screen-game[data-mode="word_invaders"] .stage-wrap { box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px rgba(125, 209, 255, 0.08); }
.screen-game[data-mode="spell_bridge"] .stage-wrap { box-shadow: 0 14px 0 rgba(15, 10, 36, 0.7), 0 18px 40px rgba(255, 223, 108, 0.08); }
.mode-title { font-size: 1.3rem; font-weight: 800; }
.mode-desc, .difficulty-desc { color: var(--muted); line-height: 1.45; }
.difficulty-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.difficulty-btn {
  min-height: 122px; padding: 18px; border-radius: 18px; background: linear-gradient(180deg, rgba(85, 61, 156, 0.9), rgba(53, 34, 107, 0.95));
  color: var(--text); text-align: left; display: flex; flex-direction: column; justify-content: space-between; box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.difficulty-btn[data-level="easy"] { border-color: rgba(61, 220, 151, 0.35); }
.difficulty-btn[data-level="medium"] { border-color: rgba(255, 179, 71, 0.35); }
.difficulty-btn[data-level="hard"] { border-color: rgba(255, 111, 174, 0.35); }
.difficulty-name { font-size: 1.3rem; font-weight: 800; }
.architecture-note { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.screen-game { display: flex; flex-direction: column; gap: 12px; position: relative; }
.hud { padding: 13px 16px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.hud > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hud > div strong { font-size: clamp(0.9rem, 1.35vw, 1.08rem); line-height: 1.15; overflow-wrap: anywhere; }
.hud-label, .prompt-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.prompt-row { display: grid; grid-template-columns: 1.25fr 0.95fr; gap: 12px; }
.prompt-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; }
.prompt-card strong { font-size: clamp(1.28rem, 2.4vw, 1.85rem); line-height: 1.1; }
.prompt-card p { font-size: 0.92rem; line-height: 1.4; }
.prompt-card-secondary strong { font-size: 1.08rem; }
.answer-panel {
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(180deg, rgba(72, 48, 126, 0.96), rgba(37, 25, 78, 0.98));
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}
.screen-game[data-mode="conversation_rush"] .answer-panel {
  opacity: 0.94;
  transform: translateY(0);
}
.screen-game[data-mode="conversation_rush"] .answer-panel.is-pending {
  opacity: 0.68;
  transform: translateY(8px);
}
.answer-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.answer-copy strong { font-size: 0.98rem; line-height: 1.15; }
.text-answer-form { display: flex; gap: 12px; width: min(480px, 100%); }
.text-answer-input {
  flex: 1; min-height: 46px; border-radius: 14px; border: 2px solid rgba(214, 205, 255, 0.24);
  background: rgba(21, 13, 43, 0.95); color: var(--text); padding: 0 16px;
}
.text-answer-input::placeholder { color: #a998d9; }
.answer-submit { min-width: 138px; }
.choice-answer-group { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.choice-answer-btn {
  min-height: 42px; padding: 0 16px; border-radius: 14px; color: #fff;
  background: linear-gradient(180deg, rgba(101, 81, 180, 0.96), rgba(55, 39, 114, 0.98));
  border-color: rgba(214, 205, 255, 0.2);
}
.choice-answer-btn[data-choice="true"] { background: linear-gradient(180deg, #35d98f, #1a8e5d); }
.choice-answer-btn[data-choice="false"] { background: linear-gradient(180deg, #ff6e94, #b63156); }
.stage-wrap { padding: 12px; background: linear-gradient(180deg, rgba(44, 28, 90, 0.98), rgba(22, 14, 45, 0.98)); }
#gameCanvas {
  display: block; width: 100%; height: auto; border-radius: 14px; border: 3px solid rgba(196, 184, 255, 0.26);
  background: linear-gradient(180deg, #29185d 0%, #362170 45%, #1d5c73 45%, #164658 100%); image-rendering: pixelated;
}
.controls-row { display: none; justify-content: space-between; align-items: center; gap: 14px; }
.control-hint { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); }
.touch-controls { display: flex; gap: 10px; }
.touch-btn {
  width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(180deg, #5a43b5, #37236f); color: white;
  border-color: rgba(214, 205, 255, 0.3); font-size: 1.25rem; font-weight: 800;
}
.touch-btn-jump { background: linear-gradient(180deg, #35d98f, #1b8b5b); }
.touch-btn-alt { background: linear-gradient(180deg, #4e61d7, #28378f); }
.result-modal {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(8, 6, 20, 0.65); backdrop-filter: blur(4px);
}
.result-card { width: min(460px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.result-score { display: flex; flex-direction: column; gap: 6px; }
.result-score strong { font-size: 3rem; }
.result-stats, .result-rewards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.result-stat {
  padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  display: flex; flex-direction: column; gap: 6px;
}
.reward-stat strong { color: #ffe58f; }
.result-actions { display: flex; gap: 12px; }
.primary-btn, .secondary-btn { flex: 1; min-height: 52px; border-radius: 16px; color: white; }
.primary-btn { background: linear-gradient(180deg, #36d68c, #17935d); }
.secondary-btn { background: linear-gradient(180deg, #5b4c90, #3a2d61); border-color: rgba(214, 205, 255, 0.28); }

@media (max-width: 860px) {
  .mode-grid, .difficulty-list, .prompt-row { grid-template-columns: 1fr; }
  .flow-header, .controls-row, .result-actions, .answer-panel, .text-answer-form { flex-direction: column; align-items: stretch; }
  .choice-answer-group { justify-content: stretch; }
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "mode difficulty"
      "time score"
      "round round"
      "objective objective";
    gap: 12px 14px;
    padding: 14px 16px;
  }
  .hud > div {
    gap: 4px;
    min-width: 0;
  }
  .hud-mode { grid-area: mode; }
  .hud-difficulty { grid-area: difficulty; }
  .hud-time { grid-area: time; }
  .hud-score { grid-area: score; }
  .hud-round { grid-area: round; }
  .hud-label {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
  }
  .hud > div strong {
    font-size: 1.08rem;
    line-height: 1.12;
  }
  .hud-objective {
    grid-area: objective;
    grid-column: 1 / -1;
    padding-top: 2px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .touch-controls { width: 100%; justify-content: center; }
  .controls-row { display: flex; }
  .screen-game:not([data-mode="word_invaders"]) .control-hint { display: none; }
  .screen-game:not([data-mode="word_invaders"]) #moveUp,
  .screen-game:not([data-mode="word_invaders"]) #moveDown { display: none; }
}

@media (max-width: 560px) {
  .app-shell { padding: 14px; }
  .hero-panel, .result-card { padding: 20px; }
  .prompt-card strong { font-size: 1.35rem; }
  .touch-btn { width: 54px; height: 54px; }
  .mode-art { height: 110px; }
}
