:root {
  --ink: #263737;
  --muted: #778887;
  --paper: #fff;
  --cream: #fffaf2;
  --line: #e8e6de;
  --mint: #50b9a7;
  --mint-dark: #238372;
  --mint-light: #e7f7f3;
  --coral: #f47c65;
  --coral-light: #fff0ec;
  --yellow: #f6c858;
  --danger: #e25e59;
  --shadow: 0 24px 65px rgba(48, 72, 68, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--ink); background: var(--cream); font-family: "Nunito", system-ui, sans-serif; }
button, select { font: inherit; }
button { color: inherit; }
svg { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.blob { position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); opacity: .78; }
.blob--mint { width: 380px; height: 380px; left: -190px; top: 120px; background: #daf4ed; }
.blob--peach { width: 330px; height: 330px; right: -170px; bottom: 30px; background: #ffeadb; }

.topbar { width: min(1240px, calc(100% - 40px)); min-height: 86px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 21px; font-weight: 900; letter-spacing: -.8px; }
.brand > span:last-child span { color: var(--mint-dark); }
.brand__icon { width: 43px; height: 43px; display: grid; place-items: center; color: white; background: var(--coral); border-radius: 15px 15px 15px 5px; box-shadow: 0 10px 25px rgba(244,124,101,.26); }
.brand__icon svg { width: 25px; height: 25px; }
.topbar__actions { display: flex; align-items: center; justify-content: flex-end; gap: 11px; }
.source-badge { max-width: 225px; display: flex; align-items: center; gap: 7px; padding: 7px 11px; overflow: hidden; border: 1px solid #cde8e1; border-radius: 99px; color: var(--mint-dark); background: rgba(255,255,255,.8); font-size: 10px; font-weight: 900; letter-spacing: .6px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.source-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px var(--mint-light); }
.source-badge.is-offline { color: #a16642; border-color: #f0d9c8; }
.source-badge.is-offline i { background: #e7a574; box-shadow: 0 0 0 3px #fff0e5; }
.count-select, .room-select { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; }
.count-select select, .room-select select { min-height: 41px; padding: 0 28px 0 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: white; font-weight: 800; cursor: pointer; }
.room-select select { width: 205px; }
.count-select select:focus, .room-select select:focus { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-light); }

.button { min-height: 47px; padding: 0 19px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; font-weight: 900; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s; }
.button:hover:not(:disabled) { transform: translateY(-2px); }
.button--outline { border: 1px solid var(--line); background: rgba(255,255,255,.84); }
.button--outline:hover { background: white; box-shadow: 0 8px 20px rgba(45,70,66,.08); }
.button--primary { color: white; background: var(--mint-dark); box-shadow: 0 10px 23px rgba(35,131,114,.25); }
.button--primary:hover { background: #1b7061; }

.app-shell { width: min(1140px, calc(100% - 40px)); margin: 18px auto 70px; display: grid; gap: 18px; }
.mission-card, .game-card { border: 1px solid rgba(229,226,216,.95); border-radius: 25px; background: rgba(255,255,255,.95); box-shadow: var(--shadow); }
.mission-card { padding: 26px 30px 22px; display: grid; grid-template-columns: 1fr auto; gap: 17px 28px; align-items: center; }
.mission-kicker { color: var(--mint-dark); font-size: 10px; font-weight: 900; letter-spacing: 1.3px; }
.mission-kicker b { display: inline-grid; width: 27px; height: 27px; margin-left: 5px; place-items: center; border-radius: 8px; color: white; background: var(--mint); font-size: 10px; }
.mission-card__copy h1 { margin: 7px 0 3px; font-size: clamp(25px, 3vw, 35px); letter-spacing: -1.2px; line-height: 1.05; }
.mission-card__copy p { margin: 0; color: var(--muted); font-size: 12px; }
.room-view { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: stretch; background: #f8fbf9; }
.audio-rail { position: relative; z-index: 6; min-width: 0; padding: 15px 10px; border-right: 1px solid var(--line); background: #fbfdfc; }
.audio-panel { position: sticky; top: 14px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.listen-button { width: 64px; min-height: 64px; aspect-ratio: 1; padding: 0; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.88); border-radius: 19px; color: white; background: var(--mint-dark); cursor: pointer; box-shadow: 0 9px 22px rgba(35,131,114,.22); transition: transform .18s, box-shadow .18s, background .18s; }
.listen-button:hover { transform: translateY(-2px); background: #1d7667; box-shadow: 0 12px 27px rgba(35,131,114,.3); }
.listen-button:active { transform: translateY(0) scale(.97); }
.listen-button__icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: var(--yellow); box-shadow: inset 0 -2px 0 rgba(113,78,0,.12); }
.listen-button__icon svg { width: 23px; height: 23px; }
.listen-button__label { display: none; }
.listen-button small { color: rgba(255,255,255,.68); font-size: 7px; font-weight: 800; }
.listen-button strong { font-size: 10px; }
.sound-wave { display: none; }
.sound-wave i { width: 3px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.72); }
.sound-wave i:nth-child(2) { height: 8px; }
.sound-wave i:nth-child(3) { height: 6px; }
.listen-button.is-playing { background: var(--coral); box-shadow: 0 0 0 6px rgba(244,124,101,.16), 0 12px 27px rgba(244,124,101,.25); }
.listen-button.is-playing .listen-button__icon svg { animation: speakerPulse .55s ease-in-out infinite alternate; }
.listen-button.is-playing .sound-wave i { animation: wave .55s ease-in-out infinite alternate; }
.listen-button.is-playing .sound-wave i:nth-child(2) { animation-delay: .12s; }
.listen-button.is-playing .sound-wave i:nth-child(3) { animation-delay: .23s; }
.listen-button.is-playing .sound-wave i:nth-child(4) { animation-delay: .34s; }
@keyframes wave { to { height: 13px; opacity: .45; } }
@keyframes speakerPulse { to { transform: scale(1.13); } }
.mission-transcript-control { align-self: center; }
.transcript-button { width: auto; min-height: 46px; padding: 0 15px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: white; cursor: pointer; transition: border-color .18s, color .18s, box-shadow .18s; }
.transcript-button:hover { color: var(--mint-dark); border-color: #bcdcd3; box-shadow: 0 7px 18px rgba(35,83,74,.08); }
.transcript-button svg { width: 18px; height: 18px; }
.transcript-button span { font-size: 9px; font-weight: 900; white-space: nowrap; }
.transcript { grid-column: 1 / -1; padding: 12px 15px; display: flex; align-items: baseline; gap: 10px; border-radius: 12px; background: var(--mint-light); }
.transcript strong { font-size: 13px; }
.transcript span { color: var(--muted); font-size: 11px; }
.progress-area { grid-column: 1 / -1; }
.progress-copy { margin-bottom: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.progress-copy b { color: #c2901d; }
.quest-map { display: flex; align-items: center; }
.map-node { position: relative; flex: 1; display: flex; align-items: center; }
.map-node:not(:last-child)::after { content: ""; height: 4px; flex: 1; background: #e8ece8; transition: background .3s; }
.map-node.is-complete:not(:last-child)::after { background: var(--mint); }
.map-dot { flex: 0 0 23px; width: 23px; height: 23px; display: grid; place-items: center; border: 3px solid #e8ece8; border-radius: 50%; color: transparent; background: white; font-size: 9px; font-weight: 900; transition: .25s; }
.map-node.is-current .map-dot { color: white; border-color: #94d7cb; background: var(--mint); box-shadow: 0 0 0 4px var(--mint-light); }
.map-node.is-complete .map-dot { color: white; border-color: var(--mint-dark); background: var(--mint-dark); }
.learning-progress { grid-column: 1 / -1; padding: 13px 15px; border: 1px solid #dcece7; border-radius: 15px; background: linear-gradient(135deg, #f7fcfa, #fffaf2); }
.learning-progress__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; }
.learning-progress__header > div { display: grid; gap: 2px; }
.learning-progress__header > div > span { color: var(--mint-dark); font-size: 8px; font-weight: 900; letter-spacing: 1px; }
.learning-progress__header strong { font-size: 13px; }
.learning-progress__header strong b { color: var(--mint-dark); }
.learning-progress__header > span { color: var(--muted); font-size: 9px; font-weight: 800; }
.learning-progress__header > span.is-complete { color: var(--mint-dark); }
.learning-progress__track { height: 7px; margin: 9px 0 8px; overflow: hidden; border-radius: 99px; background: #e5ece8; }
.learning-progress__track i { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--mint-dark)); transition: width .4s ease; }
.learning-progress__stats { display: flex; flex-wrap: wrap; gap: 7px 20px; color: var(--muted); font-size: 9px; font-weight: 800; }
.learning-progress__stats b { color: var(--ink); }

.game-card { overflow: hidden; }
.game-toolbar { min-height: 73px; padding: 13px 25px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.instruction { display: flex; align-items: center; gap: 11px; }
.instruction__icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--mint-dark); background: var(--mint-light); }
.instruction__icon svg { width: 20px; height: 20px; }
.instruction div { display: grid; }
.instruction strong { font-size: 12px; }
.instruction span { color: var(--muted); font-size: 10px; }
.attempts { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.attempts strong { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: var(--coral); background: var(--coral-light); font-size: 12px; }

.room-stage { position: relative; min-width: 0; aspect-ratio: 3 / 2; overflow: hidden; background: #e6f0ec; user-select: none; }
.room-stage > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.room-click-layer { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: crosshair; }
.room-click-layer:disabled { cursor: default; }
.room-tip { position: absolute; z-index: 3; left: 50%; bottom: 17px; transform: translateX(-50%); padding: 8px 13px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(255,255,255,.75); border-radius: 99px; color: white; background: rgba(28,54,50,.67); backdrop-filter: blur(7px); font-size: 10px; font-weight: 900; pointer-events: none; transition: opacity .25s; }
.room-tip svg { width: 15px; height: 15px; }
.click-marker { position: absolute; z-index: 4; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 3px solid var(--danger); border-radius: 50%; opacity: 0; pointer-events: none; }
.click-marker.is-visible { animation: wrongClick .6s ease-out; }
@keyframes wrongClick { 0% { opacity: 1; transform: scale(.45); } 65% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }
.target-ring { position: absolute; z-index: 4; display: none; border: 4px solid white; border-radius: 50%; box-shadow: 0 0 0 5px var(--mint), 0 7px 24px rgba(19,75,65,.25); pointer-events: none; }
.target-ring::after { content: "✓"; position: absolute; right: -12px; top: -15px; width: 31px; height: 31px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; color: white; background: var(--mint-dark); font-size: 14px; font-weight: 900; }
.target-ring.is-visible { display: block; animation: found .45s cubic-bezier(.2,.8,.2,1); }
.target-ring.is-hint { display: block; border-color: rgba(255,255,255,.9); box-shadow: 0 0 0 5px var(--yellow), 0 0 0 12px rgba(246,200,88,.2); animation: hintPulse 1s ease-in-out infinite alternate; }
.target-ring.is-hint::after { display: none; }
@keyframes found { from { opacity: 0; transform: scale(.55) rotate(-12deg); } }
@keyframes hintPulse { to { transform: scale(1.08); box-shadow: 0 0 0 5px var(--yellow), 0 0 0 18px rgba(246,200,88,0); } }
.image-loading { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--ink); background: rgba(248,246,237,.92); backdrop-filter: blur(8px); }
.image-loading strong { margin-top: 17px; font-size: 15px; }
.image-loading span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.paint-loader { height: 42px; display: flex; align-items: flex-end; gap: 6px; }
.paint-loader i { width: 12px; height: 22px; border-radius: 9px 9px 3px 3px; background: var(--mint); animation: paint .7s infinite alternate; }
.paint-loader i:nth-child(2) { height: 39px; background: var(--coral); animation-delay: .15s; }
.paint-loader i:nth-child(3) { height: 29px; background: var(--yellow); animation-delay: .3s; }
@keyframes paint { to { height: 11px; opacity: .55; } }

.feedback-bar { min-height: 82px; padding: 14px 22px; display: flex; align-items: center; gap: 12px; border-top: 1px solid #cde9e1; background: var(--mint-light); }
.feedback-bar.is-wrong { border-color: #f4d0c9; background: var(--coral-light); }
.feedback-bar__icon { flex: 0 0 39px; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--mint); font-size: 17px; font-weight: 900; }
.feedback-bar.is-wrong .feedback-bar__icon { background: var(--danger); }
.feedback-bar > div { flex: 1; }
.feedback-bar strong { font-size: 12px; }
.feedback-bar p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.feedback-bar .button { min-width: 170px; }
.hint-bar { min-height: 54px; padding: 11px 25px; display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); background: #fffdf8; }
.hint-bar > span { color: #c2901d; }
.hint-bar svg { width: 18px; height: 18px; }
.hint-bar p { margin: 0; color: var(--muted); font-size: 10px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 23px; max-width: calc(100% - 30px); padding: 12px 17px; border-radius: 12px; color: white; background: var(--ink); box-shadow: 0 13px 30px rgba(38,55,55,.25); font-size: 11px; font-weight: 800; opacity: 0; transform: translate(-50%, 90px); pointer-events: none; transition: .25s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.modal { position: fixed; z-index: 25; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(27,49,47,.55); backdrop-filter: blur(5px); }
.modal__card { position: relative; width: min(440px, 100%); padding: 33px; border-radius: 25px; background: white; box-shadow: 0 35px 90px rgba(22,43,41,.3); text-align: center; animation: modalPop .3s ease-out; }
@keyframes modalPop { from { opacity: 0; transform: scale(.9); } }
.trophy { height: 72px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--yellow); }
.trophy svg { width: 68px; height: 68px; stroke-width: 3; }
.trophy span { font-size: 19px; }
.modal__eyebrow { margin: 14px 0 3px; color: var(--mint-dark); font-size: 9px; font-weight: 900; letter-spacing: 1.2px; }
.modal__card h2 { margin: 0 0 5px; font-size: 27px; letter-spacing: -1px; }
.modal__card > p:not(.modal__eyebrow) { margin: 0; color: var(--muted); font-size: 11px; }
.result-stats { margin: 20px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.result-stats div { padding: 15px; display: grid; border-radius: 15px; background: var(--mint-light); }
.result-stats div:last-child { background: #fff6d9; }
.result-stats strong { color: var(--mint-dark); font-size: 24px; }
.result-stats div:last-child strong { color: #b6810a; }
.result-stats span { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.modal__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

@media (max-width: 1050px) {
  .source-badge { display: none; }
}

@media (max-width: 780px) {
  .topbar { width: calc(100% - 24px); min-height: 74px; }
  .source-badge, .count-select span, .room-select span { display: none; }
  .room-select select { width: min(42vw, 180px); }
  .button--outline span { display: none; }
  .topbar .button--outline { width: 43px; min-height: 43px; padding: 0; }
  .app-shell { width: calc(100% - 24px); margin-top: 8px; }
  .mission-card { padding: 23px 20px 18px; grid-template-columns: 1fr auto; }
  .room-view { grid-template-columns: 72px minmax(0, 1fr); }
  .audio-rail { padding-inline: 6px; }
  .listen-button { width: 58px; min-height: 58px; }
  .game-toolbar { padding: 12px 17px; }
  .feedback-bar { align-items: flex-start; flex-wrap: wrap; }
  .feedback-bar .button { width: 100%; }
}

@media (max-width: 520px) {
  .brand > span:last-child { display: none; }
  .mission-card { grid-template-columns: 1fr; }
  .mission-transcript-control { grid-row: 2; }
  .transcript-button { min-height: 40px; padding: 0 12px; }
  .transcript { grid-column: 1; align-items: flex-start; flex-direction: column; gap: 2px; }
  .mission-card__copy h1 { font-size: 27px; }
  .mission-card__copy p { max-width: 310px; }
  .room-view { position: relative; display: block; }
  .audio-rail { position: absolute; z-index: 7; top: 10px; left: 10px; padding: 0; border: 0; background: transparent; }
  .audio-panel { position: static; flex-direction: row; align-items: center; }
  .listen-button { width: 54px; min-height: 54px; border-radius: 16px; }
  .listen-button__label, .listen-button .sound-wave { display: none; }
  .listen-button__icon { width: 38px; height: 38px; }
  .instruction span { display: none; }
  .room-tip { bottom: 10px; }
  .transcript { align-items: flex-start; flex-direction: column; gap: 2px; }
  .learning-progress__header { align-items: flex-start; flex-direction: column; gap: 5px; }
  .learning-progress__stats { display: grid; grid-template-columns: 1fr 1fr; }
  .modal__actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
 
