/* Story Quest — The Ink Goblin's Trail */

.wq-home, .wq-screen { max-width: 640px; margin: 0 auto; padding-bottom: 32px; }

/* ---- Chapter list ---- */
.wq-chapter-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.wq-chapter-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--color-surface, #fff);
  border: 2px solid var(--wq-color, #888);
  border-radius: 16px; padding: 14px 16px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative; overflow: hidden;
}
.wq-chapter-card::before {
  content: ""; position: absolute; inset: 0;
  background: var(--wq-color); opacity: 0.07; pointer-events: none;
}
.wq-chapter-card:active { transform: scale(0.98); }
.wq-chapter-card.locked { opacity: 0.55; cursor: default; border-style: dashed; }
.wq-chapter-card.done { border-color: #22c55e; }
.wq-ch-icon { font-size: 34px; flex-shrink: 0; }
.wq-ch-info { flex: 1; min-width: 0; }
.wq-ch-kicker { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wq-color); }
.wq-ch-info h3 { margin: 2px 0; font-size: 16px; }
.wq-ch-info p { margin: 0; font-size: 12px; color: var(--color-text-muted, #777); }
.wq-ch-status { font-size: 20px; }

/* ---- Journal ---- */
.wq-journal-title { margin: 24px 0 10px; font-family: var(--font-display); }
.wq-journal { display: flex; flex-direction: column; gap: 10px; }
.wq-journal-page {
  background: #fdf6e3; border: 1px solid #e8d9ae; border-radius: 12px;
  padding: 12px 14px; color: #5b4a21; font-size: 13px; line-height: 1.55;
  box-shadow: 0 2px 6px rgba(120, 90, 20, 0.12);
}
.wq-journal-page.big { font-size: 15px; text-align: left; margin: 14px 0; }
.wq-journal-page p { margin: 4px 0 0; font-style: italic; }
.wq-journal-num { font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #b08a2e; }

/* ---- Story dialogue ---- */
.wq-story-card {
  background: var(--color-surface, #fff); border-radius: 18px; overflow: hidden;
  border: 2px solid var(--wq-color); margin-top: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}
.wq-story-scene { position: relative; width: 100%; aspect-ratio: 4 / 2.4; }
.wq-story-scene .wq-scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wq-narration {
  padding: 16px 18px; font-size: 15px; line-height: 1.6; font-style: italic;
  color: var(--color-text, #333);
}
.wq-dialogue { display: flex; gap: 12px; padding: 14px 16px; align-items: flex-start; }
.wq-speaker-avatar {
  font-size: 34px; flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%;
  background: color-mix(in srgb, var(--wq-color) 18%, transparent);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--wq-color);
}
.wq-speech { flex: 1; }
.wq-speaker-name { font-size: 12px; font-weight: 800; color: var(--wq-color); margin-bottom: 2px; }
.wq-speech p { margin: 0; font-size: 15px; line-height: 1.55; }
.wq-story-dots { display: flex; gap: 6px; justify-content: center; padding: 4px 0 2px; }
.wq-dot { width: 7px; height: 7px; border-radius: 50%; background: #d0d0d8; }
.wq-dot.on { background: var(--wq-color); }

/* ---- Buttons ---- */
.wq-btn {
  display: block; width: calc(100% - 32px); margin: 12px 16px 16px;
  padding: 13px 18px; border-radius: 14px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 800; font-family: inherit;
  background: #ececf2; color: #444;
}
.wq-btn.primary { background: var(--wq-color, #6b4fd8); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,0.18); }
.wq-btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.18); }

/* ---- Hunt ---- */
.wq-satchel {
  display: flex; align-items: center; gap: 8px; margin: 10px 0;
  font-size: 20px;
}
.wq-satchel-slot {
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 20px;
  background: var(--color-surface, #fff); border: 2px dashed #c5c5d2; opacity: 0.7;
}
.wq-satchel-slot.got { border-style: solid; border-color: #22c55e; opacity: 1; background: #eafcf0; animation: wq-pop .4s ease; }
@keyframes wq-pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

.wq-clue-card {
  background: var(--color-surface, #fff); border: 2px solid var(--wq-color);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
}
.wq-clue-label { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wq-color); }
.wq-clue-text { margin: 6px 0 4px; font-size: 15px; line-height: 1.5; font-style: italic; }
.wq-clue-hint { font-size: 11px; color: var(--color-text-muted, #888); }

.wq-scene {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  border-radius: 16px; overflow: hidden; border: 2px solid rgba(0,0,0,0.15);
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
.wq-scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wq-obj {
  position: absolute; transform: translate(-50%, -50%);
  background: none; border: none; cursor: pointer; padding: 6px;
  line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.35));
  transition: transform .12s ease;
}
.wq-obj:active { transform: translate(-50%, -50%) scale(1.25); }
.wq-decoy-msg {
  margin-top: 10px; padding: 10px 14px; border-radius: 12px;
  background: #fff8e1; border: 1px solid #f0d98c; color: #7a5c12;
  font-size: 13.5px; line-height: 1.45; animation: wq-fade-in .25s ease;
}
@keyframes wq-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Question card ---- */
.wq-question-card {
  background: var(--color-surface, #fff); border: 2px solid var(--wq-color);
  border-radius: 16px; padding: 16px; margin-top: 12px;
}
.wq-q-kicker { font-size: 12px; font-weight: 800; color: var(--wq-color); margin-bottom: 8px; }
.wq-q-text { font-size: 16px; line-height: 1.5; margin: 0 0 12px; font-weight: 600; }
.wq-options { display: flex; flex-direction: column; gap: 8px; }
.wq-option-btn {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 2px solid #d8d8e2; background: var(--color-surface, #fff);
  font-size: 14.5px; font-family: inherit; line-height: 1.35;
}
.wq-option-btn:not([disabled]):active { border-color: var(--wq-color); transform: scale(0.99); }
.wq-option-btn.correct { border-color: #22c55e; background: #eafcf0; font-weight: 700; }
.wq-option-btn.wrong { border-color: #ef4444; background: #fdeeee; }
.wq-opt-letter {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--wq-color) 15%, transparent);
  color: var(--wq-color); font-weight: 800; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.wq-feedback { margin-top: 12px; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.wq-feedback.good { background: #eafcf0; border: 1px solid #9be0b3; color: #14682f; animation: wq-pop .35s ease; }
.wq-feedback.bad { background: #fff4f4; border: 1px solid #f2b8b8; color: #8a2323; }

/* ---- Showdown lanterns ---- */
.wq-lanterns { display: flex; gap: 16px; justify-content: center; margin: 14px 0 4px; }
.wq-lantern { font-size: 40px; filter: grayscale(1) brightness(0.6); transition: filter .4s ease; }
.wq-lantern.lit { filter: none; animation: wq-glow 1.6s ease infinite alternate; }
@keyframes wq-glow {
  from { filter: drop-shadow(0 0 4px #ffb347); }
  to   { filter: drop-shadow(0 0 14px #ffd97a); }
}
.wq-showdown-note { text-align: center; font-size: 13px; color: var(--color-text-muted, #888); margin: 0 0 4px; }

/* ---- Page reveal ---- */
.wq-page-reveal {
  text-align: center; padding: 40px 18px 20px;
}
.wq-page-glow { font-size: 64px; animation: wq-glow 1.6s ease infinite alternate; }
.wq-page-reveal h2 { font-family: var(--font-display); margin: 10px 0 4px; }
.wq-reward-line { font-weight: 800; color: #d97706; margin: 8px 0; }
.wq-next-tease { color: var(--color-text-muted, #888); font-style: italic; font-size: 14px; }
.wq-finale-banner {
  background: linear-gradient(135deg, #fff7d6, #ffe9b3); border: 2px solid #f0c96a;
  border-radius: 14px; padding: 14px; margin: 12px 0; font-weight: 700; color: #7a5312;
  font-size: 14.5px; line-height: 1.5;
}

/* ---- Word Adventure home banner ---- */
.wq-banner {
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  background: linear-gradient(135deg, #3b2a68, #6b4fd8);
  border-radius: 16px; padding: 14px 16px; margin: 12px 0;
  color: #fff; box-shadow: 0 6px 16px rgba(80, 60, 180, 0.35);
  position: relative; overflow: hidden;
}
.wq-banner::after {
  content: "📄"; position: absolute; right: -6px; top: -10px;
  font-size: 64px; opacity: 0.12; transform: rotate(18deg);
}
.wq-banner:active { transform: scale(0.985); }
.wq-banner-icon { font-size: 36px; flex-shrink: 0; }
.wq-banner-info { flex: 1; min-width: 0; }
.wq-banner-info h3 { margin: 0 0 2px; font-size: 16px; }
.wq-banner-info p { margin: 0; font-size: 12px; opacity: 0.85; line-height: 1.4; }
.wq-banner-badge {
  background: #ffd447; color: #6b4b00; font-size: 11px; font-weight: 800;
  padding: 4px 10px; border-radius: 999px; flex-shrink: 0;
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
  .wq-journal-page { background: #2a2415; border-color: #57491f; color: #e8d9ae; }
  .wq-journal-num { color: #d4af4a; }
  .wq-decoy-msg { background: #2c2610; border-color: #5c4d1a; color: #ecd58a; }
  .wq-option-btn { border-color: #3a3a48; }
  .wq-option-btn.correct { background: #10321c; color: #a7e8bd; }
  .wq-option-btn.wrong { background: #38191b; color: #f3b6b6; }
  .wq-feedback.good { background: #10321c; border-color: #1e6b38; color: #a7e8bd; }
  .wq-feedback.bad { background: #38191b; border-color: #7a3030; color: #f3b6b6; }
  .wq-satchel-slot { border-color: #4a4a58; }
  .wq-satchel-slot.got { background: #10321c; }
  .wq-finale-banner { background: linear-gradient(135deg, #3a2f10, #4a3a12); border-color: #8a6d24; color: #ffd97a; }
}

/* Pet artwork (getPetEmoji can return an <img>) must stay inline-sized */
.wq-pet-inline img { height: 1.6em; width: auto; vertical-align: -0.4em; }
.wq-speaker-avatar img { width: 85%; height: 85%; object-fit: contain; }

/* ======== Pixel-art skin (quest/ sprites; -px files render crisp) ======== */
.wq-screen img[src*="-px."] { image-rendering: pixelated; }
.wq-scene-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.wq-obj .wq-obj-img { width: 1.6em; height: 1.6em; object-fit: contain; display: block; pointer-events: none; }
.wq-satchel-img { width: 1.3em; height: 1.3em; object-fit: contain; vertical-align: -0.25em; }
.wq-speaker-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; }
.wq-ui-img { width: 1.5em; height: 1.5em; object-fit: contain; vertical-align: -0.35em; }
.wq-page-img { width: 84px; height: 84px; object-fit: contain; }
.wq-lantern-img { width: 44px; height: 52px; object-fit: contain; }
.wq-lantern:not(.lit) .wq-lantern-img { filter: grayscale(0.7) brightness(0.8); }
