/* Illustrated garden and collectible learning cards. */
body[data-screen='home'] .site-head{background:#fffdf4f5;border-bottom-color:#dce5c8}
#home-screen.home-screen{position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(180px,.85fr) minmax(0,2.8fr);gap:clamp(18px,3vw,44px);padding:clamp(18px,3vw,46px);border-radius:0;box-shadow:none;background:#cbdcaa;overflow:hidden}
#home-screen>.forest-scenery{border-radius:0}
#home-screen .forest-distance{background-position:center 65%}
#home-screen .forest-sky-shade{background:linear-gradient(180deg,#f8f8d91c,#eff3dd24 60%,#9fb87c14);mix-blend-mode:normal}
#home-screen .forest-character-shadow{display:none}
#home-screen .home-companion,#home-screen .home-practice{position:relative;z-index:2}
#home-screen .home-companion{gap:10px;padding-top:12px}
#home-screen .character-room{background:linear-gradient(180deg,#fffdf29e,#fffdf218 45%,#fffdf230);border:1px solid #fffdf4ab;border-radius:28px;box-shadow:0 10px 28px #25462918;padding:16px 12px;color:#244b35;backdrop-filter:blur(2px)}
#home-screen .home-stats{font-size:15px;z-index:2}
#home-screen .home-stats>strong{padding:5px 9px;background:#fff8e7dc;border:1px solid #d7bc74;border-radius:10px;color:#79602c}
#home-screen #home-character-art{width:100%;padding:12px 0 0;filter:drop-shadow(0 8px 6px #2d4b2825)}
#home-screen .home-friend-name{font-size:clamp(18px,2vw,26px);text-shadow:0 1px 8px #fff9}
#home-screen #home-progress{height:8px;margin:7px 0}
#home-screen .home-shop-hint{font-size:12px}
.home-weather{margin:0;padding:7px 10px;border-radius:10px;background:#fffdf3e8;border:1px solid #ffffff9e;color:#3d5d43;font-size:13px;line-height:1.45;text-align:center}
#home-screen .home-footer .button{min-height:42px;font-size:14px;border-radius:12px;background:#fffdf1ee;border-color:#becaa7;box-shadow:0 2px 0 #8d9e6c26}
#home-screen .home-practice{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto minmax(0,1fr);gap:18px;align-items:center;min-height:0}
.home-invitation{grid-column:1/-1;text-align:center;color:#294d36;padding:4px 12px 8px;background:radial-gradient(ellipse,#fffdf2bd,transparent 73%);text-shadow:0 2px 12px #fff}
.home-invitation h2{font-size:clamp(20px,2.6vw,34px);font-weight:700;line-height:1.35;margin:0 0 6px}
.home-invitation p{font-size:16px;margin:0;line-height:1.5}
#home-screen .practice-launch{display:block;position:relative;aspect-ratio:2/3;width:100%;max-width:350px;max-height:100%;height:auto;min-height:0;padding:0;justify-self:center;border:0;border-radius:20px;background:none;box-shadow:0 12px 24px #334d2938;perspective:1100px;transform:rotate(var(--card-tilt,0deg));transition:transform .2s,filter .2s}
#home-screen .launch-numbers{--card-tilt:-3deg}
#home-screen .launch-english{--card-tilt:3deg}
#home-screen .practice-launch:hover{transform:translateY(-8px) rotate(0deg);filter:brightness(1.035)}
#home-screen .practice-launch:focus-visible{outline:4px solid #35694b;outline-offset:6px;transform:translateY(-6px) rotate(0deg)}
#home-screen .practice-launch:disabled{cursor:wait;opacity:1}
.learning-card-inner{display:block;width:100%;height:100%;aspect-ratio:2/3;transform-style:preserve-3d;position:relative}
.learning-card-front,.learning-card-back{position:absolute;inset:0;display:block;border-radius:20px;overflow:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.learning-card-front{background:#fff4d7}
.learning-card-front img{position:absolute;width:100%;height:100%;inset:0;object-fit:fill}
#home-screen .learning-card-front>strong{position:absolute;top:8%;left:8%;right:8%;font-size:clamp(23px,3vw,40px);line-height:1.3;color:#3b5639;font-weight:700;text-align:center;letter-spacing:.04em}
#home-screen .launch-words .learning-card-front>strong{color:#975c57}
#home-screen .launch-english .learning-card-front>strong{color:#5a628a}
.learning-card-caption{position:absolute;bottom:8%;left:7%;right:7%;text-align:center;font-size:clamp(12px,1.3vw,16px);line-height:1.4;color:#68573b;font-weight:500}
.learning-card-back{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;transform:rotateY(180deg);border:8px double #dac58b;background:radial-gradient(circle at 50% 45%,#4f7c60,#204b3b);color:#fff2ce;box-shadow:inset 0 0 0 10px #416951}
.learning-card-back::before{content:'';position:absolute;inset:18px;border:1px solid #bfa96b;border-radius:12px}
.learning-card-back .card-sprout{font-size:52px;color:#ead18d}
#home-screen .learning-card-back strong{font-size:30px}
.learning-card-back>span:last-child{font-size:14px}
/* The practice rail keeps the tools and a single content-picker button. */
.version-switch[hidden],.session-bar[hidden]{display:none!important}
:root[data-writing-display='true'] .rail-controls>.version-row{height:auto;min-height:42px;padding:0;background:none;border:0;display:flex}
:root[data-writing-display='true'] .rail-controls #mobile-library-open{display:flex!important;width:100%;height:40px;min-height:40px;align-items:center;justify-content:center;gap:7px;font-size:14px;background:var(--ui-surface);border:1px solid var(--ui-control-line);border-radius:var(--ui-radius)}
#mobile-library-open::after{content:'글자 고르기'}
.practice-level-buttons{gap:6px}
.practice-level-buttons button{min-width:65px;font-size:14px;min-height:40px}
.count-presets{grid-template-columns:repeat(4,minmax(0,1fr))!important}
/* One unified settings page. */
:root[data-writing-display='true'] #settings-dialog.settings-dialog{width:min(760px,calc(var(--app-width,100vw) - 32px));height:min(680px,calc(var(--app-height,100dvh) - 24px));max-height:calc(var(--app-height,100dvh) - 24px);border-radius:18px}
#settings-dialog .settings-body{display:grid;grid-template-columns:1fr 1fr;gap:16px;padding:16px;align-content:start}
#settings-dialog .settings-section{display:flex;flex-direction:column;gap:14px;padding:16px;border:1px solid #dce4d2;border-radius:14px;background:#fbfcf6;min-width:0}
#settings-dialog .settings-section>h3{font-size:18px;margin:0;color:#305e43}
#settings-dialog .settings-ranges{display:flex;gap:14px}
#settings-dialog .range-setting{display:flex;flex-direction:column;align-items:stretch;gap:7px;min-height:0}
.setting-label{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:14px}
#settings-dialog .range-setting output{font-size:14px;line-height:20px}
.setting-steps{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
#settings-dialog .setting-steps button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-width:0;min-height:50px;padding:6px 2px;background:#fffdf4;border:1px solid #bdcdb2;border-radius:8px;font:inherit;color:#46634b}
.setting-steps button>span{font-size:13px;font-weight:600;white-space:nowrap}.setting-steps button>small{font-size:10px;line-height:1.3;white-space:nowrap}
#settings-dialog .setting-steps button[aria-pressed='true'],#settings-dialog .voice-speeds button[aria-pressed='true']{background:#34714d;border-color:#34714d;color:#fff}
#settings-dialog .settings-toggles{gap:0}
#settings-dialog .settings-help{margin:0;font-size:14px;line-height:1.6}
#settings-dialog .voice-choices button{background:#fffef9;min-height:64px}
#settings-dialog .voice-choices button[aria-pressed='true']{background:#e7f0de}
#settings-dialog .voice-samples{margin-top:auto}
#settings-dialog .weather-setting{grid-column:1/-1}
.weather-setting p{font-size:14px;line-height:1.6;margin:0;color:#4c6751}
.weather-actions{display:flex;gap:8px}.weather-actions .button{flex:1;min-height:40px;font-size:14px}
.weather-credit{font-size:12px;color:#526e53;text-underline-offset:3px}
#settings-dialog .dialog-foot{justify-content:flex-start;min-height:58px;padding:10px 16px}
#settings-dialog .settings-done{margin-left:auto;min-width:88px}
/* Canvas controls share the same proportions, surfaces and states as the other menus. */
:root[data-writing-display='true'] .stroke-order .stroke-actions>:is(#read-aloud,#stroke-play,#stroke-next){min-height:36px;height:36px;border:1px solid var(--ui-control-line);border-radius:var(--ui-radius);background:var(--ui-surface);color:var(--ui-text);padding:6px 10px;font:500 13px Paperlogy,sans-serif;box-shadow:none;letter-spacing:0}
:root[data-writing-display='true'] .stroke-order .stroke-actions>:is(#read-aloud,#stroke-play,#stroke-next)[aria-pressed='true']{background:#e4eedc;border-color:#9eb494;color:#2e5f3c}
/* The old full-width editing row must leave room for grading and navigation. */
:root[data-writing-display='true'] #practice-actions .edit-tools{width:auto;flex:0 1 auto;justify-content:flex-start}
:root[data-writing-display='true'] #practice-actions .problem-actions{width:auto;flex:0 0 auto;margin-left:auto}
@media(max-height:600px){#home-screen.home-screen{padding:14px 24px;gap:22px;grid-template-columns:minmax(160px,.82fr) minmax(0,2.8fr)}#home-screen .home-practice{gap:10px;grid-template-rows:52px minmax(0,1fr)}.home-invitation{padding:0}.home-invitation h2{font-size:22px;margin-bottom:2px}.home-invitation p{font-size:13px}#home-screen .home-companion{padding-top:0;gap:6px}#home-screen .character-room{padding:9px;border-radius:20px}#home-screen .home-footer .button{min-height:36px;font-size:13px}#home-screen .home-friend-name{font-size:18px}.home-weather{font-size:11px;padding:4px 6px}#home-screen .home-shop-hint{font-size:11px}#home-screen .practice-launch{height:100%;width:auto;max-width:100%;max-height:100%;box-shadow:0 7px 14px #334d2938}#home-screen .learning-card-front>strong{font-size:24px}.learning-card-caption{font-size:11px}#settings-dialog .settings-body{gap:12px;padding:12px}#settings-dialog .settings-section{padding:12px;gap:10px}}
@media(max-width:620px){#settings-dialog .settings-body{grid-template-columns:1fr}#settings-dialog .weather-setting{grid-column:1}}
@media(prefers-reduced-motion:reduce){#home-screen .practice-launch{transition:none}#home-screen .practice-launch:hover{transform:rotate(var(--card-tilt,0deg))}}

/* Long words keep their letter size on a taller, scrollable sheet. */
.paper-viewport{position:absolute;inset:0 0 30px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:auto}
.paper-sheet{position:relative;width:100%;min-height:100%}
.paper-sheet>canvas{position:absolute;inset:0;width:100%;height:100%}
.paper-scroll{position:absolute;right:22px;bottom:36px;z-index:5;display:flex;gap:6px;pointer-events:auto}
.paper-scroll[hidden]{display:none}
.paper-scroll .button{min-height:36px;font-size:12px;padding:5px 9px;background:#fffdf1ef;border-color:#b9c9ae;box-shadow:0 2px 5px #344c2822}
