:root {
  --font-main: 'Cairo', 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
  --purple-dark: #43187a;
  --purple: #6e28b5;
  --purple-light: #9e53e8;
  --gold-light: #fff0a8;
  --gold: #ffd957;
  --gold-deep: #d89008;
  --turquoise: #25bfe8;
  --turquoise-deep: #0b7bb0;
  --text-dark: #2f125e;
  --good: #0a6e3c;
  --bad: #a82447;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-main);
  color: var(--text-dark);
  background: linear-gradient(165deg, #1aa3eb 0%, #7ce9ff 58%, #58c28a 100%);
}

body {
  background-image:
    linear-gradient(180deg, rgba(16, 75, 138, 0.12), rgba(30, 175, 224, 0.14)),
    url("../img/bg-sky.jpg");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  overflow-x: hidden;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 2.5px solid rgba(255, 217, 87, 0.9);
  box-shadow: 0 6px 18px rgba(38, 12, 77, 0.16);
  backdrop-filter: blur(8px);
}

.topbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button, input {
  font-family: var(--font-main);
  font-size: inherit;
}

button {
  min-height: 48px;
  cursor: pointer;
  border: 2.5px solid #7d3cc4;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f5eaff 100%);
  color: #461b7a;
  padding: 0.55em 1.05em;
  font-weight: 800;
  box-shadow: 0 4px 0 #5b25973b, 0 4px 10px #2b0f5222;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  touch-action: manipulation;
}

button:hover:not(:disabled) {
  background: linear-gradient(180deg, #fffdf0 0%, #ffefa8 100%);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5b25973b;
}

button:focus-visible, input:focus-visible {
  outline: 4px solid #0d5e8a;
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

.btn-nav {
  min-height: 44px;
  padding: 0.4em 0.85em;
  font-size: 0.95rem;
}

.primary, .banner-title, .pill {
  background: linear-gradient(180deg, #9f4bf0 0%, #61209c 100%);
  color: #fff;
  border: 3px solid var(--gold);
  border-radius: 20px;
  box-shadow: 0 5px 0 #451473, 0 8px 18px rgba(40, 8, 78, 0.35);
}

.primary {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  padding: 0.6em 1.35em;
}

.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ae5cf8 0%, #7129b5 100%);
  color: #fff;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.38em 0.95em;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 3px 0 #451473;
}

/* Panels */
.stage-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  margin: auto 0;
}

.side-guide {
  flex: 0 0 185px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  position: relative;
  filter: drop-shadow(0 10px 16px rgba(27, 15, 58, 0.25));
}

.side-guide .art-zain {
  width: 155px;
  height: auto;
}

.side-guide .star-float {
  position: absolute;
  top: 6px;
  left: -8px;
  width: 72px;
  animation: floatBob 2.3s ease-in-out infinite alternate;
}

.panel {
  flex: 1 1 auto;
  background: rgba(242, 251, 255, 0.93);
  border: 4px solid var(--gold);
  outline: 3px solid #7e3bc4;
  border-radius: 28px;
  padding: clamp(14px, 3vw, 30px);
  box-shadow: 0 14px 36px rgba(24, 34, 102, 0.28);
  text-align: center;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  backdrop-filter: blur(10px);
}

/* Cover Screen */
.cover-panel {
  max-width: 820px;
  background: rgba(232, 249, 255, 0.9);
}

.banner-title {
  display: inline-block;
  margin: 0;
  padding: 0.32em 1.1em;
  font-size: clamp(1.7rem, 4.4vw, 2.9rem);
  font-weight: 900;
  line-height: 1.25;
  text-shadow: 0 3px 0 #3f136b;
}

.subtitle-pill {
  background: linear-gradient(180deg, #ffe778 0%, #ffc82c 100%);
  color: #4b1d7d;
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 10px rgba(84, 42, 0, 0.22);
  display: inline-block;
  border-radius: 999px;
  padding: 0.3em 1.2em;
  margin: 10px auto 6px;
  font-weight: 900;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
}

.cover-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3.5vw, 34px);
  margin: 8px auto 10px;
  flex-wrap: wrap;
}

.cover-characters {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}

.cover-characters .art-zain {
  width: clamp(115px, 20vw, 158px);
}

.cover-characters .art-star {
  width: clamp(64px, 11vw, 84px);
  margin-bottom: 36px;
  margin-right: -14px;
  animation: floatBob 2s ease-in-out infinite alternate;
}

.cover-letter-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(132px, 23vw, 182px);
  height: clamp(132px, 23vw, 182px);
  border-radius: 32px;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fff7d1 70%, #ffe699 100%);
  border: 4px solid var(--gold);
  box-shadow: 0 10px 24px rgba(107, 45, 166, 0.2), inset 0 0 18px rgba(255, 204, 40, 0.35);
}

.cover-letter {
  font-size: clamp(5.5rem, 12vw, 8.2rem);
  font-weight: 900;
  line-height: 1;
  color: #e69a00;
  text-shadow:
    0 5px 0 #b36b00,
    0 10px 18px rgba(120, 62, 0, 0.3);
  user-select: none;
}

.cover-desc {
  margin: 6px auto 10px;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  font-weight: 700;
  color: #461f77;
}

.name-wrap {
  margin: 8px auto;
}

.name-hint {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #5c378c;
  margin-bottom: 4px;
}

input.student-input {
  border: 2.5px solid #9e65dc;
  border-radius: 14px;
  padding: 10px 14px;
  width: min(100%, 330px);
  text-align: center;
  background: #ffffff;
  font-weight: 700;
  color: #361366;
}

.actions, .choices {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 14px 0 6px;
}

/* Training Screen */
.training-letters {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 10px 0;
}

.letter-card {
  background: #fff;
  border: 3px solid #9a5ee0;
  border-radius: 22px;
  padding: 10px 26px;
  min-width: 112px;
  box-shadow: 0 6px 14px rgba(85, 34, 145, 0.15);
}

.letter-card .big-char {
  font-size: clamp(3.4rem, 8vw, 5rem);
  font-weight: 900;
  color: #6b26ad;
  line-height: 1.15;
}

.letter-card .tag {
  font-size: 0.92rem;
  font-weight: 800;
  color: #8c5200;
  background: #fff1b8;
  border-radius: 10px;
  padding: 2px 8px;
}

.connect-demo {
  background: #fff;
  border: 2.5px dashed #995ad9;
  border-radius: 18px;
  padding: 12px;
  margin: 12px auto;
  max-width: 560px;
}

.connect-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 800;
  color: #4f1c85;
  margin-top: 6px;
}

.connect-examples span {
  background: #f5ebff;
  border: 2px solid #cfaef5;
  border-radius: 12px;
  padding: 4px 12px;
}

/* Adventure Map */
.map-panel {
  max-width: 1080px;
  padding: 0;
  background: #3bc4e8;
  border: 4px solid var(--gold);
  outline: 3px solid #7e3bc4;
  overflow: hidden;
}

.map-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #62229e 0%, #8636d4 50%, #62229e 100%);
  border-bottom: 3px solid var(--gold);
  color: #fff;
}

.map-title {
  margin: 0;
  font-size: clamp(1.25rem, 3.2vw, 1.95rem);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.island-map-scroll {
  width: 100%;
  position: relative;
}

.island-map {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 560;
  min-height: 410px;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(ellipse at 45% 75%, #3ad9e8 0%, #0986bf 78%);
  background-image: url("../img/bg-map-clean.jpg");
  background-size: 100% 100%;
  background-position: center;
}

.map-route {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.island {
  position: absolute;
  transform: translate(-50%, -50%);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(92px, 12.2vw, 134px);
  min-height: clamp(74px, 9.5vw, 104px);
  padding: 4px 2px;
  border: 0;
  background: none;
  box-shadow: none;
  z-index: 2;
  color: #fff;
}

.island:hover:not(:disabled) {
  background: none;
  transform: translate(-50%, -54%) scale(1.04);
}

.island:disabled {
  opacity: 1;
  cursor: default;
}

.island-base {
  position: relative;
  width: clamp(76px, 9.8vw, 108px);
  height: clamp(44px, 5.6vw, 62px);
  border-radius: 50% 50% 44% 46%;
  background: radial-gradient(ellipse at 65% 28%, #aef072 0%, #58b43b 58%, #2e7d37 100%);
  border: 3px solid #96eb72;
  box-shadow:
    0 6px 0 #7b6c5a,
    0 11px 0 #574a42,
    0 14px 10px rgba(7, 56, 84, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.island.locked .island-base {
  filter: saturate(0.75) brightness(0.92);
}

.island.available .island-base {
  outline: 4px solid #ffe46b;
  outline-offset: 3px;
  box-shadow:
    0 0 22px 6px rgba(255, 232, 92, 0.85),
    0 6px 0 #7b6c5a,
    0 11px 0 #574a42;
  animation: pulseGlow 1.6s ease-in-out infinite alternate;
}

.island-badge {
  position: relative;
  margin-top: -26px;
  width: clamp(38px, 4.8vw, 52px);
  height: clamp(38px, 4.8vw, 52px);
  filter: drop-shadow(0 4px 4px rgba(29, 13, 51, 0.45));
}

.island-badge svg {
  width: 100%;
  height: 100%;
  display: block;
}

.island.just-unlocked .island-badge {
  animation: popUnlock 0.7s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.island-name {
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  background: #53268f;
  border: 1.5px solid #c99eff;
  box-shadow: 0 3px 0 #311259;
  font-size: clamp(0.68rem, 1.3vw, 0.88rem);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
}

.island.available .island-name {
  background: linear-gradient(180deg, #fff099 0%, #ffd23f 100%);
  color: #3d186e;
  border-color: #ffffff;
}

.island.complete .island-name {
  background: #2f7d47;
  border-color: #9df0aa;
}

.island.castle {
  width: clamp(114px, 14.5vw, 160px);
  min-height: clamp(92px, 12vw, 132px);
}

.island.castle .island-base {
  display: none;
}

.island.castle .island-badge {
  margin-top: 0;
  width: clamp(78px, 10.5vw, 118px);
  height: clamp(72px, 9.5vw, 108px);
}

.island.castle:not(:disabled) .island-badge {
  filter: drop-shadow(0 0 16px rgba(255, 224, 92, 0.95));
}

.island.castle .castle-lock-pin {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 34px;
  height: 38px;
}

.map-traveler {
  position: absolute;
  transform: translate(-50%, -82%);
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  transition: left 1.15s cubic-bezier(0.35, 0.05, 0.25, 1), top 1.15s cubic-bezier(0.35, 0.05, 0.25, 1);
  filter: drop-shadow(0 6px 8px rgba(15, 36, 71, 0.45));
}

.map-traveler .art-zain {
  width: clamp(54px, 6.8vw, 76px);
  height: auto;
}

.map-traveler .art-star {
  width: clamp(28px, 3.6vw, 40px);
  margin-bottom: 24px;
  margin-right: -12px;
}

.map-hint {
  margin: 0;
  padding: 11px 16px;
  background: #fff5d1;
  color: #4b1d7d;
  font-weight: 800;
  font-size: 1rem;
  border-top: 2px solid #f0cf6b;
}

.map-hint.celebrating {
  background: linear-gradient(90deg, #d8ffd8, #fff6b8, #d8ffd8);
  color: #165e2d;
}

/* Quiz Panels */
.quiz-panel {
  max-width: 760px;
}

.quiz-top-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.round-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #6c28b3;
  color: #fff;
  border: 2px solid var(--gold);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 800;
  font-size: 0.95rem;
}

.round-dots {
  display: inline-flex;
  gap: 5px;
}

.round-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 1.5px solid #ffd957;
}

.round-dot.done {
  background: #ffd957;
}

.round-dot.current {
  background: #ffffff;
  transform: scale(1.18);
}

.quiz-question {
  font-size: clamp(1.25rem, 3.2vw, 1.85rem);
  font-weight: 900;
  margin: 8px 0 10px;
  color: #3f1673;
}

.prompt-card {
  background: #ffffff;
  border: 3px solid #9e5de0;
  border-radius: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px 18px;
  margin: 0 auto 12px;
  max-width: 620px;
  box-shadow: 0 6px 16px rgba(84, 34, 145, 0.12);
}

.prompt-card[hidden] {
  display: none;
}

.pic-box {
  width: clamp(86px, 16vw, 122px);
  height: clamp(86px, 16vw, 122px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pic-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.word-display {
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.45;
  color: #361466;
}

.word-display.sentence-text {
  font-size: clamp(1.45rem, 3.6vw, 2.15rem);
  line-height: 1.6;
}

.word-display.drop-zone {
  outline: 3px dashed #934ad9;
  border-radius: 16px;
  padding: 6px 20px;
  background: #faf5ff;
  min-width: 150px;
}

.speak-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 12px;
}

.speak-main {
  background: linear-gradient(180deg, #a854ef 0%, #6422a1 100%);
  color: #ffffff;
  border: 3px solid var(--gold);
  min-width: 168px;
  min-height: 58px;
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.speak-main:hover:not(:disabled) {
  background: linear-gradient(180deg, #b868fa 0%, #742db8 100%);
  color: #ffffff;
}

/* Choice Tiles */
.choices .tile {
  min-width: 100px;
  min-height: 62px;
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  padding: 0.45em 0.9em;
  border-width: 3px;
  border-bottom-width: 5px;
  background: linear-gradient(180deg, #ffffff 0%, #f5e6ff 100%);
}

.choices .tile.word-tile {
  font-size: clamp(1.15rem, 2.8vw, 1.55rem);
  min-width: 132px;
}

.choices .picture-btn {
  width: clamp(114px, 24vw, 146px);
  height: clamp(114px, 24vw, 146px);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  border-width: 3px;
  border-bottom-width: 5px;
  background: #ffffff;
}

.choices .picture-btn svg {
  width: 100%;
  height: 100%;
}

/* Hot Air Balloons */
.balloon-btn {
  position: relative;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: clamp(104px, 21vw, 134px);
  height: clamp(134px, 27vw, 172px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.balloon-bob {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatBob 2.1s ease-in-out infinite alternate;
  pointer-events: none;
}

.balloon-btn:nth-child(2n) .balloon-bob { animation-delay: -0.9s; }
.balloon-btn:nth-child(3n) .balloon-bob { animation-delay: -0.45s; }

.balloon-btn:hover:not(:disabled) {
  background: none !important;
  transform: translateY(-4px) scale(1.04);
}

.balloon-btn .art-balloon {
  width: 100%;
  height: 100%;
}

.balloon-letter {
  position: absolute;
  top: 21%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(2.1rem, 4.8vw, 3rem);
  font-weight: 900;
  color: #361261;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.balloon-btn.picked .balloon-letter {
  color: #13682f;
}

/* Build Tiles */
.build-slots {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.build-slot {
  min-width: 58px;
  min-height: 62px;
  border: 3px dashed #924cd9;
  border-radius: 16px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  font-weight: 900;
  color: #46177a;
}

.build-slot.filled {
  border-style: solid;
  background: #fff6cf;
  border-color: #d99714;
}

/* Memory Cards */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 8px auto;
  width: 100%;
}

.memory-card {
  min-height: 98px;
  padding: 8px;
  border: 3px solid var(--gold);
  border-radius: 18px;
  background: linear-gradient(180deg, #a15ae6 0%, #5a2693 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 2.8vw, 1.55rem);
}

.memory-card .art-star-badge {
  width: 44px;
  height: 44px;
}

.memory-card.revealed, .memory-card:disabled {
  background: #ffffff;
  color: #3d166e;
  opacity: 1;
}

.memory-card.matched {
  background: #e1fad2;
  border-color: #43a649;
}

.memory-card svg {
  max-width: 72px;
  max-height: 72px;
}

/* Drawing Canvas */
.draw-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.draw-canvas {
  display: block;
  width: min(100%, 480px);
  height: auto;
  background: #ffffff;
  border: 3.5px solid #9451db;
  border-radius: 20px;
  touch-action: none;
  box-shadow: inset 0 2px 10px rgba(90, 42, 145, 0.1);
}

/* Feedback & Next */
.message {
  min-height: 1.9em;
  font-weight: 800;
  font-size: 1.15rem;
  margin: 10px 0 4px;
  color: #562081;
}

.message.good {
  color: var(--good);
  background: #defce8;
  border: 2px solid #59c47d;
  border-radius: 14px;
  padding: 6px 14px;
  display: inline-block;
}

.message.bad {
  color: var(--bad);
  background: #ffe8ee;
  border: 2px solid #eb8da6;
  border-radius: 14px;
  padding: 6px 14px;
  display: inline-block;
}

/* Treasure Chest & Certificate */
.chest-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.chest-btn {
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  padding: 4px !important;
  cursor: pointer;
}

.chest-btn .art-chest {
  width: clamp(170px, 34vw, 230px);
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(84, 34, 145, 0.35));
}

.cert {
  background: linear-gradient(180deg, #fffdf5 0%, #fff6dd 100%);
  border: 10px double #c68e22;
  outline: 4px solid #7e3bc4;
  border-radius: 22px;
  padding: clamp(20px, 4vw, 38px);
  margin: 16px auto;
  max-width: 780px;
  box-shadow: 0 12px 30px rgba(59, 25, 97, 0.22);
}

.cert .art-medal {
  width: 150px;
  height: auto;
  margin: 0 auto;
  display: block;
}

.cert h1 {
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  margin: 0.15em 0;
  color: #5a1f96;
}

.cert h2 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  margin: 0.1em 0 0.5em;
  color: #b07300;
}

.cert .cert-name {
  font-size: clamp(1.8rem, 4.5vw, 2.9rem);
  font-weight: 900;
  color: #6b25ad;
  margin: 10px auto;
  padding: 4px 16px;
  border-bottom: 3px dotted #c68e22;
  display: inline-block;
  min-width: 240px;
  overflow-wrap: anywhere;
}

.cert-date {
  font-weight: 700;
  color: #5c3c82;
  margin-top: 10px;
}

/* Animations */
@keyframes floatBob {
  from { transform: translateY(0); }
  to { transform: translateY(-7px); }
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 14px 4px rgba(255, 232, 92, 0.72), 0 6px 0 #7b6c5a, 0 11px 0 #574a42; }
  to { box-shadow: 0 0 26px 9px rgba(255, 238, 120, 0.98), 0 6px 0 #7b6c5a, 0 11px 0 #574a42; }
}

@keyframes popUnlock {
  0% { transform: scale(0.6) rotate(-14deg); }
  60% { transform: scale(1.22) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.still * {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Tablet / Smaller Desktop */
@media (max-width: 940px) {
  .stage-shell {
    flex-direction: column;
  }
  .side-guide {
    flex: none;
    flex-direction: row;
    align-items: flex-end;
    order: 2;
    margin-top: 4px;
  }
  .side-guide .art-zain {
    width: 102px;
  }
  .side-guide .star-float {
    position: static;
    width: 54px;
    margin-right: -12px;
    margin-bottom: 24px;
  }
}

/* Mobile Layout (tested down to 360px) */
@media (max-width: 640px) {
  main {
    padding: 8px;
  }
  .topbar {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 16px;
  }
  .btn-nav {
    min-height: 40px;
    padding: 0.35em 0.65em;
    font-size: 0.84rem;
  }
  .pill {
    font-size: 0.88rem;
    padding: 0.3em 0.7em;
  }
  .panel {
    border-radius: 22px;
    padding: 12px 10px;
  }
  .island-map-scroll {
    max-height: 70dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .island-map {
    aspect-ratio: auto;
    height: 1320px;
    min-height: 1320px;
    background: linear-gradient(180deg, #7be6ff 0%, #24c6e6 16%, #0c94cc 65%, #0775ab 100%);
  }
  .island {
    width: 122px;
    min-height: 82px;
  }
  .island-base {
    width: 84px;
    height: 46px;
  }
  .island-badge {
    width: 40px;
    height: 40px;
    margin-top: -24px;
  }
  .island-name {
    font-size: 0.76rem;
    max-width: 118px;
    white-space: normal;
    text-align: center;
  }
  .island.castle {
    width: 144px;
    min-height: 112px;
  }
  .island.castle .island-badge {
    width: 96px;
    height: 86px;
  }
  .map-traveler .art-zain {
    width: 56px;
  }
  .map-traveler .art-star {
    width: 28px;
  }
  .choices .tile {
    min-width: 78px;
    min-height: 54px;
  }
  .memory-card {
    min-height: 82px;
  }
}

/* A4 Landscape Certificate Printing */
@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  body {
    background: #ffffff !important;
  }
  main {
    padding: 0;
    min-height: auto;
  }
  .topbar, .no-print, .side-guide {
    display: none !important;
  }
  .panel {
    background: #ffffff !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
    padding: 0 !important;
  }
  .cert {
    height: 178mm;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    break-inside: avoid;
    box-shadow: none;
  }
}
