/* ═══════════════════════════════════════════════════════════════
   EOM Quest v2 — Visual Novel Style
   Palette: #0D1B2A (dark), #1B3A5C (navy), #D4EBF5 (sky),
            #E8705A (coral), #27AE60 (green), #F3B35E (amber)
═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif; }
body { background: #0d1b2a; color: #fff; }

/* ── Screens ──────────────────────────────────────────────── */
.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; }

/* ── Status banner ────────────────────────────────────────── */
.status-message {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  min-width: 260px; max-width: 90vw; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  background: rgba(20,40,70,0.96); color: #D4EBF5;
  z-index: 9999; opacity: 0; transition: opacity 0.2s;
  pointer-events: none; text-align: center;
}
.status-message:not(:empty) { opacity: 1; }
.status-message.error { background: rgba(180,40,40,0.95); color: #fff; }
.status-message.success { background: rgba(30,130,80,0.95); color: #fff; }

/* ── Confetti ────────────────────────────────────────────── */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9990; overflow: hidden; }
.confetti-particle {
  position: absolute; top: -10px; width: 9px; height: 9px; border-radius: 2px;
  animation: confettiFall 2s ease-in forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) translateX(var(--drift, 0px)) rotate(540deg); opacity: 0; }
}

/* ── Shared button styles ─────────────────────────────────── */
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 28px; background: #E8705A; color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.primary-btn:hover { background: #d4614c; }
.primary-btn:active { transform: scale(0.97); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ghost-sm-btn {
  padding: 7px 14px; background: transparent; color: #D4EBF5;
  border: 1px solid rgba(212,235,245,0.3); border-radius: 6px;
  font-size: 13px; cursor: pointer; transition: background 0.15s;
}
.ghost-sm-btn:hover { background: rgba(212,235,245,0.1); }

.icon-btn {
  width: 36px; height: 36px; background: rgba(255,255,255,0.1);
  border: none; border-radius: 8px; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }

/* ── INPUT / FORM shared ─────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-group label { font-size: 13px; color: rgba(212,235,245,0.8); font-weight: 500; }
.field-group input, .field-group select, .field-group textarea {
  padding: 10px 13px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(212,235,245,0.2); border-radius: 7px;
  color: #fff; font-size: 14px; outline: none;
  transition: border-color 0.2s;
}
.field-group input:focus, .field-group select:focus { border-color: #D4EBF5; }
.field-group select option { background: #1B3A5C; color: #fff; }
.field-group input.shake { animation: shake 0.35s ease; }
@keyframes shake {
  0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)}
}

/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════ */
#loginScreen {
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 40%, #1B3A5C 0%, #0D1B2A 70%);
}
.login-card {
  width: 100%; max-width: 400px; padding: 40px 32px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(212,235,245,0.12);
  border-radius: 16px; backdrop-filter: blur(20px);
  display: flex; flex-direction: column; gap: 20px;
}
.login-logo { text-align: center; }
.login-logo .logo-icon { font-size: 48px; }
.login-logo h1 { font-size: 26px; color: #D4EBF5; margin: 6px 0 4px; letter-spacing: 1px; }
.login-logo p { font-size: 13px; color: rgba(212,235,245,0.6); }
.auth-tabs { display: flex; gap: 4px; background: rgba(0,0,0,0.2); border-radius: 8px; padding: 3px; }
.auth-tab {
  flex: 1; padding: 8px; background: transparent; border: none;
  color: rgba(212,235,245,0.6); font-size: 13px; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: all 0.15s;
}
.auth-tab.active { background: #1B3A5C; color: #D4EBF5; }
#loginPanel, #registerPanel { display: flex; flex-direction: column; gap: 14px; }
#loginPanel form, #registerPanel form { display: flex; flex-direction: column; gap: 14px; }

/* ══════════════════════════════════════════════════════════
   MAP SCREEN
══════════════════════════════════════════════════════════ */
#mapScreen {
  flex-direction: column; overflow-y: auto;
  background: linear-gradient(160deg, #0D1B2A 0%, #122338 60%, #0D1B2A 100%);
}
.map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; flex-shrink: 0;
}
.map-title-block { display: flex; align-items: center; gap: 14px; font-size: 28px; }
.map-title-block h2 { font-size: 20px; color: #D4EBF5; margin: 0; }
.map-title-block p { font-size: 12px; color: rgba(212,235,245,0.6); margin: 2px 0 0; }
.map-header-right { display: flex; align-items: center; gap: 10px; }
.map-progress-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px 0; flex-shrink: 0;
}
.map-progress-track {
  flex: 1; height: 4px; background: rgba(212,235,245,0.12); border-radius: 2px; overflow: hidden;
}
.map-progress-fill { height: 100%; background: #E8705A; border-radius: 2px; transition: width 0.4s; width: 0; }
.map-progress-label { font-size: 12px; color: rgba(212,235,245,0.5); white-space: nowrap; }
.chapter-cards {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 24px 24px; flex: 1;
}
.map-chapter-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212,235,245,0.1); border-radius: 12px;
  cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
}
.map-chapter-card:hover:not(:disabled) { background: rgba(212,235,245,0.08); transform: translateX(4px); }
.map-chapter-card:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.map-chapter-card.completed { border-color: rgba(39,174,96,0.4); }
.map-chapter-card.current { border-color: rgba(232,112,90,0.5); box-shadow: 0 0 0 1px rgba(232,112,90,0.3); }
.map-card-icon { font-size: 32px; flex-shrink: 0; }
.map-card-body { flex: 1; min-width: 0; }
.map-card-sub { font-size: 11px; color: rgba(212,235,245,0.5); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.map-card-title { font-size: 16px; font-weight: 700; color: #D4EBF5; }
.map-card-time { font-size: 12px; color: rgba(212,235,245,0.5); margin-top: 2px; }
.map-card-status {
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 20px; flex-shrink: 0;
  background: rgba(212,235,245,0.08); color: rgba(212,235,245,0.5);
}
.map-chapter-card.completed .map-card-status { background: rgba(39,174,96,0.15); color: #27AE60; }
.map-chapter-card.current .map-card-status { background: rgba(232,112,90,0.2); color: #E8705A; }
.map-done-panel {
  margin: 0 24px 24px; padding: 24px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(212,235,245,0.12);
  border-radius: 12px; display: flex; flex-direction: column; gap: 14px;
}
.map-done-panel h3 { font-size: 16px; color: #D4EBF5; }
.map-done-panel p { font-size: 14px; color: rgba(212,235,245,0.7); }
.map-done-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════
   VN GAME SCREEN
══════════════════════════════════════════════════════════ */
#vnScreen { align-items: stretch; justify-content: stretch; }

/* Background */
.vn-bg {
  position: absolute; inset: 0; z-index: 0;
  transition: background 0.8s ease;
}
/* ── clinic：診間 ─ 白色牆面 + 右側窗光 + 淺木地板 ── */
.vn-bg.clinic {
  background:
    /* 右側窗光斜射 */
    linear-gradient(105deg, transparent 52%, rgba(218,240,255,0.35) 52%, rgba(218,240,255,0.35) 60%, transparent 60%),
    linear-gradient(105deg, transparent 63%, rgba(218,240,255,0.18) 63%, rgba(218,240,255,0.18) 69%, transparent 69%),
    /* 天花板燈 */
    radial-gradient(ellipse 50% 22% at 50% 0%, rgba(240,250,255,0.8) 0%, transparent 100%),
    /* 牆面漸層 + 地板 */
    linear-gradient(180deg,
      #dce9f4 0%, #cfe2f2 50%, #c4d8ec 62%,
      #b8a87e 63%, #c0b088 100%
    );
}
.vn-bg.clinic::before {
  content: '';
  position: absolute;
  /* 右側窗框 */
  top: 8%; right: 11%;
  width: 74px; height: 130px;
  background: linear-gradient(180deg, rgba(230,245,255,0.75) 0%, rgba(200,230,255,0.4) 100%);
  border: 5px solid rgba(220,235,250,0.85);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 28px rgba(190,220,255,0.45), inset 0 0 12px rgba(255,255,255,0.25);
}
.vn-bg.clinic::after {
  content: '';
  position: absolute;
  /* 踢腳板 */
  top: 62.5%; left: 0; right: 0;
  height: 5px;
  background: rgba(130,100,60,0.25);
}

/* ── clinic-desk：桌前問診（第 3 關，細部評估） ── */
.vn-bg.clinic-desk {
  background:
    radial-gradient(ellipse 55% 25% at 48% 0%, rgba(245,252,255,0.85) 0%, transparent 100%),
    linear-gradient(105deg, transparent 55%, rgba(215,238,255,0.3) 55%, rgba(215,238,255,0.3) 63%, transparent 63%),
    linear-gradient(180deg,
      #dae8f5 0%, #cce0f3 48%, #c0d4e8 61%,
      #b0a078 62%, #bfac85 100%
    );
}
.vn-bg.clinic-desk::before {
  content: '';
  position: absolute;
  /* 診桌桌面（下方） */
  bottom: 35%; left: 5%; right: 5%;
  height: 28px;
  background: linear-gradient(180deg, #d4c49a 0%, #c8b888 100%);
  border-radius: 4px 4px 0 0;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.12);
}
.vn-bg.clinic-desk::after {
  content: '';
  position: absolute;
  /* 桌腳陰影 */
  bottom: 0; left: 5%; right: 5%;
  height: 35%;
  background: linear-gradient(to top, rgba(180,160,110,0.45) 0%, transparent 100%);
}

/* ── followup：回診（第 5 關，傍晚暖光） ── */
.vn-bg.followup {
  background:
    /* 暖色窗光 */
    linear-gradient(110deg, transparent 50%, rgba(255,215,150,0.22) 50%, rgba(255,215,150,0.22) 58%, transparent 58%),
    radial-gradient(ellipse 55% 28% at 50% 0%, rgba(255,240,210,0.7) 0%, transparent 100%),
    /* 牆面 + 地板（暖色調） */
    linear-gradient(180deg,
      #e8dac8 0%, #ddd0ba 50%, #d0c4a8 62%,
      #a8946a 63%, #b09870 100%
    );
}
.vn-bg.followup::before {
  content: '';
  position: absolute;
  top: 9%; right: 10%;
  width: 68px; height: 118px;
  background: linear-gradient(180deg, rgba(255,240,200,0.8) 0%, rgba(255,220,160,0.4) 100%);
  border: 5px solid rgba(240,220,180,0.8);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 30px rgba(255,200,100,0.3), inset 0 0 10px rgba(255,230,180,0.2);
}
.vn-bg.followup::after {
  content: '';
  position: absolute;
  top: 62.5%; left: 0; right: 0;
  height: 5px;
  background: rgba(120,90,40,0.2);
}

/* HUD */
.vn-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(13,27,42,0.7) 0%, transparent 100%);
}
.vn-hud-left { display: flex; align-items: center; gap: 12px; }
.vn-hud-right { display: flex; align-items: center; gap: 8px; }
.vn-chapter-label {
  font-size: 12px; color: rgba(212,235,245,0.85); font-weight: 600;
  background: rgba(13,27,42,0.5); padding: 4px 10px; border-radius: 20px;
}
.vn-mini-progress {
  width: 80px; height: 3px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden;
}
.vn-mini-fill { height: 100%; background: #E8705A; border-radius: 2px; transition: width 0.4s; width: 0; }

/* Characters */
.vn-stage {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 5% 180px; pointer-events: none;
}
.vn-char {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: opacity 0.4s, transform 0.4s, filter 0.3s;
}
.vn-char[data-hidden="true"] { opacity: 0; transform: translateY(20px); pointer-events: none; }
.vn-char[data-hidden="false"] { opacity: 1; transform: translateY(0); }
.vn-char[data-active="false"] { filter: brightness(0.55) saturate(0.6); }
.vn-char[data-active="true"] { filter: brightness(1) saturate(1); }
.vn-char-emoji {
  font-size: 88px; line-height: 1;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.25));
  transition: transform 0.2s;
}
.vn-char[data-active="true"] .vn-char-emoji { transform: scale(1.05) translateY(-4px); }
.vn-char-name {
  font-size: 12px; font-weight: 700; color: #fff;
  background: rgba(13,27,42,0.65); padding: 3px 10px; border-radius: 20px;
}

/* HUD save button */
.vn-save-btn {
  padding: 7px 14px; background: rgba(212,235,245,0.12);
  border: 1px solid rgba(212,235,245,0.25); border-radius: 8px;
  color: rgba(212,235,245,0.9); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.vn-save-btn:hover { background: rgba(212,235,245,0.22); border-color: rgba(212,235,245,0.5); }
.vn-save-btn.saving { opacity: 0.6; cursor: wait; }

/* Textbox */
.vn-textbox {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
  padding: 20px 36px 32px;
  background: rgba(8,16,34,0.88);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(212,235,245,0.15);
  min-height: 148px;
  transition: opacity 0.25s, transform 0.25s;
  cursor: pointer;
}
.vn-textbox[data-show="false"] { opacity: 0; transform: translateY(14px); pointer-events: none; }
.vn-textbox[data-show="true"] { opacity: 1; transform: translateY(0); }
.vn-speaker-name {
  font-size: 14px; font-weight: 700; color: #F3B35E;
  margin-bottom: 10px; min-height: 20px; letter-spacing: 0.3px;
}
.vn-dialogue-text {
  font-size: 19px; line-height: 1.85; color: rgba(240,248,255,0.96);
  min-height: 56px; letter-spacing: 0.2px;
}
.vn-advance-hint {
  position: absolute; right: 28px; bottom: 20px;
  font-size: 14px; color: rgba(212,235,245,0.55);
  animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* Overlays (panels) */
.vn-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.25s;
  padding: 16px;
}
.vn-overlay[data-show="false"] { opacity: 0; pointer-events: none; }
.vn-overlay[data-show="true"] { opacity: 1; }

/* Chapter intro card */
.vn-intro-card {
  background: rgba(10,20,40,0.9); backdrop-filter: blur(20px);
  border: 1px solid rgba(212,235,245,0.15); border-radius: 18px;
  padding: 44px 40px; text-align: center; max-width: 480px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.vn-intro-icon { font-size: 52px; }
.vn-intro-sub { font-size: 12px; color: #E8705A; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.vn-intro-title { font-size: 26px; color: #D4EBF5; font-weight: 800; }
.vn-intro-time { font-size: 13px; color: rgba(212,235,245,0.55); }
.vn-intro-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Panel overlay — 置中 + 暗底 */
.vn-panel-overlay {
  align-items: center;
  padding: 20px;
  background: rgba(0,5,18,0.55);
  backdrop-filter: blur(5px);
}
.vn-panel-scroll {
  width: 100%; max-width: 900px; margin: 0 auto;
  max-height: 90vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(212,235,245,0.2) transparent;
}
.vn-panel-card {
  background: rgba(8,18,36,0.96); backdrop-filter: blur(22px);
  border: 1px solid rgba(212,235,245,0.15); border-radius: 18px;
  padding: 32px 40px 44px; display: flex; flex-direction: column; gap: 22px;
}
.vn-question-meta {
  font-size: 12px; color: #E8705A; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
}
.vn-question-body { font-size: 17px; line-height: 1.85; color: #D4EBF5; }
.vn-question-body p { margin-bottom: 12px; }
.vn-question-body p:last-child { margin-bottom: 0; }
.vn-question-body strong { color: #fff; }
.vn-question-body ul, .vn-question-body ol { padding-left: 20px; margin-bottom: 12px; }
.vn-question-body li { margin-bottom: 6px; }
.vn-question-body em { color: rgba(212,235,245,0.65); font-style: italic; }
.vn-label {
  font-size: 13px; color: rgba(212,235,245,0.75); font-weight: 600;
  margin-bottom: 6px; display: block;
}
.vn-textarea {
  width: 100%; padding: 14px 16px; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(212,235,245,0.22); border-radius: 10px;
  color: #fff; font-size: 16px; line-height: 1.7; resize: vertical; outline: none;
  font-family: inherit; transition: border-color 0.2s; min-height: 100px;
}
.vn-textarea:focus { border-color: rgba(212,235,245,0.6); background: rgba(255,255,255,0.09); }
.vn-panel-actions { display: flex; gap: 12px; margin-top: 6px; }

/* VN buttons */
.vn-btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 30px; background: #E8705A; color: #fff;
  border: none; border-radius: 10px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}
.vn-btn-primary:hover { background: #d4614c; }
.vn-btn-primary:active { transform: scale(0.97); }
.vn-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.vn-btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 22px; background: transparent;
  border: 1px solid rgba(212,235,245,0.22); border-radius: 10px;
  color: rgba(212,235,245,0.75); font-size: 15px; cursor: pointer;
  transition: background 0.15s;
}
.vn-btn-ghost:hover { background: rgba(212,235,245,0.08); }

/* Choices */
.vn-choices { display: flex; flex-direction: column; gap: 10px; }
.vn-choice-btn {
  width: 100%; padding: 15px 20px; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(212,235,245,0.18);
  border-radius: 12px; color: #D4EBF5; font-size: 16px; line-height: 1.6;
  cursor: pointer; transition: all 0.18s; position: relative; overflow: hidden;
}
.vn-choice-btn:hover { background: rgba(212,235,245,0.1); border-color: rgba(212,235,245,0.4); transform: translateX(3px); }
.vn-choice-btn.selected-correct { background: rgba(39,174,96,0.2); border-color: #27AE60; color: #fff; transform: none; }
.vn-choice-btn.selected-wrong { background: rgba(232,112,90,0.2); border-color: #E8705A; color: #fff; transform: none; }
.vn-choice-btn.correct-reveal { background: rgba(39,174,96,0.12); border-color: rgba(39,174,96,0.4); }
.vn-choice-btn:disabled { cursor: default; }
.choice-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(212,235,245,0.15); color: #D4EBF5;
  font-size: 12px; font-weight: 700; margin-right: 12px; flex-shrink: 0;
}

/* Reveal */
.vn-reveal-badge, .vn-reflect-badge {
  display: inline-block; padding: 6px 14px;
  background: rgba(212,235,245,0.1); color: #D4EBF5;
  border-radius: 20px; font-size: 13px; font-weight: 700; margin-bottom: 4px;
}
.vn-your-answer {
  padding: 12px 16px; background: rgba(255,255,255,0.04);
  border-left: 3px solid #F3B35E; border-radius: 0 8px 8px 0;
  font-size: 15px; color: rgba(212,235,245,0.85); font-style: italic; line-height: 1.6;
}
.vn-reveal-content { font-size: 16px; line-height: 1.85; color: rgba(240,248,255,0.92); }
.vn-reveal-content h4 { color: #D4EBF5; font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.vn-reveal-content h4:first-child { margin-top: 0; }
.vn-reveal-content p { margin-bottom: 12px; }
.vn-reveal-content ul, .vn-reveal-content ol { padding-left: 22px; margin-bottom: 12px; }
.vn-reveal-content li { margin-bottom: 7px; }
.vn-reveal-content table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15px; }
.vn-reveal-content th { background: rgba(212,235,245,0.1); color: #D4EBF5; padding: 10px 14px; text-align: left; font-weight: 600; }
.vn-reveal-content td { padding: 9px 14px; border-bottom: 1px solid rgba(212,235,245,0.08); color: rgba(240,248,255,0.88); }
.vn-reveal-content strong { color: #fff; }
.vn-reveal-content blockquote {
  border-left: 4px solid #E8705A; padding: 12px 18px; margin: 14px 0;
  background: rgba(232,112,90,0.08); border-radius: 0 8px 8px 0;
  color: rgba(240,248,255,0.92); font-size: 16px; line-height: 1.75;
}

/* Reflect */
.vn-reflect-q { font-size: 16px; color: rgba(212,235,245,0.88); line-height: 1.75; }

/* Summary */
.vn-summary-card { max-height: none; }
.vn-summary-card h4 { color: #D4EBF5; font-size: 16px; font-weight: 700; margin: 16px 0 10px; }
.vn-summary-card ol, .vn-summary-card ul { padding-left: 20px; font-size: 16px; color: rgba(240,248,255,0.88); }
.vn-summary-card li { margin-bottom: 8px; line-height: 1.75; }
.vn-summary-card strong { color: #fff; }
.vn-summary-card table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 10px 0; }
.vn-summary-card th { background: rgba(212,235,245,0.1); color: #D4EBF5; padding: 9px 12px; text-align: left; }
.vn-summary-card td { padding: 8px 12px; border-bottom: 1px solid rgba(212,235,245,0.08); color: rgba(240,248,255,0.88); }
.vn-summary-card blockquote {
  border-left: 4px solid #D4EBF5; padding: 12px 18px; margin: 14px 0;
  background: rgba(212,235,245,0.06); border-radius: 0 8px 8px 0; font-style: italic;
  color: rgba(240,248,255,0.92); font-size: 16px; line-height: 1.75;
}
.vn-next-preview {
  padding: 16px 18px; background: rgba(212,235,245,0.06); border-radius: 10px;
  font-size: 15px; color: rgba(212,235,245,0.8); line-height: 1.75;
}

/* Auto-save indicator */
.saved-tick {
  position: fixed; bottom: 24px; right: 24px; z-index: 9500;
  background: rgba(39,174,96,0.92); color: #fff;
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  pointer-events: none; opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}
.saved-tick.show { opacity: 1; transform: translateY(0); }

/* Mobile tweaks for panel */
@media (max-width: 600px) {
  .vn-panel-card { padding: 22px 20px 32px; }
  .vn-dialogue-text { font-size: 17px; }
  .vn-question-body, .vn-reveal-content, .vn-choice-btn { font-size: 15px; }
}

/* ══════════════════════════════════════════════════════════
   SURVEY SCREEN
══════════════════════════════════════════════════════════ */
#surveyScreen {
  flex-direction: column; overflow-y: auto;
  background: linear-gradient(160deg, #0D1B2A 0%, #122338 100%);
  align-items: center;
}
.survey-wrap { width: 100%; max-width: 600px; padding: 32px 24px 60px; display: flex; flex-direction: column; gap: 24px; }
.survey-header { text-align: center; }
.survey-header h2 { font-size: 22px; color: #D4EBF5; margin-bottom: 8px; }
.survey-header p, #surveyIntro p { font-size: 14px; color: rgba(212,235,245,0.7); line-height: 1.6; }
#surveyForm { display: flex; flex-direction: column; gap: 20px; }
.survey-question { padding: 18px; background: rgba(255,255,255,0.04); border: 1px solid rgba(212,235,245,0.1); border-radius: 12px; }
.survey-question legend { font-size: 14px; color: #D4EBF5; font-weight: 600; line-height: 1.5; margin-bottom: 12px; }
.survey-question label.field-label { font-size: 14px; color: #D4EBF5; font-weight: 600; display: block; margin-bottom: 10px; }
.scale-group { display: flex; gap: 8px; justify-content: center; }
.scale-option { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
.scale-option input { width: 20px; height: 20px; cursor: pointer; accent-color: #E8705A; }
.scale-option span { font-size: 13px; color: rgba(212,235,245,0.8); }
.scale-labels { display: flex; justify-content: space-between; font-size: 11px; color: rgba(212,235,245,0.5); margin-top: 6px; }
.choice-group { display: flex; flex-direction: column; gap: 8px; }
.choice-option { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: rgba(255,255,255,0.04); border-radius: 7px; cursor: pointer; }
.choice-option input { accent-color: #E8705A; cursor: pointer; width: 16px; height: 16px; }
.choice-option span { font-size: 13px; color: rgba(212,235,245,0.85); }
.survey-question textarea { width: 100%; font-family: inherit; }
.survey-actions { display: flex; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   WORKSHEET SCREEN
══════════════════════════════════════════════════════════ */
#worksheetScreen { flex-direction: column; overflow-y: auto; background: #f5f5f5; }
.ws-wrap { display: flex; flex-direction: column; }
.ws-toolbar { display: flex; gap: 12px; padding: 16px 24px; background: #1B3A5C; }
.ws-toolbar .primary-btn { background: #E8705A; }
.ws-toolbar .ghost-sm-btn { border-color: rgba(212,235,245,0.4); }
.ws-doc { max-width: 800px; margin: 0 auto; padding: 40px; background: #fff; min-height: 100vh; color: #1a1a2e; }
.ws-title-block { text-align: center; padding-bottom: 20px; border-bottom: 2px solid #1B3A5C; margin-bottom: 20px; }
.ws-title-block h1 { font-size: 22px; color: #1B3A5C; }
.ws-title-block p { font-size: 13px; color: #666; margin-top: 4px; }
.ws-info-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; font-size: 13px; }
.ws-info-table td { padding: 7px 12px; border: 1px solid #ddd; }
.ws-info-table td:first-child, .ws-info-table td:nth-child(3) { background: #f0f4f8; font-weight: 600; color: #1B3A5C; width: 20%; }
.ws-chapter { margin-bottom: 24px; }
.ws-chapter h3 { font-size: 15px; color: #1B3A5C; padding: 8px 12px; background: #f0f4f8; border-left: 4px solid #1B3A5C; margin-bottom: 10px; }
.ws-qa-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  table-layout: fixed;
}
.ws-qa-table th:first-child, .ws-qa-table td:first-child { width: 42%; }
.ws-qa-table th:nth-child(2), .ws-qa-table td:nth-child(2),
.ws-qa-table th:nth-child(3), .ws-qa-table td:nth-child(3) { width: 29%; }
.ws-qa-table th { background: #1B3A5C; color: #fff; padding: 10px 12px; text-align: left; }
.ws-qa-table td {
  padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: top;
  word-break: break-word; overflow-wrap: break-word; white-space: pre-line;
  line-height: 1.6;
}
.ws-qa-table tr:nth-child(even) td { background: #f9f9f9; }
.ws-survey-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid #ddd; }
.ws-survey-section h3 { font-size: 15px; color: #1B3A5C; margin-bottom: 10px; }
.ws-survey-section p { font-size: 13px; color: #444; line-height: 1.6; }
.ws-footer { margin-top: 32px; font-size: 11px; color: #999; text-align: center; padding-top: 12px; border-top: 1px solid #eee; }

/* ── Print ─────────────────────────────────────────────── */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff !important; }

  /* 隱藏所有非學習單元素 */
  .no-print, .status-message, .confetti-layer, .saved-tick { display: none !important; }

  /* 覆蓋 .screen { position: fixed; inset: 0 } */
  .screen {
    display: none !important;
    position: static !important;
    inset: auto !important;
    overflow: visible !important;
  }

  /* 只顯示學習單 */
  #worksheetScreen {
    display: block !important;
    position: static !important;
    inset: auto !important;
    overflow: visible !important;
    height: auto !important;
    background: #fff !important;
  }
  .ws-wrap { overflow: visible !important; height: auto !important; }
  .ws-doc {
    max-width: 100% !important;
    padding: 16px 20px !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    color: #000 !important;
  }

  /* 表格欄寬：問題 42% ／ 學習前想法 29% ／ 學習後反思 29% */
  .ws-qa-table {
    table-layout: fixed;
    width: 100%;
    font-size: 11px;
  }
  .ws-qa-table th:first-child,
  .ws-qa-table td:first-child { width: 42%; }
  .ws-qa-table th:nth-child(2),
  .ws-qa-table td:nth-child(2),
  .ws-qa-table th:nth-child(3),
  .ws-qa-table td:nth-child(3) { width: 29%; }

  .ws-qa-table td {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-line;
    vertical-align: top;
    padding: 7px 10px;
  }

  /* 跨頁斷行控制 */
  .ws-chapter { page-break-inside: avoid; margin-bottom: 18px; }
  .ws-qa-table tr { page-break-inside: avoid; }
  .ws-survey-section { page-break-before: auto; }
  .ws-footer { margin-top: 12px; }
}

/* ── Ripple ────────────────────────────────────────────── */
button { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.25); pointer-events: none;
  transform: scale(0); animation: rippleAnim 0.45s linear;
}
@keyframes rippleAnim { to { transform: scale(3); opacity: 0; } }

/* ── Mobile tweaks ─────────────────────────────────────── */
@media (max-width: 480px) {
  .vn-char-emoji { font-size: 64px; }
  .vn-stage { padding-bottom: 140px; }
  .vn-textbox { min-height: 100px; padding: 10px 16px 20px; }
  .vn-dialogue-text { font-size: 15px; }
  .login-card { padding: 28px 20px; }
  .vn-panel-card { padding: 18px 16px 28px; }
}
