@font-face{font-family:Nanum;src:url("assets/NanumGothic-Bold.woff") format("woff");font-weight:700;font-display:swap}
@font-face{font-family:Nanum;src:url("assets/NanumGothic-ExtraBold.woff") format("woff");font-weight:800;font-display:swap}
@font-face{font-family:Kai;src:url("assets/cwTeXKai-zhonly.woff2") format("woff2");font-display:swap}
:root{color-scheme:light;--ink:#244b42;--muted:#667d6e;--green:#247a60;--deep:#195943;--lime:#eef3d7;--cream:#fffdf4;--orange:#d56e45;--line:#d1ddbf;--gap:clamp(10px,1.5vw,22px);--pad:clamp(12px,2.3vw,34px);--leaf:34px 11px 34px 11px;--shadow:0 3px 0 #688b5f12,0 9px 24px #466f4e06;font-family:Nanum,"Malgun Gothic",sans-serif;font-weight:700}
*{box-sizing:border-box;min-width:0}
html,body{margin:0;width:100%;height:100%;overscroll-behavior:none}
body{color:var(--ink);background:#e7eedb;overflow:hidden}
body::before{content:"";position:fixed;inset:0;background:url("assets/hanja.webp") center 58%/cover;opacity:.2;pointer-events:none}
body::after{content:"";position:fixed;inset:0;background:url("assets/paper_cream.jpg") center/cover;opacity:.22;mix-blend-mode:multiply;pointer-events:none;z-index:-1}
button,input,select,textarea{font:inherit;color:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}
button{border:0}
a{color:inherit;text-decoration:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--orange);outline-offset:3px}
button:disabled{cursor:default}
button:hover:not(:disabled){filter:brightness(.985)}
button:active:not(:disabled){transform:translateY(1px)}
img{display:block;max-width:100%;object-fit:contain}
svg{width:24px;height:24px;flex-shrink:0;vertical-align:middle}
em{color:var(--orange);font-style:normal}
h1,h2,p{margin:0}
#app{position:relative;width:100%;height:100%;height:100dvh;padding:var(--pad);padding-top:max(var(--pad),env(safe-area-inset-top));padding-right:max(var(--pad),env(safe-area-inset-right));padding-bottom:max(var(--pad),env(safe-area-inset-bottom));padding-left:max(var(--pad),env(safe-area-inset-left))}
.app-shell{height:100%;display:grid;grid-template-rows:58px minmax(0,1fr);gap:var(--gap);max-width:1680px;margin:0 auto}
.app-header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px}
.brand-group,.header-tools,.playback{display:flex;align-items:center;gap:10px}
.brand-group{justify-self:start}
.brand{position:relative;white-space:nowrap;font-size:clamp(22px,2.1vw,31px);letter-spacing:-1.8px;font-weight:800}
.brand span,.home-art h2 span,.auth-art h2 span{color:var(--orange)}
.brand i{position:absolute;width:10px;height:6px;right:-7px;top:-4px;background:var(--green);border-radius:9px 0 9px 0;transform:rotate(-25deg)}
.header-heading{display:flex;align-items:center;gap:18px}
h1{font-size:clamp(20px,2vw,28px);font-weight:800;white-space:nowrap}
.context{font-size:16px;white-space:nowrap;color:var(--muted)}
.header-tools{justify-self:end}
.icon-button{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #d1dcc5;border-radius:50%;background:#fffdf1e8;flex-shrink:0}
.play-button{background:var(--green);color:white;border-color:var(--green)}
.speed-control{background:transparent;font-size:14px;padding:8px 3px;white-space:nowrap}
.account-link{font-size:15px;padding:10px 4px;white-space:nowrap}
.game-clock{font-size:23px;font-variant-numeric:tabular-nums;letter-spacing:1px}
main{min-height:0}
main>section,main>form{height:100%;min-height:0}
.panel,.card{border:1.5px solid var(--line);border-radius:var(--leaf);background:#fffef7f2;box-shadow:var(--shadow)}
.card{position:relative;display:flex;align-items:center;justify-content:center;gap:10px;text-align:center;padding:16px;font-size:clamp(22px,2.5vw,36px);font-weight:800}
.card:hover{border-color:#8eaf7e}
.card svg{position:absolute;right:18px;top:18px;color:var(--green);width:22px}
.primary,.secondary,.all-button{display:inline-flex;justify-content:center;align-items:center;gap:10px;min-height:46px;padding:10px 24px;border-radius:18px 7px;background:var(--green);color:white;border:1px solid var(--green);font-size:18px;font-weight:800}
.secondary{background:#f9f9ec;color:var(--green)}
.all-button{font-size:17px;min-height:42px;padding:8px 22px}
.all-button small{font-size:.8em;opacity:.85}
.home-layout,.menu-layout,.grade-layout,.auth-layout{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.3fr);gap:clamp(20px,4vw,60px);align-items:stretch}
.home-art,.menu-art,.auth-art{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:0;position:relative}
.home-art::before,.auth-art::before{content:"";position:absolute;inset:9% 0 8%;background:#fffdf58c;border-radius:50% 50% 38% 45%;z-index:-1}
.home-art img{width:90%;height:66%}
.home-art h2,.auth-art h2{font-size:clamp(34px,5vw,68px);font-weight:800;letter-spacing:-3px;margin-top:18px}
.home-cards{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;gap:var(--gap);padding:clamp(10px,4vh,40px) 0}
.home-cards .card{font-size:clamp(28px,3.4vw,48px)}
.home-cards .card:nth-child(2){background:#f4f5dce8}
.home-cards .card:nth-child(3){background:#f7eadbe8}
.home-cards .game-entry{background:#cfe6c5eb;border-color:#a3c59b}
.menu-art img{width:100%;height:92%;max-height:480px}
.menu-cards{display:grid;grid-template-columns:1fr 1fr;grid-auto-rows:1fr;gap:var(--gap)}
.menu-cards[data-count="3"]{grid-template-columns:1fr}
.menu-cards[data-count="5"] .card:last-child{grid-column:1/-1}
.selection{display:grid;grid-template-rows:auto minmax(0,1fr);gap:var(--gap)}
.selection-heading{display:flex;align-items:center;justify-content:space-between;min-height:46px;padding:0 6px}
.selection-heading h2{font-size:24px}
.selection-grid{display:grid;gap:var(--gap);min-height:0}
.grade-grid{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr}
.range-grid{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr))}
.range-grid strong{display:flex;align-items:center;justify-content:center;gap:8px}
.range-grid strong span{font-size:.7em;color:#8ca585}
.lesson-grid{grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-template-rows:repeat(var(--rows),minmax(0,1fr))}
.lesson-grid .card{padding:8px}
.lesson-grid strong{font-size:clamp(23px,3.2vw,42px)}
.lesson-grid small{font-size:.55em;margin-left:6px;color:var(--muted)}
.lesson-grid .current{background:#e8eed6;border-color:#abc49b}
.games-menu{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:var(--gap)}
.game-category{padding:clamp(14px,2vw,26px);display:grid;grid-template-rows:auto minmax(0,1fr);gap:var(--gap)}
.game-category h2{text-align:center;font-size:26px;padding:4px}
.game-category nav{display:grid;grid-auto-rows:1fr;gap:12px}
.game-menu-card{font-size:clamp(19px,2.5vw,30px);border-radius:20px 7px;background:#f3f6e8;padding:12px}
.game-menu-card svg{width:18px;right:10px;top:9px}
/* Client sketch: two regions above; all actual components below. */
.garden-lesson{display:grid;grid-template-rows:minmax(0,3fr) minmax(100px,1fr);gap:var(--gap)}
.lesson-top{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.9fr);gap:var(--gap);min-height:0}
.without-art .lesson-top{grid-template-columns:1fr}
.illustration{padding:clamp(10px,2vw,28px);display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:0;gap:12px}
.illustration img{width:100%;height:100%;min-height:0;flex:1;object-fit:contain}
.illustration strong{font-size:clamp(18px,2.2vw,28px);line-height:1.4;flex-shrink:0;text-align:center}
.core-picture{display:flex;flex:1;min-height:0;width:100%}
.core-picture>svg{display:none}
.picture-content,.picture-caption-slot{display:contents}
.character-card{display:grid;grid-template-columns:1.12fr 1fr;gap:clamp(10px,1.6vw,26px);padding:clamp(32px,4vh,48px) clamp(14px,2vw,30px) 20px;position:relative;min-height:0;align-items:stretch}
.counter{position:absolute;top:16px;right:22px;display:flex;gap:7px;align-items:center;color:var(--muted);font-size:16px;line-height:1;font-variant-numeric:tabular-nums;font-weight:700}
.counter b{color:var(--green)}
.glyph-box{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;padding:0;background:transparent}
.glyph-box img{width:100%;height:100%;object-fit:contain;max-height:360px;mix-blend-mode:multiply}
.lesson-explanation{display:flex;flex-direction:column;justify-content:center;gap:clamp(12px,2vh,22px);text-align:center;line-height:1.5;font-size:clamp(20px,2.3vw,32px);word-break:keep-all;overflow-wrap:anywhere}
.lesson-explanation strong{font-weight:800}
.stage-meanings p{font-size:clamp(18px,2vw,28px);color:#607465}
.stage-meanings .active-meaning{color:var(--deep);font-weight:800}
.current-reading{color:var(--deep)}
.current-reading em{color:var(--orange)}
.components{display:grid;grid-template-columns:repeat(var(--part-count),minmax(0,1fr));gap:var(--gap);min-height:0}
.part{position:relative;display:flex;align-items:center;justify-content:center;gap:clamp(10px,1.6vw,24px);padding:clamp(8px,1.2vw,20px);min-height:0;text-align:center}
.part:nth-child(3n+1){background:#edf3ddea}
.part:nth-child(3n+2){background:#f6eedbeb}
.part:nth-child(3n){background:#e4efebe8}
.part strong{font-size:clamp(18px,2vw,29px);line-height:1.35;word-break:keep-all;overflow-wrap:anywhere}
.part-symbol{display:flex;align-items:center;justify-content:center;height:100%;max-width:42%;min-width:25%}
.han{font-family:Kai,"KaiTi","Batang",serif;font-weight:400;line-height:1.1}
.part .han{font-size:clamp(42px,5.4vw,76px);color:var(--green)}
.part-image{width:70px;height:100%;max-height:88px;object-fit:contain;mix-blend-mode:multiply}
.active-part{border-color:#5d9a69!important;box-shadow:inset 0 0 0 1.5px #5d9a69,0 3px 0 #688b5f12}
.part.upcoming{color:#687b67}
.many-parts .part{gap:8px}
.many-parts .part strong{font-size:clamp(17px,1.7vw,25px)}
.many-parts .part .han{font-size:clamp(38px,4.6vw,65px)}
.without-art .character-card{grid-template-columns:1fr 1fr;padding-left:14%;padding-right:14%}
.meaning-cards .part strong{font-size:clamp(22px,2.8vw,38px)}
.word-learning{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:var(--gap)}
.word-characters{display:grid;grid-template-columns:1fr 1fr;gap:var(--gap);min-height:0}
.word-part{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(14px,3vh,30px);padding:16px}
.word-part .han{font-size:clamp(80px,13vw,190px)}
.word-part strong{font-size:clamp(22px,2.6vw,38px);line-height:1.3;word-break:keep-all}
.word-meaning{position:relative;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:24px;text-align:center;padding:42px 28px 26px}
.word-reading{font-size:clamp(30px,4vw,56px);font-weight:800;color:var(--green)}
.word-meaning p{font-size:clamp(22px,2.5vw,36px);line-height:1.65;word-break:keep-all;overflow-wrap:anywhere}
/* Existing games keep their own four-choice, six-choice or input rule. */
.quiz-layout{display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);gap:var(--gap)}
.question{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:40px 26px 28px;min-height:0;text-align:center}
.question-art{min-height:0;width:100%;flex:1;display:flex;align-items:center;justify-content:center;max-height:85%}
.question-art img{width:100%;height:100%;max-height:400px;object-fit:contain;mix-blend-mode:multiply}
.picture-caption{font-size:clamp(20px,2.3vw,32px);line-height:1.35}
.question-readings{display:flex;flex-direction:column;justify-content:center;gap:16px;font-size:clamp(26px,3.5vw,48px);line-height:1.3}
.question-word{font-size:clamp(80px,12vw,180px);white-space:nowrap}
.choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:var(--gap);min-height:0}
.choices[data-count="6"]{grid-template-rows:repeat(3,minmax(0,1fr))}
.choice{padding:16px;min-height:0;font-size:clamp(24px,3vw,40px);line-height:1.35}
.choice:nth-child(4n+2){background:#f4f3e1f2}
.choice:nth-child(4n+3){background:#edf3e2f2}
.choice strong{word-break:keep-all;overflow-wrap:anywhere}
.choice.long-choice{font-size:clamp(19px,2.3vw,32px);line-height:1.3;padding:10px}
.choice.image-choice{display:flex;flex-direction:column;gap:4px}
.image-choice img{width:100%;height:100%;min-height:0;max-height:76%;object-fit:contain;mix-blend-mode:multiply}
.image-choice strong{font-size:clamp(20px,2.2vw,30px);flex-shrink:0}
.quiz-layout[data-mode="core-reverse"] .image-choice img{max-height:100%}
.choice-state{position:absolute;top:12px;right:12px;display:flex}
.choice-state svg{position:static;width:26px;height:26px}
.choice.correct{border-color:var(--green);background:#dbecd4;box-shadow:inset 0 0 0 2px var(--green)}
.choice.incorrect{border-color:#c55a40;background:#fff1e7}
.choice.incorrect .choice-state svg{color:#bb493b}
.choice.correct .choice-state svg{color:var(--green)}
.feedback{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none}
.feedback:empty{display:none}
.feedback svg{width:80px;height:80px;padding:14px;border-radius:50%;background:#f4f9e5e8;color:var(--green);box-shadow:0 2px 20px #244b421a}
.found-count{position:absolute;bottom:15px;right:22px;font-size:17px;color:var(--green)}
.typing{align-self:center;display:flex;flex-direction:column;gap:22px;padding:clamp(24px,4vw,56px)}
.typing label{font-size:24px}
.typing input{width:100%;height:76px;background:#f8faef;border:2px solid #b6cba3;border-radius:16px;text-align:center;font-size:34px;outline-offset:3px}
.typing .primary{font-size:23px;height:58px}
.typing.correct{border-color:var(--green)}.typing.incorrect{border-color:#bd6045}
/* Membership retains original fields; this offline edition does not submit them. */
.auth-art img{height:64%;width:90%}
.auth-form{align-self:center;display:flex;flex-direction:column;gap:22px;padding:clamp(24px,4vw,60px);width:100%;max-width:590px;justify-self:center}
.field{display:flex;flex-direction:column;gap:7px;min-height:0}
.field>span{font-size:17px;line-height:1.25}
.field input,.field select,.field textarea{width:100%;height:44px;border:1px solid #b8c8a5;background:#fffef8;border-radius:9px;padding:8px 12px;font-size:18px;font-weight:700}
.field textarea{resize:none}
.auth-form .field input{height:58px;font-size:23px}
.remember,.auth-links{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:15px}
.remember label{display:flex;align-items:center;gap:4px;white-space:nowrap}
input[type="checkbox"]{accent-color:var(--green);width:18px;height:18px;flex-shrink:0}
.auth-links button{background:transparent;padding:8px 0;font-size:15px}
.auth-form .primary{height:54px;font-size:21px}
.join-layout{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--gap);padding:clamp(8px,4vh,40px) 0}
.join-card{display:flex;flex-direction:column;gap:24px;padding:24px}
.join-card img{height:65%;width:100%;min-height:0}
.join-card strong{font-size:clamp(28px,3.6vw,48px)}
.signup-form{display:flex;flex-direction:column;justify-content:center;gap:16px;padding:clamp(16px,2.5vw,34px);max-width:1300px;margin:0 auto}
.fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px 24px;min-height:0}
.student-form .fields{grid-template-columns:repeat(4,minmax(0,1fr))}
.form-footer{display:flex;justify-content:space-between;align-items:center;gap:12px}
.agreement{display:flex;align-items:center;gap:7px;font-size:16px}
.duties{display:flex;align-items:center;gap:18px;font-size:16px}
.duties label{display:flex;align-items:center;gap:4px}
.form-notice:empty{display:none}
.form-notice{color:var(--orange);font-size:14px}
.leave-form{max-width:900px}
.leave-form .fields{grid-template-columns:1fr 1fr}
.leave-form .field:last-child{grid-column:1/-1}
.leave-form .field textarea{height:100px}
.leave-form .form-footer{justify-content:flex-end}
.notice-dialog{max-width:min(90vw,500px);border:1px solid var(--line);border-radius:24px;padding:30px;color:var(--ink);background:var(--cream);font-size:20px;line-height:1.6}
.notice-dialog::backdrop{background:#193e3466}
.notice-dialog>button,.notice-dialog>div{margin-top:24px}
.notice-dialog>div{display:flex;gap:12px}
.notice-dialog p{word-break:keep-all}
/* Results use only the record made in this browser. */
.result-layout{display:grid;grid-template-columns:1.1fr 1fr;gap:var(--gap)}
.score-panel,.rank-panel{display:flex;flex-direction:column;justify-content:center;gap:28px;padding:clamp(20px,3vw,44px);min-height:0}
.score-number{font-size:clamp(70px,9vw,130px);font-weight:800;text-align:center;color:var(--green)}
.score-number small{font-size:.32em;color:var(--muted)}
.score-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.score-stats>div{display:flex;flex-direction:column;align-items:center;gap:12px;text-align:center}
.score-stats span{font-size:17px;color:var(--muted)}
.score-stats strong{font-size:28px}
.score-note{text-align:center;font-size:15px;color:var(--muted)}
.result-layout .rank-panel{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);justify-content:stretch;padding-inline:0}
.rank-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-inline:clamp(14px,2vw,28px)}
.rank-heading h2{font-size:25px}
.rank-limit{flex:none;font-size:12px;font-weight:800;letter-spacing:.03em;color:var(--green);white-space:nowrap}
.rank-panel p{font-size:21px;line-height:1.7;text-align:center;word-break:keep-all}
.rank-scroll{min-height:0;min-width:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;scrollbar-width:thin;scrollbar-color:#91ad91 transparent}
.rank-scroll:focus-visible{outline:2px solid var(--green);outline-offset:-2px}
.rank-panel ol{margin:0;padding:0;list-style:none}
.rank-panel li{display:grid;grid-template-columns:6ch minmax(0,1fr) auto;align-items:center;gap:8px;min-height:48px;padding:10px clamp(14px,2vw,28px);font-size:18px;line-height:1.35}
.rank-panel li:nth-child(odd){background:#e8f0d9}
.rank-panel li:nth-child(even){background:#f7f2e5}
.rank-panel li b,.rank-panel li strong{text-align:center}
.rank-panel li strong{min-width:0;overflow-wrap:anywhere}
.rank-panel li b,.rank-panel li span{font-variant-numeric:tabular-nums;white-space:nowrap}
.rank-panel li.mine{box-shadow:inset 4px 0 var(--green)}
.rank-panel li.rank-outside{margin-top:12px;border-top:2px dashed #91ad91}
.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;text-align:center;padding:30px}
.empty-state h2{font-size:clamp(23px,3vw,34px)}
.empty-state p{font-size:19px;line-height:1.6}
.empty-mark{display:flex;align-items:center;justify-content:center;width:80px;height:80px;border-radius:50%;background:#e4efd6;color:var(--green)}
.empty-mark svg{width:38px;height:38px}
@media(min-aspect-ratio:18/10) and (min-height:600px){
 .garden-lesson{grid-template-rows:minmax(0,3.2fr) minmax(100px,1fr)}
 .illustration{padding:20px}
}
@media(orientation:portrait){
 :root{--pad:clamp(12px,3vw,24px);--gap:clamp(10px,2.5vw,18px);--leaf:25px 9px 25px 9px}
 .app-shell{grid-template-rows:74px minmax(0,1fr)}
 .app-header{grid-template-columns:1fr auto;grid-template-rows:36px 30px;gap:8px}
 .brand{font-size:24px}
 .brand-group{grid-column:1;grid-row:1;gap:8px}
 .header-tools{grid-column:2;grid-row:1}
 .header-heading{grid-column:1/-1;grid-row:2;justify-content:space-between;padding:0 2px}
 .header-heading h1{font-size:21px}
 .context{font-size:14px}
 .icon-button{width:36px;height:36px}
 .icon-button svg{width:20px;height:20px}
 .playback{gap:5px}
 .speed-control{font-size:12px}
 .study-header .brand{font-size:20px}
 .study-header .brand-group{gap:5px}
 .account-link{font-size:13px;padding:8px 2px}
 .home-layout,.menu-layout,.grade-layout,.auth-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,.65fr) minmax(0,1fr);gap:var(--gap)}
 .home-art{flex-direction:row;gap:12px}
 .home-art img{height:95%;width:48%;max-width:220px}
 .home-art h2{font-size:clamp(33px,6vw,52px);margin:0;letter-spacing:-2px}
 .home-art::before{inset:0 3%}
 .home-cards{padding:0}
 .home-cards .card{font-size:clamp(27px,5vw,42px)}
 .menu-layout{grid-template-rows:minmax(0,.45fr) minmax(0,1fr)}
 .menu-art img{width:90%;height:100%}
 .menu-cards{grid-template-columns:1fr 1fr}
 .menu-cards .card{font-size:clamp(22px,4.8vw,34px)}
 .menu-cards[data-count="3"]{grid-template-columns:1fr}
 .card svg{width:18px;top:12px;right:12px}
 .grade-layout{grid-template-rows:minmax(0,.43fr) minmax(0,1fr)}
 .grade-grid .card{font-size:clamp(23px,5vw,36px);padding:10px}
 .range-grid{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr))}
 .range-grid .card{font-size:clamp(20px,4.8vw,32px);padding:8px}
 .range-grid strong{gap:3px}
 .selection-heading h2{font-size:21px}
 .selection-heading{min-height:38px}
 .all-button{font-size:15px;min-height:38px;padding:7px 16px}
 .lesson-grid strong{font-size:clamp(22px,5.3vw,36px)}
 .lesson-grid .card{border-radius:19px 6px;padding:5px}
 .lesson-grid small{margin-left:3px}
 /* Match the nine-grade screen: its lower grid takes 1 / (0.43 + 1)
    of the available height and contains three rows with two gaps. */
 .lesson-selection{container-type:size}
 .lesson-grid{
  --grade-button-height:calc(((100cqh - var(--gap)) / 1.43 - 2 * var(--gap)) / 3);
  --lesson-available-height:calc((100% - (var(--portrait-rows) - 1) * var(--gap)) / var(--portrait-rows));
  grid-template-columns:repeat(3,minmax(0,1fr));
  grid-template-rows:repeat(var(--portrait-rows),minmax(0,min(var(--grade-button-height),var(--lesson-available-height))));
  align-content:start;
 }
 .games-menu{grid-template-columns:1fr;grid-template-rows:1.25fr 1fr .85fr}
 .game-category{grid-template-rows:auto 1fr;padding:12px;gap:10px}
 .game-category h2{font-size:20px;padding:0}
 .game-category nav{grid-template-columns:1fr 1fr;gap:8px}
 .game-category:nth-child(2) .card:last-child{grid-column:1/-1}
 .game-menu-card{font-size:19px;padding:10px}
 .game-menu-card svg{width:15px;right:8px;top:7px}
 .garden-lesson{grid-template-rows:minmax(0,1.3fr) minmax(0,1fr)}
 .garden-lesson[data-parts="1"]{grid-template-rows:minmax(0,3fr) minmax(0,1fr)}
 .garden-lesson[data-parts="2"]{grid-template-rows:minmax(0,1.8fr) minmax(0,1fr)}
 .garden-lesson.many-parts{grid-template-rows:minmax(0,1fr) minmax(0,1.15fr)}
 /* Keep the visible core lesson halves stable for one through four meanings.
    The detached font reference keeps its original proportions. */
 main>.garden-lesson.core-learning{grid-template-rows:repeat(2,minmax(0,1fr))}
 .core-learning .illustration{padding:6px;gap:8px}
 .core-learning .illustration strong{padding-inline:4px}
 .core-picture>img{display:none}
 .core-picture>svg{display:block;width:100%;height:100%;min-height:0;overflow:hidden;mix-blend-mode:multiply}
 .lesson-top{grid-template-columns:minmax(0,1fr) minmax(0,1.15fr)}
 .character-card{display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto;padding:30px 10px 14px;gap:8px}
 .glyph-box img{max-height:240px}
 .illustration{padding:12px;gap:10px}
 .illustration strong{font-size:clamp(17px,3.8vw,25px)}
 .counter{font-size:13px;top:12px;right:14px;gap:5px}
 .lesson-explanation{font-size:clamp(20px,4.8vw,31px);line-height:1.35;gap:5px}
 .stage-meanings p{font-size:clamp(16px,3.8vw,25px)}
 .components{grid-template-columns:1fr;grid-template-rows:repeat(var(--part-count),minmax(0,1fr));gap:8px}
 .part{justify-content:center;padding:5px 14px;gap:22px}
 .part-symbol{width:24%;max-width:24%;min-width:0}
 .part .han,.many-parts .part .han{font-size:clamp(32px,8vw,58px)}
 .part-image{width:52px;max-height:62px}
 .part strong,.many-parts .part strong{font-size:clamp(20px,4.8vw,29px)}
 .many-parts .part{gap:18px}
 .without-art .character-card{grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:30px 20px 14px;gap:16px}
 .without-art .glyph-box{align-self:center}
 .meaning-cards .part strong{font-size:clamp(22px,5vw,32px)}
 .core-learning .character-card{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto}
 .word-learning{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(0,.8fr)}
 .word-part .han{font-size:clamp(80px,23vw,160px)}
 .word-part strong{font-size:clamp(21px,5vw,32px)}
 .word-part{gap:14px;padding:12px}
 .word-meaning{gap:15px;padding:30px 22px 20px}
 .word-reading{font-size:clamp(30px,8vw,45px)}
 .word-meaning p{font-size:clamp(22px,5vw,30px);line-height:1.5}
 .quiz-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(0,1.1fr)}
 .multi-quiz{grid-template-rows:minmax(0,.8fr) minmax(0,1.2fr)}
 .question{padding:28px 20px 16px;gap:6px}
 .question-art{max-height:100%}
 .question-readings{font-size:clamp(24px,6vw,38px);gap:6px}
 .picture-caption{font-size:clamp(20px,4.8vw,28px)}
 .question-word{font-size:clamp(80px,22vw,140px)}
 .choice{font-size:clamp(24px,5.8vw,36px);padding:12px}
 .image-choice img{max-height:73%}
 .image-choice strong{font-size:clamp(18px,4.5vw,28px)}
 .choice-state{top:8px;right:8px}
 .choice-state svg{width:21px;height:21px}
 .found-count{font-size:14px;right:14px;bottom:11px}
 .input-quiz{grid-template-rows:minmax(0,1.5fr) minmax(0,1fr)}
 .typing{align-self:stretch;justify-content:center;padding:20px;gap:12px}
 .typing label{font-size:20px}
 .typing input{height:55px;font-size:28px}
 .typing .primary{height:46px;min-height:44px;font-size:20px}
 .auth-layout{grid-template-rows:minmax(0,.45fr) auto}
 .auth-art{flex-direction:row;gap:16px}
 .auth-art img{height:100%;width:48%}
 .auth-art h2{font-size:36px;margin:0}
 .auth-form{padding:22px;gap:16px}
 .auth-form .field input{height:48px;font-size:20px}
 .auth-form .primary{height:48px}
 .remember,.auth-links button{font-size:13px}
 .join-layout{grid-template-columns:1fr;grid-template-rows:repeat(3,minmax(0,1fr));padding:0}
 .join-card{flex-direction:row;gap:28px;padding:16px}
 .join-card img{width:45%;height:100%}
 .join-card strong{font-size:32px;width:40%}
 .signup-form{padding:16px;gap:12px;justify-content:center}
 .fields,.student-form .fields{grid-template-columns:1fr 1fr;gap:12px}
 .field{gap:5px}
 .field>span{font-size:14px}
 .field input,.field select,.field textarea{height:38px;font-size:16px;padding:6px 8px}
 .form-footer{gap:8px}
 .form-footer .primary{font-size:16px;padding:8px 16px;min-height:38px}
 .agreement{font-size:13px;gap:3px}
 .duties{gap:8px;font-size:13px;flex-wrap:wrap}
 .duties label{gap:2px}
 .leave-form .field textarea{height:100px}
 .result-layout{grid-template-columns:1fr;grid-template-rows:minmax(0,1.4fr) minmax(0,1fr)}
 .score-panel,.rank-panel{padding:22px;gap:20px}
 .score-number{font-size:82px}
 .score-stats{gap:8px}
 .score-stats span{font-size:14px}
 .score-stats strong{font-size:24px}
 .rank-heading h2{font-size:22px}
 .rank-panel p{font-size:18px}
 .rank-panel li{font-size:16px;padding:5px 8px}
}
@media(orientation:portrait) and (max-height:700px){
 :root{--pad:10px;--gap:8px}
 .app-shell{grid-template-rows:68px minmax(0,1fr)}
 .app-header{grid-template-rows:32px 28px;gap:6px}
 .brand{font-size:22px}
 .study-header .brand{font-size:18px}
 .icon-button{width:32px;height:32px}
 .playback{gap:3px}
 .speed-control{font-size:11px}
 .header-heading h1{font-size:19px}
 .context{font-size:13px}
 .home-art h2{font-size:32px}
 .lesson-explanation{font-size:20px;gap:3px}
 .stage-meanings p{font-size:15px}
 .character-card{padding:26px 8px 9px;gap:4px}
 .illustration{padding:8px}
 .illustration strong{font-size:16px}
 .part strong,.many-parts .part strong{font-size:19px}
 .part .han,.many-parts .part .han{font-size:32px}
 .components{gap:6px}
 .counter{top:10px;right:11px;font-size:12px}
 .word-meaning{padding:27px 16px 12px;gap:10px}
 .word-meaning p{font-size:20px}
 .word-part .han{font-size:78px}
 .word-part strong{font-size:20px}
 .question{padding:25px 16px 15px}
 .choice{font-size:23px}
 .choice.long-choice{font-size:18px;line-height:1.25;padding:8px}
 .image-choice strong{font-size:18px}
 .typing{padding:15px;gap:8px}
 .typing label{font-size:17px}
 .typing input{height:46px}
 .typing .primary{height:40px;min-height:40px}
 .signup-form{padding:12px;gap:8px}
 .fields,.student-form .fields{gap:6px 10px}
 .field{gap:2px}
 .field>span{font-size:14px}
 .field input,.field select{height:32px;font-size:16px;padding:4px 7px}
 .form-footer .primary{min-height:34px;padding:6px 12px;font-size:15px}
 .agreement{font-size:12px}
 .duties{font-size:12px}
 .auth-form{padding:20px;gap:12px}
 .auth-form .field input{height:43px}
 .auth-form .field>span{font-size:16px}
 .remember{font-size:12px;gap:5px}
 .auth-art h2{font-size:30px}
 .auth-links button{font-size:12px}
 .game-category{padding:10px;gap:8px}
 .game-category h2{font-size:18px}
 .game-menu-card{font-size:18px;padding:7px}
 .result-layout{grid-template-rows:minmax(0,1.2fr) minmax(0,1fr)}
 .score-panel,.rank-panel{padding:14px;gap:10px}
 .score-number{font-size:54px;line-height:1.1}
 .score-stats>div{gap:6px}
 .score-stats span{font-size:12px;line-height:1.2}
 .score-stats strong{font-size:22px;line-height:1.2}
 .score-note{font-size:12px;line-height:1.4}
 .score-panel .primary{font-size:16px;min-height:36px;padding:7px 12px}
 .rank-heading h2{font-size:19px}
 .rank-panel li{font-size:14px;padding:3px 6px}
}
@media(orientation:landscape) and (max-height:600px){
 :root{--pad:12px;--gap:10px;--leaf:24px 8px 24px 8px}
 .app-shell{grid-template-rows:42px minmax(0,1fr)}
 .app-header{gap:10px;grid-template-columns:auto 1fr auto}
 .brand-group{gap:8px}
 .brand{font-size:23px}
 .header-heading{gap:12px;justify-content:center}
 .header-heading h1{font-size:21px}
 .context{font-size:13px}
 .icon-button{width:35px;height:35px}
 .icon-button svg{width:20px;height:20px}
 .playback{gap:5px}
 .speed-control{font-size:12px}
 .home-cards{padding:10px 0}
 .home-art h2{font-size:38px;margin-top:8px}
 .menu-layout,.home-layout,.grade-layout,.auth-layout{gap:22px}
 .card{font-size:25px;padding:10px}
 .card svg{top:10px;right:10px;width:17px}
 .home-cards .card{font-size:31px}
 .menu-art img{height:95%}
 .selection-heading{min-height:34px}
 .selection-heading h2{font-size:20px}
 .all-button{min-height:34px;font-size:14px;padding:6px 15px}
 .lesson-grid strong{font-size:26px}
 .lesson-grid .card{border-radius:14px 5px;padding:4px}
 .garden-lesson{grid-template-rows:minmax(0,2.65fr) minmax(66px,1fr)}
 .character-card{padding:25px 14px 12px;gap:10px}
 .illustration{padding:10px;gap:5px}
 .illustration strong{font-size:18px}
 .counter{top:10px;right:13px;font-size:12px}
 .lesson-explanation{font-size:24px;gap:8px;line-height:1.4}
 .stage-meanings p{font-size:19px}
 .components{gap:8px}
 .part{padding:6px 9px;gap:10px}
 .part strong{font-size:21px}
 .part .han{font-size:45px}
 .many-parts .part strong{font-size:18px}
 .many-parts .part .han{font-size:38px}
 .part-image{max-height:58px}
 .word-part{padding:12px;gap:12px}
 .word-part .han{font-size:95px}
 .word-part strong{font-size:24px}
 .word-meaning{padding:28px 20px 18px;gap:18px}
 .word-reading{font-size:34px}
 .word-meaning p{font-size:23px;line-height:1.45}
 .question{padding:28px 16px 16px;gap:5px}
 .picture-caption{font-size:21px}
 .question-readings{font-size:32px;gap:9px}
 .question-word{font-size:105px}
 .choice{font-size:28px;padding:10px}
 .image-choice strong{font-size:20px}
 .typing{padding:22px;gap:14px}
 .typing label{font-size:20px}
 .typing input{height:54px;font-size:28px}
 .typing .primary{height:44px;min-height:44px;font-size:20px}
 .auth-art h2{font-size:40px}
 .auth-form{padding:20px;gap:12px}
 .field>span{font-size:14px}
 .field{gap:4px}
 .auth-form .field input{height:40px;font-size:19px}
 .auth-form .primary{height:42px;min-height:40px;font-size:18px}
 .remember,.auth-links button{font-size:12px}
 .signup-form{padding:14px 18px;gap:10px}
 .fields,.student-form .fields{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px 14px}
 .field input,.field select{height:34px;font-size:16px;padding:5px 8px}
 .form-footer .primary{min-height:35px;padding:6px 18px;font-size:16px}
 .agreement,.duties{font-size:14px}
 .leave-form .fields{grid-template-columns:repeat(4,minmax(0,1fr))}
 .leave-form .field textarea{height:65px}
 .join-layout{padding:8px 0}
 .join-card{gap:16px}
 .join-card strong{font-size:29px}
 .game-category{padding:14px;gap:10px}
 .game-category h2{font-size:22px}
 .game-category nav{gap:8px}
 .game-menu-card{font-size:20px;padding:8px}
 .score-panel,.rank-panel{padding:20px;gap:18px}
 .score-number{font-size:75px}
 .score-stats span{font-size:14px}
 .score-stats strong{font-size:22px}
 .rank-panel p{font-size:18px}
}
@media(orientation:landscape) and (max-height:360px){
 :root{--pad:8px;--gap:7px}
 .app-shell{grid-template-rows:34px minmax(0,1fr)}
 .app-header{gap:6px}
 .brand{font-size:20px}
 .brand-group{gap:6px}
 .header-heading{gap:8px}
 .header-heading h1{font-size:18px}
 .context{font-size:11px}
 .study-header .brand{font-size:18px}
 .icon-button{width:30px;height:30px}
 .playback{gap:3px}
 .speed-control{font-size:10px}
 .account-link{font-size:12px}
 .garden-lesson{grid-template-rows:minmax(0,2.7fr) minmax(54px,1fr)}
 .character-card{padding:21px 9px 7px;gap:6px}
 .counter{top:8px;right:10px;font-size:11px}
 .lesson-explanation{font-size:19px;gap:4px}
 .stage-meanings p{font-size:15px}
 .illustration{padding:7px}
 .illustration strong{font-size:16px}
 .part strong{font-size:18px}
 .part .han{font-size:36px}
 .many-parts .part strong{font-size:15px}
 .many-parts .part .han{font-size:30px}
 .part-image{max-height:40px}
 .lesson-grid strong{font-size:21px}
 .lesson-grid small{font-size:.6em}
 .range-grid .card,.grade-grid .card{font-size:22px}
 .selection-heading h2{font-size:18px}
 .selection-heading{min-height:30px}
 .all-button{min-height:30px;font-size:13px}
 .question{padding:22px 12px 12px}
 .question-readings{font-size:27px;gap:6px}
 .picture-caption{font-size:17px}
 .choice{font-size:24px}
 .choice.long-choice{font-size:18px;line-height:1.25;padding:8px}
 .image-choice strong{font-size:17px}
 .typing{padding:16px;gap:10px}
 .typing input{height:43px;font-size:24px}
 .typing .primary{height:38px;min-height:38px}
 .word-part .han{font-size:78px}
 .word-part strong{font-size:20px}
 .word-reading{font-size:28px}
 .word-meaning{gap:10px;padding:24px 16px 12px}
 .word-meaning p{font-size:19px}
 .fields,.student-form .fields{gap:5px 9px}
 .field{gap:2px}
 .field>span{font-size:14px}
 .field input,.field select{height:27px;font-size:16px;padding:3px 6px}
 .signup-form{padding:9px 12px;gap:7px}
 .form-footer .primary{min-height:30px;font-size:14px;padding:4px 15px}
 .agreement,.duties{font-size:12px}
 input[type="checkbox"]{width:15px;height:15px}
 .auth-form{padding:13px 18px;gap:8px}
 .auth-form .field>span{font-size:13px}
 .auth-form .field input{height:32px;font-size:17px}
 .auth-form .primary{height:34px;min-height:34px;font-size:17px}
 .auth-links button{padding:4px 0}
 .remember{font-size:11px;gap:4px}
 .home-art h2,.auth-art h2{font-size:31px}
 .home-cards .card{font-size:27px}
 .menu-cards .card{font-size:23px}
 .card svg{width:15px;right:8px;top:8px}
 .game-category{padding:9px;gap:7px}
 .game-category h2{font-size:19px}
 .game-category nav{gap:6px}
 .game-menu-card{font-size:17px;padding:6px}
 .game-menu-card svg{width:13px}
 .score-number{font-size:60px}
 .score-panel,.rank-panel{padding:16px;gap:13px}
 .score-panel .primary{font-size:16px;min-height:36px;padding:6px 12px}
 .score-stats span{font-size:12px}
 .score-stats strong{font-size:19px}
 .rank-panel p{font-size:16px}
 .rank-panel li{font-size:14px;padding:3px 6px}
 .score-note{font-size:12px}
 .rank-heading h2{font-size:20px}
}
/* Card-relative Korean type. Only the requested study/game regions opt in. */
.fit-slot{display:flex;align-items:center;justify-content:center;min-height:0;min-width:0;width:100%;height:100%;flex:1}
.fit-slot>[data-fit-text]{display:block;flex:none;width:max-content;max-width:none;margin:0;white-space:nowrap;word-break:normal;overflow-wrap:normal;line-height:1.12;text-align:center}
.fit-slot>[data-fit-wrap]{line-height:1.4}
.fit-slot>[data-fit-reading]{line-height:1.3}
.fit-slot>.fit-wrapped{width:calc(100% - 4px);white-space:normal;word-break:keep-all;overflow-wrap:normal}
.lesson-explanation.fit-group,.question-readings.fit-group{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(var(--fit-rows),minmax(0,1fr));width:100%;height:100%;min-height:0;gap:clamp(4px,1vh,12px)}
.lesson-explanation.stage-meanings.fit-group{display:flex;flex-direction:column;justify-content:center;row-gap:clamp(8px,1vh,14px)}
.stage-meanings.fit-group>.fit-slot{flex:0 0 auto;height:auto}
.fit-group[data-reading-group]{display:flex;flex-direction:column;justify-content:center;row-gap:clamp(8px,1vh,12px)}
.fit-group[data-reading-group]>.fit-slot{flex:0 0 auto;height:auto}
.character-learning .part-symbol{flex:0 0 25%;width:25%;min-width:0;max-width:25%}
.character-learning .part .fit-slot{width:0}
.quiz-layout[data-mode="hanja-meaning"] .choice .fit-slot{width:100%}
@media(orientation:portrait){
 .with-art .character-card{grid-template-rows:minmax(0,1.1fr) minmax(0,1fr)}
 .without-art .character-card{grid-template-rows:minmax(0,1fr)}
}
/* All three reading modes use the same fixed regions. The hidden typography
   reference is intentionally excluded so game font sizes do not change. */
.study-lesson{grid-template-columns:minmax(0,1fr)}
.study-lesson .components{grid-template-columns:repeat(max(3,var(--part-count)),minmax(0,1fr))}
.study-lesson .part.active-part{background:#c3d9a4}
.study-lesson .part.active-part:nth-child(3n+2){background:#e9cf95}
.study-lesson .part.active-part:nth-child(3n){background:#afd1c1}
.study-lesson .character-card{grid-template-columns:minmax(0,1.12fr) minmax(0,1fr)}
.study-lesson .part-symbol{flex:0 0 25%;width:25%;min-width:0;max-width:25%;height:100%;display:flex;align-items:center;justify-content:center;container-type:size}
.study-lesson .part-symbol .han{font-size:min(76px,5.4vw,95cqw,85cqh);line-height:1}
.study-lesson .part .fit-slot{width:0}
.study-lesson .stage-meanings [data-fit-text]{font-weight:700;overflow-wrap:anywhere}
.study-lesson .stage-meanings.fit-group{row-gap:clamp(4px,1vh,12px)}
.study-lesson .word-explanation .current-reading{color:var(--deep)}
.study-lesson .word-glyph{container-type:size}
.study-lesson .word-glyph>.han{display:flex;justify-content:center;font-size:min(150px,43cqw,85cqh);line-height:1.1;white-space:nowrap}
.study-lesson .active-word-character{color:var(--green)}
/* Keep the three-card width, centering the actual group when there are fewer. */
@media(orientation:landscape){
 .study-lesson .components[data-count="1"]>.part{grid-column:2}
 .study-lesson .components[data-count="2"]{grid-template-columns:repeat(6,minmax(0,1fr))}
 .study-lesson .components[data-count="2"]>.part:first-child{grid-column:2/span 2}
 .study-lesson .components[data-count="2"]>.part:nth-child(2){grid-column:4/span 2}
}
@media(orientation:portrait){
 main>.study-lesson[data-parts]{grid-template-rows:repeat(2,minmax(0,1fr))}
 .study-lesson .components{grid-template-columns:1fr;grid-template-rows:repeat(max(3,var(--part-count)),minmax(0,1fr));align-content:start}
 /* Caption size follows its own picture card, including on small phones. */
 .study-lesson.core-learning .illustration{container-type:size}
 /* The outer 6px inset keeps the caption size reference. Inner insets match
    the adjacent character card's 30px/10px/14px padding and two equal rows. */
 .study-lesson.core-learning .picture-content{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr));gap:8px;padding:24px 4px 8px;width:100%;height:100%;min-height:0;min-width:0}
 .study-lesson.core-learning .core-picture{height:100%}
 .study-lesson.core-learning .picture-caption-slot{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;min-width:0}
 .study-lesson.core-learning .picture-caption-slot>strong{display:block;width:calc(100% - 4px);font-size:clamp(20px,min(18cqw,8cqh),40px);line-height:1.3;max-width:100%;overflow-wrap:anywhere}
 .study-lesson.with-art .character-card{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) minmax(0,1fr)}
 .study-lesson.without-art .character-card{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);padding-inline:12px}
 .study-lesson .part-symbol .han{font-size:min(58px,10vw,95cqw,85cqh)}
 .study-lesson .word-glyph>.han{font-size:min(130px,43cqw,85cqh)}
}
@media(orientation:portrait) and (max-height:700px){
 .study-lesson.core-learning .picture-content{padding:20px 2px 3px;gap:4px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
