:root {
  --ink: #102a43;
  --muted: #5d7486;
  --blue: #126fb4;
  --blue-deep: #062f50;
  --gold: #f2be48;
  --green: #35b779;
  --red: #d85252;
  --cream: #fff8e9;
  --glass: rgba(255, 255, 255, 0.86);
  --glass-strong: rgba(255, 255, 255, 0.96);
  --shadow: 0 16px 36px rgba(5, 36, 59, 0.16), 0 4px 12px rgba(5, 36, 59, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --shadow-hover: 0 24px 48px rgba(5, 36, 59, 0.22), 0 8px 18px rgba(5, 36, 59, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --app-fit-scale: 1;
  --app-fit-width: 100vw;
  --app-fit-height: 100dvh;
  --app-fit-radius: 0px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(125, 213, 255, 0.58), transparent 42%),
    radial-gradient(circle at 0% 70%, rgba(255, 219, 128, 0.2), transparent 34%),
    linear-gradient(180deg, #dff5ff 0%, #f7efe1 58%, #d7edfb 100%);
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

html.zoom-fit-active body {
  align-items: center;
  justify-content: center;
}

button {
  font: inherit;
}

.hidden {
  display: none !important;
}

#particles-container {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: particleFade var(--particle-duration, 1000ms) cubic-bezier(0.17, 0.88, 0.32, 1) forwards;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.55), 0 0 22px currentColor;
  opacity: 0.92;
}

.particle-spark {
  border-radius: 4px;
  clip-path: polygon(50% 0%, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0% 50%, 38% 36%);
}

.particle-mist {
  filter: blur(1.5px);
  opacity: 0.5;
}

.particle-rune {
  border-radius: 36% 64% 54% 46%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: transparent !important;
}

@keyframes particleFade {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.45) rotate(0deg);
  }
  to {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(var(--particle-scale, 1.4)) rotate(var(--rot, 0deg));
  }
}

#app-container {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100svh;
  height: 100dvh;
  min-height: min(620px, 100dvh);
  overflow: hidden;
  background-color: #0c6ea0;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(0, 28, 50, 0.42)),
    url("../assets/maps/learning_hub.png");
  background-size: cover;
  background-position: center;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.55),
    0 22px 78px rgba(0, 38, 67, 0.26);
}

html.zoom-fit-active #app-container {
  width: var(--app-fit-width) !important;
  max-width: none !important;
  height: var(--app-fit-height) !important;
  min-height: 0 !important;
  margin: 0 !important;
  border-radius: var(--app-fit-radius) !important;
  transform: scale(var(--app-fit-scale));
  transform-origin: center center;
}

#app-container::before,
#app-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#app-container::before {
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 233, 158, 0.42), transparent 24%),
    radial-gradient(circle at 82% 18%, rgba(141, 214, 255, 0.28), transparent 22%),
    radial-gradient(circle at 54% 88%, rgba(113, 230, 178, 0.16), transparent 30%);
  mix-blend-mode: screen;
  animation: auroraFloat 16s ease-in-out infinite alternate;
  z-index: 11;
}

#app-container::after {
  background:
    linear-gradient(180deg, rgba(2, 27, 47, 0.05) 0%, transparent 20%, transparent 80%, rgba(1, 18, 33, 0.28) 100%),
    radial-gradient(circle at center, transparent 0 58%, rgba(1, 18, 33, 0.18) 100%);
  z-index: 12;
}

@keyframes auroraFloat {
  from { transform: translate(-2%, -1%) scale(1); }
  to { transform: translate(2%, 1%) scale(1.06); }
}

#app-container[data-bg="learning"] { background-image: linear-gradient(180deg, rgba(255,255,255,.2), rgba(0,28,50,.44)), url("../assets/maps/learning_hub.png"); }
#app-container[data-bg="story"] { background-image: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,28,50,.28)), url("../assets/maps/village_map.png"); }
#app-container[data-bg="character"] { background-image: linear-gradient(180deg, rgba(255,255,255,.16), rgba(0,28,50,.46)), url("../assets/maps/character_room.png"); }
#app-container[data-bg="daily"] { background-image: linear-gradient(180deg, rgba(255,255,255,.15), rgba(0,28,50,.48)), url("../assets/maps/daily_room.png"); }
#app-container[data-bg="graduation"] { background-image: linear-gradient(180deg, rgba(255,255,255,.16), rgba(0,28,50,.42)), url("../assets/maps/graduation_harbor.png"); }

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 18%, rgba(213, 242, 255, 0.72), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f4fbff 58%, #e9f6ff 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.boot-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.boot-card {
  position: relative;
  z-index: 1;
  display: block;
  width: min(460px, 92vw);
  padding: 34px 24px 28px;
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.96);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  text-align: center;
  opacity: 1;
}

.boot-fish {
  width: min(220px, 54vw);
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(5, 31, 50, 0.24));
  animation: npcFloat 2.4s ease-in-out infinite;
}

.boot-kicker,
.home-kicker,
.hub-panel-kicker,
.bubble-kicker,
.game-mode-tag,
.modal-head span {
  display: inline-block;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.boot-card h1 {
  margin-top: 10px;
  font-size: clamp(2.05rem, 8vw, 2.8rem);
  line-height: 1.08;
}

.boot-card p {
  margin: 14px auto 18px;
  max-width: 360px;
  color: var(--muted);
  font-weight: 850;
  font-size: 1.02rem;
  line-height: 1.55;
}

.boot-card .btn {
  min-height: 64px;
  padding-inline: 26px;
  font-size: 1.2rem;
}

.boot-progress {
  height: 13px;
  margin: 4px auto 16px;
  width: min(280px, 82%);
  overflow: hidden;
  border-radius: 999px;
  background: #dcecf6;
  box-shadow: inset 0 2px 5px rgba(10, 46, 70, 0.14);
}

.boot-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #65d6ff, #ffe08b, #43d08c);
  transform-origin: left center;
  transform: scaleX(0.04);
  transition: transform 0.22s ease;
}

.boot-travel {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 8px;
  width: min(320px, 86%);
  height: 58px;
  margin: 2px auto 16px;
  padding: 20px 12px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(232, 247, 255, 0.92), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 2px 8px rgba(8, 58, 92, 0.1);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.boot-travel::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 20px;
  height: 5px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(18, 111, 180, 0.2) 0 12px, transparent 12px 22px);
}

.boot-travel span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-inline: auto;
  border-radius: 999px;
  color: #0d3552;
  font-weight: 1000;
  background: #fff6c9;
  border: 2px solid rgba(219, 163, 41, 0.45);
  box-shadow: 0 4px 8px rgba(9, 48, 72, 0.14);
}

.boot-travel-fish {
  position: absolute;
  z-index: 2;
  left: 4%;
  bottom: 16px;
  width: 58px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(5, 31, 50, 0.22));
  opacity: 0;
}

.boot-overlay.traveling .boot-travel {
  opacity: 1;
  transform: translateY(0);
}

.boot-overlay.traveling .boot-travel-fish {
  opacity: 1;
  animation: bootFishPass 2.45s cubic-bezier(.2, .8, .25, 1) both;
}

.boot-overlay.traveling .boot-card {
  animation: bootCardDepart 2.65s ease both;
}

@keyframes bootLoad {
  from { transform: scaleX(0.05); }
  to { transform: scaleX(1); }
}

@keyframes bootFishPass {
  0% { left: 2%; transform: translateY(8px) rotate(-6deg) scale(0.9); }
  18% { transform: translateY(-18px) rotate(5deg) scale(1.06); }
  36% { transform: translateY(4px) rotate(-4deg) scale(0.98); }
  55% { transform: translateY(-20px) rotate(4deg) scale(1.08); }
  76% { transform: translateY(2px) rotate(-3deg) scale(1); }
  100% { left: 82%; transform: translateY(-10px) rotate(5deg) scale(1.05); }
}

@keyframes bootCardDepart {
  0%, 75% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

.boot-card .btn {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.boot-overlay.ready .boot-card .btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.boot-card .btn:disabled {
  filter: grayscale(0.2);
  opacity: 0;
}

.view-section {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
}

.active-view {
  display: flex;
}

#app-container.scene-transitioning .active-view {
  animation: sceneBrightIn 1.3s ease both;
}

#app-container.page-flash .view-section,
#app-container.page-flash #view-game {
  animation: pageDimGlow 1.1s ease both;
}

@keyframes sceneBrightIn {
  0% { opacity: 0.38; filter: brightness(0.58) saturate(0.88); transform: scale(1.018); }
  52% { opacity: 0.82; filter: brightness(1.08) saturate(1.04); }
  100% { filter: brightness(1) saturate(1); transform: scale(1); }
}

@keyframes pageDimGlow {
  0% { filter: brightness(1); }
  42% { opacity: 0.68; filter: brightness(0.62) blur(0.7px); }
  100% { filter: brightness(1.1); }
}

.hub-content {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: calc(var(--safe-top) + 76px) 14px 18px;
  overflow: hidden;
}

#app-container[data-panel="character"] .hub-content,
#app-container[data-panel="daily"] .hub-content,
#app-container[data-panel="story"] .hub-content,
#app-container[data-panel="pets"] .hub-content,
#app-container[data-panel="settings"] .hub-content {
  padding-top: calc(var(--safe-top) + 82px);
}

#app-container[data-panel="character"] .hub-panel-stack,
#app-container[data-panel="daily"] .hub-panel-stack,
#app-container[data-panel="story"] .hub-panel-stack,
#app-container[data-panel="pets"] .hub-panel-stack,
#app-container[data-panel="settings"] .hub-panel-stack {
  top: 386px;
}

.home-shell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 28px rgba(2, 35, 59, 0.18);
  backdrop-filter: blur(12px);
}

.home-shell h1 {
  margin-top: 3px;
  font-size: clamp(1.36rem, 5.4vw, 1.86rem);
  line-height: 1.14;
  font-weight: 900;
}

.home-shell p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 800;
}

.resource-chip {
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #e6f5ff);
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: inset 0 -3px 0 rgba(10, 75, 112, 0.08);
}

.hero-zone {
  position: relative;
  height: 178px;
  margin-top: 12px;
}

.hero-bubble {
  position: absolute;
  left: 4px;
  top: 8px;
  width: min(280px, 70%);
  padding: 12px 14px;
  border-radius: 22px 22px 22px 8px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 10px 26px rgba(5, 32, 52, 0.17);
}

.hero-bubble p {
  margin-top: 5px;
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 850;
}

.npc-duo {
  position: absolute;
  right: 0;
  bottom: -6px;
  width: 72%;
  height: 170px;
}

.npc-fish {
  position: absolute;
  right: 190px;
  bottom: 27px;
  width: 96px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 12px 14px rgba(4, 30, 49, 0.26));
  animation: npcFloat 2.4s ease-in-out infinite;
  z-index: 2;
}

.npc-fangfang {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 128px;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(4, 30, 49, 0.25));
  z-index: 1;
}

.npc-duo.victory .npc-fish {
  right: 6px;
  bottom: 0;
  width: min(250px, 72%);
  height: 168px;
  animation: npcFloat 2.2s ease-in-out infinite, victoryGlow 2.8s ease-in-out infinite;
}

.npc-duo.victory .npc-fangfang {
  display: none;
}

@keyframes victoryGlow {
  0%, 100% { filter: drop-shadow(0 12px 14px rgba(4, 30, 49, 0.26)) drop-shadow(0 0 0 rgba(255, 224, 139, 0)); }
  50% { filter: drop-shadow(0 12px 14px rgba(4, 30, 49, 0.26)) drop-shadow(0 0 18px rgba(255, 224, 139, 0.8)); }
}

@keyframes npcFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.hub-panel-stack {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 330px;
  bottom: 18px;
  min-height: 0;
}

.hub-panel {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hub-panel.active {
  display: flex;
  animation: panelIn 0.55s ease both;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hub-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.hub-panel-head h2 {
  margin-top: 2px;
  font-size: 1.35rem;
  line-height: 1.15;
}

.hub-panel-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.42;
  font-weight: 800;
}

.hub-panel-badge {
  align-self: start;
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffe69b, #e5ad36);
  font-weight: 1000;
  font-size: 0.82rem;
}

.handbook-grid,
.character-grid,
.daily-actions,
.daily-summary {
  overflow: auto;
  min-height: 0;
  padding: 2px 3px 12px;
}

.handbook-grid,
.character-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.handbook-card,
.stat-card,
.pet-card,
.badge-card,
.task-card,
.choice-card,
.media-card {
  padding: 14px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 249, 255, 0.92));
  border: 1px solid rgba(11, 112, 183, 0.12);
  box-shadow: 0 10px 22px rgba(6, 53, 86, 0.1);
}

.handbook-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.handbook-card img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(12, 112, 183, 0.14);
}

.handbook-card h3,
.stat-card h3,
.pet-card h3,
.badge-card h3 {
  font-size: 1rem;
  line-height: 1.24;
}

.handbook-card {
  position: relative;
}

.handbook-card::after {
  content: "點卡片複習";
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0a3a5b;
  background: #fff1b8;
  border: 1px solid rgba(219, 163, 41, 0.25);
  font-size: 0.72rem;
  font-weight: 1000;
  box-shadow: 0 0 0 4px rgba(255, 224, 139, 0.12);
}

.handbook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.handbook-actions button {
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  color: #07395b;
  background: linear-gradient(180deg, #fff8d6, #ffe08b);
  font-weight: 1000;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.mini-handbook-grid {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.mini-handbook {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 10px;
}

.mini-handbook img {
  width: 62px;
  height: 46px;
  object-fit: cover;
  border-radius: 12px;
}

.mini-handbook span {
  display: grid;
  gap: 2px;
}

.mini-handbook small {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 1000;
}

.mini-handbook.ebook img {
  object-fit: contain;
  padding: 7px;
  background: #fff7d8;
}

.muted {
  color: var(--muted);
  font-weight: 780;
  line-height: 1.45;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 22px;
  text-align: center;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px dashed rgba(12, 112, 183, 0.2);
}

.empty-state.compact {
  min-height: 110px;
  padding: 14px;
}

.btn,
.hub-nav-btn,
.large-action,
.choice-btn,
.task-btn,
.icon-btn,
.quit-btn {
  border: 0;
  cursor: pointer;
  font-weight: 950;
  transition: transform 0.2s cubic-bezier(0.2, 1.4, 0.3, 1), filter 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
.hub-nav-btn:hover,
.large-action:hover,
.choice-btn:hover,
.task-btn:hover,
.icon-btn:hover,
.quit-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn:active,
.hub-nav-btn:active,
.large-action:active,
.choice-btn:active,
.task-btn:active,
.icon-btn:active,
.quit-btn:active {
  transform: translateY(1px) scale(0.97);
}

.btn {
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 16px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.13), 0 10px 18px rgba(5, 48, 78, 0.14);
  letter-spacing: 0;
}

.btn-primary {
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 224, 139, 0.36), transparent 38%),
    linear-gradient(180deg, #18a7f4, #075082);
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.18),
    0 12px 22px rgba(5, 48, 78, 0.2),
    0 0 0 4px rgba(255, 224, 139, 0.12);
  overflow: hidden;
  animation: primaryGlow 2.5s ease-in-out infinite;
}

@keyframes primaryGlow {
  0%, 100% { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 12px 22px rgba(5, 48, 78, 0.2), 0 0 0 4px rgba(255, 224, 139, 0.12); }
  50% { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 16px 28px rgba(5, 48, 78, 0.28), 0 0 16px rgba(255, 224, 139, 0.44), 0 0 0 6px rgba(255, 224, 139, 0.2); }
}}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: -30% auto -30% -45%;
  width: 42%;
  transform: skewX(-16deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.54), transparent);
  pointer-events: none;
  animation: buttonShine 2.6s ease-in-out infinite;
}

@keyframes buttonShine {
  0%, 45% { left: -48%; opacity: 0; }
  62% { opacity: 1; }
  100% { left: 112%; opacity: 0; }
}

.btn-secondary {
  color: var(--ink);
  background: linear-gradient(180deg, #fff, #dceffd);
}

.full-width {
  width: 100%;
}

.hub-bottom-nav {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(var(--safe-bottom) + 12px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 7px;
  min-height: 78px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06)),
    linear-gradient(180deg, rgba(9, 73, 111, 0.94), rgba(4, 35, 61, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -8px 18px rgba(0, 16, 31, 0.22),
    0 20px 42px rgba(0, 20, 34, 0.42);
  backdrop-filter: blur(18px) saturate(1.16);
}

.header-brand {
  flex: 0 0 auto;
  font-size: 1rem;
  font-weight: 1000;
  color: #dff5ff;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 5px rgba(0, 11, 25, 0.34);
}

.top-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.top-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 188px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 34px rgba(0, 25, 42, 0.28);
  display: grid;
  gap: 6px;
  z-index: 150;
}

.top-menu button {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff, #eaf6ff);
  font-weight: 950;
  font-size: 0.92rem;
  cursor: pointer;
}

.top-menu img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.hub-nav-btn {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 0;
  border-radius: 23px;
  color: #eaf8ff;
  background: transparent;
  box-shadow: none;
  border: 1px solid transparent;
  opacity: 0.82;
}

.nav-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgba(0, 28, 48, 0.28));
}

.hub-nav-btn.active {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.82), transparent 40%),
    linear-gradient(180deg, #ffeaa5, #e1ad39);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 -5px 0 rgba(142, 89, 3, 0.16),
    0 12px 22px rgba(0, 20, 34, 0.24);
  opacity: 1;
}

.main-orb-btn {
  transform: none;
  min-height: 64px;
}

.nav-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 1000;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-with-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.global-header,
.game-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: calc(var(--safe-top) + 10px) 10px 12px;
  color: #fff;
}

.global-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: calc(var(--safe-top) + 58px);
  z-index: 100;
}

.global-header,
.game-header {
  background:
    linear-gradient(180deg, rgba(9, 64, 99, 0.96), rgba(5, 38, 64, 0.84)),
    radial-gradient(circle at 50% 0%, rgba(255, 231, 148, 0.22), transparent 56%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
  box-shadow:
    inset 0 -1px 0 rgba(4, 23, 42, 0.28),
    0 10px 28px rgba(0, 24, 43, 0.24);
  backdrop-filter: blur(18px) saturate(1.12);
}

.game-header {
  min-height: calc(var(--safe-top) + 72px);
  border-radius: 0 0 24px 24px;
  margin-bottom: 10px;
}

.header-title,
.game-header h1 {
  min-width: 44px;
  text-align: center;
  font-size: 0.96rem;
  font-weight: 1000;
  text-shadow: 0 2px 5px rgba(0, 11, 25, 0.34);
}

.header-title {
  flex: 1 1 auto;
}

.stats-combo {
  display: flex;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 900;
  min-width: 0;
}

.stats-combo span,
.icon-btn,
.quit-btn {
  padding: 8px 10px;
  border-radius: 999px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)),
    rgba(3, 32, 52, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.stats-combo span,
.icon-btn {
  padding: 5px 7px;
}

.stats-combo span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stats-combo img {
  width: 17px;
  height: 17px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 12, 22, 0.28));
}

.icon-btn-img {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.icon-btn-img img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.story-map {
  position: relative;
  flex: 0 0 auto;
  width: min(100%, 360px);
  aspect-ratio: 16 / 9;
  margin: 8px auto 0;
  min-height: 0;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--focus-x, 50%) var(--focus-y, 50%), rgba(255, 224, 139, 0.26), transparent 26%),
    #0a82bd;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    0 16px 30px rgba(2, 34, 56, 0.18),
    0 0 0 5px rgba(255, 255, 255, 0.24);
  opacity: 0.92;
}

.story-map::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--focus-x, 50%) var(--focus-y, 50%), transparent 0 18%, rgba(0, 25, 42, 0.08) 45%, rgba(0, 21, 36, 0.22) 100%);
  mix-blend-mode: multiply;
}

.story-map::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 21;
  pointer-events: none;
  border-radius: 18px;
  border: 2px solid rgba(255, 224, 139, 0.42);
  box-shadow: inset 0 0 28px rgba(255, 224, 139, 0.12), 0 0 22px rgba(255, 224, 139, 0.18);
}

.story-map-layer {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  transition: transform 0.95s cubic-bezier(.2, .82, .22, 1), filter 0.95s ease;
  will-change: transform;
}

.story-action-row {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.hub-panel[data-panel="story"] .story-action-row .btn {
  margin-top: 0;
  min-height: 66px;
  border-radius: 20px;
  font-size: 1.22rem;
  animation: startPulse 1.8s ease-in-out infinite;
  isolation: isolate;
}

.hub-panel[data-panel="story"] #btn-start-current-level::before {
  content: "請按這裡";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 9px;
  border-radius: 999px;
  color: #0a3a5b;
  background: rgba(255, 244, 197, 0.95);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  font-size: 0.75rem;
  font-weight: 1000;
  z-index: 2;
}

.hub-panel[data-panel="story"] #btn-start-current-level::after {
  content: "";
  position: absolute;
  inset: -5px;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 224, 139, 0.44), transparent 62%);
  animation: startHalo 1.8s ease-in-out infinite;
}

.hub-panel[data-panel="story"] #btn-start-current-level.completed-cta {
  background:
    linear-gradient(180deg, #21b6ff 0%, #0876b7 52%, #064f86 100%);
  border: 2px solid rgba(255, 245, 190, 0.95);
  box-shadow:
    inset 0 -5px 0 rgba(0, 37, 74, 0.24),
    0 16px 28px rgba(6, 92, 146, 0.3),
    0 0 0 6px rgba(255, 223, 117, 0.16);
}

.hub-panel[data-panel="story"] #btn-retry-final-level {
  animation: none;
  min-height: 58px;
  color: #073453;
  border: 2px solid rgba(9, 79, 122, 0.18);
  box-shadow: 0 8px 18px rgba(5, 48, 78, 0.12);
}

@keyframes startPulse {
  0%, 100% { filter: brightness(1); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.13), 0 10px 18px rgba(5, 48, 78, 0.14); }
  50% { filter: brightness(1.08); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.13), 0 18px 30px rgba(18, 111, 180, 0.28); }
}

@keyframes startHalo {
  0%, 100% { opacity: 0.45; transform: scale(0.98); }
  50% { opacity: 0.9; transform: scale(1.035); }
}

.story-map img.map-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-node {
  position: absolute;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  font-weight: 1000;
  background: radial-gradient(circle, #fff 0 50%, #d7edf8 51% 70%, #8ca3b2 71% 100%);
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 18px rgba(0, 25, 42, 0.24);
  z-index: 4;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.18, 1.4, 0.28, 1), box-shadow 0.2s ease, background 0.2s ease;
}

.map-node:not(.locked) {
  cursor: pointer;
}

.map-node:not(.locked):hover {
  transform: translate(-50%, -50%) scale(1.22);
  box-shadow: 0 12px 24px rgba(0, 25, 42, 0.36), 0 0 16px rgba(255, 224, 139, 0.6);
  z-index: 10;
}

.map-node.current:not(.locked):hover {
  transform: translate(-50%, -50%) scale(1.28);
}

.map-node > img {
  position: absolute;
  inset: -7px;
  width: calc(100% + 14px);
  height: calc(100% + 14px);
  object-fit: contain;
  filter: drop-shadow(0 7px 9px rgba(0, 25, 42, 0.28));
}

.map-node > b {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--ink);
}

.map-node.current {
  background: radial-gradient(circle, #fff 0 48%, #ffe08b 49% 70%, #0b77b7 71% 100%);
  animation: pulseNode 1.6s ease-in-out infinite;
  transform: translate(-50%, -50%) scale(1.12);
}

.map-unlocking .map-node.current {
  animation: unlockNode 0.72s ease-in-out infinite;
  z-index: 10;
}

.map-unlocking .story-map-layer {
  filter: brightness(1.14) saturate(1.14);
}

.map-node.done {
  background: radial-gradient(circle, #fff 0 48%, #95edbd 49% 70%, #229a65 71% 100%);
}

.map-node.locked {
  opacity: 0.52;
  filter: grayscale(0.55);
}

.map-node.locked > b {
  color: rgba(18, 48, 71, 0.55);
}

.node-label {
  position: absolute;
  top: 39px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(3, 32, 52, 0.7);
  font-size: 0.62rem;
  box-shadow: 0 4px 9px rgba(0, 21, 35, 0.16);
}

.btn-primary,
.large-action,
.comic-nav-btn:not(:disabled),
.product-prompt-chip,
.prompt-chip,
.choice-btn,
.source-add,
.task-btn:not(.correct),
.pair-target,
.tool-orb {
  position: relative;
}

.btn-primary::after,
.large-action::after,
.comic-nav-btn:not(:disabled)::after,
.product-prompt-chip::after,
.prompt-chip::after,
.choice-btn:not(.correct)::after,
.source-add:not(.ready)::after,
.task-btn:not(.correct)::after,
.pair-target::after,
.tool-orb::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  pointer-events: none;
  border: 2px solid rgba(255, 224, 139, 0.7);
  opacity: 0.88;
  animation: simpleReflect 3.2s ease-in-out infinite;
}

@keyframes simpleReflect {
  0%, 55%, 100% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(255, 224, 139, 0); }
  72% { filter: brightness(1.18); box-shadow: 0 0 0 5px rgba(255, 224, 139, 0.12); }
}

@keyframes pulseNode {
  0%, 100% { box-shadow: 0 8px 18px rgba(0, 25, 42, 0.24), 0 0 0 0 rgba(255, 225, 138, 0.7); }
  50% { box-shadow: 0 8px 18px rgba(0, 25, 42, 0.24), 0 0 0 15px rgba(255, 225, 138, 0); }
}

@keyframes unlockNode {
  0%, 100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); filter: brightness(1.35); }
}

.map-fish {
  position: absolute;
  width: 54px;
  height: 44px;
  object-fit: contain;
  transform: translate(-50%, -105%);
  z-index: 7;
  filter: drop-shadow(0 10px 12px rgba(0, 26, 44, 0.26));
  animation: npcFloat 2.2s ease-in-out infinite;
}

.map-travel-fish {
  position: absolute;
  width: 66px;
  height: 54px;
  object-fit: contain;
  transform: translate(-50%, -105%);
  z-index: 18;
  filter:
    drop-shadow(0 10px 12px rgba(0, 26, 44, 0.26))
    drop-shadow(0 0 16px rgba(255, 224, 139, 0.92));
  transition: left 3.2s cubic-bezier(.2, .82, .22, 1), top 3.2s cubic-bezier(.2, .82, .22, 1);
  animation: mapFishTravelGlow 0.7s ease-in-out infinite alternate;
}

.map-travel-fish::after {
  content: "";
}

@keyframes mapFishTravelGlow {
  from { transform: translate(-50%, -105%) scale(0.95) rotate(-4deg); }
  to { transform: translate(-50%, -122%) scale(1.08) rotate(5deg); }
}

.map-flag {
  position: absolute;
  width: 28px;
  transform: translate(-8%, -100%);
  z-index: 6;
}

.daily-actions {
  display: grid;
  gap: 12px;
}

.large-action {
  min-height: 118px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 4px 12px;
  align-content: center;
  align-items: center;
  text-align: left;
  padding: 16px;
  border-radius: 24px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(230, 246, 255, 0.9));
  border: 1px solid rgba(11, 112, 183, 0.18);
  box-shadow: 0 12px 24px rgba(6, 53, 86, 0.12);
}

.large-action img {
  grid-row: 1 / span 2;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(5, 43, 70, 0.16));
}

.large-action.accent {
  background:
    linear-gradient(135deg, rgba(255, 246, 213, 0.98), rgba(255, 255, 255, 0.94));
}

.large-action span {
  font-size: 1.18rem;
  font-weight: 1000;
}

.large-action small {
  color: var(--muted);
  font-weight: 850;
  line-height: 1.45;
}

.media-card-with-icon {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
  align-items: center;
}

.media-card-with-icon > img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(5, 43, 70, 0.16));
}

.quiz-title-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.quiz-title-row img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(5, 43, 70, 0.14));
}

.badge-row,
.pet-row,
.upgrade-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  width: 42px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px 15px 11px 11px;
  background: linear-gradient(180deg, #eef8ff, #c8dcea);
  font-weight: 1000;
  color: rgba(18, 48, 71, 0.55);
  position: relative;
  overflow: hidden;
}

.badge img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  object-fit: contain;
  opacity: 0.42;
}

.badge b {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: rgba(18, 48, 71, 0.72);
}

.badge.on {
  color: var(--ink);
  background: linear-gradient(180deg, #ffe395, #daa233);
}

.badge.on img {
  opacity: 1;
}

.badge.on b {
  color: var(--ink);
}

.pet-art {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 0;
  color: #fff;
  background: transparent;
  font-weight: 1000;
  box-shadow: none;
}

.pet-art.big {
  width: 136px;
  height: 136px;
  border-radius: 40px;
  font-size: 3rem;
}

.pet-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter:
    drop-shadow(0 10px 10px rgba(0, 20, 36, 0.2))
    drop-shadow(0 0 12px rgba(255, 224, 139, 0.42));
  animation: petFloat 2.5s ease-in-out infinite;
}

@keyframes petFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.pet-list-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  float: left;
  margin: 0 9px 6px 0;
}

.pet-option {
  min-height: 94px;
}

.pet-option.pet-missing {
  filter: grayscale(1);
  opacity: 0.55;
  background: linear-gradient(180deg, #eef3f7, #d9e3ea);
}

.pet-option.pet-missing::after {
  content: "尚未取得";
  background: #e2e8ee;
  color: #536878;
  box-shadow: none;
  animation: none;
}

.pet-option.pet-owned {
  background:
    radial-gradient(circle at 16% 16%, rgba(255, 224, 139, 0.26), transparent 42%),
    linear-gradient(180deg, #ffffff, #eefaff);
}

.pet-option.pet-owned .pet-list-icon {
  filter: drop-shadow(0 8px 12px rgba(18, 111, 180, 0.2)) drop-shadow(0 0 12px rgba(255, 224, 139, 0.45));
}

.pet-option.pet-active {
  border-color: #ffd76b;
  box-shadow: 0 0 0 5px rgba(255, 224, 139, 0.22), 0 16px 28px rgba(6, 53, 86, 0.14);
}

.pet-option.pet-active::after {
  content: "陪伴中";
  color: #6b4800;
  background: #ffe08b;
}

.icon-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-line img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.placeholder-icon {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin-bottom: 10px;
  filter: drop-shadow(0 10px 12px rgba(5, 43, 70, 0.14));
}

.pet-companion {
  position: absolute;
  right: 131px;
  bottom: 27px;
  z-index: 3;
}

.battle-pet {
  display: none;
}

.install-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  font-weight: 850;
  color: var(--muted);
}

#view-game {
  background: rgba(4, 23, 38, 0.18);
}

#view-game::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 224, 139, 0.2), transparent 24%),
    radial-gradient(circle at 86% 18%, rgba(121, 220, 255, 0.18), transparent 28%),
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.12) 45%, transparent 54% 100%);
  background-size: auto, auto, 220% 100%;
  animation: stageLightSweep 5.5s ease-in-out infinite;
  z-index: 1;
}

@keyframes stageLightSweep {
  0%, 100% { background-position: center, center, 180% 0; opacity: 0.55; }
  50% { background-position: center, center, 0% 0; opacity: 0.85; }
}

.game-header {
  align-items: flex-start;
}

.game-header p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  font-weight: 800;
}

.game-status {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
  padding: 0 14px 10px;
}

.hp-box,
.step-box {
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 22px rgba(3, 31, 51, 0.14);
}

.hp-box span,
.step-box span {
  display: block;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 1000;
}

.hp-dots {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

.hp-dot {
  width: 20px;
  height: 20px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ff7670, #c73535);
}

.hp-dot.empty {
  background: rgba(157, 176, 189, 0.45);
}

.game-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  margin: 0 10px 10px;
  padding: 10px;
  overflow: auto;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.91);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  animation: stageRise 0.28s ease both;
}

@keyframes stageRise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#app-container[data-game-step="media"] .game-status {
  display: none;
}

#app-container[data-play-mode="story"] .hp-box,
#app-container[data-quiz-mode="soft"] .hp-box {
  display: none;
}

#app-container[data-game-step="media"] .game-header {
  min-height: calc(var(--safe-top) + 58px);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

#app-container[data-game-step="media"] .game-header > div {
  display: none;
}

#app-container[data-game-step="media"] .quit-btn {
  margin-right: auto;
}

#app-container[data-game-step="media"] .game-stage {
  margin-top: 0;
}

.game-stage[data-step-type="intro"],
.game-stage[data-step-type="post"],
.game-stage[data-step-type="handbook"],
.game-stage[data-step-type="handbook2"] {
  overflow: hidden;
}

.stage-media {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  height: 100%;
  min-height: 0;
  align-content: start;
  perspective: 1100px;
  animation: pageArrive 0.62s ease both;
}

.stage-media-frame {
  display: grid;
  place-items: center;
  min-height: 0;
  height: auto;
  max-height: min(68dvh, 620px);
  border-radius: 24px;
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.92));
  border: 1px solid rgba(11, 112, 183, 0.16);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.48),
    0 14px 28px rgba(4, 36, 58, 0.16);
}

.stage-media-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(60dvh, 560px);
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(4, 36, 58, 0.12));
}

.stage-media-frame::-webkit-scrollbar {
  width: 8px;
}

.stage-media-frame::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.32);
}

.comic-player {
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-items: center;
}

.comic-panel-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  height: fit-content;
  max-height: calc(100svh - var(--safe-top) - 220px);
  aspect-ratio: auto;
  justify-self: center;
  align-self: center;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(237, 247, 255, 0.92));
  border: 1px solid rgba(11, 112, 183, 0.16);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.48),
    0 14px 28px rgba(4, 36, 58, 0.16);
}

.comic-panel-frame::after {
  content: attr(data-panel);
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff2b8, #e4b247);
  font-weight: 1000;
  box-shadow: 0 8px 16px rgba(4, 36, 58, 0.18);
}

.comic-panel-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100svh - var(--safe-top) - 220px);
  object-fit: contain;
  transition: opacity 0.55s ease, transform 0.62s cubic-bezier(0.2, 0.82, 0.24, 1);
}

.comic-caption {
  position: relative;
}

.comic-caption h3 {
  display: none;
}

.comic-page-count {
  display: inline-block;
  margin-top: 5px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 1000;
}

.comic-controls {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 10px;
}

.comic-nav-btn {
  min-height: 48px;
}

.comic-nav-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.book-frame {
  position: relative;
}

.book-frame::before {
  content: "";
  position: absolute;
  inset: 9px auto 9px 50%;
  width: 2px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(11, 76, 114, 0.18), transparent);
  opacity: 0.5;
  z-index: 2;
}

.stage-media .media-card {
  padding: 10px 12px;
  border-radius: 18px;
}

.stage-media .media-card h3 {
  font-size: 0.98rem;
  line-height: 1.2;
}

.stage-media .media-card .muted {
  font-size: 0.78rem;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-next-btn {
  min-height: 44px;
}

.teaching-step {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 100%;
  animation: pageArrive 0.62s ease both;
}

.teaching-head {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.34), transparent 38%),
    rgba(255, 255, 255, 0.94);
}

.teaching-card-grid {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 6px;
  overscroll-behavior: contain;
}

.teaching-card {
  position: relative;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.9));
  border: 2px solid rgba(18, 111, 180, 0.12);
  box-shadow: 0 12px 22px rgba(6, 53, 86, 0.1);
  animation: cardPop 0.46s ease both;
}

.ebook-step {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

.ebook-reader {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 12px;
  border-radius: 26px;
  background:
    linear-gradient(90deg, rgba(255, 247, 226, 0.96), rgba(255, 255, 255, 0.98) 48%, rgba(238, 249, 255, 0.96));
  border: 2px solid rgba(18, 111, 180, 0.12);
  box-shadow: 0 16px 28px rgba(4, 36, 58, 0.14);
}

.ebook-cover {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px 12px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
}

.ebook-cover img {
  grid-row: 1 / span 3;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.ebook-cover h2 {
  font-size: 1.1rem;
  line-height: 1.2;
}

.ebook-cover p {
  color: var(--muted);
  font-weight: 850;
  line-height: 1.42;
  font-size: 0.92rem;
}

.ebook-pages {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding: 2px 2px 8px;
}

.ebook-page {
  position: relative;
  min-height: 142px;
  padding: 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.22), transparent 35%),
    rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(18, 111, 180, 0.12);
  box-shadow: 0 10px 18px rgba(6, 53, 86, 0.08);
}

.ebook-page h3 {
  padding-right: 44px;
  font-size: 1.08rem;
}

.ebook-page p {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 860;
  line-height: 1.5;
  font-size: 0.94rem;
}

@media (min-width: 760px) {
  .ebook-pages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }
}

.teaching-card h3 {
  padding-right: 44px;
  font-size: 1.12rem;
}

.teaching-card p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.55;
}

.teaching-example {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 224, 139, 0.22), transparent 42%),
    rgba(255, 248, 225, 0.86);
  border: 1px solid rgba(219, 163, 41, 0.2);
}

.teaching-example strong {
  display: block;
  color: #8a5a00;
  font-size: 0.82rem;
  font-weight: 1000;
}

.teaching-example p {
  margin-top: 4px;
  color: #4f6170;
  font-size: 0.94rem;
}

.lesson-number {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff2b8, #e4b247);
  color: var(--ink);
  font-weight: 1000;
  box-shadow: 0 8px 16px rgba(4, 36, 58, 0.16);
}

.teaching-points {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.teaching-points span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.1);
  color: var(--blue-deep);
  font-size: 0.78rem;
  font-weight: 1000;
}

.page-turning {
  transform-origin: left center;
  animation: pageTurnOut 1.1s cubic-bezier(0.15, 0.85, 0.25, 1) both;
}

@keyframes pageArrive {
  from { opacity: 0; transform: translateY(18px) rotateX(8deg) scale(0.985); }
  to { opacity: 1; transform: translateY(0) rotateX(0deg) scale(1); }
}

@keyframes softShine {
  0%, 42% { transform: translateX(-125%); opacity: 0; }
  54% { opacity: 0.82; }
  72%, 100% { transform: translateX(125%); opacity: 0; }
}

@keyframes toolDeskPulse {
  0% { box-shadow: 0 0 0 0 rgba(242, 190, 72, 0), 0 12px 24px rgba(6, 53, 86, 0.1); }
  42% { box-shadow: 0 0 0 8px rgba(242, 190, 72, 0.24), 0 18px 32px rgba(6, 53, 86, 0.18); }
  100% { box-shadow: 0 12px 24px rgba(6, 53, 86, 0.1); }
}

@keyframes pageTurnOut {
  0% { opacity: 1; transform: rotateY(0deg) translateX(0) scale(1); filter: brightness(1); }
  45% { opacity: 0.96; transform: rotateY(-13deg) translateX(-5px) scale(0.992); filter: brightness(0.86); }
  72% { opacity: 0.82; transform: rotateY(-28deg) translateX(-14px) scale(0.982); filter: brightness(1.15); }
  100% { opacity: 0; transform: rotateY(-48deg) translateX(-32px) scale(0.965); filter: brightness(1.26); }
}

.stage-placeholder {
  padding: 28px;
  text-align: center;
}

.task-list,
.choice-list,
.sequence-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.task-brief {
  animation: missionDrop 0.52s ease both;
}

.task-brief.match { background: linear-gradient(135deg, #e9f7ff, #ffffff); }
.task-brief.slots { background: linear-gradient(135deg, #fff4d2, #ffffff); }
.task-brief.select { background: linear-gradient(135deg, #f3edff, #ffffff); }
.task-brief.sequence { background: linear-gradient(135deg, #e9fff4, #ffffff); }

@keyframes missionDrop {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.task-btn,
.choice-btn {
  width: 100%;
  min-height: 72px;
  padding: 16px;
  border-radius: 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(18, 111, 180, 0.24);
  text-align: left;
  box-shadow:
    0 10px 18px rgba(6, 53, 86, 0.1),
    inset 0 -3px 0 rgba(18, 111, 180, 0.08);
  position: relative;
  overflow: hidden;
  animation: cardPop 0.44s ease both;
  font-size: 1rem;
  line-height: 1.45;
}

.task-btn:not(.correct)::before,
.choice-btn:not(.correct)::before,
.prompt-chip::before,
.product-prompt-chip::before,
.tool-orb::before,
.pair-target::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle, #fff 0 22%, #ffd76b 23% 68%, rgba(255, 215, 107, 0) 69%);
  box-shadow: 0 0 0 4px rgba(255, 224, 139, 0.2), 0 0 14px rgba(255, 215, 107, 0.85);
  animation: none;
}

@keyframes tapDot {
  0%, 100% { transform: scale(0.9); opacity: 0.72; }
  50% { transform: scale(1.18); opacity: 1; }
}

.task-btn.selected,
.choice-btn.selected {
  border-color: var(--gold);
  background: #fff5cf;
}

.task-btn.correct,
.choice-btn.correct {
  border-color: var(--green);
  background: #e0f9ed;
  animation: correctPulse 0.45s ease both;
}

.welcome-tap-console {
  gap: 14px;
}

.task-btn.welcome-first-card {
  min-height: 112px;
  padding: 22px 18px;
  border-color: rgba(242, 190, 72, 0.96);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.94), transparent 34%),
    linear-gradient(180deg, #fff7ca, #ffd965);
  box-shadow:
    0 0 0 6px rgba(255, 224, 139, 0.18),
    0 16px 28px rgba(131, 86, 9, 0.22),
    inset 0 -4px 0 rgba(132, 86, 0, 0.12);
  animation: welcomeCardGlow 1.45s ease-in-out infinite;
  font-size: 1.08rem;
  font-weight: 1000;
}

.task-btn.welcome-first-card::after {
  content: "請先點這張";
  color: #6b4300;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 4px rgba(255, 244, 195, 0.5), 0 8px 16px rgba(97, 64, 0, 0.14);
}

.btn-muted {
  color: #5e7180;
  background: linear-gradient(180deg, #eef3f6, #d6e0e7);
  border: 2px solid rgba(94, 113, 128, 0.2);
  box-shadow: inset 0 -4px 0 rgba(60, 76, 88, 0.08), 0 8px 14px rgba(5, 48, 78, 0.08);
  animation: none !important;
}

.btn-muted::before,
.btn-muted::after {
  display: none !important;
}

@keyframes welcomeCardGlow {
  0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); }
  50% { transform: translateY(-2px) scale(1.01); filter: brightness(1.08); }
}

.task-btn.wrong,
.choice-btn.wrong {
  border-color: var(--red);
  background: #ffe3e0;
  animation: wrongShake 0.34s ease both;
}

.task-btn:not(.correct):not(:disabled)::after,
.choice-btn:not(.correct):not(:disabled)::after,
.prompt-chip:not(:disabled)::after,
.product-prompt-chip:not(:disabled)::after,
.pair-source-card:not(.correct)::after,
.pair-target:not(.correct)::after,
.tool-orb:not(.selected)::after {
  content: "點這裡";
  position: absolute;
  inset: auto 12px 10px auto;
  width: auto;
  height: auto;
  padding: 5px 9px;
  border: 0;
  border-radius: 999px;
  color: #07395b;
  background: linear-gradient(180deg, #fff9d8, #ffd76b);
  box-shadow: 0 0 0 4px rgba(255, 224, 139, 0.14), 0 8px 16px rgba(9, 52, 78, 0.12);
  font-size: 0.72rem;
  font-weight: 1000;
  animation: tapLabelGlow 1.7s ease-in-out infinite;
}

.task-btn.correct::after,
.choice-btn.correct::after,
.pair-source-card.correct::after,
.pair-target.correct::after {
  content: "已完成";
  position: absolute;
  inset: auto 12px 10px auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0b5a3a;
  background: #dff8ea;
  font-size: 0.72rem;
  font-weight: 1000;
}

@keyframes tapLabelGlow {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-2px); filter: brightness(1.12); }
}

@keyframes cardPop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.035); box-shadow: 0 0 0 8px rgba(53, 183, 121, 0.12); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-2px); }
}

.nav-console {
  grid-template-columns: 1fr;
  padding: 10px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 224, 139, 0.42), transparent 38%),
    linear-gradient(180deg, rgba(229, 246, 255, 0.9), rgba(255, 255, 255, 0.9));
}

.match-board,
.forge-board {
  gap: 12px;
}

.pairing-console {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  min-height: 0;
}

.pair-card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.pair-source-card {
  width: 100%;
  min-height: 78px;
  padding: 12px 14px;
  border-radius: 20px;
  text-align: left;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.9));
  border: 2px solid rgba(18, 111, 180, 0.14);
  box-shadow: 0 8px 15px rgba(6, 53, 86, 0.08);
  display: grid;
  gap: 4px;
  align-content: center;
  position: relative;
  overflow: hidden;
}

.pair-source-card::after {
  content: "";
  position: absolute;
  inset: auto 14px 10px auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.12);
}

.pair-source-card span {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 1000;
}

.pair-source-card strong {
  font-size: 0.95rem;
  line-height: 1.35;
  padding-right: 34px;
}

.pair-source-card em {
  justify-self: start;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(53, 183, 121, 0.14);
  color: #0e5d3b;
  font-style: normal;
  font-weight: 1000;
  font-size: 0.76rem;
}

.pair-source-card.active {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.48), transparent 34%),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 5px rgba(242, 190, 72, 0.16), 0 12px 22px rgba(6, 53, 86, 0.12);
}

.pair-source-card.correct {
  border-color: rgba(53, 183, 121, 0.55);
  background: linear-gradient(135deg, #e0f9ed, #ffffff);
}

.pair-target-deck {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 224, 139, 0.34), transparent 42%),
    linear-gradient(180deg, rgba(7, 59, 99, 0.92), rgba(7, 92, 139, 0.78));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 14px 30px rgba(4, 36, 58, 0.16);
}

.pair-target-title {
  padding: 4px 4px 0;
}

.pair-target-title .hub-panel-kicker {
  color: #ffe08b;
}

.pair-target-title h3 {
  margin-top: 4px;
  color: #fff;
  font-size: 1rem;
  line-height: 1.35;
}

.pair-target {
  width: 100%;
  min-height: 56px;
  padding: 12px;
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(255, 255, 255, 0.56);
  font-weight: 1000;
  text-align: center;
  box-shadow: 0 8px 15px rgba(6, 53, 86, 0.14);
}

.pair-target.correct {
  border-color: var(--green);
  background: #e0f9ed;
  animation: correctPulse 0.45s ease both;
}

.pair-target.wrong {
  border-color: var(--red);
  background: #ffe3e0;
  animation: wrongShake 0.34s ease both;
}

.match-board .task-slot,
.forge-board .task-slot {
  border: 2px solid rgba(18, 111, 180, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 255, 0.86));
}

.forge-board .task-slot {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.4), transparent 36%),
    linear-gradient(180deg, #fffaf0, #fff);
}

.scanner-board {
  grid-template-columns: 1fr;
  padding: 10px;
  border-radius: 22px;
  background:
    repeating-linear-gradient(135deg, rgba(18, 111, 180, 0.07) 0 8px, transparent 8px 16px),
    rgba(241, 248, 255, 0.9);
}

.scanner-board .task-btn.selected::after {
  content: "已標記";
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ffe08b;
  font-size: 0.68rem;
  font-weight: 1000;
}

.route-board {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(90deg, rgba(211, 245, 228, 0.95), rgba(240, 249, 255, 0.95));
}

.route-board .task-btn {
  min-height: 54px;
  display: grid;
  place-items: center;
  text-align: center;
}

.sequence-pool {
  grid-template-columns: 1fr;
}

.scenario-board {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.scenario-card {
  position: relative;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 248, 255, 0.92));
  border: 2px solid rgba(18, 111, 180, 0.13);
  box-shadow: 0 12px 22px rgba(6, 53, 86, 0.1);
  animation: cardPop 0.46s ease both;
}

.scenario-card.complete {
  border-color: rgba(53, 183, 121, 0.52);
  box-shadow: 0 0 0 6px rgba(53, 183, 121, 0.1), 0 12px 22px rgba(6, 53, 86, 0.1);
}

.scenario-card h3 {
  margin-top: 3px;
  font-size: 1.04rem;
}

.scenario-card p,
.scenario-card li {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.5;
}

.scenario-card ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.scenario-choice-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.scenario-choice-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.scenario-choice-list .task-btn {
  min-height: 68px;
}

.scenario-result {
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(53, 183, 121, 0.12);
  color: #0e5d3b !important;
}

.graduation-plan .scenario-card {
  cursor: pointer;
}

.teacher-task-board,
.ai-sim-console {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  animation: pageArrive 0.58s ease both;
}

.teacher-task-queue {
  display: grid;
  gap: 9px;
}

.teacher-task-ticket {
  position: relative;
  padding: 12px 14px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.92));
  border: 2px solid rgba(18, 111, 180, 0.13);
  box-shadow: 0 8px 15px rgba(6, 53, 86, 0.08), inset 0 -3px 0 rgba(18, 111, 180, 0.08);
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  overflow: hidden;
}

.teacher-task-ticket::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.8) 42%, transparent 62%);
  transform: translateX(-125%);
  animation: softShine 2.9s ease-in-out infinite;
  pointer-events: none;
}

.teacher-task-ticket:hover,
.teacher-task-ticket:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(242, 190, 72, 0.68);
  box-shadow: 0 0 0 5px rgba(242, 190, 72, 0.14), 0 14px 24px rgba(6, 53, 86, 0.15);
  outline: none;
}

.teacher-task-ticket span {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 1000;
}

.teacher-task-ticket h3 {
  margin-top: 3px;
  font-size: 1rem;
}

.teacher-task-ticket p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 820;
  line-height: 1.42;
}

.teacher-task-ticket b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 9px;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7cf, #f2be48);
  color: #14314a;
  font-size: 0.8rem;
  font-weight: 1000;
  box-shadow: 0 6px 12px rgba(136, 94, 9, 0.18);
}

.teacher-task-ticket.active {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 92% 0%, rgba(255, 230, 141, 0.7), transparent 36%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 246, 205, 0.94));
  box-shadow: 0 0 0 6px rgba(242, 190, 72, 0.2), 0 16px 28px rgba(6, 53, 86, 0.15);
  transform: translateY(-1px);
}

.teacher-task-ticket.complete {
  border-color: rgba(53, 183, 121, 0.55);
  background: linear-gradient(135deg, #e0f9ed, #ffffff);
}

.teacher-task-ticket.complete b {
  background: linear-gradient(180deg, #d9fae9, #73d79b);
  color: #0e5d3b;
}

.teacher-tool-desk,
.ai-workspace-panel,
.ai-chat-window,
.prompt-chip-panel {
  padding: 14px;
  border-radius: 24px;
  box-shadow: 0 12px 24px rgba(6, 53, 86, 0.1);
}

.teacher-tool-desk,
.ai-workspace-panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.34), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 248, 255, 0.92));
  border: 2px solid rgba(18, 111, 180, 0.13);
}

.teacher-tool-desk.focus-pulse {
  animation: toolDeskPulse 1.05s ease both;
}

.teacher-tool-desk h3,
.ai-workspace-panel h3 {
  margin-top: 4px;
  font-size: 1.06rem;
}

.teacher-tool-desk p,
.ai-workspace-panel p {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.45;
}

.tool-helper-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  background: rgba(255, 245, 200, 0.82);
  color: #153852;
  font-size: 0.84rem;
  font-weight: 1000;
  box-shadow: inset 0 0 0 1px rgba(242, 190, 72, 0.32);
}

.tool-helper-line img {
  width: 34px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 5px 7px rgba(4, 30, 49, 0.2));
}

.teacher-tool-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tool-orb {
  white-space: pre-line;
  min-height: 82px;
  padding: 14px 15px;
  border: 2px solid rgba(18, 111, 180, 0.24);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9), transparent 38%),
    linear-gradient(180deg, #fff, #e5f5ff);
  color: var(--ink);
  font-weight: 1000;
  line-height: 1.35;
  box-shadow:
    0 10px 18px rgba(5, 48, 78, 0.14),
    inset 0 -3px 0 rgba(18, 111, 180, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-orb:hover,
.tool-orb:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(242, 190, 72, 0.74);
  box-shadow: 0 0 0 6px rgba(242, 190, 72, 0.15), 0 14px 24px rgba(5, 48, 78, 0.17);
}

.tool-orb.selected {
  background: linear-gradient(180deg, #fff2b8, #e4b247);
  border-color: rgba(242, 190, 72, 0.95);
  box-shadow:
    0 0 0 5px rgba(242, 190, 72, 0.18),
    0 14px 24px rgba(145, 99, 12, 0.22),
    inset 0 -4px 0 rgba(117, 78, 0, 0.12);
}

.tool-orb.matched::after {
  content: "已配對";
  display: inline-block;
  margin-top: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #6b4300;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 1000;
}

.ai-preview-bubble {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(18, 111, 180, 0.1);
  color: var(--blue-deep);
  font-weight: 850;
  line-height: 1.45;
}

.ai-preview-bubble p {
  margin-top: 5px;
}

.sim-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.sim-progress span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.1);
  color: var(--blue-deep);
  font-size: 0.74rem;
  font-weight: 1000;
}

.sim-progress span.active {
  background: #fff2b8;
}

.sim-progress span.done {
  background: #dff8eb;
  color: #0e5d3b;
}

.ai-chat-window {
  display: grid;
  gap: 9px;
  min-height: 230px;
  background:
    linear-gradient(180deg, rgba(7, 59, 99, 0.94), rgba(6, 91, 139, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.chat-line {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 8px 15px rgba(0, 20, 34, 0.16);
  animation: cardPop 0.44s ease both;
}

.chat-line strong {
  display: block;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 1000;
}

.chat-line p {
  margin-top: 3px;
  font-weight: 850;
  line-height: 1.46;
}

.chat-line.teacher {
  justify-self: end;
  background: #fff6d9;
}

.chat-line.ai {
  justify-self: start;
  background: #e8fff4;
}

.chat-line.guide {
  justify-self: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.88);
}

.chat-line.final {
  max-width: 100%;
  background: linear-gradient(135deg, #fff2b8, #ffffff);
}

.prompt-chip-panel {
  display: grid;
  gap: 9px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(18, 111, 180, 0.12);
}

.prompt-chip {
  min-height: 52px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #eaf7ff);
  border: 2px solid rgba(18, 111, 180, 0.26);
  color: var(--ink);
  font-weight: 950;
  text-align: left;
  box-shadow:
    0 10px 18px rgba(6, 53, 86, 0.1),
    inset 0 -3px 0 rgba(18, 111, 180, 0.08);
}

.sim-final-card {
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff8df, #ffffff);
  border: 2px solid rgba(242, 190, 72, 0.3);
}

.sim-final-card p {
  margin-top: 8px;
  color: var(--blue-deep);
  font-weight: 880;
  line-height: 1.55;
}

.task-guide {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 20px;
  color: var(--blue-deep);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 224, 139, 0.36), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.9));
  border: 2px solid rgba(242, 190, 72, 0.28);
  box-shadow: 0 12px 24px rgba(6, 53, 86, 0.1);
  animation: guidePulse 1.9s ease-in-out infinite alternate;
}

.task-guide img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(4, 36, 58, 0.12));
}

.task-guide strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 1000;
}

.task-guide p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 880;
  line-height: 1.45;
}

.task-guide.hint-alert {
  border-color: rgba(242, 190, 72, 0.72);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 224, 139, 0.5), transparent 48%),
    rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 5px rgba(255, 224, 139, 0.18),
    0 16px 28px rgba(116, 80, 8, 0.16);
  animation: hintAlert 0.72s ease both;
}

.task-guide.hint-alert img {
  animation: npcFloat 1.5s ease-in-out infinite;
}

@keyframes hintAlert {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes guidePulse {
  from { transform: translateY(0); box-shadow: 0 12px 24px rgba(6, 53, 86, 0.1); }
  to { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(18, 111, 180, 0.16); }
}

.product-sim {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  animation: pageArrive 0.58s ease both;
}

.chatbot-window,
.product-side,
.product-chip-shelf,
.notebook-sources,
.notebook-main,
.notebook-studio {
  border-radius: 24px;
  border: 1px solid rgba(18, 111, 180, 0.14);
  box-shadow: 0 12px 24px rgba(6, 53, 86, 0.1);
}

.chatbot-window {
  display: grid;
  grid-template-rows: auto minmax(190px, 1fr) auto auto;
  min-height: min(520px, calc(100dvh - 250px));
  max-height: min(76dvh, 680px);
  overflow: hidden;
  background: #ffffff;
}

.chatbot-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  color: #172033;
  background: #f7f7f8;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.gemini-sim .chatbot-topbar {
  color: #102a43;
  background: linear-gradient(90deg, #f5f9ff, #fff);
}

.chatbot-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #19c37d, #78e6b9);
}

.gemini-sim .chatbot-dot {
  background: linear-gradient(135deg, #4285f4, #a142f4, #fbbc04);
}

.chatbot-topbar strong {
  font-weight: 1000;
}

.chatbot-topbar em {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 850;
}

.chatbot-thread {
  display: grid;
  align-content: start;
  gap: 11px;
  padding: 16px;
  overflow: auto;
  min-height: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(116, 215, 255, 0.1), transparent 32%),
    #ffffff;
}

.product-msg {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 18px;
  font-weight: 850;
  line-height: 1.52;
  animation: cardPop 0.42s ease both;
}

.product-msg strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 1000;
}

.product-msg.user {
  justify-self: end;
  background: #e9edf3;
  color: #172033;
  border-bottom-right-radius: 6px;
}

.product-msg.bot {
  justify-self: start;
  background: #f7f7f8;
  color: #172033;
  border-bottom-left-radius: 6px;
}

.gemini-sim .product-msg.bot {
  background: #eef5ff;
}

.product-msg.helper {
  justify-self: center;
  text-align: center;
  background: #fff6d8;
  color: var(--blue-deep);
}

.product-msg.final {
  max-width: 100%;
  background: linear-gradient(135deg, #fff5cc, #f3fbff);
  border: 2px solid rgba(242, 190, 72, 0.26);
}

.chatbot-input {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: center;
  margin: 0 12px 12px;
  padding: 10px 10px 10px 14px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid rgba(17, 24, 39, 0.08);
}

.chatbot-input span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.product-side {
  padding: 14px;
  min-width: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.2), transparent 36%),
    rgba(255, 255, 255, 0.94);
}

.canvas-side {
  border-left: 6px solid #19c37d;
}

.workspace-side {
  border-left: 6px solid #4285f4;
}

.product-side h3 {
  margin-top: 4px;
  font-size: 1.06rem;
}

.product-side p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.55;
}

.product-fish-guide {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff8d9, #fff);
  border: 1px solid rgba(242, 190, 72, 0.34);
  box-shadow: 0 8px 16px rgba(6, 53, 86, 0.08);
}

.product-fish-guide img {
  flex: 0 0 auto;
  width: 54px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 7px 9px rgba(4, 36, 58, 0.15));
}

.product-fish-guide strong {
  display: block;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 1000;
}

.product-fish-guide p {
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.45;
  font-weight: 850;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.workspace-tabs span,
.notebook-studio span,
.source-list span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.1);
  color: var(--blue-deep);
  font-size: 0.74rem;
  font-weight: 1000;
}

.workspace-doc-preview {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(66, 133, 244, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.workspace-doc-preview strong {
  display: block;
  margin-bottom: 6px;
  color: #1a73e8;
  font-weight: 1000;
}

.product-chip-shelf {
  display: grid;
  gap: 9px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  min-width: 0;
}

.chatbot-window > .product-chip-shelf,
.notebook-main > .product-chip-shelf {
  margin: 0 12px 10px;
  padding: 8px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 224, 139, 0.24), transparent 45%),
    rgba(244, 250, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(18, 111, 180, 0.1);
}

.product-prompt-chip {
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 2px solid rgba(18, 111, 180, 0.26);
  background: linear-gradient(180deg, #fff, #eef8ff);
  color: var(--ink);
  text-align: left;
  font-weight: 950;
  box-shadow:
    0 10px 18px rgba(6, 53, 86, 0.1),
    inset 0 -3px 0 rgba(18, 111, 180, 0.08);
}

.product-prompt-chip.selected {
  border-color: rgba(242, 190, 72, 0.82);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.34), transparent 38%),
    linear-gradient(180deg, #ffffff, #fff7dc);
  box-shadow: 0 0 0 4px rgba(242, 190, 72, 0.18), 0 12px 22px rgba(6, 53, 86, 0.12);
  transform: translateY(-1px);
}

.chatbot-window > .product-chip-shelf .product-prompt-chip,
.notebook-main > .product-chip-shelf .product-prompt-chip {
  min-height: 46px;
  padding: 10px 12px;
  border-color: rgba(18, 111, 180, 0.2);
}

.notebooklm-sim {
  grid-template-columns: 1fr;
}

.notebook-sources,
.notebook-main,
.notebook-studio {
  padding: 14px;
  background: rgba(255, 255, 255, 0.95);
}

.notebook-brand {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 12px;
  color: #fff;
  background: #1f6feb;
  font-weight: 1000;
}

.source-add {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px dashed rgba(31, 111, 235, 0.5);
  border-radius: 14px;
  color: #1f6feb;
  background: #f5f9ff;
  font-weight: 950;
}

.source-add.ready {
  color: #0e5d3b;
  background: #e0f9ed;
  border-style: solid;
  border-color: rgba(53, 183, 121, 0.38);
}

.source-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.source-list span.on {
  background: #e0f9ed;
  color: #0e5d3b;
}

.source-list span.blocked {
  color: #8a4651;
  background: rgba(216, 82, 82, 0.12);
}

.notebook-title p {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 850;
}

.notebook-answer {
  display: grid;
  gap: 10px;
  min-height: 220px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: #f7f8fb;
}

.notebook-studio div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

@media (min-width: 620px) {
  .product-sim {
    grid-template-columns: minmax(0, 1.22fr) minmax(220px, 0.78fr);
    align-items: stretch;
  }

  .product-sim.gemini-sim {
    grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  }

  .notebooklm-sim {
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
  }

  .notebook-studio {
    grid-column: 1 / -1;
  }
}

.task-slot {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(229, 245, 255, 0.8);
}

.task-slot h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.quiz-question {
  display: grid;
  gap: 12px;
  min-height: 100%;
  align-content: center;
}

.quiz-question h2 {
  font-size: 1.28rem;
  line-height: 1.26;
}

.quiz-question .choice-list {
  grid-template-columns: 1fr;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.quiz-question .choice-btn {
  min-height: 76px;
  text-align: left;
  display: block;
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 224, 139, 0.28), transparent 42%),
    rgba(255, 255, 255, 0.94);
}

.feedback {
  padding: 12px;
  border-radius: 18px;
  background: #eef8ff;
  color: var(--blue-deep);
  font-weight: 850;
  line-height: 1.5;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 20, 34, 0.68);
}

.modal-panel {
  width: 100%;
  max-height: 88dvh;
  overflow: auto;
  padding: 16px;
  border-radius: 28px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
}

.modal-head {
  margin-bottom: 12px;
}

.media-body {
  display: grid;
  place-items: center;
  min-height: 280px;
  border-radius: 22px;
  overflow: hidden;
  background: #eef8ff;
}

.media-body img {
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
}

.media-ebook-reader {
  max-height: 72dvh;
  overflow: auto;
}

.reward-overlay {
  position: absolute;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top)) 18px max(18px, var(--safe-bottom));
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 232, 143, 0.42), transparent 36%),
    rgba(2, 20, 34, 0.72);
  backdrop-filter: blur(9px);
}

.reward-overlay.hidden {
  display: none;
}

.reward-panel {
  position: relative;
  width: min(100%, 520px);
  padding: 22px 18px 18px;
  border-radius: 32px;
  overflow: hidden;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 231, 143, 0.64), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 248, 255, 0.96));
  border: 2px solid rgba(255, 255, 255, 0.84);
  box-shadow:
    0 26px 70px rgba(0, 22, 38, 0.42),
    inset 0 0 0 1px rgba(242, 190, 72, 0.3);
  animation: rewardPanelIn 0.64s cubic-bezier(0.16, 0.9, 0.22, 1.08) both;
}

.reward-shine {
  position: absolute;
  inset: -30%;
  background:
    conic-gradient(from 0deg, transparent, rgba(255, 230, 141, 0.55), transparent 24%, rgba(120, 218, 255, 0.35), transparent 48%);
  animation: rewardSpin 5.2s linear infinite;
  opacity: 0.9;
}

.reward-panel > *:not(.reward-shine) {
  position: relative;
  z-index: 1;
}

.reward-icon {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto 8px;
  filter: drop-shadow(0 14px 18px rgba(7, 45, 72, 0.24)) drop-shadow(0 0 16px rgba(255, 224, 139, 0.72));
  animation: rewardIconFloat 2.2s ease-in-out infinite;
}

.reward-kicker {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(18, 111, 180, 0.1);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 1000;
}

.reward-panel h2 {
  margin-top: 8px;
  font-size: clamp(1.62rem, 7vw, 2.2rem);
  line-height: 1.12;
}

.reward-panel p {
  margin: 8px auto 0;
  max-width: 34em;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.52;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.reward-grid article {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 8px 16px rgba(6, 53, 86, 0.08),
    inset 0 -3px 0 rgba(18, 111, 180, 0.08);
}

.reward-grid img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  margin: 0 auto 6px;
}

.reward-grid span,
.reward-grid strong {
  display: block;
}

.reward-grid span {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 1000;
}

.reward-grid strong {
  margin-top: 3px;
  font-size: clamp(0.82rem, 3vw, 1rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

@keyframes rewardPanelIn {
  from { opacity: 0; transform: translateY(22px) scale(0.94); filter: brightness(1.28); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes rewardSpin {
  to { transform: rotate(360deg); }
}

@keyframes rewardIconFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
}

.map-unlock-effect {
  position: absolute;
  inset: 0;
  z-index: 5150;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 235, 156, 0.88), rgba(10, 56, 92, 0.82) 48%, rgba(2, 20, 34, 0.88));
}

.map-unlock-effect {
  z-index: 5100;
  pointer-events: none;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 232, 143, 0.92), rgba(18, 111, 180, 0.42) 36%, transparent 62%),
    rgba(2, 20, 34, 0.18);
  animation: unlockFlash 3.4s ease both;
}

.map-unlock-effect strong {
  display: block;
  font-size: clamp(2rem, 10vw, 3.5rem);
  text-shadow: 0 6px 18px rgba(0, 18, 32, 0.34);
}

.map-unlock-effect span {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(5, 46, 72, 0.76);
  font-weight: 1000;
}

@keyframes unlockFlash {
  0% { opacity: 0; transform: scale(0.96); filter: brightness(1); }
  12% { opacity: 1; transform: scale(1); filter: brightness(1.45); }
  82% { opacity: 1; transform: scale(1.02); filter: brightness(1.08); }
  100% { opacity: 0; transform: scale(1.05); filter: brightness(1.2); }
}

.gacha-overlay {
  position: absolute;
  inset: 0;
  z-index: 5200;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 230, 150, 0.76), rgba(2, 22, 38, 0.86));
  transition: opacity 0.58s ease;
}

.gacha-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gacha-result-wrap {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 28px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  transform: scale(0.86);
  transition: transform 0.3s cubic-bezier(0.2, 1.3, 0.28, 1);
}

.gacha-overlay.active .gacha-result-wrap {
  transform: scale(1);
  animation: gachaCharge 2.2s ease both;
}

.gacha-overlay.active.revealed .gacha-result-wrap {
  animation: gachaReveal 0.58s cubic-bezier(0.18, 1.4, 0.28, 1) both;
}

.gacha-burst {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(255, 216, 118, 0.36) 45%, transparent 70%);
  animation: burstSpin 4s linear infinite;
}

@keyframes burstSpin {
  to { transform: rotate(360deg); }
}

@keyframes gachaCharge {
  0% { transform: scale(0.86) rotate(-2deg); filter: brightness(0.9); }
  20% { transform: scale(0.96) rotate(4deg); }
  40% { transform: scale(0.92) rotate(-5deg); filter: brightness(1.25); }
  60% { transform: scale(1.04) rotate(6deg); }
  80% { transform: scale(0.98) rotate(-7deg); filter: brightness(1.52); }
  100% { transform: scale(1.08) rotate(0deg); filter: brightness(1); }
}

@keyframes gachaReveal {
  0% { transform: scale(0.72); filter: brightness(2) blur(3px); }
  62% { transform: scale(1.14); filter: brightness(1.35) blur(0); }
  100% { transform: scale(1); filter: brightness(1); }
}

.gacha-result-name {
  font-size: 1.2rem;
  font-weight: 1000;
}

#dialogue-overlay {
  position: absolute;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 18, 32, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
  cursor: pointer;
}

#dialogue-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.dialogue-character {
  position: absolute;
  inset: auto 0 142px 0;
  height: 42%;
  display: grid;
  place-items: end center;
  pointer-events: none;
}

.dialogue-character img {
  max-width: min(62%, 330px);
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 16, 28, 0.34));
  transform: translateY(18px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

#dialogue-overlay.show .dialogue-character img {
  transform: translateY(0);
  opacity: 1;
}

#dialogue-overlay[data-mood="happy"] .dialogue-character img,
#dialogue-overlay[data-mood="victory"] .dialogue-character img {
  filter: drop-shadow(0 18px 24px rgba(0, 16, 28, 0.34)) brightness(1.08);
  transform: translateY(-4px) rotate(-2deg) scale(1.04);
}

#dialogue-overlay[data-mood="think"] .dialogue-character img {
  filter: drop-shadow(0 18px 24px rgba(0, 16, 28, 0.34)) saturate(0.94);
  transform: translateY(0) rotate(2deg) scale(0.98);
}

#dialogue-overlay[data-mood="teacher"] .dialogue-character img {
  max-width: min(58%, 310px);
}

.dialogue-box {
  position: relative;
  z-index: 2;
  margin: 0 12px calc(var(--safe-bottom) + 12px);
  padding: 18px;
  border-radius: 28px 28px 22px 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 34px rgba(0, 18, 32, 0.24);
}

.dialogue-name {
  color: var(--blue);
  font-size: 1rem;
  margin-bottom: 8px;
}

.dialogue-text {
  min-height: 54px;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.6;
}

.dialogue-continue {
  margin-top: 8px;
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 900;
  text-align: right;
  animation: softBlink 1.4s ease-in-out infinite;
}

.quiz-fish-guide {
  margin: 12px 0;
}

@keyframes softBlink {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

.toast {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + 14px);
  z-index: 5500;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(5, 46, 72, 0.9);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 20, 34, 0.28);
}

@media (min-width: 700px) {
  #app-container {
    margin-block: 14px;
    height: calc(100dvh - 28px);
    min-height: min(620px, calc(100dvh - 28px));
    border-radius: 38px;
  }
}

@media (max-width: 430px) {
  #app-container {
    max-width: none;
    width: 100vw;
  }

  .hub-content {
    padding: calc(var(--safe-top) + 70px) 12px 14px;
  }

  .home-shell {
    padding: 13px;
    border-radius: 23px;
    gap: 8px;
  }

  .home-shell h1 {
    font-size: clamp(1.32rem, 7vw, 1.72rem);
    line-height: 1.16;
  }

  .home-shell p {
    font-size: 0.8rem;
    line-height: 1.42;
  }

  .resource-chip {
    padding: 8px;
    font-size: 0.72rem;
    border-radius: 15px;
  }

  .hero-zone {
    height: 150px;
    margin-top: 9px;
  }

  .hero-bubble {
    width: min(250px, 64%);
    padding: 10px 12px;
  }

  .hero-bubble p {
    font-size: 0.84rem;
    line-height: 1.42;
  }

  .npc-duo {
    bottom: -16px;
    height: 150px;
  }

  .npc-fish {
    right: 164px;
    bottom: 24px;
    width: 82px;
    height: 66px;
  }

  .npc-fangfang {
    width: 108px;
    height: 128px;
  }

  .pet-companion {
    right: 108px;
    bottom: 22px;
  }

  .pet-art {
    width: 48px;
    height: 48px;
  }

  #app-container[data-panel="story"] .hub-panel {
    display: block;
    padding: 14px;
    background:
      radial-gradient(circle at 50% 42%, rgba(255, 224, 139, 0.16), transparent 36%),
      rgba(255, 255, 255, 0.9);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none;
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  #app-container[data-panel="story"] .hub-panel::-webkit-scrollbar {
    display: none;
  }

  #app-container[data-panel="story"] .hub-panel-head {
    margin-bottom: 8px;
  }

  #app-container[data-panel="story"] .hub-panel-head p {
    font-size: 0.9rem;
  }

  #app-container[data-panel="story"] .story-map {
    width: 100%;
    height: clamp(205px, 29svh, 340px);
    aspect-ratio: auto;
    margin: 6px auto 10px;
    border-radius: 28px;
    opacity: 1;
  }

  #app-container[data-panel="story"] .story-map-layer {
    inset: auto;
    left: var(--map-layer-left, 0%);
    top: var(--map-layer-top, 0%);
    width: var(--map-layer-size, 188%);
    height: var(--map-layer-size, 188%);
    transform: none;
    filter: saturate(1.06) brightness(1.03);
  }

  #app-container[data-panel="story"] .story-map::before {
    background:
      radial-gradient(circle at 50% 50%, transparent 0 24%, rgba(0, 25, 42, 0.08) 50%, rgba(0, 21, 36, 0.24) 100%);
  }

  #app-container[data-panel="story"] .map-node {
    width: 38px;
    height: 38px;
    border-width: 2px;
  }

  #app-container[data-panel="story"] .map-node > b {
    font-size: 0.76rem;
  }

  #app-container[data-panel="story"] .node-label {
    top: 34px;
    font-size: 0.58rem;
  }

  #app-container[data-panel="story"] .map-fish {
    width: 46px;
    height: 38px;
  }

  #app-container[data-panel="story"] .btn.full-width {
    min-height: 72px;
    margin-top: 0;
    font-size: 1.24rem;
    border-radius: 24px;
  }

  #app-container[data-panel="story"] .story-action-row {
    position: relative;
    left: 0;
    right: 0;
    bottom: auto;
    z-index: 30;
    margin-top: 10px;
    padding: 10px 0 calc(12px + var(--safe-bottom));
    border-radius: 22px 22px 0 0;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.96) 24%, rgba(255, 255, 255, 0.98));
    box-shadow: 0 -12px 24px rgba(255, 255, 255, 0.78);
  }

  #app-container[data-panel="story"] .hub-panel-stack {
    bottom: calc(10px + var(--safe-bottom));
  }

  #app-container[data-view="game"] .game-stage {
    margin-bottom: calc(10px + var(--safe-bottom));
    padding-bottom: calc(92px + var(--safe-bottom));
    overflow: auto;
  }

  #app-container[data-view="game"] .game-stage > .btn.full-width:last-child {
    position: sticky;
    bottom: 0;
    z-index: 35;
    margin-top: 12px;
    box-shadow:
      inset 0 -4px 0 rgba(0, 0, 0, 0.13),
      0 -10px 22px rgba(255, 255, 255, 0.88),
      0 12px 22px rgba(5, 48, 78, 0.2);
  }

  #app-container[data-panel="character"] .hub-panel-stack,
  #app-container[data-panel="daily"] .hub-panel-stack,
  #app-container[data-panel="story"] .hub-panel-stack,
  #app-container[data-panel="pets"] .hub-panel-stack,
  #app-container[data-panel="settings"] .hub-panel-stack {
    top: 342px;
  }

  .home-title {
    font-size: 1.62rem;
  }

  .stats-combo {
    gap: 3px;
    font-size: 0.64rem;
  }

  .stats-combo span {
    padding: 5px 6px;
  }

  .header-title {
    font-size: 0.9rem;
  }
}

@media (max-height: 720px) {
  #app-container {
    min-height: 100dvh;
  }

  .hero-zone {
    height: 132px;
  }

  .hub-panel-stack {
    top: 294px;
  }

  #app-container[data-panel="character"] .hub-panel-stack,
  #app-container[data-panel="daily"] .hub-panel-stack,
  #app-container[data-panel="story"] .hub-panel-stack,
  #app-container[data-panel="pets"] .hub-panel-stack,
  #app-container[data-panel="settings"] .hub-panel-stack {
    top: 322px;
  }

  #app-container[data-panel="story"] .story-map {
    height: clamp(185px, 26svh, 300px);
  }

  #app-container[data-panel="story"] .btn.full-width {
    min-height: 68px;
    font-size: 1.16rem;
  }

  .npc-fangfang {
    width: 112px;
    height: 132px;
  }

  .npc-fish {
    width: 86px;
    right: 174px;
    bottom: 25px;
  }

  .pet-companion {
    right: 118px;
    bottom: 24px;
  }

  .pet-art {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 760px) {
  body {
    align-items: center;
    padding: 18px;
  }

  #app-container {
    max-width: min(100vw - 36px, 980px);
    height: min(100dvh - 36px, 720px);
    min-height: min(620px, calc(100dvh - 36px));
    border-radius: 34px;
  }

  .global-header {
    border-radius: 34px 34px 22px 22px;
  }

  .hub-content {
    padding: calc(var(--safe-top) + 86px) 18px 18px;
  }

  .home-shell {
    width: 38%;
    min-height: 154px;
  }

  .hero-zone {
    width: 38%;
    height: calc(100% - 176px);
    min-height: 360px;
  }

  .hero-bubble {
    width: 92%;
    max-width: 330px;
  }

  .npc-duo {
    width: 100%;
    height: 230px;
    bottom: 76px;
  }

  .npc-fish {
    right: 226px;
    bottom: 62px;
    width: 118px;
    height: 96px;
  }

  .npc-fangfang {
    bottom: 26px;
    width: 154px;
    height: 184px;
  }

  .pet-companion {
    right: 155px;
    bottom: 78px;
  }

  .pet-art {
    width: 70px;
    height: 70px;
  }

  .hub-panel-stack,
  #app-container[data-panel="character"] .hub-panel-stack,
  #app-container[data-panel="daily"] .hub-panel-stack,
  #app-container[data-panel="story"] .hub-panel-stack,
  #app-container[data-panel="pets"] .hub-panel-stack,
  #app-container[data-panel="settings"] .hub-panel-stack {
    left: calc(38% + 32px);
    right: 18px;
    top: calc(var(--safe-top) + 88px);
    bottom: 18px;
  }

  .story-map {
    width: min(100%, 520px);
  }

  .view-section#view-game {
    max-width: none;
  }

  .game-stage {
    margin: 0 18px 18px;
  }
}

@media (orientation: landscape) and (min-width: 700px) and (max-width: 1180px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  #app-container {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .global-header {
    border-radius: 0 0 22px 22px;
  }

  .hub-content {
    padding: calc(var(--safe-top) + 76px) 14px 12px;
  }

  .home-shell {
    width: 35%;
    min-height: 142px;
  }

  .hero-zone {
    width: 35%;
    height: calc(100% - 158px);
    min-height: 0;
  }

  .hub-panel-stack,
  #app-container[data-panel="character"] .hub-panel-stack,
  #app-container[data-panel="daily"] .hub-panel-stack,
  #app-container[data-panel="story"] .hub-panel-stack,
  #app-container[data-panel="pets"] .hub-panel-stack,
  #app-container[data-panel="settings"] .hub-panel-stack {
    left: calc(35% + 26px);
    right: 14px;
    top: calc(var(--safe-top) + 76px);
    bottom: 12px;
  }

  #app-container[data-panel="story"] .home-shell,
  #app-container[data-panel="story"] .hero-zone {
    width: clamp(232px, 30%, 280px);
  }

  #app-container[data-panel="story"] .hub-panel-stack {
    left: calc(clamp(232px, 30%, 280px) + 16px);
  }

  #app-container[data-panel="story"] .npc-duo {
    right: 0;
    bottom: 34px;
    width: 100%;
    height: 190px;
    overflow: visible;
  }

  #app-container[data-panel="story"] .npc-fish {
    left: clamp(8px, 8%, 30px);
    right: auto;
    bottom: 52px;
    width: clamp(72px, 8vw, 92px);
    height: clamp(58px, 7vw, 74px);
  }

  #app-container[data-panel="story"] .pet-companion {
    left: clamp(78px, 34%, 124px);
    right: auto;
    bottom: 54px;
  }

  #app-container[data-panel="story"] .pet-art {
    width: clamp(44px, 5vw, 58px);
    height: clamp(44px, 5vw, 58px);
  }

  #app-container[data-panel="story"] .npc-fangfang {
    right: clamp(0px, 3%, 12px);
    bottom: 10px;
    width: clamp(98px, 11vw, 128px);
    height: clamp(122px, 13vw, 158px);
  }

  .story-map {
    width: min(100%, 920px);
    max-height: calc(100dvh - 230px);
  }

  .game-header {
    min-height: calc(var(--safe-top) + 60px);
    padding: calc(var(--safe-top) + 8px) 12px 10px;
    margin-bottom: 8px;
    border-radius: 0 0 22px 22px;
  }

  .game-status {
    padding: 0 12px 8px;
  }

  .game-stage {
    margin: 0 12px 12px;
    padding: 10px;
  }

  #app-container[data-game-step="media"] .game-header {
    min-height: calc(var(--safe-top) + 54px);
    margin-bottom: 6px;
  }

  #app-container[data-game-step="media"] .game-stage {
    margin-bottom: 10px;
  }

  .stage-media-frame {
    max-height: min(76dvh, 760px);
  }

  .comic-panel-frame {
    max-height: calc(100dvh - var(--safe-top) - 154px);
  }

  .comic-panel-frame img {
    max-height: calc(100dvh - var(--safe-top) - 154px);
  }

  .comic-caption {
    padding: 8px 12px;
  }

  .comic-caption .muted {
    -webkit-line-clamp: 1;
  }

  .pairing-console {
    grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
    align-items: start;
  }

  .pair-card-list {
    max-height: 46dvh;
    overflow: auto;
    padding-right: 4px;
  }

  .pair-target-deck {
    position: sticky;
    top: 0;
  }

  .dialogue-character img {
    max-width: min(28%, 260px);
    max-height: 78%;
  }

  .teacher-task-board,
  .ai-sim-console {
    grid-template-columns: minmax(220px, 0.86fr) minmax(300px, 1.14fr);
    align-items: start;
  }

  .teacher-tool-desk,
  .prompt-chip-panel {
    position: sticky;
    top: 0;
  }

  .teacher-tool-desk,
  .ai-chat-window,
  .prompt-chip-panel {
    grid-column: auto;
  }

  .ai-chat-window {
    min-height: 330px;
  }

  .ai-workspace-panel {
    grid-row: span 2;
  }

  .product-sim {
    grid-template-columns: minmax(360px, 1.2fr) minmax(220px, 0.8fr);
    align-items: start;
  }

  .product-sim > .product-chip-shelf {
    grid-column: 1 / -1;
  }

  .notebooklm-sim {
    grid-template-columns: minmax(190px, 0.7fr) minmax(340px, 1.3fr);
  }

  .notebook-studio,
  .notebooklm-sim .product-chip-shelf {
    grid-column: 1 / -1;
  }
}

@media (orientation: landscape) and (min-width: 1181px) {
  body {
    padding: 12px;
    align-items: center;
  }

  #app-container {
    width: min(100vw - 24px, 1360px);
    max-width: 1360px;
    height: min(100dvh - 24px, 860px);
    min-height: min(700px, calc(100dvh - 24px));
    border-radius: 30px;
  }

  .global-header {
    border-radius: 30px 30px 20px 20px;
  }

  .hub-content {
    padding: calc(var(--safe-top) + 82px) 16px 16px;
  }

  .home-shell {
    width: 34%;
    min-height: 150px;
  }

  .hero-zone {
    width: 34%;
    height: calc(100% - 170px);
    min-height: 420px;
  }

  .hub-panel-stack,
  #app-container[data-panel="character"] .hub-panel-stack,
  #app-container[data-panel="daily"] .hub-panel-stack,
  #app-container[data-panel="story"] .hub-panel-stack,
  #app-container[data-panel="pets"] .hub-panel-stack,
  #app-container[data-panel="settings"] .hub-panel-stack {
    left: calc(34% + 28px);
    right: 16px;
    top: calc(var(--safe-top) + 82px);
    bottom: 16px;
  }

  #app-container[data-panel="story"] .home-shell,
  #app-container[data-panel="story"] .hero-zone {
    width: 22%;
  }

  #app-container[data-panel="story"] .hub-panel-stack {
    left: calc(22% + 20px);
  }

  #app-container[data-panel="story"] .npc-duo {
    right: 0;
    bottom: 46px;
    width: 100%;
    height: 210px;
    overflow: visible;
  }

  #app-container[data-panel="story"] .npc-fish {
    left: clamp(10px, 8%, 34px);
    right: auto;
    bottom: 60px;
    width: clamp(82px, 6vw, 104px);
    height: clamp(66px, 5vw, 84px);
  }

  #app-container[data-panel="story"] .pet-companion {
    left: clamp(88px, 34%, 140px);
    right: auto;
    bottom: 62px;
  }

  #app-container[data-panel="story"] .pet-art {
    width: clamp(48px, 4.5vw, 64px);
    height: clamp(48px, 4.5vw, 64px);
  }

  #app-container[data-panel="story"] .npc-fangfang {
    right: clamp(2px, 3%, 16px);
    bottom: 14px;
    width: clamp(108px, 8.6vw, 142px);
    height: clamp(134px, 10vw, 176px);
  }

  .hub-panel[data-panel="story"] {
    padding: 18px;
  }

  .story-map {
    width: min(100%, 1120px);
    max-height: calc(100dvh - 235px);
  }

  .hub-panel[data-panel="story"] .btn {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

  .npc-duo {
    height: 250px;
    bottom: 74px;
  }

  .npc-fish {
    right: 238px;
    bottom: 66px;
    width: 122px;
    height: 100px;
  }

  .npc-fangfang {
    bottom: 28px;
    width: 164px;
    height: 194px;
  }

  .pet-companion {
    right: 165px;
    bottom: 86px;
  }

  .comic-panel-frame {
    max-height: calc(100dvh - var(--safe-top) - 170px);
  }

  .comic-panel-frame img {
    max-height: calc(100dvh - var(--safe-top) - 170px);
  }

  .pairing-console {
    grid-template-columns: minmax(260px, 0.92fr) minmax(320px, 1.08fr);
    align-items: start;
  }

  .pair-card-list {
    max-height: 52dvh;
    overflow: auto;
    padding-right: 4px;
  }

  .pair-target-deck {
    position: sticky;
    top: 0;
  }

  .dialogue-character img {
    max-width: min(24%, 300px);
    max-height: 78%;
  }

  .teacher-task-board,
  .ai-sim-console {
    grid-template-columns: minmax(260px, 0.86fr) minmax(360px, 1.14fr);
    align-items: start;
  }

  .ai-chat-window {
    min-height: 360px;
  }

  .ai-workspace-panel {
    grid-row: span 2;
  }

  .product-sim {
    grid-template-columns: minmax(460px, 1.24fr) minmax(300px, 0.76fr);
    align-items: start;
  }

  .product-sim > .product-chip-shelf {
    grid-column: 1 / -1;
  }

  .chatbot-window {
    min-height: 360px;
  }

  .notebooklm-sim {
    grid-template-columns: minmax(240px, 0.65fr) minmax(480px, 1.35fr);
  }

  .notebook-studio,
  .notebooklm-sim .product-chip-shelf {
    grid-column: 1 / -1;
  }
}
