/* Malggu Daily — Quest Deck (floating card session) */

:root {
  --qd-card-bg: rgba(16, 13, 24, 0.92);
  --qd-card-radius: 20px;
  --qd-shadow: 0 32px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--line);
  --qd-ease-deal: cubic-bezier(0.22, 1, 0.36, 1);
  --qd-xp: var(--coral, #ff8a68);
  --qd-ok: #34d399;
}

body.qd-active .hero-scene,
body.qd-active .hero-meta {
  display: none;
}

body.qd-active {
  overflow: hidden;
  height: 100dvh;
}

body.qd-active .page-wrapper {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.qd-active .shell {
  padding: 0;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

body.qd-active #malggu-footer,
body.qd-active #malggu-footer .malggu-footer,
body.qd-active .malggu-footer,
body.qd-active .malggu-teacher-strip {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

body.qd-active #app {
  position: fixed;
  inset: 0;
  z-index: 45;
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.qd-active #space-canvas {
  opacity: 0.25;
}

body.qd-active .atmosphere {
  opacity: 0.5;
}

/* Landing: keep footer below first screen */
body.page-portal:not(.qd-active) .shell {
  min-height: calc(100dvh - var(--nav-h, 60px) - 32px);
}

.qd-stage {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: stretch;
  overflow: hidden;
}

.qd-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #06050a;
  background-image:
    radial-gradient(ellipse 90% 55% at 50% 8%, rgba(255, 138, 104, 0.09), transparent 52%),
    radial-gradient(ellipse 70% 50% at 12% 88%, rgba(72, 56, 120, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 45% at 88% 72%, rgba(40, 72, 110, 0.1), transparent 50%),
    linear-gradient(180deg, #14101f 0%, #09070f 48%, #040308 100%);
  background-size: cover;
  background-position: center;
  filter: saturate(0.88) brightness(0.82);
}

.qd-scene.place-school {
  box-shadow: inset 0 -30vh 80px rgba(90, 58, 38, 0.12);
}
.qd-scene.place-cafe {
  box-shadow: inset 0 -30vh 80px rgba(110, 78, 48, 0.14);
}
.qd-scene.place-market {
  box-shadow: inset 0 -30vh 80px rgba(120, 68, 32, 0.14);
}
.qd-scene.place-park {
  box-shadow: inset 0 -30vh 80px rgba(40, 88, 58, 0.12);
}
.qd-scene.place-station {
  box-shadow: inset 0 -30vh 80px rgba(48, 68, 98, 0.14);
}
.qd-scene.place-library {
  box-shadow: inset 0 -30vh 80px rgba(96, 72, 44, 0.12);
}
.qd-scene.place-home {
  box-shadow: inset 0 -30vh 80px rgba(100, 56, 44, 0.12);
}

.qd-scene__label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 700;
  color: rgba(255, 248, 244, 0.06);
  pointer-events: none;
  white-space: nowrap;
}

.qd-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 14px 8px;
}

.qd-rail {
  flex: 1;
  display: flex;
  gap: 4px;
  align-items: center;
}

.qd-rail__seg {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.qd-rail__seg.on {
  box-shadow: 0 0 0 1px rgba(255, 138, 104, 0.35);
}

.qd-rail__seg.done .qd-rail__fill {
  background: rgba(255, 138, 104, 0.55);
}

.qd-rail__seg.on .qd-rail__fill {
  background: var(--qd-xp);
}

.qd-rail__seg.locked::after {
  content: "🔒";
  position: absolute;
  right: -2px;
  top: -10px;
  font-size: 0.55rem;
  opacity: 0.7;
}

.qd-rail__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.15);
  transition: width 0.35s var(--qd-ease-deal);
}

.qd-rail__label {
  font-size: 0.72rem;
  color: rgba(255, 248, 244, 0.72);
  white-space: nowrap;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qd-xp-chip {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--qd-xp);
  border: 1px solid rgba(255, 138, 104, 0.35);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 138, 104, 0.08);
}

.qd-xp-chip.bump {
  animation: qd-xp-bump 0.28s ease;
}

.qd-xp-chip--catch {
  box-shadow:
    0 0 0 2px rgba(255, 138, 104, 0.45),
    0 0 18px rgba(255, 138, 104, 0.35);
}

.qd-xp-chip--pulse-ring {
  animation: qd-xp-ring 0.42s ease-out;
}

@keyframes qd-xp-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 104, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(255, 138, 104, 0); }
}

.qd-xp-orb {
  position: fixed;
  z-index: 67;
  margin: -10px 0 0 -10px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(255, 138, 104, 0.85));
  will-change: transform, opacity;
}

.qd-xp-orb.is-flying {
  animation: qd-xp-fly 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.qd-xp-orb--combo {
  filter: drop-shadow(0 0 12px rgba(255, 196, 140, 0.9));
}

.qd-xp-orb--soft {
  filter: drop-shadow(0 0 8px rgba(163, 155, 179, 0.55));
  opacity: 0.85;
}

@keyframes qd-xp-fly {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.35);
  }
  14% {
    opacity: 1;
    transform: translate(0, 0) scale(1.15);
  }
  42% {
    opacity: 1;
    transform: translate(var(--qd-mid-x), var(--qd-mid-y)) scale(0.9);
  }
  100% {
    opacity: 0.15;
    transform: translate(var(--qd-fly-x), var(--qd-fly-y)) scale(0.3);
  }
}

@keyframes qd-xp-bump {
  50% { transform: scale(1.12); }
}

.qd-deck {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 14px max(20px, env(safe-area-inset-bottom));
  min-height: 0;
  overflow-y: auto;
}

.qd-hangul-dock {
  width: min(560px, calc(100vw - 28px));
  margin-top: 10px;
  flex-shrink: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.qd-hangul-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.qd-hangul-dock__toggle {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
}

.qd-hangul-dock__toggle:hover {
  border-color: rgba(255, 138, 104, 0.4);
  color: var(--ink);
}

.qd-hangul-dock.is-collapsed .qd-hangul-dock__body {
  display: none;
}

.qd-hangul-dock__body {
  padding: 0 8px 8px;
}

.qd-hangul-dock__hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.qd-hangul-dock__hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.68rem;
  font-family: inherit;
}

.ko-kbd {
  padding: 10px 8px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.32);
  user-select: none;
}

.ko-kbd-row {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 5px;
}

.ko-kbd-key {
  flex: 1 1 0;
  min-width: 0;
  max-width: 44px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: #f4efe8;
  font: inherit;
  cursor: pointer;
  padding: 2px 1px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.ko-kbd-key:active,
.ko-kbd-key.is-lit {
  background: rgba(255, 138, 104, 0.34);
  border-color: rgba(255, 138, 104, 0.62);
  box-shadow: 0 0 0 2px rgba(255, 138, 104, 0.28);
}

.ko-kbd-main {
  font-weight: 800;
  font-size: 0.92rem;
  color: #f4efe8;
}

.ko-kbd-sub {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  margin-top: 1px;
  min-height: 0.72rem;
}

.ko-kbd-en {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8a7f76;
  text-transform: uppercase;
}

.ko-kbd-shift-hint {
  font-size: 0.58rem;
  font-weight: 800;
  color: #c9a84c;
}

.ko-kbd-key.is-shifted .ko-kbd-main {
  color: #ffb89a;
}

.ko-kbd-key.is-shifted .ko-kbd-shift-hint {
  color: #8a7f76;
}

.ko-kbd-mod {
  max-width: 52px;
  color: #ffb89a;
  font-size: 0.85rem;
  font-weight: 800;
}

.ko-kbd-mod.on {
  background: rgba(255, 138, 104, 0.25);
  border-color: rgba(255, 138, 104, 0.45);
}

.ko-kbd-space {
  max-width: none;
  flex: 3;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.ko-kbd-done {
  max-width: 72px;
  flex: 1.4;
  background: rgba(255, 138, 104, 0.22);
  border-color: rgba(255, 138, 104, 0.4);
  color: #ffb89a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ko-kbd-punct .ko-kbd-main {
  font-size: 1rem;
}

@media (max-width: 480px) {
  .ko-kbd-key {
    height: 42px;
    max-width: 36px;
  }

  .ko-kbd-main {
    font-size: 0.82rem;
  }
}

.qd-under {
  position: absolute;
  width: min(560px, calc(100vw - 28px));
  min-height: 120px;
  border-radius: var(--qd-card-radius);
  background: rgba(16, 13, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--qd-shadow);
  pointer-events: none;
}

.qd-under--1 {
  transform: translateY(10px) scale(0.96);
  opacity: 0.35;
}

.qd-under--2 {
  transform: translateY(20px) scale(0.92);
  opacity: 0.18;
}

.qd-card {
  position: relative;
  width: min(560px, calc(100vw - 28px));
  min-height: min(400px, 52dvh);
  max-height: min(76dvh, 680px);
  display: flex;
  flex-direction: column;
  border-radius: var(--qd-card-radius);
  background: var(--qd-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--qd-shadow);
  overflow: hidden;
}

.qd-card.dealing-out {
  animation: qd-deal-out 0.19s ease-in forwards;
}

.qd-card.dealing-in {
  animation: qd-deal-in 0.3s var(--qd-ease-deal) forwards;
}

.qd-card.qd-glow-pulse {
  animation: qd-glow 0.28s ease;
}

.qd-card.qd-shake {
  animation: qd-shake 0.16s ease;
}

@keyframes qd-deal-out {
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.97) rotate(-1deg);
  }
}

@keyframes qd-deal-in {
  from {
    opacity: 0.5;
    transform: translateY(12px) scale(0.955);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes qd-glow {
  50% { box-shadow: 0 0 0 2px rgba(255, 138, 104, 0.55), var(--qd-shadow); }
}

@keyframes qd-shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.qd-card__eyebrow {
  padding: 16px 20px 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qd-xp);
}

.qd-card__title {
  padding: 6px 20px 0;
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.qd-card__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
  min-height: 0;
}

.qd-card__body .scene-shell {
  margin: -4px -8px 0;
  border-radius: 14px;
}

.qd-card__body .scene-shell__banner {
  min-height: 100px;
}

.qd-card__cta {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.qd-card__cta .row-btns {
  margin-top: 0;
}

.qd-card__cta .cta-btn {
  width: 100%;
  justify-content: center;
  min-height: 48px;
}

.qd-card--gate {
  border-color: rgba(255, 138, 104, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 138, 104, 0.25), var(--qd-shadow);
}

.qd-flash-en {
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255, 248, 244, 0.88);
}

.qd-flash-ko {
  margin-top: 14px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.35;
}

.qd-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  margin: 20px auto;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  font-size: 1.75rem;
  color: #1a0f0c;
  background: linear-gradient(135deg, #ff8a68, #ff6b4a);
  box-shadow: 0 12px 32px rgba(255, 138, 104, 0.35);
}

.qd-play-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qd-mission {
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255, 248, 244, 0.9);
  margin: 0 0 10px;
}

/* Click-anchored game float (XP / Nice / combo copy) */
.qd-float-win {
  position: fixed;
  z-index: 66;
  pointer-events: none;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55);
  will-change: transform, opacity;
}

.qd-float-win::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 104, 0.22) 0%, transparent 68%);
  opacity: 0;
}

.qd-float-win.is-on {
  animation: qd-float-pop 1.05s var(--qd-ease-deal) forwards;
}

.qd-float-win.is-on::before {
  animation: qd-float-burst 0.55s ease-out forwards;
}

.qd-float-win.is-out {
  animation: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.qd-float-win__xp {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 9vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #ffb89a;
  text-shadow:
    0 0 24px rgba(255, 138, 104, 0.55),
    0 4px 18px rgba(0, 0, 0, 0.45);
}

.qd-float-win__line {
  display: block;
  margin-top: 8px;
  font-size: clamp(0.92rem, 3.6vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 248, 244, 0.92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.qd-float-win__line--solo {
  margin-top: 0;
  font-size: clamp(1rem, 4vw, 1.15rem);
}

.qd-float-win--combo .qd-float-win__xp {
  color: #ffe0c8;
  text-shadow:
    0 0 28px rgba(255, 180, 120, 0.65),
    0 4px 20px rgba(0, 0, 0, 0.45);
}

.qd-float-win--soft .qd-float-win__line,
.qd-float-win--soft .qd-float-win__line--solo {
  color: rgba(255, 248, 244, 0.72);
}

.qd-float-win--info .qd-float-win__line--solo {
  color: rgba(255, 248, 244, 0.82);
  font-weight: 600;
}

@keyframes qd-float-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.14);
  }
  28% {
    transform: translate(-50%, -50%) scale(1);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.94);
  }
}

@keyframes qd-float-burst {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

.qd-evidence {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.qd-evidence .diff-before {
  display: block;
  text-decoration: line-through;
  opacity: 0.55;
  margin-bottom: 6px;
}

.qd-stamp {
  text-align: center;
  margin: 16px 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--qd-xp);
  letter-spacing: 0.04em;
}

.qd-card .chip {
  min-height: 44px;
  padding: 10px 14px;
}

.qd-card .gist-opt {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.qd-card .srs-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.qd-card .srs-btns .cta-btn {
  min-height: 44px;
}

.qd-card .cta-btn:active:not(:disabled),
.qd-card .chip:active,
.qd-card .gist-opt:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .qd-card .cta-btn:hover:not(:disabled) {
    transform: translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .qd-card.dealing-out,
  .qd-card.dealing-in,
  .qd-card.qd-glow-pulse,
  .qd-card.qd-shake,
  .qd-xp-chip.bump,
  .qd-xp-chip--pulse-ring,
  .qd-xp-orb.is-flying,
  .qd-float-win.is-on,
  .qd-float-win.is-on::before {
    animation: none !important;
  }
  .qd-xp-orb.is-flying {
    opacity: 1;
    transform: translate(var(--qd-fly-x), var(--qd-fly-y)) scale(0.5);
  }
  .qd-float-win.is-on {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  .qd-rail__fill {
    transition: none;
  }
}

@media (max-width: 640px) {
  .qd-rail__label {
    display: none;
  }
}

/* ── Phase 2: landing, stamps, session chrome ── */

.qd-landing {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}

.qd-landing__hero-card {
  text-align: left;
}

.qd-landing__eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--qd-xp);
}

.qd-landing__title {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.qd-landing__streak {
  margin: 10px 0 0;
  font-weight: 700;
  color: var(--qd-xp);
}

.qd-landing__start {
  width: 100%;
  margin-top: 16px;
  min-height: 52px;
  justify-content: center;
}

.qd-stamp-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.qd-stamp-strip--empty {
  padding: 8px 4px;
  font-size: 0.88rem;
}

.qd-stamp-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 248, 244, 0.45);
  background: rgba(255, 255, 255, 0.03);
}

.qd-stamp-chip.today {
  border-style: solid;
  border-color: rgba(255, 138, 104, 0.45);
  color: rgba(255, 248, 244, 0.85);
}

.qd-stamp-chip.cleared {
  border-style: solid;
  border-color: rgba(255, 138, 104, 0.55);
  color: var(--qd-xp);
  background: rgba(255, 138, 104, 0.12);
}

.qd-landing__settings {
  margin-top: 4px;
}

.qd-landing__settings-title {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.qd-scene--bright {
  filter: saturate(0.92) brightness(0.94);
  transition: filter 0.8s ease;
}

.qd-scene.qd-scene--bright .qd-scene__label {
  color: rgba(255, 248, 244, 0.08);
}

.qd-home-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 248, 244, 0.72);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.qd-home-btn:hover {
  color: #fff8f4;
  border-color: rgba(255, 138, 104, 0.35);
}

.qd-rail__seg button,
button.qd-rail__seg {
  appearance: none;
  padding: 0;
  border: 0;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

.qd-rail__seg:not(.done) {
  cursor: default;
}

.qd-mission-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.qd-mission-dot {
  font-size: 0.65rem;
  color: rgba(255, 248, 244, 0.25);
}

.qd-mission-dot.on {
  color: var(--qd-xp);
}

.qd-mission-dot.done {
  color: rgba(255, 138, 104, 0.55);
}

.qd-card--keyboard {
  max-height: 52dvh !important;
}

.qd-stamp.stamped {
  animation: qd-stamp-pop 0.45s var(--qd-ease-deal);
}

@keyframes qd-stamp-pop {
  0% { transform: scale(0.85); opacity: 0.5; }
  55% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

body.qd-active #malggu-nav {
  position: relative;
  z-index: 46;
  background: rgba(8, 10, 18, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.qd-active .malggu-floating-coach,
body.qd-active #malggu-floating-coach {
  z-index: 46;
}

@media (prefers-reduced-motion: reduce) {
  .qd-scene--bright {
    transition: none;
  }
  .qd-stamp.stamped {
    animation: none;
  }
  .qd-wave.is-playing span {
    animation: none;
  }
}

/* ── Phase 3: gloss, write stack, dict focus, wave ── */

.qd-scene-mini-banner {
  display: flex;
  align-items: flex-end;
  min-height: 88px;
  padding: 12px 14px;
  margin: -4px -4px 12px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 248, 244, 0.88);
  box-shadow: inset 0 -40px 48px rgba(0, 0, 0, 0.55);
}

.qd-gloss-line {
  line-height: 1.85;
}

.qd-word-chip {
  display: inline;
  border: 0;
  background: rgba(255, 138, 104, 0.1);
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 2px 6px;
  margin: 0 2px;
  border-radius: 8px;
  cursor: pointer;
  vertical-align: baseline;
}

.qd-word-chip:hover,
.qd-word-chip:focus-visible {
  background: rgba(255, 138, 104, 0.22);
  outline: 2px solid rgba(255, 138, 104, 0.45);
  outline-offset: 1px;
}

.qd-gloss-hint {
  font-size: 0.82rem;
  margin-top: 10px;
}

.qd-en-blur-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.qd-en-blur {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
}

.qd-en-blur__text {
  display: block;
  font-size: 0.88rem;
  line-height: 1.45;
  transition: filter 0.28s ease, opacity 0.28s ease, color 0.28s ease;
}

.qd-en-blur:not(.is-revealed) .qd-en-blur__text {
  filter: blur(7px);
  opacity: 0.5;
  user-select: none;
}

.qd-en-blur.is-revealed {
  cursor: default;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.qd-en-blur.is-revealed .qd-en-blur__text {
  filter: none;
  opacity: 1;
  color: rgba(255, 248, 244, 0.84);
}

.qd-en-blur__hint {
  display: block;
  margin-top: 5px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 138, 104, 0.78);
}

.scene-line .qd-en-line {
  margin-top: 8px;
}

.qd-gloss-pop {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 138, 104, 0.35);
  background: rgba(255, 138, 104, 0.08);
}

.qd-gloss-pop strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.qd-gloss-pop span {
  color: var(--muted);
  font-size: 0.9rem;
}

.qd-wave {
  display: flex;
  justify-content: center;
  gap: 5px;
  height: 16px;
  margin: 8px auto 0;
  opacity: 0.35;
}

.qd-wave span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--qd-xp);
}

.qd-wave.is-playing span {
  animation: qd-wave-dot 0.9s ease-in-out infinite;
}

.qd-wave.is-playing span:nth-child(2) { animation-delay: 0.12s; }
.qd-wave.is-playing span:nth-child(3) { animation-delay: 0.24s; }
.qd-wave.is-playing span:nth-child(4) { animation-delay: 0.36s; }
.qd-wave.is-playing span:nth-child(5) { animation-delay: 0.48s; }

@keyframes qd-wave-dot {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-6px); opacity: 1; }
}

.dict-blank.dict-focus {
  outline: 2px solid rgba(255, 138, 104, 0.55);
  outline-offset: 2px;
}

.qd-xray-hint {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 248, 244, 0.82);
  font-size: 0.88rem;
}

.qd-write-progress {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.qd-write-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.qd-write-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--qd-xp);
  transition: width 0.35s var(--qd-ease-deal);
}

.produce-row--active textarea {
  min-height: 88px;
}

.produce-row--active .intent {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.qd-write-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.qd-write-done {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.qd-write-check {
  color: var(--qd-ok);
  font-weight: 700;
  flex-shrink: 0;
}

.qd-write-hints {
  margin: 10px 0 12px;
}

.qd-write-hints__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.qd-write-hint-btn {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.86rem;
}

.qd-write-hints__meta {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.qd-write-hint-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.qd-write-hint {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 138, 104, 0.28);
  background: rgba(255, 138, 104, 0.06);
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(255, 248, 244, 0.9);
}

.qd-write-hint__tag {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--qd-xp);
}

.qd-float-win--soft .qd-float-win__xp {
  color: rgba(255, 200, 180, 0.92);
}

.qd-evidence-after {
  color: var(--qd-xp);
}

/* ── Phase 4: coachmark, blocked chips, share ── */

.qd-word-chip--blocked {
  background: rgba(255, 138, 104, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 138, 104, 0.55);
}

.qd-gloss-pop__block {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.qd-coachmark-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 3, 8, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.qd-coachmark {
  width: min(400px, calc(100vw - 32px));
  padding: 22px 20px;
  border-radius: var(--qd-card-radius);
  border: 1px solid rgba(255, 138, 104, 0.35);
  background: var(--qd-card-bg);
  box-shadow: var(--qd-shadow);
}

.qd-coachmark__eyebrow {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qd-xp);
}

.qd-coachmark__title {
  margin: 0 0 12px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.qd-coachmark__list {
  margin: 0 0 16px;
  padding-left: 18px;
  color: rgba(255, 248, 244, 0.82);
  font-size: 0.92rem;
  line-height: 1.55;
}

.qd-coachmark__list li {
  margin-bottom: 6px;
}

.qd-coachmark .cta-btn {
  width: 100%;
  justify-content: center;
}
