:root {
  --sky: #66c9ff;
  --ocean: #1b8bd6;
  --leaf: #50b84d;
  --lime: #b7e655;
  --sun: #ffd34d;
  --orange: #ff9f35;
  --coral: #ff6f61;
  --rose: #f45aa2;
  --violet: #7b55d9;
  --ink: #243047;
  --muted: #657083;
  --paper: #fff4cf;
  --paper-deep: #f6d985;
  --white: #ffffff;
  --success: #2fbf71;
  --danger: #e94b5f;
  --shadow: 0 18px 38px rgba(45, 59, 96, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 255, 255, 0.9) 0 6%, transparent 7%),
    radial-gradient(circle at 84% 14%, rgba(255, 255, 255, 0.85) 0 5%, transparent 6%),
    linear-gradient(180deg, #63caff 0%, #9ce6ff 42%, #a8e46b 100%);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 10px;
  border: 3px solid rgba(112, 76, 35, 0.25);
  border-radius: 24px;
  background: rgba(255, 244, 207, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  font-weight: 900;
  color: #6a401a;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(145deg, var(--violet), var(--rose));
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
}

.status-pills {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 12px;
  border: 2px solid rgba(112, 76, 35, 0.18);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 800;
}

.badge-pill {
  color: #5c2d91;
  background: #f3e9ff;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff7d7, #ffd65b);
  box-shadow: inset 0 -5px rgba(138, 89, 20, 0.22), 0 5px 12px rgba(74, 47, 18, 0.2);
  font-size: 1.32rem;
  transition: transform 180ms ease, filter 180ms ease;
}

.icon-button:hover,
.primary-button:hover,
.choice-button:hover,
.map-node:not(.locked):hover,
.word-chip:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.04);
}

.screen {
  max-width: 1180px;
  min-height: calc(100vh - 110px);
  margin: 0 auto;
}

body.start-mode,
body:has(.start-game-screen) {
  background: #070414;
}

body.start-mode .topbar,
body:has(.start-game-screen) .topbar {
  display: none;
}

body.start-mode .app-shell,
body:has(.start-game-screen) .app-shell {
  padding: 0;
}

.screen:has(.start-game-screen) {
  max-width: none;
  min-height: 100vh;
}

.panel {
  border: 4px solid rgba(112, 76, 35, 0.26);
  border-radius: 30px;
  background: rgba(255, 244, 207, 0.94);
  box-shadow: var(--shadow);
}

.start-game-screen {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 112px);
  overflow: hidden;
  border: 4px solid rgba(134, 101, 255, 0.44);
  border-radius: 32px;
  background:
    linear-gradient(90deg, rgba(7, 8, 22, 0.86), rgba(12, 8, 28, 0.24) 28%, rgba(12, 8, 28, 0.24) 72%, rgba(7, 8, 22, 0.86)),
    linear-gradient(180deg, rgba(7, 8, 22, 0.2), rgba(7, 8, 22, 0.86)),
    url("images/bg1.png") center / cover no-repeat;
  box-shadow: 0 28px 60px rgba(8, 9, 30, 0.45);
}

.start-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 220, 91, 0.28), transparent 19%),
    radial-gradient(circle at 50% 46%, rgba(123, 85, 217, 0.26), transparent 21%),
    radial-gradient(circle at 15% 82%, rgba(34, 147, 255, 0.28), transparent 18%),
    radial-gradient(circle at 87% 78%, rgba(244, 90, 162, 0.26), transparent 18%);
  animation: floatGlow 5s ease-in-out infinite alternate;
}

.start-character {
  position: absolute;
  z-index: 2;
  width: min(32vw, 320px);
  max-height: 74%;
  object-fit: contain;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.55)) saturate(1.08);
  mix-blend-mode: lighten;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 54%, rgba(0, 0, 0, 0.7) 68%, transparent 82%);
  mask-image: radial-gradient(ellipse at center, #000 54%, rgba(0, 0, 0, 0.7) 68%, transparent 82%);
  animation: bob 3.2s ease-in-out infinite;
}

.start-character-left {
  left: max(8px, 2.5vw);
  bottom: 34px;
}

.start-character-right {
  right: max(2px, 1vw);
  bottom: 28px;
  animation-delay: 0.35s;
}

.game-start-panel {
  position: relative;
  z-index: 4;
  display: grid;
  justify-items: center;
  width: min(680px, calc(100% - 320px));
  min-height: 520px;
  padding: 22px 24px 24px;
  border: 3px solid rgba(255, 219, 98, 0.34);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(30, 20, 64, 0.78), rgba(16, 10, 32, 0.58)),
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.18), transparent 34%);
  box-shadow: inset 0 0 0 2px rgba(141, 102, 255, 0.2), 0 24px 45px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
}

.start-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.start-status-row span {
  min-height: 34px;
  padding: 7px 12px;
  border: 2px solid rgba(255, 224, 111, 0.22);
  border-radius: 999px;
  color: #fff7d2;
  background: rgba(23, 18, 46, 0.78);
  font-size: 0.9rem;
  font-weight: 900;
}

.game-logo {
  display: grid;
  justify-items: center;
  text-align: center;
}

.logo-small {
  color: #ffc95b;
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  font-weight: 1000;
  letter-spacing: 1px;
  text-shadow: 0 3px 0 #6b320d, 0 0 16px rgba(255, 219, 91, 0.5);
}

.game-logo h1 {
  margin: -4px 0 4px;
  color: #f4d9ff;
  font-size: clamp(3.2rem, 8vw, 6.6rem);
  line-height: 0.82;
  font-weight: 1000;
  text-shadow:
    0 4px 0 #632886,
    0 9px 0 #321747,
    0 0 28px rgba(206, 118, 255, 0.66);
}

.logo-ribbon {
  min-width: min(430px, 100%);
  padding: 8px 18px 10px;
  border: 3px solid rgba(255, 224, 111, 0.36);
  border-radius: 12px;
  color: #4b2505;
  background: linear-gradient(180deg, #ffe074, #f2a72c);
  box-shadow: inset 0 -5px rgba(102, 51, 7, 0.18), 0 9px 18px rgba(0, 0, 0, 0.24);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 1000;
}

.start-tagline {
  margin: 16px 0 14px;
  color: #e8f5ff;
  font-size: clamp(1rem, 2vw, 1.24rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.start-play-button,
.start-help-button,
.start-map-button {
  border: 0;
  border-radius: 18px;
  font-weight: 1000;
  transition: transform 180ms ease, filter 180ms ease;
}

.start-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 66px;
  padding: 14px 30px;
  color: #5d2f00;
  background: linear-gradient(180deg, #fff36b, #ffae26);
  box-shadow: inset 0 -8px rgba(112, 65, 0, 0.24), 0 0 30px rgba(255, 207, 68, 0.42), 0 13px 0 rgba(74, 42, 6, 0.35);
  font-size: 1.42rem;
}

.start-play-button span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--white);
  background: #45b84d;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
}

.start-help-button,
.start-map-button {
  min-height: 54px;
  padding: 12px 18px;
  color: #f6ecff;
  background: linear-gradient(180deg, #8054d8, #4f2f96);
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.2), 0 8px 0 rgba(21, 12, 46, 0.42);
}

.start-play-button:hover,
.start-help-button:hover,
.start-map-button:hover,
.start-wh-card:hover {
  transform: translateY(-3px) scale(1.03);
  filter: brightness(1.08);
}

.start-wh-dock {
  display: grid;
  grid-template-columns: repeat(7, minmax(64px, 1fr));
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 3px solid rgba(255, 224, 111, 0.18);
  border-radius: 18px;
  background: rgba(14, 10, 32, 0.55);
}

.start-wh-card {
  display: grid;
  place-items: center;
  min-height: 68px;
  padding: 7px 6px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: var(--white);
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.18), 0 7px 14px rgba(0, 0, 0, 0.22);
  transition: transform 180ms ease, filter 180ms ease;
}

.start-wh-card strong {
  font-size: 0.96rem;
}

.start-wh-card small {
  font-size: 0.78rem;
  font-weight: 900;
}

.player-setup {
  display: grid;
  gap: 6px;
  width: min(380px, 100%);
  margin: 0 auto 12px;
}

.player-setup label {
  color: #fff4d2;
  font-size: 0.92rem;
  font-weight: 1000;
  text-align: center;
}

.player-setup input {
  min-height: 48px;
  padding: 0 16px;
  border: 3px solid rgba(255, 234, 150, 0.45);
  border-radius: 999px;
  color: #2b183f;
  background: rgba(255, 250, 226, 0.94);
  box-shadow: inset 0 -4px rgba(118, 78, 20, 0.1), 0 8px 18px rgba(0, 0, 0, 0.2);
  font-weight: 900;
  text-align: center;
}

.hero-select {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.hero-choice {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 108px;
  min-height: 118px;
  padding: 8px;
  border: 3px solid rgba(255, 234, 150, 0.24);
  border-radius: 20px;
  color: #fff4d2;
  background: rgba(18, 12, 38, 0.62);
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.18), 0 10px 20px rgba(0, 0, 0, 0.24);
  font-size: 0.82rem;
  font-weight: 1000;
}

.hero-choice img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.hero-choice.selected {
  border-color: #ffe477;
  background: rgba(115, 69, 209, 0.74);
  box-shadow: 0 0 0 5px rgba(255, 221, 91, 0.18), 0 0 22px rgba(255, 221, 91, 0.42);
}

.start-bottom-panel {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 3px solid rgba(255, 224, 111, 0.24);
  border-radius: 20px;
  color: #fff7d2;
  background: rgba(13, 9, 28, 0.72);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.28);
}

.start-bottom-panel div {
  display: grid;
  gap: 2px;
}

.start-bottom-panel strong {
  font-size: 1.02rem;
}

.start-bottom-panel span {
  color: #cbdcff;
  font-size: 0.9rem;
  font-weight: 800;
}

/* Reset splash screen into a cinematic game title page. */
.start-game-screen {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(5, 4, 17, 0.92), rgba(8, 5, 20, 0.16) 22%, rgba(8, 5, 20, 0.16) 78%, rgba(5, 4, 17, 0.92)),
    linear-gradient(180deg, rgba(5, 4, 17, 0.2), rgba(5, 4, 17, 0.46) 52%, rgba(5, 4, 17, 0.92)),
    url("images/bg1.png") center / cover no-repeat;
  box-shadow: none;
}

.start-game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 218, 84, 0.2), transparent 12%),
    radial-gradient(circle at 50% 42%, rgba(167, 88, 255, 0.28), transparent 28%),
    linear-gradient(180deg, transparent 68%, rgba(5, 4, 17, 0.72));
  pointer-events: none;
}

.start-bg-glow {
  z-index: 1;
  background:
    radial-gradient(circle at 28% 28%, rgba(69, 184, 255, 0.32), transparent 16%),
    radial-gradient(circle at 73% 30%, rgba(244, 90, 162, 0.34), transparent 17%),
    radial-gradient(circle at 50% 54%, rgba(255, 216, 76, 0.22), transparent 22%);
  mix-blend-mode: screen;
}

.start-sparkles {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(circle at 22% 20%, #fff8c9 0 2px, transparent 3px),
    radial-gradient(circle at 74% 16%, #d6f5ff 0 2px, transparent 3px),
    radial-gradient(circle at 42% 22%, #fff 0 1px, transparent 2px),
    radial-gradient(circle at 62% 65%, #fff2a6 0 2px, transparent 3px),
    radial-gradient(circle at 31% 72%, #88dbff 0 2px, transparent 3px);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
  animation: twinkle 2.8s ease-in-out infinite alternate;
  pointer-events: none;
}

.game-start-panel {
  z-index: 5;
  width: min(760px, 62vw);
  min-height: 0;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-logo {
  transform: translateY(-8px);
}

.logo-small {
  font-size: clamp(1.6rem, 3.4vw, 3rem);
  color: #ffd875;
  -webkit-text-stroke: 1px rgba(92, 43, 4, 0.7);
  text-shadow: 0 4px 0 #6e2f05, 0 0 22px rgba(255, 218, 88, 0.7);
}

.game-logo h1 {
  margin: -8px 0 0;
  font-size: clamp(4.5rem, 10vw, 9.4rem);
  letter-spacing: 0;
  color: #e9c6ff;
  -webkit-text-stroke: 3px #43216e;
  text-shadow:
    0 7px 0 #6d3199,
    0 15px 0 #261236,
    0 0 18px rgba(255, 255, 255, 0.5),
    0 0 42px rgba(173, 80, 255, 0.85);
}

.logo-ribbon {
  min-width: min(470px, 100%);
  margin-top: 4px;
  border-color: rgba(255, 238, 145, 0.64);
  border-radius: 999px;
  transform: rotate(-1deg);
  font-size: clamp(1.12rem, 2.2vw, 1.62rem);
}

.start-tagline {
  margin: 18px 0 16px;
  color: #ffffff;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  letter-spacing: 0;
}

.start-play-button {
  min-width: min(330px, 86vw);
  min-height: 82px;
  border: 4px solid rgba(255, 244, 177, 0.72);
  border-radius: 999px;
  font-size: 2rem;
  color: #5d2f00;
  background: linear-gradient(180deg, #fff77d, #ffbf2f 48%, #ed891c);
  box-shadow:
    inset 0 -10px rgba(112, 65, 0, 0.24),
    0 0 0 8px rgba(255, 197, 56, 0.16),
    0 0 42px rgba(255, 207, 68, 0.62),
    0 15px 0 rgba(74, 42, 6, 0.46);
  animation: playPulse 1.8s ease-in-out infinite;
}

.start-play-button span {
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
}

.start-wh-dock {
  width: min(650px, 92vw);
  grid-template-columns: repeat(7, minmax(56px, 1fr));
  margin-top: 10px;
  padding: 8px;
  border-color: rgba(255, 224, 111, 0.28);
  background: rgba(10, 7, 24, 0.48);
  backdrop-filter: blur(6px);
}

.start-wh-card {
  min-height: 58px;
}

.start-character {
  z-index: 4;
  width: min(34vw, 410px);
  max-height: 82vh;
  mix-blend-mode: normal;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 62%, rgba(0, 0, 0, 0.74) 75%, transparent 91%);
  mask-image: radial-gradient(ellipse at center, #000 62%, rgba(0, 0, 0, 0.74) 75%, transparent 91%);
}

.start-character-left {
  left: max(14px, 3vw);
  bottom: 0;
}

.start-character-right {
  right: max(-18px, 1.5vw);
  bottom: -2px;
}

.start-corner-actions {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 8;
  display: flex;
  gap: 10px;
}

.start-icon-action {
  display: grid;
  place-items: center;
  min-width: 54px;
  height: 54px;
  padding: 0 14px;
  border: 3px solid rgba(255, 234, 150, 0.5);
  border-radius: 18px;
  color: #fff6cd;
  background: rgba(22, 15, 46, 0.62);
  box-shadow: inset 0 -5px rgba(0, 0, 0, 0.18), 0 10px 22px rgba(0, 0, 0, 0.26);
  font-size: 1.35rem;
  font-weight: 1000;
  backdrop-filter: blur(6px);
}

.start-menu-action {
  width: auto;
  font-size: 0.92rem;
}

.start-icon-action:hover {
  transform: translateY(-3px);
  filter: brightness(1.12);
}

.start-bottom-panel {
  right: auto;
  left: 24px;
  bottom: 22px;
  width: auto;
  min-width: 250px;
  border-color: rgba(255, 224, 111, 0.28);
  background: rgba(10, 7, 24, 0.54);
  backdrop-filter: blur(8px);
}

.start-mission-count {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #3e2500 !important;
  background: linear-gradient(180deg, #fff6a8, #ffbd35);
}

@keyframes twinkle {
  from { opacity: 0.45; transform: scale(0.98); }
  to { opacity: 0.98; transform: scale(1.02); }
}

@keyframes playPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.035); }
}

@keyframes correctPop {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(1.08); filter: brightness(1.28) drop-shadow(0 0 18px rgba(112, 255, 129, 0.75)); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes wrongWiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); filter: drop-shadow(0 0 14px rgba(255, 87, 87, 0.72)); }
  75% { transform: translateX(7px); }
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes mapHeroFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-14px) rotate(1deg); }
}

@keyframes heroSpark {
  0%, 100% { opacity: 0.35; transform: translateY(0) scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: translateY(-18px) scale(1.15) rotate(25deg); }
}

@keyframes gateOpen {
  0% { opacity: 1; transform: scaleX(1) translateY(0); clip-path: inset(0 0 0 0 round 40px 40px 16px 16px); }
  55% { opacity: 1; transform: scaleX(1.08) translateY(-8px); }
  100% { opacity: 0; transform: scaleX(0.15) translateY(-26px); clip-path: inset(0 42% 0 42% round 40px); }
}

@keyframes unlockPulse {
  0% { box-shadow: 0 0 0 rgba(255, 228, 112, 0); }
  45% { box-shadow: 0 0 0 10px rgba(255, 228, 112, 0.18), 0 0 34px rgba(255, 228, 112, 0.55); }
  100% { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 18px 34px rgba(7, 6, 24, 0.42); }
}

.primary-button,
.secondary-button,
.choice-button,
.small-button {
  border: 0;
  border-radius: 18px;
  font-weight: 900;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease;
}

.primary-button {
  min-height: 64px;
  padding: 14px 30px;
  color: #6f3c00;
  background: linear-gradient(180deg, #fff36b, #ffb12f);
  box-shadow: inset 0 -7px rgba(138, 89, 20, 0.22), 0 10px 20px rgba(116, 78, 20, 0.24);
  font-size: 1.5rem;
}

.secondary-button,
.small-button {
  min-height: 46px;
  padding: 10px 16px;
  color: #4b317f;
  background: #efe5ff;
}

.hero-stage {
  min-height: 430px;
}

.hero-character {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
}

.hero-face {
  position: relative;
  display: grid;
  place-items: center;
  width: min(310px, 72vw);
  height: min(310px, 72vw);
  border: 12px solid #fff1bd;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #ffe2b7 0 24%, transparent 25%),
    radial-gradient(circle at 42% 43%, #25324f 0 3%, transparent 4%),
    radial-gradient(circle at 58% 43%, #25324f 0 3%, transparent 4%),
    linear-gradient(145deg, #4c2b1c 0 32%, #2775d2 33% 64%, #fff 65%);
  box-shadow: var(--shadow);
  animation: bob 2.8s ease-in-out infinite;
}

.hero-face::before,
.hero-face::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.hero-face::before {
  width: 112px;
  height: 18px;
  top: 188px;
  background: #fff7f0;
}

.hero-face::after {
  width: 96px;
  height: 140px;
  right: -42px;
  bottom: 18px;
  border-radius: 60% 30% 70% 30%;
  background: linear-gradient(145deg, #2d87e8, #1450a6);
  transform: rotate(-25deg);
}

.magic-orb {
  position: absolute;
  right: 18%;
  top: 18%;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 8px solid #ffda65;
  border-radius: 50%;
  color: var(--white);
  background: radial-gradient(circle at 35% 25%, #fff, #51dbff 42%, #2775d2 74%);
  font-size: 2.3rem;
  font-weight: 900;
  animation: pulse 1.7s ease-in-out infinite;
}

.wh-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.wh-token,
.wh-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 13px;
  border-radius: 14px;
  color: var(--white);
  font-weight: 900;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.18);
}

.what { background: #7b55d9; }
.where { background: #40a846; }
.when { background: #f28b22; }
.who { background: #2187d8; }
.why { background: #d64bb4; }
.which { background: #19a9aa; }
.how { background: #e84e72; }

.map-screen {
  position: relative;
  min-height: 660px;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 214, 87, 0.18), transparent 14%),
    radial-gradient(circle at 23% 72%, rgba(58, 188, 255, 0.18), transparent 18%),
    radial-gradient(circle at 82% 70%, rgba(191, 82, 255, 0.2), transparent 18%),
    linear-gradient(180deg, rgba(12, 8, 31, 0.48), rgba(12, 8, 31, 0.84)),
    url("images/bg1.png") center / cover no-repeat;
  border-color: rgba(151, 112, 255, 0.42);
  box-shadow: inset 0 0 0 2px rgba(255, 225, 128, 0.1), 0 24px 58px rgba(10, 7, 24, 0.42);
}

.map-hero-avatar {
  position: absolute;
  right: 20px;
  bottom: 8px;
  z-index: 0;
  width: min(230px, 22vw);
  max-height: 330px;
  object-fit: contain;
  opacity: 0.8;
  filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.45));
  pointer-events: none;
  animation: mapHeroFloat 3.4s ease-in-out infinite;
}

.map-screen::after {
  content: "✦";
  position: absolute;
  right: min(180px, 16vw);
  bottom: 270px;
  z-index: 1;
  color: #ffe477;
  font-size: 2.3rem;
  filter: drop-shadow(0 0 12px rgba(255, 228, 112, 0.9));
  animation: heroSpark 2.2s ease-in-out infinite;
  pointer-events: none;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.map-actions .secondary-button {
  color: #fff8da;
  background: linear-gradient(180deg, rgba(123, 85, 217, 0.98), rgba(67, 36, 129, 0.98));
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.2), 0 8px 18px rgba(0, 0, 0, 0.24);
}

.map-home-button::before {
  content: "⌂ ";
}

.section-heading h2 {
  margin: 0;
  color: #ffe57a;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  text-shadow: 0 4px 0 rgba(82, 39, 8, 0.72), 0 0 18px rgba(255, 213, 77, 0.4);
}

.section-heading p {
  margin: 6px 0 0;
  color: #e8ddff;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.68);
}

.level-path {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 18px;
  padding: 28px 8px 16px;
}

.level-path::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 9%;
  left: 9%;
  height: 8px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(255, 235, 118, 0.95) 0 24px, transparent 24px 38px);
  opacity: 0.9;
  filter: drop-shadow(0 0 9px rgba(255, 229, 98, 0.85));
}

.level-path::after {
  content: "";
  position: absolute;
  inset: 6px 5%;
  border: 2px dashed rgba(203, 164, 255, 0.36);
  border-radius: 46%;
  filter: drop-shadow(0 0 10px rgba(167, 88, 255, 0.55));
  pointer-events: none;
}

.map-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 240px;
  padding: 16px 12px;
  border: 4px solid rgba(255, 230, 137, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 248, 218, 0.9), rgba(233, 216, 255, 0.74)),
    rgba(42, 27, 73, 0.72);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18), 0 18px 34px rgba(7, 6, 24, 0.42);
  backdrop-filter: blur(7px);
}

.magic-ring {
  position: absolute;
  inset: 11px;
  border: 2px solid rgba(156, 94, 255, 0.28);
  border-radius: 24px;
  pointer-events: none;
}

.magic-ring::before,
.magic-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(255, 229, 105, 0.45);
  border-radius: 50%;
  animation: slowSpin 12s linear infinite;
}

.magic-ring::after {
  inset: 28px;
  animation-direction: reverse;
}

.map-node.locked {
  filter: grayscale(0.45);
  opacity: 0.82;
  cursor: not-allowed;
}

.lock-gate {
  position: absolute;
  inset: 58px 25px 22px;
  z-index: 2;
  display: none;
  border: 4px solid rgba(255, 224, 111, 0.5);
  border-radius: 44px 44px 16px 16px;
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 224, 111, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(51, 31, 84, 0.94), rgba(24, 15, 49, 0.98));
  box-shadow: inset 0 0 0 3px rgba(18, 12, 38, 0.58), 0 0 22px rgba(156, 94, 255, 0.34);
  pointer-events: none;
}

.lock-gate::before {
  content: "🔒";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
  filter: drop-shadow(0 0 12px rgba(255, 224, 111, 0.74));
}

.map-node.locked .lock-gate {
  display: block;
}

.map-node.locked .node-art,
.map-node.locked .node-title,
.map-node.locked .node-scene,
.map-node.locked .stars {
  opacity: 0.28;
}

.map-node.opening {
  animation: unlockPulse 1.25s ease both;
}

.map-node.opening .lock-gate {
  display: block;
  animation: gateOpen 1.2s ease both;
}

.node-number {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(180deg, #9b65ff, #4f2db0);
  font-size: 1.8rem;
  font-weight: 900;
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.2), 0 0 16px rgba(175, 104, 255, 0.46);
}

.node-art {
  display: grid;
  place-items: center;
  width: 98px;
  height: 78px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 229, 104, 0.26), transparent 35%),
    linear-gradient(145deg, #ffffff, #eee5ff);
  font-size: 2.9rem;
  box-shadow: 0 0 18px rgba(255, 229, 105, 0.22);
}

.node-title {
  margin: 8px 0 2px;
  color: #311948;
  font-size: 1.04rem;
  font-weight: 900;
  text-align: center;
}

.node-scene {
  min-height: 36px;
  color: #67517d;
  font-size: 0.88rem;
  font-weight: 800;
  text-align: center;
}

.stars {
  color: #ffb600;
  font-size: 1.35rem;
  letter-spacing: 1px;
}

.level-screen {
  overflow: hidden;
}

.memory-scene {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 115px);
  padding: 18px;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 223, 91, 0.2), transparent 16%),
    linear-gradient(90deg, rgba(12, 7, 27, 0.92), rgba(77, 47, 30, 0.18) 22%, rgba(44, 29, 45, 0.18) 78%, rgba(12, 7, 27, 0.92)),
    linear-gradient(180deg, rgba(12, 7, 27, 0.24), rgba(12, 7, 27, 0.82)),
    url("images/bg2.png") center / cover no-repeat;
  border: 4px solid rgba(127, 76, 215, 0.44);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.memory-board {
  position: relative;
  width: min(450px, 100%);
  min-height: 720px;
  padding: 18px 18px 16px;
  overflow: hidden;
  border: 5px solid #7043b8;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 228, 108, 0.22), transparent 20%),
    radial-gradient(circle at 45% 48%, rgba(95, 217, 255, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 58% 58%, rgba(255, 255, 255, 0.7) 0 2px, transparent 3px),
    linear-gradient(180deg, rgba(24, 18, 52, 0.86), rgba(31, 25, 55, 0.82)),
    repeating-linear-gradient(0deg, #332119 0 28px, #4b2e1d 28px 33px);
  box-shadow: inset 0 0 0 3px rgba(20, 12, 44, 0.7), 0 22px 44px rgba(18, 19, 47, 0.42);
}

.memory-board::before,
.memory-board::after {
  content: "";
  position: absolute;
  top: 112px;
  bottom: 118px;
  width: 54px;
  border-radius: 12px;
  background:
    repeating-linear-gradient(0deg, #2b1832 0 42px, #f0bd58 42px 47px, #5e2b29 47px 82px);
  opacity: 0.58;
}

.memory-board::before {
  left: 14px;
}

.memory-board::after {
  right: 14px;
}

.memory-title {
  position: relative;
  z-index: 2;
  margin: 0 auto 18px;
  padding: 0 14px 14px;
  border: 3px solid rgba(169, 119, 238, 0.65);
  border-radius: 18px;
  background: linear-gradient(180deg, #4b2c86, #24183f);
  color: #fff4d2;
  text-align: center;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

.memory-title span {
  display: inline-grid;
  place-items: center;
  min-width: 120px;
  min-height: 42px;
  margin-top: -3px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, #7a4fc2, #4b2c86);
  color: var(--white);
  font-size: 1.12rem;
  font-weight: 900;
}

.memory-title h2 {
  margin: 10px 0 2px;
  font-size: 1.8rem;
  line-height: 1;
}

.memory-title p {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.match-lines {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.spark-line {
  stroke: #dfff5e;
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px #fff36b) drop-shadow(0 0 12px #73ff8b);
  animation: lineDraw 420ms ease both;
}

.match-columns {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 86px;
  padding: 0 16px;
}

.match-column {
  display: grid;
  gap: 12px;
}

.match-option {
  min-height: 55px;
  padding: 8px 10px;
  border: 3px solid rgba(91, 57, 26, 0.28);
  border-radius: 10px;
  color: #2b2435;
  background: #fff0c8;
  box-shadow: inset 0 -5px rgba(116, 65, 26, 0.12), 0 5px 0 rgba(44, 26, 22, 0.2);
  font-size: 1.02rem;
  font-weight: 900;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.match-option.word-side {
  color: #1e2438;
  text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.match-option.meaning-side {
  background: linear-gradient(180deg, #fff9e6, #f7dfaa);
  font-size: 1.1rem;
}

.match-option.selected {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 0 4px rgba(255, 236, 94, 0.62), 0 0 22px rgba(255, 245, 112, 0.8);
}

.match-option.matched {
  color: #214226;
  background: linear-gradient(180deg, #ecffd9, #bdf089);
  box-shadow: inset 0 -5px rgba(35, 116, 40, 0.14), 0 0 16px rgba(158, 255, 87, 0.68);
}

.memory-instruction {
  position: relative;
  z-index: 4;
  margin: 34px auto 14px;
  padding: 12px 14px;
  border: 2px solid rgba(255, 246, 210, 0.18);
  border-radius: 10px;
  color: #fff4d2;
  background: rgba(35, 27, 51, 0.78);
  font-size: 0.95rem;
  font-weight: 900;
  text-align: center;
}

.memory-pass {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 3px solid rgba(99, 62, 28, 0.28);
  border-radius: 12px;
  color: #573719;
  background: linear-gradient(180deg, #fff8d5, #f2d286);
  font-size: 0.9rem;
  font-weight: 900;
}

.memory-star {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff0a8;
  font-size: 1.45rem;
}

.memory-actions {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.memory-score {
  color: #fff4d2;
  font-weight: 900;
}

.mission-scene {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 115px);
  padding: 18px;
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.mission-2 {
  background:
    linear-gradient(90deg, rgba(5, 24, 48, 0.9), rgba(5, 24, 48, 0.18), rgba(5, 24, 48, 0.9)),
    linear-gradient(180deg, rgba(10, 21, 48, 0.16), rgba(10, 21, 48, 0.78)),
    url("images/bg2.png") center / cover no-repeat;
}

.mission-3 {
  background:
    radial-gradient(circle at 58% 43%, rgba(61, 230, 255, 0.22), transparent 19%),
    linear-gradient(90deg, rgba(6, 43, 47, 0.94), rgba(24, 76, 75, 0.28), rgba(6, 43, 47, 0.94)),
    linear-gradient(180deg, rgba(6, 43, 47, 0.16), rgba(6, 43, 47, 0.82)),
    url("images/bg2.png") center / cover no-repeat;
}

.mission-4 {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 206, 71, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(103, 67, 27, 0.44), rgba(70, 39, 18, 0.76)),
    url("images/bg2.png") center / cover no-repeat;
}

.mission-5 {
  background:
    radial-gradient(circle at 72% 30%, rgba(255, 116, 72, 0.24), transparent 18%),
    linear-gradient(90deg, rgba(31, 13, 43, 0.94), rgba(73, 24, 58, 0.5), rgba(31, 13, 43, 0.94)),
    linear-gradient(180deg, rgba(31, 13, 43, 0.18), rgba(31, 13, 43, 0.86)),
    url("images/bg2.png") center / cover no-repeat;
}

.mission-card {
  position: relative;
  width: min(460px, 100%);
  min-height: 720px;
  padding: 18px;
  overflow: hidden;
  border: 5px solid var(--mission-border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 20%),
    linear-gradient(180deg, var(--mission-top), var(--mission-bottom));
  box-shadow: inset 0 0 0 3px rgba(19, 16, 36, 0.56), 0 22px 44px rgba(18, 19, 47, 0.42);
}

.blue-card {
  --mission-border: #4ca3d9;
  --mission-top: rgba(10, 74, 119, 0.92);
  --mission-bottom: rgba(16, 43, 79, 0.88);
  --mission-tab: #1573aa;
}

.green-card {
  --mission-border: #93c86a;
  --mission-top: rgba(25, 84, 50, 0.92);
  --mission-bottom: rgba(14, 49, 53, 0.9);
  --mission-tab: #4f923f;
}

.orange-card {
  --mission-border: #ee9b44;
  --mission-top: rgba(153, 70, 20, 0.92);
  --mission-bottom: rgba(89, 70, 34, 0.86);
  --mission-tab: #bd651d;
}

.red-card {
  --mission-border: #d74c4f;
  --mission-top: rgba(122, 31, 39, 0.94);
  --mission-bottom: rgba(49, 18, 45, 0.92);
  --mission-tab: #a62e38;
}

.mission-title-card {
  position: relative;
  z-index: 2;
  margin: 0 auto 12px;
  padding: 0 12px 12px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background: rgba(20, 16, 38, 0.68);
  color: #fff4d2;
  text-align: center;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.24);
}

.mission-title-card span {
  display: inline-grid;
  place-items: center;
  min-width: 120px;
  min-height: 40px;
  margin-top: -3px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, var(--mission-tab), rgba(20, 16, 38, 0.36));
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 900;
}

.mission-title-card h2 {
  margin: 10px 0 2px;
  font-size: 1.48rem;
  line-height: 1.05;
}

.mission-title-card p {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
}

.mission-progress {
  position: relative;
  z-index: 3;
  height: 14px;
  margin: 0 4px 12px;
  background: rgba(255, 255, 255, 0.28);
}

.mission-content {
  position: relative;
  z-index: 3;
}

.quiz-scroll,
.example-box,
.source-card,
.target-card,
.answer-card {
  border: 3px solid rgba(82, 55, 26, 0.28);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e7, #f6deb4);
  color: #2b2435;
  box-shadow: 0 9px 0 rgba(43, 25, 21, 0.23), 0 14px 24px rgba(0, 0, 0, 0.2);
}

.quiz-scroll {
  padding: 20px 16px;
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice-list .choice-button {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  min-height: 56px;
  padding: 8px 10px;
  border: 2px solid rgba(98, 68, 34, 0.22);
  border-radius: 10px;
  color: #1f2a36;
  background: linear-gradient(180deg, #fff8e7, #ead2a8);
  box-shadow: inset 0 -4px rgba(102, 63, 24, 0.08);
  font-size: 1rem;
  text-align: left;
}

.choice-letter,
.check-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 900;
}

.choice-letter {
  border: 2px solid rgba(67, 55, 44, 0.28);
  background: #f4ead4;
}

.check-badge {
  visibility: hidden;
  color: var(--white);
  background: #46b64a;
}

.choice-button.correct .check-badge,
.answer-good::after {
  visibility: visible;
}

.choice-list .choice-button.correct {
  color: var(--white);
  background: linear-gradient(180deg, #5fca61, #2e9d35);
}

.choice-list .choice-button.wrong {
  color: var(--white);
  background: linear-gradient(180deg, #f17270, #cf3444);
}

.spark-correct {
  animation: correctPop 520ms ease both;
}

.spark-wrong {
  animation: wrongWiggle 360ms ease both;
}

.mission-caption {
  margin: 14px 0 10px;
  padding: 10px;
  border-radius: 10px;
  color: #fff4d2;
  background: rgba(22, 18, 38, 0.72);
  font-weight: 900;
  text-align: center;
}

.lab-layout {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: end;
}

.example-box,
.answer-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.example-box span,
.answer-card span,
.source-card span,
.target-card span {
  color: #514564;
  font-size: 0.88rem;
  font-weight: 900;
}

.example-box strong,
.answer-card strong,
.source-card strong,
.target-card strong {
  font-size: 1.16rem;
  line-height: 1.2;
}

.robot-helper {
  width: 118px;
  height: 150px;
  border: 8px solid #d9f5ff;
  border-radius: 34px 34px 24px 24px;
  background:
    radial-gradient(circle at 38% 42%, #52f5ff 0 7px, transparent 8px),
    radial-gradient(circle at 62% 42%, #52f5ff 0 7px, transparent 8px),
    linear-gradient(180deg, #eaf8ff 0 22%, #273b57 23% 64%, #f5fcff 65%);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.24);
}

.input-label {
  display: block;
  margin-top: 12px;
  color: #fff4d2;
  font-weight: 900;
}

.mission-content input {
  width: 100%;
  min-height: 58px;
  margin: 8px 0 10px;
  padding: 0 16px;
  border: 3px solid rgba(74, 55, 34, 0.3);
  border-radius: 12px;
  background: #fffef6;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
}

.rule-box {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 3px solid rgba(73, 112, 46, 0.26);
  border-radius: 12px;
  background: #e6f4c8;
  color: #243047;
  font-weight: 800;
}

.builder-visual {
  display: grid;
  grid-template-columns: 1fr 38px 1fr;
  gap: 8px;
  align-items: center;
}

.source-card,
.target-card {
  display: grid;
  min-height: 120px;
  gap: 6px;
  place-items: center;
  padding: 12px;
  text-align: center;
}

.source-card::before {
  content: "";
  width: 92px;
  height: 54px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #7fcaff 0 43%, #78c15f 44%),
    linear-gradient(45deg, transparent 48%, #fff 49% 51%, transparent 52%);
  box-shadow: inset 0 0 0 3px rgba(90, 66, 34, 0.16);
}

.arrow-sign {
  display: grid;
  place-items: center;
  color: #7cf2a0;
  font-size: 2rem;
  font-weight: 900;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.72));
}

.dragon-layout {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
  align-items: end;
}

.boss-questions {
  min-width: 0;
}

.dragon-helper {
  width: 122px;
  height: 176px;
  border-radius: 58% 42% 46% 44%;
  background:
    radial-gradient(circle at 58% 30%, #ffe777 0 5px, transparent 6px),
    radial-gradient(circle at 65% 31%, #1c1424 0 2px, transparent 3px),
    linear-gradient(145deg, #8c48d7 0 22%, #5c2b96 23% 62%, #d65c4b 63%);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.3);
}

.dragon-helper::before,
.dragon-helper::after {
  content: "";
  position: absolute;
}

.mission-rule {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 58px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 3px solid rgba(99, 62, 28, 0.28);
  border-radius: 12px;
  color: #573719;
  background: linear-gradient(180deg, #fff8d5, #f2d286);
  font-size: 0.88rem;
  font-weight: 900;
}

.mission-content .primary-button {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
}

.mission-content .small-button {
  width: 100%;
  margin-top: 8px;
}

.level-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 24px 28px;
  color: var(--white);
}

.scene-library { background: linear-gradient(135deg, #6b45c7, #2a7bc2); }
.scene-city { background: linear-gradient(135deg, #244a95, #17a9a7); }
.scene-lab { background: linear-gradient(135deg, #1b87c8, #91d94d); }
.scene-builder { background: linear-gradient(135deg, #e88b29, #34a46e); }
.scene-dragon { background: linear-gradient(135deg, #4b246f, #e1553f); }

.level-hero h2 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.objective {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  opacity: 0.95;
}

.scene-icon {
  font-size: clamp(3.8rem, 9vw, 6.5rem);
  animation: bob 3s ease-in-out infinite;
}

.level-body {
  padding: 26px;
}

.progress-wrap {
  height: 18px;
  margin-bottom: 20px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

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

.match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.match-card {
  min-height: 104px;
  padding: 12px;
  border: 0;
  border-radius: 20px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 10px 18px rgba(47, 61, 93, 0.16);
  font-size: 1.15rem;
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.match-card.selected {
  outline: 5px solid #ffe05d;
  transform: translateY(-5px);
}

.match-card.matched {
  color: #145735;
  background: #d8ffea;
  box-shadow: 0 0 0 5px rgba(47, 191, 113, 0.25);
}

.shake {
  animation: shake 300ms ease;
}

.quiz-card,
.typing-card,
.builder-card {
  padding: 22px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
}

.question-text {
  margin: 0 0 18px;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  font-weight: 900;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.choice-button {
  min-height: 72px;
  padding: 14px;
  color: var(--white);
  background: linear-gradient(180deg, #6bb8ff, #2775d2);
  box-shadow: inset 0 -6px rgba(0, 0, 0, 0.18);
  font-size: 1.25rem;
}

.choice-button.correct,
.answer-good {
  background: var(--success);
  color: var(--white);
}

.choice-button.wrong,
.answer-bad {
  background: var(--danger);
  color: var(--white);
}

.typing-card input {
  width: 100%;
  min-height: 58px;
  margin: 12px 0;
  padding: 0 16px;
  border: 3px solid rgba(101, 112, 131, 0.25);
  border-radius: 18px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
}

.feedback-box {
  min-height: 54px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #eef6ff;
  color: #31506f;
  font-weight: 800;
}

.word-bank,
.drop-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 82px;
  margin: 12px 0;
  padding: 14px;
  border: 3px dashed rgba(101, 112, 131, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.drop-zone {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(139, 94, 44, 0.14) 0 14%, transparent 14% 28%),
    rgba(255, 255, 255, 0.72);
}

.word-chip {
  min-height: 46px;
  padding: 9px 15px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(180deg, #ffffff, #dff4ff);
  color: var(--ink);
  box-shadow: 0 7px 14px rgba(47, 61, 93, 0.16);
  font-weight: 900;
}

.word-chip.used {
  opacity: 0.35;
  pointer-events: none;
}

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.level-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.ending-screen {
  display: grid;
  place-items: center;
  min-height: 660px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(255, 211, 77, 0.8), rgba(102, 201, 255, 0.82));
}

.certificate {
  width: min(720px, 100%);
  padding: 34px;
  border: 7px double #b67a1d;
  border-radius: 28px;
  background: #fff8dc;
  text-align: center;
  box-shadow: var(--shadow);
}

.certificate h2 {
  margin: 0;
  color: #6a3d14;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.certificate p {
  color: #4d5b70;
  font-size: 1.25rem;
  font-weight: 800;
}

.clear-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 5, 20, 0.72);
  backdrop-filter: blur(7px);
}

.clear-card {
  position: relative;
  width: min(520px, 100%);
  padding: 30px 24px;
  border: 5px solid rgba(255, 228, 112, 0.74);
  border-radius: 28px;
  color: #fff7d2;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 228, 112, 0.24), transparent 28%),
    linear-gradient(180deg, rgba(84, 45, 155, 0.96), rgba(25, 13, 58, 0.96));
  box-shadow: 0 0 42px rgba(255, 210, 79, 0.28), 0 28px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: clearIn 360ms ease both;
}

.clear-card h2 {
  margin: 4px 0 8px;
  color: #ffe477;
  font-size: clamp(2.1rem, 6vw, 3.7rem);
  text-shadow: 0 4px 0 rgba(92, 43, 4, 0.62), 0 0 18px rgba(255, 228, 112, 0.5);
}

.clear-card p {
  margin: 0 auto 14px;
  max-width: 420px;
  font-weight: 900;
}

.clear-burst {
  font-size: 3rem;
  animation: slowSpin 6s linear infinite;
}

.clear-stars {
  color: #ffd747;
  font-size: 2.3rem;
  letter-spacing: 4px;
  filter: drop-shadow(0 0 12px rgba(255, 226, 100, 0.8));
}

.clear-score {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  margin: 10px 0 16px;
  padding: 6px 16px;
  border-radius: 999px;
  color: #3e2500;
  background: linear-gradient(180deg, #fff6a8, #ffbd35);
  font-weight: 1000;
}

.clear-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

@keyframes clearIn {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 38, 62, 0.55);
}

.hidden {
  display: none;
}

.modal-card {
  position: relative;
  width: min(680px, 100%);
  padding: 26px;
  border-radius: 26px;
  background: #fff8dc;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-top: 0;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: var(--white);
  background: var(--danger);
  font-size: 1.4rem;
  font-weight: 900;
}

.wh-guide {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.app-info-list {
  display: grid;
  gap: 12px;
  width: 100%;
}

.app-info-list div {
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.guide-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: var(--white);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--white);
  background: #243047;
  box-shadow: var(--shadow);
  font-weight: 900;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes floatGlow {
  from { transform: translateY(-8px); }
  to { transform: translateY(8px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@keyframes lineDraw {
  from {
    stroke-dasharray: 260;
    stroke-dashoffset: 260;
    opacity: 0;
  }
  to {
    stroke-dasharray: 260;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    justify-content: center;
  }

  .brand-mini {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  .start-screen,
  .level-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .start-game-screen {
    min-height: 780px;
    padding: 16px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .game-start-panel {
    width: min(620px, 100%);
    min-height: 500px;
    margin-bottom: 112px;
  }

  .start-character {
    width: min(34vw, 230px);
    max-height: 42%;
  }

  .start-character-left {
    left: -8px;
    bottom: 76px;
  }

  .start-character-right {
    right: -18px;
    bottom: 74px;
  }

  .level-path {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .level-path::before {
    display: none;
  }

  .match-grid,
  .choice-grid,
  .wh-guide {
    grid-template-columns: 1fr 1fr;
  }

  .memory-board {
    min-height: 690px;
  }

  .match-columns {
    gap: 48px;
    padding: 0 10px;
  }
}

@media (max-width: 560px) {
  .status-pills {
    order: 3;
  }

  .pill {
    font-size: 0.82rem;
  }

  .start-screen,
  .map-screen,
  .level-body {
    padding: 18px;
  }

  .start-game-screen {
    min-height: 820px;
    border-radius: 22px;
  }

  .game-start-panel {
    align-self: start;
    min-height: auto;
    margin-top: 12px;
    margin-bottom: 170px;
    padding: 16px 12px;
  }

  .game-logo h1 {
    font-size: clamp(2.7rem, 16vw, 4.4rem);
  }

  .logo-ribbon {
    min-width: 0;
    width: 100%;
  }

  .start-actions {
    width: 100%;
  }

  .start-play-button,
  .start-help-button {
    width: 100%;
  }

  .start-wh-dock {
    grid-template-columns: repeat(2, 1fr);
  }

  .start-character {
    width: min(44vw, 180px);
    max-height: 32%;
  }

  .start-character-left {
    left: -28px;
    bottom: 78px;
  }

  .start-character-right {
    right: -42px;
    bottom: 78px;
  }

  .start-bottom-panel {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .level-path,
  .match-grid,
  .choice-grid,
  .wh-guide {
    grid-template-columns: 1fr;
  }

  .map-node {
    min-height: 210px;
  }

  .memory-scene {
    padding: 8px;
  }

  .memory-board {
    min-height: 670px;
    padding: 14px 10px;
  }

  .match-columns {
    gap: 22px;
    padding: 0 2px;
  }

  .match-option {
    min-height: 52px;
    font-size: 0.92rem;
  }

  .match-option.meaning-side {
    font-size: 1rem;
  }

  .memory-title h2 {
    font-size: 1.55rem;
  }
}

@media (max-width: 900px) {
  body.start-mode .app-shell,
  body:has(.start-game-screen) .app-shell {
    padding: 0;
  }

  .start-game-screen {
    min-height: 100vh;
    padding: 18px 14px;
  }

  .game-start-panel {
    width: min(720px, 100%);
    margin: 0 0 150px;
    padding: 0 8px;
  }

  .start-character {
    width: min(36vw, 250px);
    max-height: 42vh;
  }

  .start-character-left {
    left: -24px;
    bottom: 18px;
  }

  .start-character-right {
    right: -36px;
    bottom: 16px;
  }

  .start-wh-dock {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
  }
}

@media (max-width: 560px) {
  .start-game-screen {
    justify-items: center;
    min-height: 100vh;
    padding: 72px 12px 150px;
  }

  .game-start-panel {
    align-self: center;
    width: 100%;
    margin: 0;
  }

  .game-logo h1 {
    font-size: clamp(3rem, 18vw, 4.8rem);
    -webkit-text-stroke-width: 2px;
  }

  .logo-small {
    font-size: 1.45rem;
  }

  .logo-ribbon {
    font-size: 1rem;
  }

  .start-play-button {
    min-width: 230px;
    min-height: 70px;
    font-size: 1.55rem;
  }

  .start-wh-dock {
    grid-template-columns: repeat(2, minmax(92px, 1fr));
    max-width: 360px;
  }

  .start-corner-actions {
    top: 12px;
    right: 12px;
    left: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .start-icon-action {
    width: 48px;
    height: 48px;
  }

  .start-menu-action {
    width: auto;
    min-width: 92px;
    font-size: 0.78rem;
  }

  .start-character {
    width: min(43vw, 170px);
    max-height: 28vh;
  }

  .start-character-left {
    left: -34px;
    bottom: 20px;
  }

  .start-character-right {
    right: -48px;
    bottom: 20px;
  }

  .start-bottom-panel {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
