/* 5단계 학습 루틴 화면을 K웹툰 스타일로 꾸민다. 지도·게임·복습 화면 규칙은 그대로 둔다. */

/* ── 지도 화면(그대로 유지) ─────────────────────────── */
.routine-intro{display:flex;align-items:center;justify-content:space-between;gap:24px;border:1px solid #e0d7eb;background:linear-gradient(115deg,#f3edf9,#eef4eb);border-radius:20px;padding:26px 28px;margin-bottom:22px}
.routine-eyebrow{font-size:10px;letter-spacing:1.8px;color:#7a6590;font-weight:800}
.routine-intro h2{font-size:25px;letter-spacing:-.8px;margin:8px 0}
.routine-intro p{font-size:13px;line-height:1.8;margin:0;color:#716580}
.routine-intro .btn-primary{flex-shrink:0;font-size:13px}
.resume-banner{display:flex;align-items:center;gap:12px;background:#fff5dc;border:1px solid #ead7a5;border-radius:14px;padding:18px 20px;margin:0 0 20px;font-size:13px}
.resume-banner>div{flex:1}
.resume-banner p{font-size:11px;color:#827345;margin:5px 0 0}
.resume-banner button{font-size:12px;white-space:nowrap}

/* ── 학습 루틴 화면 : K웹툰 셸 ───────────────────────── */
/* 학습·결과 화면은 전역 상단바와 하단 탭을 숨겨 몰입형 학습 페이지로 만든다(모바일). */
@media(max-width:899px){
  body[data-screen="lesson"] .hud,body[data-screen="lesson"] .sidebar,
  body[data-screen="results"] .hud,body[data-screen="results"] .sidebar{display:none!important}
}
.screen[data-screen="lesson"]{
  background:linear-gradient(172deg,#fff8ed 0%,#f2eafb 46%,#dfefe9 100%)!important;
  padding:calc(20px + env(safe-area-inset-top,0px)) 18px calc(28px + env(safe-area-inset-bottom,0px));overflow-x:hidden}
.lesson-v5{max-width:680px;width:100%;margin:0 auto}

.lesson-top{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 16px}
.lesson-top #leaveLesson{border:2px solid #e2d5f1;border-radius:999px;background:#fff;color:#7a6890;font-weight:800;padding:10px 16px;box-shadow:0 3px 0 #ece2f6}
.lesson-top #leaveLesson:active{transform:translateY(2px);box-shadow:none}
.lesson-top span{background:#fff;border:2px solid #ece2f6;border-radius:999px;padding:8px 14px;font-size:12px;font-weight:700;color:#8a7ba8;text-align:right}

.lesson-v5 .guide-row{display:flex;align-items:center;gap:14px;padding:2px 2px 0;margin-bottom:12px}
.lesson-v5 .g-portrait{width:74px;height:74px;flex-shrink:0;background:radial-gradient(circle at 38% 32%,#fff,#efe7fb);border:3px solid #fff;border-radius:50%;box-shadow:0 10px 22px rgba(124,92,255,.26);padding:7px;filter:none}
.lesson-v5 .g-portrait img{width:100%;height:100%;object-fit:contain}
.lesson-v5 .g-bubble{position:relative;background:#fff;border:2.5px solid #ece2f6;border-radius:18px;padding:13px 16px;font-size:.92rem;font-weight:700;line-height:1.7;color:#4a3768;box-shadow:0 7px 18px rgba(63,45,88,.1);flex:1}
.lesson-v5 .g-bubble::before{content:"";position:absolute;left:-13px;top:22px;border:9px solid transparent;border-right-color:#ece2f6}
.lesson-v5 .g-bubble::after{content:"";position:absolute;left:-9px;top:23px;border:8px solid transparent;border-right-color:#fff}

.lesson-count{text-align:center;font-size:12px;font-weight:700;color:#8a7ba8;margin:4px 0 10px}

.screen[data-screen="lesson"] progress,.screen[data-screen="lesson"] .lesson-v5 progress{
  -webkit-appearance:none;appearance:none;display:block;width:100%;max-width:560px;height:15px;margin:0 auto 22px;
  border:2px solid #fff;border-radius:999px;overflow:hidden;background:#eae1f6;
  box-shadow:0 3px 10px rgba(124,92,255,.16),inset 0 1px 3px rgba(63,45,88,.12)}
.screen[data-screen="lesson"] progress::-webkit-progress-bar{background:transparent}
.screen[data-screen="lesson"] progress::-webkit-progress-value{background:linear-gradient(90deg,#7c5cc9,#ff6b9d);border-radius:999px}
.screen[data-screen="lesson"] progress::-moz-progress-bar{background:linear-gradient(90deg,#7c5cc9,#ff6b9d)}

.routine-steps{display:flex;justify-content:center;flex-wrap:wrap;gap:6px;margin:0 auto 22px;max-width:100%}
.routine-steps span{font-size:10px;font-weight:800;padding:7px 10px;border-radius:999px;border:2px solid #e6dbf2;background:#fff;color:#9a8bb0;box-shadow:0 2px 0 #efe6f7;white-space:nowrap}
.routine-steps .current{background:linear-gradient(135deg,#7c5cc9,#9a6bff);border-color:#5b3de0;color:#fff;transform:translateY(-1px);
  box-shadow:0 4px 0 #4f33b5,0 9px 20px rgba(124,92,255,.35)}
.routine-steps .done{background:#e4f6ee;border-color:#a7e0cb;color:#12876a;box-shadow:0 2px 0 #cdeee0}
.routine-steps .done::before{content:"✓";font-weight:900;margin-right:3px}

.learning-card{position:relative;overflow:hidden;max-width:620px;width:100%;margin:0 auto;background:#fff;
  border:2.5px solid #ece2f6;border-radius:30px;padding:34px 30px 30px;text-align:center;
  box-shadow:0 26px 64px rgba(63,45,88,.13),0 4px 0 #efe7f7}
.learning-card::before{content:"";position:absolute;left:0;right:0;top:0;height:7px;
  background:linear-gradient(90deg,#7c5cc9,#ff6b9d 55%,#ffc95c)}
.learning-card::after{content:"";position:absolute;right:-26px;bottom:-26px;width:150px;height:150px;pointer-events:none;z-index:0;
  background-image:radial-gradient(#f0e7f9 2px,transparent 2.5px);background-size:15px 15px;opacity:.7}
.learning-card>*{position:relative;z-index:1}
.learning-card #phaseLabel{color:#8a6fc0;letter-spacing:1.8px}
.learning-card h1{font-size:35px;font-weight:800;color:#3f2d58;letter-spacing:-.5px;line-height:1.45;margin:16px 0 12px;overflow-wrap:anywhere}
.learning-card>p{font-size:18px;line-height:1.8;margin:10px 0;color:#6b5a83}
#wordExample{font-size:15px;background:#f7f2fc;border:1.5px solid #ede3f7;padding:12px 14px;border-radius:12px;color:#7c6a92}

.word-visual{width:100%;max-width:520px;margin:0 auto 18px}
.word-visual>svg,.word-visual>img{width:100%;height:auto;display:block;aspect-ratio:640/380;border-radius:20px}
.word-visual>img{object-fit:contain;background:#f7f3fb}
.word-visual figcaption{font-size:11px;color:#8a7799;line-height:1.7;margin-top:10px;text-align:center}

/* phase 0 : 상용 품질 K웹툰 학습 카드 (실제 캐릭터 아트 + 의미 장면) */
.wc{position:relative;width:100%;aspect-ratio:8/5;border-radius:26px;overflow:hidden;
  background:linear-gradient(158deg,var(--wc-a,#f4eefc),var(--wc-b,#e2daf0));
  border:3px solid #fff;box-shadow:0 22px 50px rgba(63,45,88,.24),0 0 0 2px var(--wc-l,#d8c9e8)}
.wc::before{content:"";position:absolute;left:-16%;top:-34%;width:58%;height:96%;border-radius:50%;background:#fff;opacity:.34}
.wc::after{content:"";position:absolute;right:-3%;bottom:-6%;width:46%;height:62%;pointer-events:none;
  background:radial-gradient(circle,rgba(255,255,255,.55) 20%,transparent 22%);background-size:15px 15px;opacity:.75}
.wc-panel{position:absolute;left:5%;top:9%;width:45%;height:58%;background:#fff;border-radius:18px;
  border:2.5px solid var(--wc,#7c5cc9);box-shadow:0 12px 28px rgba(63,45,88,.18);display:grid;place-items:center;overflow:hidden;z-index:2}
.wc-scene{width:90%;height:90%}
.wc-emoji{font-size:clamp(52px,15vw,92px);line-height:1;filter:drop-shadow(0 6px 8px rgba(63,45,88,.18))}
.wc-ai{width:100%;height:100%;object-fit:cover;border-radius:15px}
.wc-char{position:absolute;right:-2%;bottom:0;height:98%;width:auto;z-index:1;
  filter:drop-shadow(0 14px 16px rgba(63,45,88,.32))}
.wc-word{position:absolute;left:5%;bottom:8%;width:46%;background:#fff;border-radius:15px;padding:10px 15px 12px;
  border-left:6px solid var(--wc,#7c5cc9);box-shadow:0 12px 26px rgba(63,45,88,.22);z-index:3}
.wc-word b{display:block;font-size:clamp(20px,5.8vw,30px);font-weight:800;color:var(--wc-ink,#3f2d58);line-height:1.05;letter-spacing:-.5px;overflow-wrap:anywhere}
.wc-word span{font-size:clamp(12px,3.3vw,16px);color:#6b5a83;font-weight:600}
@media(max-width:520px){.wc-word b{font-size:22px}}

.memory-panel{background:linear-gradient(160deg,#fff8ee,#f3ecfb);border:2px solid #ecdff5;border-radius:20px;
  text-align:left;padding:20px;margin:18px 0;scroll-margin-block:24px}
.memory-panel .routine-eyebrow{color:#8a6fbe}
.memory-panel p{font-size:13px;line-height:1.85;color:#63557a;margin:8px 0}
.memory-panel details{border-top:1.5px solid #e6d9f2;padding-top:12px;margin-top:12px}
.memory-panel summary{font-size:12px;font-weight:700;color:#7a5aa8;cursor:pointer;min-height:30px}
.memory-panel label{font-size:11px;display:block;margin-top:10px;color:#7c6a92}
.memory-panel textarea{display:block;width:100%;padding:11px;margin:7px 0;font:inherit;font-size:13px;border:2px solid #dccfec;border-radius:11px;background:#fff;resize:vertical;min-height:75px}
.memory-panel small{font-size:10px;margin-left:8px;color:#5d754d}

.listen-button{border:2.5px solid #d9caf0;border-bottom-width:5px;background:#f5efff;color:#6b4bb0;
  border-radius:999px;padding:12px 24px;margin:6px 0 20px;font:inherit;font-size:14px;font-weight:800}
.listen-button:active{transform:translateY(2px);border-bottom-width:2.5px}

.choices{display:grid;grid-template-columns:1fr 1fr;gap:12px;width:100%;max-width:520px;margin:20px auto 0}
#lessonOptions .opt-btn{border:2.5px solid #e2d5f1;border-bottom-width:5px;border-radius:16px;background:#fff;color:#493768;
  font-size:1rem;font-weight:800;line-height:1.6;padding:15px 14px;text-align:left;overflow-wrap:anywhere;transition:transform .12s,border-color .12s}
#lessonOptions .opt-btn:hover{transform:translateY(-2px);border-color:#c9b3ea}
#lessonOptions .opt-btn:active{transform:translateY(1px);border-bottom-width:2.5px}
#lessonOptions .opt-btn.correct{background:#e4f6ee;border-color:#12b886;color:#0c6b52}
#lessonOptions .opt-btn.wrong{background:#ffe9ee;border-color:#ff6b9d;color:#c23a5d}

.tile-game{margin-top:22px}
.tile-game>p{font-size:12px;line-height:1.8;color:#7b698a}
.tile-answer,.tile-pool{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;padding:16px;border-radius:18px;min-height:82px}
.tile-answer{background:#f6f0fc;border:2.5px dashed #c9b3ea;margin-bottom:14px}
.tile-pool{background:#f2f6f3;border:2px solid #e2ebe5}
.tile-answer>span{font-size:12px;color:#9b89a8;align-self:center}
.tile-answer button,.tile-pool button{display:grid;place-items:center;min-width:46px;min-height:50px;padding:8px;
  border:2.5px solid #3f2d58;border-bottom-width:5px;border-radius:12px;background:#fff;color:#3f2d58;font-size:21px;font-weight:900;font-family:inherit}
.tile-answer button{background:linear-gradient(135deg,#efe4fb,#e3d3f7);border-color:#5b3de0}
.tile-pool button:active{transform:translateY(2px);border-bottom-width:2.5px}
.tile-pool button:disabled{opacity:.22}
.tile-answer button:disabled{opacity:1;cursor:default}
.tile-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin:16px 0}
.tile-actions button{font-size:12px;padding:11px 15px}
.tile-keyboard{font-size:12px;font-weight:700;color:#6f568a;margin:10px auto}

.listening-help{padding:16px;border:2px solid #e3daf0;background:linear-gradient(160deg,#f7f2fc,#eef4fb);border-radius:16px;margin-top:18px}
.listening-help p{font-size:12px;line-height:1.7;margin:0 0 8px;color:#6b5a83}
.listening-help small{font-size:10px;display:block;color:#7b688b;margin-top:8px}
.listening-help button{font-size:12px;font-weight:700}

#spellForm{display:grid;gap:12px;text-align:left;margin-top:20px}
#spellForm label{font-size:13px;font-weight:700;color:#7c6a92}
#spellAnswer{width:100%;font:inherit;font-size:24px;text-align:center;padding:15px;border:2.5px solid #d5c6e7;border-radius:14px;color:#57406a}
#spellAnswer:focus{outline:3px solid #e9e0fb;border-color:#7c5cc9}
.voice-answer{margin-top:6px;display:flex;gap:9px;flex-wrap:wrap;align-items:center;background:#f7f2fc;border:2px solid #ece2f6;border-radius:16px;padding:14px}
.voice-answer button{border:2.5px solid #d8c9ef;border-bottom-width:4px;background:#fff;color:#6b4bb0;border-radius:12px;padding:10px 15px;font:inherit;font-size:13px;font-weight:800;min-height:44px}
.voice-answer button:active{transform:translateY(1px);border-bottom-width:2.5px}
.voice-answer p{margin:0;font-size:11px;line-height:1.7;color:#7c6b88;text-align:left;flex:1;min-width:150px}
.voice-answer small{display:block;width:100%;font-size:10px;color:#877690;text-align:left;line-height:1.6}

.answer-explanation{white-space:pre-line;background:#fffdf3;border:2px solid #f0e2b8;border-left:6px solid #ffc95c;
  border-radius:14px;padding:16px 18px;line-height:1.8;font-size:15px;color:#6a5a3a;max-width:620px;margin:20px auto 0;width:100%}

.lesson-v5 .stage-actions{display:flex;gap:10px;max-width:620px;margin:22px auto 0;padding:0}
.lesson-v5 .stage-actions button{min-height:52px}
.screen[data-screen="lesson"] .btn-primary{background:linear-gradient(135deg,#7c5cc9,#9a6bff);color:#fff;border:0;border-radius:14px;
  font-weight:800;font-size:16px;padding:15px 22px;box-shadow:0 5px 0 #4f33b5,0 12px 24px rgba(124,92,255,.3)}
.screen[data-screen="lesson"] .btn-primary:active{transform:translateY(3px);box-shadow:0 2px 0 #4f33b5}
.screen[data-screen="lesson"] .btn-ghost{border:2px solid #e2d5f1;border-radius:999px;background:#fff;color:#7a6890;font-weight:800;padding:13px 18px}

/* ── 결과 화면 ─────────────────────────────────────── */
.screen[data-screen="results"]{background:linear-gradient(172deg,#fff8ed,#f4ecfb 50%,#e1efe8)!important;
  padding:calc(24px + env(safe-area-inset-top,0px)) 18px calc(24px + env(safe-area-inset-bottom,0px))}
[data-screen="results"] .result-hero{position:relative;overflow:hidden;max-width:560px;margin:10px auto 0;padding:40px 26px 26px;
  background:#fff;border:2.5px solid #ece2f6;border-radius:28px;box-shadow:0 26px 64px rgba(63,45,88,.14);text-align:center}
[data-screen="results"] .result-hero::before{content:"";position:absolute;left:0;right:0;top:0;height:8px;
  background:linear-gradient(90deg,#7c5cc9,#ff6b9d 55%,#ffc95c)}
[data-screen="results"] .result-hero>*{position:relative}
.result-character{height:200px;max-width:100%;object-fit:contain;filter:drop-shadow(0 14px 20px rgba(124,92,255,.22))}
[data-screen="results"] h1{font-size:26px;font-weight:800;color:#3f2d58;margin:14px 0 8px}
[data-screen="results"] p{color:#6b5a83;line-height:1.8}
[data-screen="results"] .report-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:22px 0}
[data-screen="results"] .report-stats>*{background:#f7f3fc;border:2px solid #ece2f6;border-radius:16px;padding:16px 8px;font-size:13px;color:#7c6a92}
[data-screen="results"] .btn-primary{background:linear-gradient(135deg,#7c5cc9,#9a6bff);color:#fff;border:0;border-radius:14px;
  font-weight:800;padding:14px 26px;margin:16px auto 8px;display:block;box-shadow:0 5px 0 #4f33b5,0 12px 24px rgba(124,92,255,.3)}
[data-screen="results"] .btn-primary:active{transform:translateY(3px);box-shadow:0 2px 0 #4f33b5}
[data-screen="results"] .btn-ghost{border:2px solid #e2d5f1;border-radius:999px;background:#fff;color:#7a6890;font-weight:800}

/* ── 복습 화면(그대로 유지) ─────────────────────────── */
.scheduled-review{margin:25px 0}
.scheduled-review article{display:flex;gap:20px;align-items:center;justify-content:space-between;padding:22px;border:1px solid #ccdfce;background:#eff6ec;border-radius:16px;margin-bottom:12px}
.scheduled-review h2{font-size:19px;margin:9px 0}
.scheduled-review p{font-size:12px;color:#668166;line-height:1.8;margin:0}
.scheduled-review button{font-size:12px}
.schedule-empty{border:1px solid #e4dcec;border-radius:16px;padding:22px;background:#fff}
.schedule-empty b{font-size:15px}
.schedule-empty p{font-size:12px;line-height:1.8;color:#897892}

/* ── 게임 스튜디오 화면(그대로 유지) ────────────────── */
.arcade-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin:28px 0 12px}
.arcade-toolbar label{font-size:12px;color:#806b90}
.arcade-toolbar select{min-width:120px}
#gameCourseLabel{font-size:12px;line-height:1.8;color:#826b92}
.arcade-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:23px 0}
.arcade-grid>button{border:1px solid #ddd1e8;border-radius:22px;padding:28px;text-align:left;color:#493557;background:linear-gradient(150deg,#f5edfd,#fff);transition:transform .15s,box-shadow .15s;font:inherit}
.arcade-grid>button:nth-child(2){background:linear-gradient(150deg,#eaf4ea,#fff)}
.arcade-grid>button:nth-child(3){background:linear-gradient(150deg,#eaf0fa,#fff)}
.arcade-grid>button:nth-child(4){background:linear-gradient(150deg,#fff1de,#fff)}
.arcade-grid>button:hover{transform:translateY(-3px);box-shadow:0 12px 30px #4a25531a}
.arcade-grid>button>span{display:grid;place-items:center;width:55px;height:55px;border-radius:16px;background:#ffffffb5;font-size:31px;color:#8063a6}
.arcade-grid h2{font-size:24px;letter-spacing:-.7px;margin:17px 0 8px}
.arcade-grid p{font-size:13px;color:#7e6e8c;line-height:1.8;min-height:44px}
.arcade-grid small{font-size:11px;color:#876596}
.routine-note{font-size:12px;color:#84718f;line-height:1.8}
#gameHistory{margin-top:30px;border-top:1px solid #e3dbea;padding-top:22px}
#gameHistory h2{font-size:18px}
#gameHistory>p{font-size:13px;color:#8c7a95}
.game-history-row{display:flex;gap:20px;padding:15px 0;border-bottom:1px solid #e7dfec;font-size:12px}
.game-history-row small{margin-left:auto;color:#99869e}

/* ── 반응형 ────────────────────────────────────────── */
@media(max-width:800px){
  .routine-intro{padding:22px;gap:18px}.routine-intro h2{font-size:22px}
  .resume-banner{flex-wrap:wrap}.resume-banner>div{flex-basis:100%}
  .learning-card{padding:26px 20px}
  .routine-steps{gap:6px}.routine-steps span{font-size:10px;padding:7px 10px}
  .arcade-grid{gap:13px}.arcade-grid>button{padding:23px}.arcade-grid h2{font-size:21px}
}
@media(max-width:520px){
  .screen[data-screen="lesson"]{padding:16px 12px}
  .routine-intro{display:block;padding:22px 19px}.routine-intro h2{font-size:23px;line-height:1.5}
  .routine-intro .btn-primary{margin-top:18px;width:100%;font-size:14px}.routine-intro p{font-size:12px}
  .resume-banner{padding:16px}.resume-banner button{font-size:11px}
  .lesson-v5 .g-portrait{width:58px;height:58px;padding:5px}
  .lesson-v5 .g-bubble{font-size:.84rem;padding:11px 13px}
  .routine-steps{gap:5px}.routine-steps span{font-size:9px;padding:6px 8px}
  .learning-card{padding:22px 16px;border-radius:24px}.learning-card h1{font-size:28px}
  .learning-card>p{font-size:16px}
  .memory-panel{padding:15px}.memory-panel p{font-size:12px}
  .choices{grid-template-columns:1fr}
  #lessonOptions .opt-btn{font-size:15px;min-height:54px}
  .tile-pool,.tile-answer{gap:6px;padding:12px}
  .tile-pool button,.tile-answer button{min-width:40px;min-height:46px;font-size:19px;padding:7px}
  .tile-actions{gap:5px}.tile-actions button{font-size:11px;padding:10px}
  .voice-answer p{flex-basis:100%}
  .arcade-grid{grid-template-columns:1fr}.arcade-grid>button{padding:24px}.arcade-grid p{min-height:0}
  .scheduled-review article{display:block;padding:20px}.scheduled-review button{margin-top:14px}
  .arcade-toolbar{gap:7px}.arcade-toolbar select{font-size:12px;min-width:110px}
  .game-history-row{gap:10px;font-size:11px}.routine-note{font-size:11px}
  [data-screen="results"] .result-hero{padding:30px 18px 20px}.result-character{height:160px}
  [data-screen="results"] h1{font-size:22px}
}
@media(prefers-reduced-motion:reduce){
  .arcade-grid>button:hover,#lessonOptions .opt-btn:hover{transform:none}
  *{scroll-behavior:auto!important}
}
