/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== 靜音按鈕 ===== */
.mute-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 2px solid #f0c040;
  color: #f0c040;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.mute-btn:hover { transform: scale(1.1); }

/* ===== Audio Enable Splash ===== */
.audio-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: linear-gradient(135deg, #0a0520, #1a0a3e);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease;
}
.audio-splash.hidden {
  display: none;
}
.splash-card {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
}
.splash-owl {
  font-size: 5rem;
  animation: float 3s ease-in-out infinite;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(126,207,255,0.6));
}
.splash-title {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: #f0c040;
  text-shadow: 0 0 20px rgba(240,192,64,0.6);
  margin-bottom: 1rem;
  letter-spacing: 3px;
}
.splash-text {
  font-family: 'Noto Serif TC', serif;
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
.splash-text-small {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  letter-spacing: 1px;
}
.splash-btn {
  font-size: 0.95rem !important;
  padding: 16px 40px !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

:root {
  --gold: #f0c040;
  --gold-dark: #b8860b;
  --parchment: #f5e6c8;
  --parchment-dark: #e8d4a0;
  --ink: #2c1a0e;
  --magic-blue: #4a90d9;
  --magic-glow: #7ecfff;
  --red: #8b0000;
  --green: #1a4a1a;
  --font-title: 'Cinzel', 'Noto Serif TC', serif;
  --font-body: 'Lato', 'Noto Serif TC', sans-serif;
  --font-zh: 'Noto Serif TC', 'Cinzel', serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: #000;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }

.bg-img {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  transition: opacity 0.8s;
}

.dark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1;
}

.map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,2,0,0.72);
  z-index: 1;
}

.cover-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.7) 100%);
  z-index: 1;
}

/* ===== COVER ===== */
.cover-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
  animation: fadeInUp 1.2s ease;
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(240,192,64,0.8), 0 2px 0 var(--gold-dark);
  letter-spacing: 4px;
  margin-bottom: 0.5rem;
}

.game-subtitle {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(126,207,255,0.7);
}

.game-mission {
  font-family: var(--font-title);
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  color: var(--gold);
  margin: 0.5rem 0 1.5rem;
  letter-spacing: 2px;
}

.grade-label {
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.sparkle-ring {
  width: 200px; height: 200px;
  border: 2px solid rgba(240,192,64,0.3);
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 20s linear infinite;
  position: relative;
}
.sparkle-ring::before {
  content: '✦ ✦ ✦ ✦ ✦ ✦';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 8px;
  white-space: nowrap;
}

/* ===== PARCHMENT ===== */
.parchment {
  background: var(--parchment);
  background-image:
    radial-gradient(ellipse at top left, rgba(240,192,64,0.15), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(184,134,11,0.1), transparent 60%);
  border: 3px solid var(--gold-dark);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(240,192,64,0.4), inset 0 0 60px rgba(184,134,11,0.1);
  color: var(--ink);
}

/* ===== BUTTONS ===== */
.btn-magic {
  background: linear-gradient(135deg, #8b1a1a, #b8860b, #8b1a1a);
  background-size: 200% 200%;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 36px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 1.5rem;
  animation: shimmer 3s linear infinite;
  transition: transform 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}
.btn-magic:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(240,192,64,0.6);
}

/* ===== REGISTER ===== */
.register-box {
  position: relative;
  z-index: 10;
  width: min(560px, 92vw);
  padding: 2rem;
  margin: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-desc {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
  color: #555;
  font-family: var(--font-zh);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--gold-dark);
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  color: var(--ink);
  font-family: var(--font-body);
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(240,192,64,0.4);
}

.avatar-label {
  font-family: var(--font-title);
  font-weight: 700;
  margin-bottom: 0.8rem;
  text-align: center;
}

.avatar-row {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.avatar-card {
  width: 90px;
  padding: 12px 8px;
  border: 2px solid var(--gold-dark);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  background: rgba(255,255,255,0.5);
  transition: all 0.2s;
}
.avatar-card:hover, .avatar-card.selected {
  background: var(--gold);
  border-color: var(--gold-dark);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(184,134,11,0.4);
}
.avatar-emoji { font-size: 2rem; margin-bottom: 4px; }
.avatar-card p { font-size: 0.8rem; font-weight: 700; color: var(--ink); }

/* ===== TRAIN ===== */
.train-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
}

.train-desc {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  text-shadow: 0 0 10px rgba(126,207,255,0.5);
}

.ticket-container { cursor: pointer; display: inline-block; }

.ticket {
  background: linear-gradient(135deg, #8b1a1a 0%, #5a0e0e 100%);
  border: 3px solid var(--gold);
  border-radius: 12px;
  padding: 2rem 3rem;
  color: var(--gold);
  font-family: var(--font-title);
  box-shadow: 0 0 40px rgba(240,192,64,0.3);
  animation: float 3s ease-in-out infinite;
  transition: transform 0.2s;
}
.ticket:hover { transform: scale(1.05) rotate(1deg); }
.ticket-top { font-size: 1.4rem; font-weight: 700; letter-spacing: 3px; }
.ticket-route { font-size: 1rem; margin: 0.5rem 0; color: #fff; }
.ticket-class { font-size: 0.8rem; color: rgba(240,192,64,0.7); }
.ticket-tap { font-size: 1rem; margin-top: 1rem; animation: pulse 1.5s ease-in-out infinite; }

.train-progress { margin-top: 2rem; color: #fff; }
.progress-track { width: 300px; height: 12px; background: rgba(255,255,255,0.2); border-radius: 6px; margin: 1rem auto; border: 1px solid var(--gold); }
.progress-train { height: 100%; background: linear-gradient(90deg, var(--gold), #fff); border-radius: 6px; width: 0%; transition: width 0.1s; }

.glow { color: var(--gold); text-shadow: 0 0 20px rgba(240,192,64,0.8); }

/* ===== MAP - STATION STYLE ===== */
.map-ui {
  position: relative;
  z-index: 10;
  text-align: center;
  width: min(1100px, 97vw);
  padding: 1.5rem 1rem;
}

.map-title {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 3vw, 2rem);
  color: var(--gold);
  text-shadow: 0 0 24px rgba(240,192,64,0.8), 0 2px 0 rgba(0,0,0,0.5);
  margin-bottom: 0.5rem;
}

.student-tag {
  background: rgba(0,0,0,0.75);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 6px 20px;
  color: var(--gold);
  font-size: 0.82rem;
  display: inline-block;
  margin-bottom: 1.8rem;
  text-shadow: none;
}

.map-stations {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.station-arrow {
  color: var(--gold);
  font-size: 2.2rem;
  text-shadow: 0 0 12px rgba(240,192,64,0.8);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.station {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: clamp(150px, 16vw, 200px);
  transition: transform 0.25s, filter 0.25s;
}
.station:hover { transform: translateY(-8px) scale(1.04); }

.station-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid rgba(240,192,64,0.3);
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.station.unlocked .station-img-wrap {
  border-color: var(--gold);
  border-width: 4px;
  box-shadow: 0 0 28px rgba(240,192,64,0.9), 0 0 60px rgba(240,192,64,0.3);
}
.station.completed .station-img-wrap {
  border-color: #4caf50;
  border-width: 4px;
  box-shadow: 0 0 20px rgba(76,175,80,0.7);
}
.station.locked .station-img-wrap {
  filter: grayscale(90%) brightness(0.35);
}

.station-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.station.unlocked:hover .station-img { transform: scale(1.08); }

.station-lock, .station-done {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 2.2rem;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.station-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
  gap: 3px;
}
.station-num {
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: rgba(240,192,64,0.8);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.station-name {
  font-family: var(--font-title);
  font-size: 0.88rem;
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0,0,0,0.9);
}
.station-status {
  font-size: 0.72rem;
  color: #aaa;
  letter-spacing: 1px;
}
.station.unlocked .station-status { color: var(--gold); font-weight: 700; font-size: 0.8rem; }
.station.completed .station-status { color: #4caf50; }

@media (max-width: 600px) {
  .map-stations { gap: 0.3rem; }
  .station { width: clamp(100px, 18vw, 130px); }
  .station-arrow { font-size: 1.4rem; }
  .station-name { font-size: 0.7rem; }
}

/* ===== 嘿美 AI 小助理 (貓頭鷹版，永遠待命) ===== */
.hamei-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hamei-owl-wrap {
  position: relative;
  cursor: pointer;
  width: 110px;
  filter: drop-shadow(0 0 16px rgba(126,207,255,0.7));
  transition: transform 0.25s;
  animation: float 4s ease-in-out infinite;
}
.hamei-owl-wrap:hover { transform: scale(1.08) rotate(-3deg); }

.hamei-owl-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(240,192,64,0.5), 0 0 40px rgba(126,207,255,0.3);
  display: block;
}

.hamei-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(126,207,255,0.5);
  animation: pulsering 2s ease-in-out infinite;
}

@keyframes pulsering {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 0.2; }
}

.hamei-bubble {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,5,20,0.9);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-zh);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  animation: pulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
.hamei-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--gold);
  border-bottom: 0;
}

/* 對話框 */
.hamei-panel {
  width: min(320px, 88vw);
  background: linear-gradient(160deg, #0f0520, #1e0850);
  border: 2px solid var(--gold);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(123,47,247,0.5), 0 0 0 1px rgba(240,192,64,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 380px;
  animation: fadeInUp 0.25s ease;
}

.hamei-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(123,47,247,0.25);
  border-bottom: 1px solid rgba(240,192,64,0.25);
  font-family: var(--font-zh);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gold);
}
.hamei-close {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.hamei-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240,192,64,0.3) transparent;
}

.hamei-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.55;
  font-family: var(--font-zh);
  animation: fadeInUp 0.3s ease;
}
.hamei-msg.ai {
  background: rgba(123,47,247,0.25);
  border: 1px solid rgba(240,192,64,0.18);
  color: #ddd4ff;
  align-self: flex-start;
  border-radius: 4px 12px 12px 12px;
}
.hamei-msg.user {
  background: rgba(240,192,64,0.12);
  border: 1px solid rgba(240,192,64,0.28);
  color: var(--gold);
  align-self: flex-end;
  border-radius: 12px 4px 12px 12px;
}
.hamei-msg.typing { color: #888; font-style: italic; }

.hamei-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(240,192,64,0.18);
}
.hamei-input-row input {
  flex: 1;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid rgba(240,192,64,0.35);
  background: rgba(255,255,255,0.07);
  color: #fff;
  font-size: 0.83rem;
  font-family: var(--font-zh);
}
.hamei-input-row input::placeholder { color: #666; font-family: var(--font-zh); }
.hamei-input-row input:focus { outline: none; border-color: var(--gold); }
.hamei-send {
  padding: 7px 12px;
  background: linear-gradient(135deg, #7b2ff7, #3d0e6b);
  border: 1px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-size: 1rem;
  cursor: pointer;
}
.hamei-send:hover { background: linear-gradient(135deg, #9b4fff, #5a1a9b); }

/* ===== QUEST BOXES ===== */
.quest-box {
  position: relative;
  z-index: 10;
  width: min(620px, 94vw);
  padding: 1.8rem;
  margin: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.quest-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
  text-align: center;
}

.quest-desc {
  text-align: center;
  color: #555;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-zh);
}

/* ===== Q1 DRAG & DROP ===== */
.drop-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin: 1rem 0;
}

.drop-zone {
  min-width: 120px;
  padding: 10px 16px;
  border: 2px dashed var(--gold-dark);
  border-radius: 8px;
  background: rgba(255,255,255,0.5);
  font-family: var(--font-title);
  font-size: 0.95rem;
  text-align: center;
  transition: background 0.2s;
}
.drop-zone.dragover { background: rgba(240,192,64,0.3); }
.drop-zone.correct { border-color: #4caf50; background: rgba(76,175,80,0.15); }
.drop-zone.wrong { border-color: #e53935; background: rgba(229,57,53,0.15); }

.words-col, .items-col { display: none; } /* using drop zone instead */

.match-game { display: none; }

.word-btn {
  display: inline-block;
  padding: 8px 18px;
  background: linear-gradient(135deg, #8b1a1a, #5a0e0e);
  border: 2px solid var(--gold);
  color: var(--gold);
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  cursor: grab;
  margin: 4px;
  user-select: none;
  transition: transform 0.2s;
}
.word-btn:hover { transform: scale(1.05); }
.word-btn:active { cursor: grabbing; }

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(0,0,0,0.08);
  border-radius: 8px;
  border: 1px dashed var(--gold-dark);
}

/* ===== Q2 SORTING ===== */
.sorting-q { margin-bottom: 1rem; }
.q-text { font-weight: 700; margin-bottom: 0.8rem; font-size: 1rem; color: var(--ink); }
.q-options { display: flex; flex-direction: column; gap: 0.5rem; }

.opt-btn {
  padding: 10px 16px;
  background: linear-gradient(135deg, #3d1a0a, #5a2a10);
  border: 2px solid var(--gold-dark);
  color: #f5e6c8;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: var(--font-zh);
  text-align: left;
  transition: all 0.2s;
}
.opt-btn:hover { background: linear-gradient(135deg, #6b3a1a, #8b5a2a); border-color: var(--gold); }
.opt-btn.correct-ans { background: #1a4a1a; border-color: #4caf50; }
.opt-btn.wrong-ans { background: #4a1a1a; border-color: #e53935; }

.house-result {
  text-align: center;
  padding: 1.5rem;
  background: rgba(0,0,0,0.08);
  border-radius: 10px;
  border: 2px solid var(--gold);
  margin-top: 1rem;
}
.house-result h3 { font-family: var(--font-title); font-size: 1.5rem; color: var(--ink); margin-bottom: 0.5rem; }

/* ===== Q3 CHARMS ===== */
.charm-section { margin-bottom: 1.5rem; }
.charm-section h3 { font-family: var(--font-title); font-size: 1rem; color: var(--ink); margin-bottom: 0.8rem; border-bottom: 1px solid var(--gold-dark); padding-bottom: 4px; }
.listen-row { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.listen-btn { padding: 8px 14px; background: #2c1a0e; border: 2px solid var(--gold); color: var(--gold); border-radius: 6px; cursor: pointer; font-size: 1rem; }
.listen-choices { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.charm-mark { font-size: 1.2rem; font-weight: 700; min-width: 24px; }

.feather-game { margin-top: 0.8rem; }
.direction-words { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.dir-word {
  padding: 8px 16px;
  background: linear-gradient(135deg, #8b1a1a, #5a0e0e);
  border: 2px solid var(--gold);
  color: var(--gold);
  border-radius: 6px;
  cursor: grab;
  font-family: var(--font-title);
  font-size: 0.95rem;
  user-select: none;
}
.arrows-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.arrow-drop {
  padding: 10px;
  border: 2px dashed var(--gold-dark);
  border-radius: 8px;
  background: rgba(255,255,255,0.4);
  text-align: center;
  font-family: var(--font-title);
}
.arrow-drop.correct { border-color: #4caf50; background: rgba(76,175,80,0.15); }

/* ===== Q4 FOREST ===== */
.forest-q { margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(184,134,11,0.3); }
.clue { font-style: italic; color: var(--red); margin-bottom: 0.5rem; font-size: 0.95rem; }
.creature-choices { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ===== Q5 DOORS ===== */
.door-puzzle { margin-bottom: 1.2rem; padding: 1rem; background: rgba(0,0,0,0.06); border-radius: 8px; border: 1px solid rgba(184,134,11,0.3); }
.door-label { font-family: var(--font-title); font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; }
.scramble-hint { font-size: 0.85rem; color: #666; margin-bottom: 0.6rem; }
.sentence-input { width: 100%; padding: 10px; border: 2px solid var(--gold-dark); border-radius: 6px; font-size: 0.95rem; background: rgba(255,255,255,0.7); color: var(--ink); font-family: var(--font-body); }

/* ===== FINALE ===== */
.finale-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem;
  width: min(640px, 95vw);
}

.certificate {
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 4px double var(--gold-dark);
  animation: fadeInUp 1s ease;
}

.cert-header { font-family: var(--font-title); font-size: 1.1rem; font-weight: 700; color: var(--gold-dark); letter-spacing: 2px; margin-bottom: 1rem; }
.cert-text { font-size: 0.95rem; color: var(--ink); margin: 0.3rem 0; }
.cert-name { font-family: var(--font-title); font-size: 1.8rem; color: var(--red); margin: 0.5rem 0; }
.cert-house { font-family: var(--font-title); font-size: 1.1rem; color: var(--ink); margin: 0.5rem 0; font-weight: 700; }
.cert-house span { color: var(--red); }
.cert-game { font-family: var(--font-title); font-size: 0.95rem; color: var(--gold-dark); font-style: italic; }
.cert-footer { font-size: 0.8rem; color: #888; margin-top: 1rem; }
.cert-number { font-weight: 700; }

.finale-quote {
  color: var(--gold);
  font-style: italic;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px rgba(240,192,64,0.5);
}

.email-status { color: #7ecfff; font-size: 0.9rem; margin-top: 0.5rem; min-height: 1.2rem; }

/* ===== FEEDBACK ===== */
.feedback {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.5rem;
  min-height: 1.5rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  font-family: var(--font-zh);
}
.feedback.success { color: #2e7d32; background: rgba(76,175,80,0.1); }
.feedback.error { color: #c62828; background: rgba(229,57,53,0.1); }

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .avatar-row { gap: 0.5rem; }
  .avatar-card { width: 70px; padding: 8px 4px; }
  .quest-nodes { gap: 0.6rem; }
  .quest-node { width: 100px; padding: 0.8rem; }
}
