*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
:root{
  --purple:#7548e8; --purple2:#9d4edd; --pink:#ec4899; --ink:#26324b;
  --muted:#69738a; --line:#eadff8; --cream:#fffaf5; --lav:#f7f1ff; --panel:#fffdfc;
}
html{scroll-behavior:smooth}
body{
  margin:0; min-height:100vh; padding:18px;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans KR",Roboto,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at 12% 7%,#eee8ff 0,transparent 28%),
    radial-gradient(circle at 88% 18%,#fff0f6 0,transparent 30%),
    linear-gradient(135deg,#f8f6ff,#fff9f2 62%,#f1edff);
}
.app-shell{
  width:min(1180px,100%); margin:0 auto; overflow:hidden;
  background:rgba(255,252,249,.96); border:1px solid #eee7fb; border-radius:30px;
  box-shadow:0 22px 60px rgba(80,55,120,.14);
}
.hero{
  display:grid; grid-template-columns:1.25fr .85fr 1.05fr; gap:18px; align-items:center;
  padding:28px 30px 18px; position:relative;
}
.hero::after{content:"";position:absolute;left:30px;right:30px;bottom:0;height:1px;background:#f1e8f8}
.hero-copy h1{
  margin:0; font-size:clamp(34px,4.3vw,62px); line-height:1.06; letter-spacing:-2px;
  background:linear-gradient(105deg,#6d46df 10%,#c83abf 56%,#f03783);
  -webkit-background-clip:text;background-clip:text;color:transparent;font-weight:900;
}
.hero-copy p{margin:14px 0 0;color:#e63483;font-weight:800;font-size:clamp(14px,1.7vw,19px)}
.muni-hero{display:flex;justify-content:center;align-items:flex-end;min-height:190px}
.muni-hero img{width:min(260px,100%);max-height:220px;object-fit:contain;filter:drop-shadow(0 10px 16px rgba(109,70,223,.14))}
.bgm-card{
  padding:20px 22px; border:1.5px solid #ebd5f8; border-radius:22px;
  background:linear-gradient(145deg,#fffaff,#fbf2ff); box-shadow:inset 0 0 0 1px rgba(255,255,255,.75);
}
.bgm-title{font-size:20px;font-weight:900;color:#552d8c;margin-bottom:10px}
.bgm-song{font-size:16px;font-weight:700;margin-bottom:14px;color:#403154}
.bgm-row{display:flex;align-items:center;gap:12px}
.bgm-slider{flex:1;accent-color:#cf35df;min-width:90px}
.bgm-switch-btn{
  border:0;border-radius:12px;padding:9px 14px;color:#fff;font-weight:900;cursor:pointer;
  background:linear-gradient(135deg,#d53ce4,#9f43ee)
}
.bgm-switch-btn.off{background:#d7dbe5;color:#687086}

.tab-nav{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:14px 30px 0}
.tab-btn{
  border:1px solid #e2e5ec;background:#fff;color:#536078;font-size:17px;font-weight:900;
  padding:15px 18px;border-radius:15px;cursor:pointer;box-shadow:0 3px 10px rgba(48,53,80,.03)
}
.tab-btn.active{color:#fff;border-color:transparent;background:linear-gradient(100deg,#7447e7,#9550e8);box-shadow:0 7px 18px rgba(117,72,232,.22)}

.content-wrap{padding:14px 30px 26px}
#create-view{display:block}
.create-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(280px,.85fr);gap:18px;align-items:start}
.stack{display:flex;flex-direction:column;gap:14px}
.section-card{
  background:rgba(255,255,255,.94);border:1px solid #eee8f2;border-radius:19px;padding:18px;
  box-shadow:0 7px 22px rgba(69,51,87,.055)
}
.section-title{display:flex;align-items:center;gap:8px;font-size:17px;font-weight:900;color:#7041d8;margin:0 0 14px}
.section-title .num{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:9px;background:#f0e9ff;color:#7447e7;font-size:13px}
.settings-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.user-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.user-status{display:none;color:#12a46d;font-size:12px;font-weight:800}
.btn-small,.btn-clear,.photo-btn,.photo-clear-btn{
  border:0;border-radius:10px;padding:8px 11px;font-weight:800;cursor:pointer
}
.btn-small{background:#7157e8;color:#fff} .btn-clear{background:#fff0f2;color:#e34d63}
label{display:block;font-weight:800;font-size:14px;margin:9px 0 6px;color:#38425a}
input,select{
  width:100%;padding:13px 14px;border:1.5px solid #dfe3ec;border-radius:13px;background:#fff;
  font-size:15px;color:#283149;outline:none
}
input:focus,select:focus{border-color:#8067ea;box-shadow:0 0 0 3px rgba(128,103,234,.1)}
.helper-text{font-size:12.5px;color:#728096;line-height:1.55;margin-top:8px}
.helper-alert{color:#5f50d7;font-weight:900}
.photo-upload-box{border:1.5px dashed #efc65b;background:#fffbeb;border-radius:17px;padding:16px}
.photo-upload-inner{display:grid;grid-template-columns:1fr auto;align-items:center;gap:14px}
.photo-copy strong{font-size:15px;color:#7f5215} .photo-copy p{font-size:13px;color:#9a6a28;margin:7px 0 0;line-height:1.45}
.photo-preview-wrapper{display:flex;align-items:center;gap:9px;flex-wrap:wrap;justify-content:flex-end}
.photo-preview-img{width:74px;height:74px;object-fit:cover;border-radius:15px;border:3px solid #f4c14d;display:none}
.photo-btn{background:#7651e8;color:#fff} .photo-clear-btn{display:none;background:#fee2e2;color:#9b1c1c}

.theme-chips{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;margin-bottom:12px}
.theme-chip{border:1px solid #eadff7;background:#fff;padding:10px 6px;border-radius:13px;cursor:pointer;font-weight:800;color:#46516a;font-size:12px}
.theme-chip:hover{border-color:#a98ce9;background:#faf7ff}
.input-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.input-group{margin-bottom:0}
.primary-btn{
  width:100%;border:0;border-radius:16px;padding:17px 18px;font-size:18px;font-weight:900;color:#fff;cursor:pointer;
  background:linear-gradient(100deg,#7249e8,#d943bd,#f05b91);box-shadow:0 9px 22px rgba(144,70,202,.24);margin-top:2px
}
.primary-btn:active{transform:translateY(1px)} .primary-btn:disabled{opacity:.55;cursor:wait}
#status-log{font-size:14px;font-weight:800;color:#6554d9;text-align:center;line-height:1.5;margin-top:8px}

.side-card{background:rgba(255,255,255,.88);border:1px solid #eee8f2;border-radius:19px;padding:18px}
.side-card h3{margin:0 0 12px;color:#6940d3;font-size:17px}
.tip-list{margin:0;padding-left:20px;color:#576177;font-size:13.5px;line-height:1.8}
.audio-feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.audio-feature{padding:14px 6px;text-align:center;border:1px solid #ebe4f5;border-radius:13px;background:#fff;font-size:12px;font-weight:800;color:#526079}
.audio-feature b{display:block;font-size:22px;margin-bottom:5px}
.side-note{font-size:13px;line-height:1.65;color:#667188;margin:0}
.side-cta{width:100%;padding:11px;border:1px solid #cfc2f3;border-radius:12px;background:#faf7ff;color:#7041d8;font-weight:900;cursor:pointer}

#library-view{display:none;background:#fff;border:1px solid #eee8f2;border-radius:19px;padding:18px}
.library-header{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px}
.library-play-all{border:0;border-radius:10px;padding:9px 12px;background:#7157e8;color:#fff;font-weight:800;cursor:pointer}
.library-item{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:13px 14px;background:#fff;border:1px solid #e9e6ef;border-radius:13px;margin-bottom:9px}
.library-info h4{margin:0 0 4px;font-size:15px} .library-info p{margin:0;font-size:11.5px;color:#748097}
.library-actions{display:flex;gap:6px} .library-actions button{border:0;border-radius:8px;padding:7px 10px;font-size:12px;font-weight:800;cursor:pointer}
.btn-load{background:#7359e7;color:#fff} .btn-delete{background:#f05f71;color:#fff}

#book-container{display:none;margin-top:18px;padding-top:16px;border-top:1px dashed #d9cee9}
.story-title{font-size:23px;font-weight:900;text-align:center;margin-bottom:14px}
.book-page-wrapper{width:100%;position:relative}
.page-item{display:none;position:relative;width:100%;aspect-ratio:1/1;border-radius:18px;overflow:hidden;background:#e7e8ef;box-shadow:0 9px 24px rgba(0,0,0,.12)}
.page-item.active{display:block} .page-img{width:100%;height:100%;object-fit:cover;display:block}
.page-loading-text{display:flex;align-items:center;justify-content:center;height:100%;font-weight:800;color:#7a8497}
.page-overlay-box{position:absolute;left:0;right:0;bottom:0;max-height:56%;overflow:auto;padding:38px 18px 17px;background:linear-gradient(to top,rgba(20,15,31,.94),rgba(20,15,31,.66),transparent);color:#fff}
.page-text{margin:0;color:#fff;line-height:1.7;font-size:14px} .page-num-badge{display:inline-block;background:#f7c948;color:#714c0b;padding:3px 8px;border-radius:7px;font-size:12px;font-weight:900;margin-bottom:6px}
.dialogue-char{font-weight:900} .dialogue-hero{color:#a7d2ff} .dialogue-villain{color:#ff9292} .dialogue-elder{color:#ffe36e} .emotion-tag{font-size:11px;padding:1px 5px;border-radius:5px;background:rgba(255,255,255,.18)}
.page-nav-bar{display:flex;justify-content:space-between;align-items:center;margin-top:12px;padding:10px;border-radius:12px;background:#f6f5fb}
.page-nav-btn{border:0;border-radius:9px;padding:9px 12px;background:#6f55de;color:#fff;font-weight:800;cursor:pointer} .page-nav-btn:disabled{background:#cbd0dc}
.page-indicator{font-weight:900}
.drama-control-box{margin-top:12px;background:#f8f5ff;border:1px solid #e4daf7;padding:12px;border-radius:13px}
.controls{display:none;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:12px}
.controls button{border:0;border-radius:11px;padding:11px 8px;font-weight:800;cursor:pointer;background:#ececf3;color:#3e4960}
.controls .read-btn{grid-column:1/-1;background:linear-gradient(100deg,#17ad7a,#0d8f66);color:#fff;font-size:16px}
.controls .save-btn{background:#7157e8;color:#fff} .controls .pdf-btn{background:#f1a72e;color:#fff} .controls .stop{background:#fee2e2;color:#9b1c1c}
.controls .bgm-btn{background:#fbf1ff;color:#8d3199} .controls .loop-btn.active{background:#7a53df;color:#fff}

.footer{padding:13px 30px;background:linear-gradient(90deg,#f6ecff,#fff0f7);display:flex;justify-content:space-between;gap:12px;font-size:13px;color:#626d82}

@media(max-width:850px){
  body{padding:0;background:#fff}
  .app-shell{border-radius:0;border:0;box-shadow:none}
  .hero{grid-template-columns:1fr;gap:8px;padding:22px 18px 16px;text-align:center}
  .hero-copy h1{font-size:39px} .hero-copy p{font-size:15px}
  .muni-hero{min-height:130px;order:-1} .muni-hero img{max-height:150px;width:190px}
  .bgm-card{text-align:left;padding:14px}
  .tab-nav{padding:12px 14px 0} .content-wrap{padding:12px 14px 20px}
  .create-grid{grid-template-columns:1fr} .sidebar{display:grid;grid-template-columns:1fr;gap:12px}
  .input-grid{grid-template-columns:1fr} .theme-chips{grid-template-columns:repeat(3,1fr)}
  .photo-upload-inner{grid-template-columns:1fr} .photo-preview-wrapper{justify-content:flex-start}
  .controls{grid-template-columns:1fr 1fr} .controls .read-btn{grid-column:1/-1}
  .footer{padding:12px 16px;flex-direction:column;text-align:center}
}
@media(max-width:470px){
  .hero-copy h1{font-size:34px} .tab-btn{font-size:14px;padding:12px 8px}
  .bgm-row{flex-wrap:wrap} .bgm-slider{width:100%}
  .theme-chips{grid-template-columns:repeat(2,1fr)}
}

.voice-status{margin-top:10px;padding:9px 10px;border-radius:11px;background:#f8f5ff;color:#6959a8;font-size:12px;line-height:1.5}


.browser-guide-overlay,.install-guide-overlay{
  position:fixed;inset:0;z-index:99999;display:none;align-items:center;justify-content:center;padding:18px;
  background:rgba(30,24,42,.72);backdrop-filter:blur(8px)
}
.browser-guide-overlay.show,.install-guide-overlay.show{display:flex}
.guide-card{
  width:min(460px,100%);background:#fffdfc;border:1px solid #eadff8;border-radius:24px;padding:24px;
  box-shadow:0 24px 70px rgba(0,0,0,.28);text-align:center
}
.guide-card h2{margin:2px 0 10px;color:#53318d;font-size:22px}
.guide-card p{color:#596379;line-height:1.65;font-size:14px}
.guide-steps{text-align:left;background:#f8f4ff;border:1px solid #eadff8;border-radius:15px;padding:13px 15px;margin:14px 0;color:#4f5870;font-size:13.5px;line-height:1.7}
.guide-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:14px}
.guide-actions button,.install-app-btn{
  border:0;border-radius:12px;padding:12px 10px;font-weight:900;cursor:pointer
}
.guide-primary{background:#7354e7;color:#fff}.guide-secondary{background:#f0edf5;color:#5b6170}
.install-app-btn{
  position:fixed;right:16px;bottom:16px;z-index:9000;background:linear-gradient(135deg,#7354e7,#d445bd);
  color:#fff;box-shadow:0 8px 22px rgba(95,63,170,.28);display:none
}
.install-app-btn.show{display:block}


/* --- 이야기동화 / 배움동화 / 한영 전환 --- */

/* EAIM Kids cloud library */
.cloud-auth-box{margin:0 0 14px;padding:13px 14px;border:1px solid #e3ddf4;border-radius:14px;background:linear-gradient(135deg,#f8f6ff,#fffdf8)}
.cloud-auth-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.cloud-auth-copy{font-size:12px;color:#667085;line-height:1.45}.cloud-auth-copy b{display:block;color:#4d4670;font-size:13px;margin-bottom:2px}
.cloud-auth-actions{display:flex;gap:7px;flex-wrap:wrap}.cloud-btn{border:0;border-radius:10px;padding:9px 12px;font-weight:900;cursor:pointer;background:#fff;color:#5e51b8;box-shadow:0 2px 9px rgba(60,45,120,.10)}
.cloud-btn.primary{background:linear-gradient(135deg,#6f57e8,#9b5de5);color:#fff}.cloud-btn.sync{background:#edf8f4;color:#197354}.cloud-btn:disabled{opacity:.55;cursor:default}
.cloud-user{display:none;align-items:center;gap:8px}.cloud-avatar{width:28px;height:28px;border-radius:50%;object-fit:cover;background:#eee}.cloud-status{font-size:11px;color:#7d8698;margin-top:7px}
.story-purpose-box{margin-bottom:14px;padding:14px;border:1px solid #e8e2f3;border-radius:14px;background:linear-gradient(135deg,#fffdf8,#faf7ff)}
.story-purpose-title{font-size:13px;font-weight:900;color:#4f5870;margin-bottom:8px}
.story-purpose-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.story-purpose-btn{border:1px solid #ddd5ef;background:#fff;color:#5d6476;border-radius:12px;padding:11px 10px;font-weight:900;cursor:pointer;transition:.18s ease}
.story-purpose-btn.active{background:linear-gradient(135deg,#7354e7,#d445bd);border-color:transparent;color:#fff;box-shadow:0 6px 16px rgba(113,87,232,.18)}
.story-topic-box{margin-top:10px}
.learning-box{margin-top:10px;padding:14px;border:1px solid #e8e2f3;border-radius:14px;background:linear-gradient(135deg,#f7fff9,#faf7ff)}
.learning-box[hidden],.story-topic-box[hidden]{display:none!important}
.learning-row{display:grid;grid-template-columns:1fr 1.4fr;gap:10px;align-items:end}
.learning-hint{margin-top:7px;font-size:11.5px;color:#7c879b;line-height:1.45}
.learning-topic-wrap{margin-top:12px}
.learning-topic-title{font-size:13px;font-weight:800;color:#574a72;margin-bottom:8px}
.learning-topic-chips{display:flex;flex-wrap:wrap;gap:8px}
.learning-topic-chip{border:1px solid #ddd4ee;background:#fff;color:#5f5473;border-radius:999px;padding:9px 12px;font-size:12.5px;font-weight:700;cursor:pointer;transition:.16s ease}
.learning-topic-chip:hover{transform:translateY(-1px);border-color:#b9a7de}
.learning-topic-chip.active{background:linear-gradient(135deg,#e8dcff,#dff7eb);border-color:#9d84d5;color:#4e377b;box-shadow:0 4px 12px rgba(93,69,145,.12)}
.learning-custom-row{display:none;margin-top:10px}
.learning-custom-row.show{display:block}
.learning-custom-row input{width:100%}
.learning-selected-note{margin-top:8px;font-size:12px;color:#6d6380;font-weight:700}
.language-control-box{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:10px 0 14px;padding:11px 12px;border:1px solid #e7e2f1;border-radius:13px;background:#fbf9ff}
.language-label{font-size:13px;font-weight:900;color:#4f5870;margin-right:2px}
.lang-btn{border:1px solid #d9d2ed;background:#fff;color:#5e6475;border-radius:999px;padding:7px 11px;font-size:12px;font-weight:900;cursor:pointer}
.lang-btn.active{background:#7157e8;color:#fff;border-color:#7157e8}
.lang-btn:disabled{opacity:.55;cursor:wait}
.translation-status{flex-basis:100%;font-size:11px;color:#7d8798;margin-top:1px}
.korean-translation{margin-top:9px;padding-top:9px;border-top:1px dashed rgba(255,255,255,.5);font-size:.92em;opacity:.9}
.korean-translation strong{display:inline-block;margin-bottom:4px}
.library-tag{display:inline-flex;align-items:center;padding:2px 6px;border-radius:999px;background:#f0ecff;color:#6552bd;font-size:10px;font-weight:800;margin-left:4px}
@media(max-width:700px){.learning-row{grid-template-columns:1fr}.language-control-box{gap:6px}.lang-btn{padding:7px 9px}}


/* First-time English story creation overlay */
.english-translation-overlay{position:fixed;inset:0;z-index:12000;background:rgba(43,31,73,.38);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;padding:22px}
.english-translation-overlay.show{display:flex}
.english-translation-card{width:min(390px,92vw);background:#fff;border:1px solid #e8defb;border-radius:26px;padding:30px 24px;text-align:center;box-shadow:0 20px 60px rgba(76,48,130,.25)}
.english-translation-card .globe{font-size:48px;line-height:1;margin-bottom:12px}
.english-translation-card h3{margin:0 0 10px;color:#5032a8;font-size:21px}
.english-translation-card p{margin:0;color:#6f6680;line-height:1.65;font-weight:600}
.english-loading-dots{display:flex;justify-content:center;gap:8px;margin-top:18px}
.english-loading-dots span{width:9px;height:9px;border-radius:50%;background:#7650e8;animation:muniEnglishDot 1.15s infinite ease-in-out}
.english-loading-dots span:nth-child(2){animation-delay:.16s}.english-loading-dots span:nth-child(3){animation-delay:.32s}
@keyframes muniEnglishDot{0%,80%,100%{transform:scale(.65);opacity:.35}40%{transform:scale(1.15);opacity:1}}
