/* 未來奇幻數學遊樂園 — 高彩度霓虹積木遊樂場風（與溫暖阿里山農場完全區隔） */
:root {
  --bg-deep: #0F172A;
  --bg-mid: #1E1B4B;
  --bg-light: #EEF2FF;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.94);
  --ink: #0F172A;
  --muted: #64748B;
  --cyan: #06B6D4;
  --cyan-dark: #0E7490;
  --violet: #7C3AED;
  --violet-dark: #5B21B6;
  --pink: #EC4899;
  --pink-dark: #BE185D;
  --amber: #F59E0B;
  --amber-dark: #B45309;
  --emerald: #10B981;
  --emerald-dark: #047857;
  --danger: #EF4444;
  --border: #E2E8F0;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  --radius: 22px;
}

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

body {
  margin: 0;
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background: radial-gradient(circle at 15% 10%, #312E81 0%, #1E1B4B 36%, #0F172A 100%);
  color: var(--ink);
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ===== 通用按鈕（立體電玩按壓感） ===== */
.btn {
  border: none;
  border-radius: 15px;
  padding: 11px 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.12s ease;
  min-height: 46px;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(0.97); }
.btn:hover:not(:disabled) { filter: brightness(1.06); }

.btn-primary {
  background: linear-gradient(135deg, #22D3EE, #06B6D4 55%, #0284C7);
  color: #fff;
  box-shadow: 0 4px 0 #0369A1;
}
.btn-violet {
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  color: #fff;
  box-shadow: 0 4px 0 #5B21B6;
}
.btn-pink {
  background: linear-gradient(135deg, #F472B6, #EC4899);
  color: #fff;
  box-shadow: 0 4px 0 #BE185D;
}
.btn-amber {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #0F172A;
  box-shadow: 0 4px 0 #B45309;
}
.btn-success {
  background: linear-gradient(135deg, #34D399, #10B981);
  color: #fff;
  box-shadow: 0 4px 0 #047857;
}
.btn-danger {
  background: linear-gradient(135deg, #F87171, #EF4444);
  color: #fff;
  box-shadow: 0 4px 0 #B91C1C;
}
.btn-soft {
  background: #E2E8F0;
  color: #1E293B;
  box-shadow: 0 3px 0 #CBD5E1;
}
.btn-glass {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
}
.btn:disabled {
  background: #CBD5E1 !important;
  color: #64748B !important;
  box-shadow: none !important;
  cursor: not-allowed;
}
.btn-sm { padding: 7px 12px; font-size: 14px; min-height: 36px; border-radius: 11px; }
.btn-lg { padding: 13px 24px; font-size: 18px; min-height: 52px; }
.btn-xl { padding: 15px 28px; font-size: 20px; min-height: 58px; }
.btn-block { width: 100%; }

.input {
  width: 100%;
  border: 2px solid #CBD5E1;
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: #F8FAFC;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: var(--cyan);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.18);
}
.input-lg { padding: 13px 16px; font-size: 18px; }

.muted { color: var(--muted); }

/* ===== 標準上下數學分數與線段排版 ===== */
.m-mixed {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  margin: 0 2px;
}
.m-whole {
  font-weight: 900;
  font-size: 1.08em;
}
.m-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1.05;
  margin: 0 3px;
  font-size: 0.86em;
  font-weight: 800;
}
.m-num {
  border-bottom: 2px solid currentColor;
  padding: 0 4px 1px;
  min-width: 18px;
  text-align: center;
}
.m-den {
  padding: 2px 4px 0;
  min-width: 18px;
  text-align: center;
}
.m-seg {
  text-decoration: overline;
  font-weight: 900;
  letter-spacing: 1px;
}

/* ===== 1. 登入畫面 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.neon-float-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 25%, rgba(6, 182, 212, 0.22), transparent 34%),
    radial-gradient(circle at 82% 20%, rgba(236, 72, 153, 0.2), transparent 32%),
    radial-gradient(circle at 50% 85%, rgba(124, 58, 237, 0.25), transparent 40%);
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 820px;
  background: var(--surface-glass);
  border-radius: 28px;
  padding: 26px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(34, 211, 238, 0.35);
}
.login-hero {
  text-align: center;
  margin-bottom: 20px;
}
.park-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1E1B4B, #4C1D95);
  color: #67E8F9;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.login-hero h1 {
  margin: 4px 0 6px;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
  background: linear-gradient(135deg, #0284C7, #7C3AED 55%, #EC4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin: 0;
  color: #475569;
  font-weight: 700;
  font-size: 15px;
}
.login-form-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  align-items: stretch;
}
.field-group { margin-bottom: 14px; }
.field-group label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 6px;
}
.pin-dots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.pin-dot {
  height: 52px;
  border-radius: 14px;
  border: 2px solid #CBD5E1;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--violet);
  font-weight: 900;
}
.pin-dot.filled {
  border-color: var(--violet);
  background: #EDE9FE;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}
.login-error {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1.5px solid #FCA5A5;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}
.demo-hint-box {
  background: #ECFEFF;
  border: 1.5px dashed #22D3EE;
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 13.5px;
  color: #155E75;
  line-height: 1.5;
}
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}
.num-btn {
  height: 54px;
  border: none;
  border-radius: 14px;
  background: #F1F5F9;
  color: #0F172A;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 #CBD5E1;
  transition: transform 0.08s;
}
.num-btn:active { transform: translateY(2px); background: #E0E7FF; }
.num-btn.num-fn { font-size: 15px; background: #E2E8F0; color: #475569; }
.login-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1.5px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.cloud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.cloud-badge.kind-online { background: #D1FAE5; color: #065F46; }
.cloud-badge.kind-local { background: #E2E8F0; color: #334155; }
.cloud-badge.kind-connecting { background: #FEF3C7; color: #92400E; }
.cloud-badge.kind-error { background: #FEE2E2; color: #991B1B; }

/* ===== 2. 學生主介面外框 ===== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid rgba(34, 211, 238, 0.25);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand-left {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #06B6D4, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.45);
}
.brand-title { font-weight: 900; font-size: 17px; color: #F8FAFC; }
.brand-sub { font-size: 12.5px; color: #94A3B8; font-weight: 600; }

.stat-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.11);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  color: #fff;
}
.stat-pill.points { background: rgba(245, 158, 11, 0.2); border-color: rgba(251, 191, 36, 0.5); color: #FDE68A; }
.stat-pill.tickets { background: rgba(236, 72, 153, 0.22); border-color: rgba(244, 114, 182, 0.55); color: #FBCFE8; }
.stat-pill.stars { background: rgba(6, 182, 212, 0.2); border-color: rgba(34, 211, 238, 0.5); color: #A5F3FC; }

.main-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px 6px;
  flex-wrap: wrap;
}
.nav-tab {
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
  padding: 11px 20px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.nav-tab:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.nav-tab.active {
  background: linear-gradient(135deg, #06B6D4, #7C3AED);
  border-color: #67E8F9;
  color: #fff;
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.app-content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px 40px;
  flex: 1;
}

/* ===== 3. 闖關地圖（5 單元園區 + 期末大統整） ===== */
.map-banner {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(124, 58, 237, 0.3));
  border: 2px solid rgba(103, 232, 249, 0.35);
  border-radius: 24px;
  padding: 18px 22px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.map-banner h2 { margin: 0 0 4px; font-size: 22px; }
.map-banner p { margin: 0; color: #CBD5E1; font-size: 14px; font-weight: 600; }
.progress-bar-wrap {
  min-width: 210px;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 16px;
  padding: 10px 14px;
}
.progress-bar-track {
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #22D3EE, #FBBF24, #EC4899);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.unit-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unit-card.cleared {
  border-color: #34D399;
}
.unit-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.unit-badge-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}
.unit-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--violet);
  background: #EDE9FE;
  padding: 2px 9px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 3px;
}
.unit-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
}
.unit-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.stage-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stage-btn {
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  border-radius: 16px;
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.stage-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: #ECFEFF;
}
.stage-btn.done {
  border-color: #10B981;
  background: #ECFDF5;
}
.stage-btn.locked {
  opacity: 0.58;
  cursor: not-allowed;
  background: #F1F5F9;
}
.stage-num { font-size: 11px; font-weight: 800; color: #64748B; }
.stage-name { font-size: 14px; font-weight: 900; color: #0F172A; }
.stage-stars { font-size: 13px; letter-spacing: 1px; }

/* 終極統整 Boss 卡片 */
.boss-card {
  margin-top: 18px;
  background: linear-gradient(135deg, #312E81, #581C87 50%, #9D174D);
  border: 3px solid #FBBF24;
  border-radius: 26px;
  padding: 22px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 14px 36px rgba(236, 72, 153, 0.3);
}
.boss-card.locked {
  filter: saturate(0.45);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ===== 4. 數學答題引擎＋隨手計算紙 ===== */
.quiz-wrap {
  max-width: 820px;
  margin: 0 auto;
}
.quiz-topbar {
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 12px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.quiz-progress-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.q-dot {
  width: 24px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}
.q-dot.current { background: #38BDF8; box-shadow: 0 0 8px #38BDF8; }
.q-dot.ok { background: #34D399; }
.q-dot.bad { background: #F87171; }

.quiz-card {
  background: #FFFFFF;
  border-radius: 26px;
  padding: 22px 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.q-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.q-chip {
  background: #EDE9FE;
  color: #5B21B6;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.q-prompt {
  font-size: clamp(19px, 2.8vw, 23px);
  font-weight: 900;
  color: #0F172A;
  line-height: 1.55;
  margin: 0 0 16px;
}
.q-visual-box {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.math-svg {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
}
.chart-card {
  width: 100%;
  max-width: 460px;
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: 16px;
  padding: 12px 14px;
}
.chart-title {
  text-align: center;
  font-weight: 900;
  font-size: 15px;
  color: #1E293B;
  margin-bottom: 8px;
}
.picto-legend {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
  background: #E2E8F0;
  padding: 4px 10px;
  border-radius: 10px;
}
.picto-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-bottom: 1px dashed #CBD5E1;
}
.picto-row:last-child { border-bottom: none; }
.picto-label { min-width: 68px; font-weight: 800; font-size: 14px; color: #0F172A; }
.picto-icons { display: flex; flex-wrap: wrap; gap: 4px; font-size: 20px; }
.picto-icon.is-small { font-size: 15px; opacity: 0.72; }

.math-table-wrap { overflow-x: auto; }
.math-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: #fff;
}
.math-table th, .math-table td {
  border: 1.5px solid #CBD5E1;
  padding: 6px 8px;
  text-align: center;
  font-weight: 700;
}
.math-table th { background: #E0E7FF; color: #312E81; font-weight: 900; }
.math-table td.col-head { background: #F1F5F9; font-weight: 900; color: #0F172A; }

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.options-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}
.opt-btn {
  border: 2.5px solid #CBD5E1;
  background: #F8FAFC;
  border-radius: 18px;
  padding: 15px 14px;
  font-size: 19px;
  font-weight: 900;
  color: #0F172A;
  cursor: pointer;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.12s;
  box-shadow: 0 4px 0 #CBD5E1;
}
.opt-btn:hover:not(:disabled) {
  border-color: var(--cyan);
  background: #ECFEFF;
  transform: translateY(-2px);
}
.opt-btn.correct {
  border-color: #10B981 !important;
  background: #D1FAE5 !important;
  color: #065F46 !important;
  box-shadow: 0 4px 0 #059669 !important;
}
.opt-btn.wrong {
  border-color: #EF4444 !important;
  background: #FEE2E2 !important;
  color: #991B1B !important;
  box-shadow: 0 4px 0 #DC2626 !important;
}

.feedback-box {
  margin-top: 16px;
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 700;
  line-height: 1.6;
  animation: popIn 0.2s ease;
}
.feedback-box.ok { background: #ECFDF5; border: 2px solid #34D399; color: #065F46; }
.feedback-box.bad { background: #FFF1F2; border: 2px solid #FDA4AF; color: #9F1239; }

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

/* 隨手計算紙 */
.scratchpad-panel {
  margin-top: 14px;
  background: #FEFCE8;
  border: 2.5px dashed #F59E0B;
  border-radius: 20px;
  padding: 12px;
}
.scratchpad-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.scratchpad-canvas {
  width: 100%;
  height: 220px;
  background-color: #FFFFFF;
  background-image:
    linear-gradient(to right, #E2E8F0 1px, transparent 1px),
    linear-gradient(to bottom, #E2E8F0 1px, transparent 1px);
  background-size: 24px 24px;
  border: 2px solid #CBD5E1;
  border-radius: 14px;
  touch-action: none;
  cursor: crosshair;
  display: block;
}
.pen-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
}
.pen-swatch.active { border-color: #0F172A; transform: scale(1.12); }

/* 結算畫面 */
.result-card {
  background: #FFFFFF;
  border-radius: 28px;
  padding: 28px 24px;
  text-align: center;
  max-width: 560px;
  margin: 10px auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.result-stars { font-size: 48px; letter-spacing: 8px; margin: 6px 0; }
.reward-pills {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.reward-chip {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 18px;
  padding: 12px 18px;
  font-size: 18px;
  font-weight: 900;
}

/* ===== 5. 未來奇幻遊樂園場景 ===== */
.park-header-bar {
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 12px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.park-stage {
  position: relative;
  width: 100%;
  height: 460px;
  border-radius: 28px;
  overflow: hidden;
  border: 3px solid rgba(103, 232, 249, 0.5);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  background:
    radial-gradient(circle at 20% 18%, rgba(236, 72, 153, 0.32), transparent 34%),
    radial-gradient(circle at 80% 15%, rgba(34, 211, 238, 0.32), transparent 35%),
    linear-gradient(180deg, #0F172A 0%, #312E81 36%, #1E3A8A 52%, #065F46 53%, #047857 76%, #064E3B 100%);
  user-select: none;
  touch-action: none;
}
.park-sky-stars {
  position: absolute;
  inset: 0 0 48% 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 20%, #fff, transparent),
    radial-gradient(2px 2px at 34% 12%, #67E8F9, transparent),
    radial-gradient(3px 3px at 66% 18%, #FDE68A, transparent),
    radial-gradient(2px 2px at 84% 28%, #F9A8D4, transparent),
    radial-gradient(2px 2px at 50% 8%, #fff, transparent);
}
.park-track-path {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 10%;
  height: 36%;
  border-radius: 999px;
  border: 6px dashed rgba(103, 232, 249, 0.35);
  background: rgba(15, 23, 42, 0.16);
  pointer-events: none;
}

.park-node {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  text-align: center;
  transition: transform 0.14s ease;
  z-index: 5;
}
.park-node:hover { transform: translate(-50%, -54%) scale(1.06); z-index: 12; }
.park-ride-card {
  background: rgba(15, 23, 42, 0.84);
  border: 2.5px solid #22D3EE;
  border-radius: 20px;
  padding: 8px 12px;
  color: #fff;
  min-width: 106px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 14px rgba(34, 211, 238, 0.35);
}
.park-ride-card.lv2 { border-color: #C084FC; box-shadow: 0 8px 22px rgba(192, 132, 252, 0.45); }
.park-ride-card.lv3 { border-color: #FBBF24; box-shadow: 0 0 24px rgba(251, 191, 36, 0.65); }
.park-ride-emoji { font-size: 38px; line-height: 1.05; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); }
.park-ride-title { font-size: 12.5px; font-weight: 900; margin-top: 2px; white-space: nowrap; }
.park-play-pill {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  background: linear-gradient(135deg, #F43F5E, #F59E0B);
  color: #fff;
}
.park-decor-emoji {
  font-size: 42px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.38));
  line-height: 1;
}
.park-decor-label {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 2px;
  white-space: nowrap;
}

/* 商店與圖鑑區 */
.park-drawer {
  margin-top: 16px;
  background: var(--surface);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.drawer-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.shop-item {
  border: 2px solid #E2E8F0;
  border-radius: 18px;
  padding: 14px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.shop-item.built { border-color: #22D3EE; background: #ECFEFF; }
.shop-emoji { font-size: 36px; }
.rarity-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
}
.rarity-R { background: #0284C7; }
.rarity-SR { background: #7C3AED; }
.rarity-SSR { background: linear-gradient(135deg, #F59E0B, #EC4899); }

/* ===== 6. 迷你遊戲彈窗（賽車／雲霄飛車／打氣球／飛碟／夾娃娃機） ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-box {
  background: #FFFFFF;
  border-radius: 26px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  max-height: 92vh;
  overflow-y: auto;
}
.arcade-modal {
  max-width: 640px;
  background: linear-gradient(180deg, #0F172A, #1E1B4B);
  color: #fff;
  border: 3px solid #22D3EE;
  padding: 18px 20px;
}
.arcade-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 900;
  font-size: 16px;
}
.arcade-canvas {
  width: 100%;
  max-width: 560px;
  height: auto;
  border-radius: 18px;
  border: 2.5px solid rgba(103, 232, 249, 0.5);
  background: #020617;
  display: block;
  margin: 0 auto;
  touch-action: none;
}
.arcade-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}
.arcade-ctrl-btn {
  flex: 1;
  max-width: 190px;
  height: 58px;
  border-radius: 18px;
  border: 2px solid rgba(103, 232, 249, 0.5);
  background: rgba(34, 211, 238, 0.2);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}
.arcade-ctrl-btn:active { background: rgba(34, 211, 238, 0.48); transform: scale(0.96); }

/* ===== 7. 同學參觀卡片 ===== */
.visit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.visit-card {
  background: #fff;
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== 8. 老師管理後台 ===== */
.teacher-shell {
  min-height: 100vh;
  background: #F1F5F9;
  color: #0F172A;
}
.teacher-header {
  background: linear-gradient(135deg, #1E1B4B, #312E81);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.teacher-body {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.kpi-val { font-size: 28px; font-weight: 900; color: var(--violet); }
.panel-card {
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  margin-bottom: 16px;
}
.data-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th, .data-table td {
  border-bottom: 1px solid #E2E8F0;
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}
.data-table th { background: #F8FAFC; font-weight: 900; color: #334155; }

/* 響應式微調 */
@media (max-width: 720px) {
  .login-form-grid { grid-template-columns: 1fr; }
  .options-grid { grid-template-columns: 1fr; }
  .options-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .park-stage { height: 400px; }
}


/* ===== 9. 超大腹地仿真遊樂園（2200×1400 可自由拖曳滑動＋縮放＋雷達小地圖） ===== */
.park-viewport-wrap {
  position: relative;
  width: 100%;
  height: 540px;
  border-radius: 26px;
  overflow: hidden;
  border: 3px solid rgba(103, 232, 249, 0.55);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.48);
  background: #1E4E3D;
}
.park-viewport-wrap.is-fullscreen {
  position: fixed;
  inset: 12px;
  height: calc(100vh - 24px);
  width: calc(100vw - 24px);
  z-index: 80;
  border-radius: 22px;
}
.park-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.park-viewport.dragging { cursor: grabbing; }

.park-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 2200px;
  height: 1400px;
  transform-origin: 0 0;
  will-change: transform;
}
.world-ground-svg {
  position: absolute;
  inset: 0;
  width: 2200px;
  height: 1400px;
  display: block;
  pointer-events: none;
}

/* 具體仿真設施與地標節點 */
.world-ride-node {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.16s ease, filter 0.16s ease;
}
.world-ride-node:hover {
  transform: translate(-50%, -53%) scale(1.04);
  z-index: 20;
  filter: drop-shadow(0 12px 24px rgba(34, 211, 238, 0.45));
}
.ride-svg-art {
  width: 290px;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
}
.world-ride-node.is-plot .ride-svg-art {
  width: 250px;
  opacity: 0.94;
}
.ride-plaque {
  margin-top: -8px;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #22D3EE;
  border-radius: 999px;
  padding: 5px 14px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.ride-plaque.lv2 { border-color: #C084FC; }
.ride-plaque.lv3 { border-color: #FBBF24; box-shadow: 0 0 18px rgba(251, 191, 36, 0.55); }
.ride-play-tag {
  background: linear-gradient(135deg, #F43F5E, #F59E0B);
  color: #fff;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
}

.world-decor-node {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.14s ease;
}
.world-decor-node:hover {
  transform: translate(-50%, -54%) scale(1.07);
  z-index: 18;
}
.decor-svg-art {
  width: 132px;
  height: auto;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.32));
}
.decor-pill-art {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.28);
}

/* 走動的園區遊客小人偶 */
.park-visitor {
  position: absolute;
  font-size: 20px;
  pointer-events: none;
  z-index: 6;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
  animation: visitorWalk 7s ease-in-out infinite alternate;
}
@keyframes visitorWalk {
  0% { transform: translate(0, 0); }
  50% { transform: translate(42px, -16px); }
  100% { transform: translate(-24px, 18px); }
}

/* SVG 動態特效 */
.anim-spin { animation: parkSpin 14s linear infinite; }
@keyframes parkSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.anim-bob { animation: parkBob 1.8s ease-in-out infinite alternate; }
@keyframes parkBob {
  from { transform: translateY(-3px); }
  to { transform: translateY(3px); }
}
.anim-float { animation: parkFloat 2.4s ease-in-out infinite alternate; }
@keyframes parkFloat {
  from { transform: translateY(-6px); }
  to { transform: translateY(5px); }
}
.anim-claw { animation: parkClawSwing 2.6s ease-in-out infinite alternate; }
@keyframes parkClawSwing {
  from { transform: translateX(-34px); }
  to { transform: translateX(34px); }
}

/* 園區懸浮 HUD：超精簡縮放鈕與迷你雷達小地圖 */
.park-hud-top-left {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}
.park-hud-top-left > * { pointer-events: auto; }
.park-drag-tip {
  background: rgba(15, 23, 42, 0.78);
  color: #E0F2FE;
  border: 1px solid rgba(103, 232, 249, 0.4);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 800;
  backdrop-filter: blur(6px);
  width: fit-content;
}
.park-zoom-bar {
  display: flex;
  gap: 4px;
}
.park-zoom-bar .btn {
  padding: 4px 8px;
  font-size: 12px;
  min-height: 28px;
  border-radius: 9px;
  gap: 3px;
}
.park-zone-dock {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100% - 24px);
  background: rgba(15, 23, 42, 0.84);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  backdrop-filter: blur(8px);
}
.zone-jump-btn {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #F8FAFC;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, transform 0.1s;
}
.zone-jump-btn:hover { background: rgba(34, 211, 238, 0.35); }
.zone-jump-btn:active { transform: scale(0.95); }

/* 右上角迷你互動雷達小地圖（精巧不擋畫面） */
.park-minimap {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 118px;
  height: 75px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.82);
  border: 1.5px solid rgba(34, 211, 238, 0.8);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.38);
  z-index: 30;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.park-minimap:hover { opacity: 1; }
.minimap-pin {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid #fff;
}
.minimap-pin.built { background: #22D3EE; box-shadow: 0 0 4px #22D3EE; }
.minimap-pin.plot { background: #F59E0B; opacity: 0.75; }
.minimap-cam {
  position: absolute;
  border: 1.5px solid #FDE047;
  background: rgba(253, 224, 71, 0.16);
  border-radius: 3px;
  pointer-events: none;
}

@media (max-width: 720px) {
  .park-viewport-wrap { height: 460px; }
  .park-minimap { width: 92px; height: 58px; }
  .ride-svg-art { width: 245px; }
}


/* ===== 10. 園區外部導航列（不遮擋入園大門）、大園區行走角色與角色換裝屋 ===== */
.park-zone-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(15, 23, 42, 0.84);
  border: 1.5px solid rgba(103, 232, 249, 0.35);
  border-radius: 18px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.park-zone-strip-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 玩家自選行走小人物 */
.player-avatar-actor {
  position: absolute;
  transform: translate(-50%, -86%);
  z-index: 24;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left 0.72s cubic-bezier(0.22, 0.9, 0.35, 1), top 0.72s cubic-bezier(0.22, 0.9, 0.35, 1);
}
.player-avatar-actor.is-walking .avatar-body-wrap {
  animation: avatarStepBounce 0.28s ease-in-out infinite alternate;
}
@keyframes avatarStepBounce {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-10px) rotate(3deg); }
}
.player-speech-bubble {
  background: #FFFFFF;
  color: #0F172A;
  border: 2.5px solid #06B6D4;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  margin-bottom: 4px;
  position: relative;
}
.player-name-tag {
  margin-top: -6px;
  background: linear-gradient(135deg, #EC4899, #7C3AED);
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
}

/* 雷達小地圖上的「我的位置」紅粉閃爍點 */
.minimap-player {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #EC4899;
  border: 1.5px solid #FFFFFF;
  box-shadow: 0 0 8px #F472B6;
  transform: translate(-50%, -50%);
  z-index: 4;
  animation: pulseMe 1.1s ease-in-out infinite alternate;
}
@keyframes pulseMe {
  from { transform: translate(-50%, -50%) scale(0.95); }
  to { transform: translate(-50%, -50%) scale(1.28); }
}

/* 👗 角色換裝屋排版 */
.wardrobe-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
  align-items: start;
}
.wardrobe-stage {
  background: radial-gradient(circle at 50% 35%, #312E81, #0F172A);
  border: 3px solid #22D3EE;
  border-radius: 22px;
  padding: 18px 14px;
  text-align: center;
  color: #FFFFFF;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
}
.wardrobe-bases {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.base-chip {
  border: 2px solid #CBD5E1;
  background: #F8FAFC;
  border-radius: 14px;
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #0F172A;
}
.base-chip.active {
  border-color: #EC4899;
  background: #FDF2F8;
  color: #9D174D;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.16);
}
.wardrobe-slot-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.wardrobe-card {
  border: 2px solid #E2E8F0;
  border-radius: 18px;
  padding: 12px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.wardrobe-card.equipped {
  border-color: #10B981;
  background: #ECFDF5;
}
.wardrobe-card.owned:not(.equipped) {
  border-color: #38BDF8;
  background: #F0F9FF;
}

@media (max-width: 780px) {
  .wardrobe-layout { grid-template-columns: 1fr; }
}
