:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #3d4e47;
  background: #fbf9f3;
  font-synthesis: none;
  --ink: #3d4e47;
  --muted: #738174;
  --green: #527e69;
  --green-dark: #3c6652;
  --paper: #fffefa;
  --border: #ecece3;
  --pink: #f5c8b9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .32; }
button:focus-visible, a:focus-visible { outline: 3px solid #e5ad67; outline-offset: 5px; }
button:not(:disabled), a { -webkit-tap-highlight-color: transparent; }
button:not(:disabled):active { transform: translateY(1px) scale(.98); }
a { color: inherit; }
svg { display: block; }
.icon { width: 24px; height: 24px; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.app-header { height: 88px; max-width: 1320px; margin: auto; padding: 0 50px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0; text-align: left; }
.brand img { width: 48px; height: 48px; border-radius: 15px; }
.brand-title { font-size: 21px; font-weight: 750; letter-spacing: 1px; }
.main-nav { display: flex; gap: 8px; padding: 6px; border: 1px solid #ecebe2; border-radius: 21px; background: #f3f2e9; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 13px 22px; border-radius: 15px; font-size: 14px; font-weight: 600; color: #6c7a6b; white-space: nowrap; }
.nav-item .icon { width: 19px; height: 19px; }
.nav-item.active { color: #5d7b65; background: #fffefa; box-shadow: 0 3px 9px #73765e0b; }
.header-end { display: flex; align-items: center; gap: 17px; }
.save-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #969c8f; white-space: nowrap; }
.save-status .status-dot { width: 5px; height: 5px; border-radius: 50%; background: #9ab58d; }
.round-button { width: 44px; height: 44px; flex: 0 0 44px; aspect-ratio: 1; padding: 0; display: grid; place-items: center; border: 1px solid #e8e8dd; border-radius: 50%; background: #fffefa; color: #8c9686; }
.round-button .icon { width: 20px; height: 20px; }
.home { max-width: 1220px; padding: 12px 50px 44px; margin: auto; }
.welcome { min-height: 198px; position: relative; display: flex; align-items: center; padding: 26px 32px; border: 0; border-radius: 24px; background: #e8f1e6; overflow: hidden; }
.welcome-copy { position: relative; z-index: 1; max-width: 57%; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #8d9a76; letter-spacing: 2px; font-weight: 600; }
.eyebrow .icon { height: 15px; width: 15px; }
.welcome h1 { margin: 15px 0 12px; font-size: clamp(28px, 3.4vw, 38px); font-weight: 750; letter-spacing: 2px; line-height: 1.35; }
.welcome h1 span { position: relative; display: inline-block; color: #65816b; }
.welcome p { color: #637d67; font-size: 14px; line-height: 1.9; margin: 16px 0 0; }
.gallery-top { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; margin-bottom: 18px; gap: 12px; }
.section-heading { display: flex; gap: 12px; align-items: center; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: .7px; font-weight: 700; }
.section-heading small { font-size: 12px; color: #7c887b; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; font-size: 13px; color: #527a62; padding: 8px 0 8px 12px; }
.text-button .icon { width: 17px; height: 17px; }
.category-tabs { display: flex; gap: 10px; padding: 0 0 24px; overflow: auto; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { display: flex; align-items: center; gap: 8px; padding: 12px 19px; min-height: 47px; white-space: nowrap; border: 1px solid #e9e9de; border-radius: 15px; color: #667768; font-size: 13px; background: #fffefa; }
.category-tab .icon { width: 19px; height: 19px; }
.category-tab.active { background: #657f69; border-color: #657f69; color: #fffefa; box-shadow: 0 4px 9px #5c785714; }
.category-tab .count { font-size: 10px; opacity: .65; margin-left: 3px; }
.lesson-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.lesson-card { text-align: left; padding: 0; border-radius: 22px; background: #fffefa; border: 1px solid #ebece2; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.lesson-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px #6871550c; }
.lesson-picture { height: 188px; position: relative; padding: 7px 22px; margin: 7px 7px 0; border-radius: 17px; overflow: hidden; }
.lesson-picture::before { content: ''; position: absolute; width: 128px; height: 128px; background: #ffffff56; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.lesson-picture svg { width: 100%; height: 100%; position: relative; transition: transform .25s; }
.lesson-card:hover .lesson-picture svg { transform: rotate(-2deg) scale(1.06); }
.lesson-info { display: flex; align-items: center; justify-content: space-between; padding: 16px 17px 17px; }
.lesson-info h3 { margin: 0 0 6px; font-weight: 650; font-size: 15px; letter-spacing: .5px; }
.lesson-info p { margin: 0; color: #7c887b; font-size: 11px; display: flex; gap: 5px; align-items: center; }
.step-dot { width: 4px; height: 4px; border-radius: 50%; background: #bcc9ae; }
.card-start { width: 30px; height: 30px; border-radius: 50%; background: #f3f4ec; color: #97a188; display: grid; place-items: center; }
.card-start .icon { width: 16px; height: 16px; }
.resume-card { display: flex; align-items: center; gap: 14px; padding: 13px 19px; margin-top: 18px; border-radius: 18px; border: 1px dashed #d4ddc8; background: #f5f5eb; }
.resume-card img { width: 52px; height: 52px; object-fit: contain; border-radius: 9px; background: white; }
.resume-copy { flex: 1; }
.resume-copy strong { font-size: 13px; display: block; }
.resume-copy span { font-size: 11px; color: #9aa18a; display: block; margin-top: 5px; }
.small-button { display: flex; align-items: center; gap: 6px; border-radius: 12px; padding: 11px 15px; background: #fffefa; border: 1px solid #e3e8d9; color: #6b8265; font-size: 12px; }
.small-button .icon { width: 16px; height: 16px; }

.hero-friends { margin-left: auto; display: flex; align-items: center; gap: 10px; padding-left: 25px; }
.hero-friend { width: 128px; height: 144px; border-radius: 24px; padding: 8px; }
.hero-friend svg { width: 100%; height: 100%; }
.hero-friend:nth-child(2) { transform: translateY(-8px) rotate(3deg); }
.hero-friend:first-child { transform: rotate(-5deg); }
.hero-friend:last-child { transform: rotate(5deg); }
.action-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 11px 18px; border: 1px solid #dce7db; border-radius: 18px; background: #fffefa; color: #52735b; font-size: 14px; font-weight: 650; white-space: nowrap; }
.action-button .icon { width: 20px; height: 20px; }
.action-button.primary { background: #527e69; border-color: #527e69; color: white; }
.next-step { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 11px 18px; border-radius: 15px; background: #527e69; color: white; font-size: 14px; font-weight: 650; white-space: nowrap; }
.next-step .icon { width: 19px; height: 19px; }

.gallery-page { max-width: 1220px; padding: 36px 50px 60px; margin: auto; }
.gallery-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 30px; }
.gallery-heading h1 { font-size: 30px; letter-spacing: 2px; margin: 0 0 12px; }
.gallery-heading p { font-size: 13px; color: #9b9f8c; margin: 0; }
.art-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 23px; }
.art-card { background: #fffefa; border: 1px solid #e8eade; border-radius: 22px; overflow: hidden; }
.art-image-button { display: block; padding: 12px; width: 100%; position: relative; background: #f2f3e9; }
.art-image-button img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fffefa; border-radius: 13px; }
.art-badge { position: absolute; top: 23px; left: 23px; padding: 5px 9px; border-radius: 8px; font-size: 10px; background: #ffffffde; color: #99a17f; }
.art-meta { display: flex; justify-content: space-between; align-items: center; padding: 17px; }
.art-meta strong { display: block; font-size: 14px; font-weight: 600; }
.art-meta span { display: block; font-size: 10px; color: #a5a894; margin-top: 7px; }
.art-meta-actions { display: flex; gap: 6px; }
.art-meta-actions button { width: 44px; height: 44px; display: grid; place-items: center; background: #f3f4eb; border-radius: 10px; color: #9da58c; }
.art-meta-actions .icon { width: 16px; height: 16px; }
.empty-gallery { margin: 55px auto; max-width: 450px; text-align: center; padding: 40px; }
.empty-gallery > .icon { width: 75px; height: 75px; color: #b3c19f; margin: 0 auto 24px; stroke-width: 1; }
.empty-gallery h2 { font-size: 23px; font-weight: 600; }
.empty-gallery p { color: #a0a48f; font-size: 13px; line-height: 1.9; margin-bottom: 27px; }
.empty-gallery .next-step { margin: auto; width: max-content; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: #34432e45; backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade-in .2s ease; }
.modal { position: relative; width: min(100%, 450px); max-height: calc(100svh - 48px); overflow: auto; padding: 32px; border-radius: 28px; background: #fffef8; box-shadow: 0 20px 90px #27372320; outline: none; }
.modal-close { position: absolute; right: 16px; top: 16px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #a8ae99; background: #f2f3e9; }
.modal-close .icon { width: 18px; height: 18px; }
.modal h2 { margin: 2px 0 13px; font-size: 22px; font-weight: 650; letter-spacing: 1px; }
.modal-intro { margin: 0 0 23px; font-size: 12px; line-height: 1.9; color: #71816f; }
.setting-label { font-size: 12px; font-weight: 600; color: #849171; margin: 24px 0 12px; }
.assist-options { display: flex; flex-direction: column; gap: 9px; }
.assist-option { display: flex; align-items: center; gap: 13px; text-align: left; border: 1px solid #e8ebdd; border-radius: 16px; padding: 15px; background: #fcfcf5; }
.assist-option.selected { background: #eff4e7; border-color: #c6d7b7; }
.assist-symbol { width: 34px; height: 34px; display: grid; place-items: center; color: #95a77f; font-size: 26px; }
.assist-option strong { font-size: 13px; font-weight: 600; display: block; }
.assist-option small { font-size: 11px; line-height: 1.7; display: block; color: #71816f; margin-top: 5px; }
.assist-copy { flex: 1; min-width: 0; }
.selection-slot { width: 18px; flex: 0 0 18px; }
.assist-option .selection-check { width: 18px; height: 18px; color: #7b9a66; }
.setting-row { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #eff0e6; margin-top: 17px; padding-top: 15px; gap: 15px; }
.setting-row strong { display: block; font-size: 13px; font-weight: 600; }
.setting-row small { display: block; font-size: 12px; color: #71816f; margin-top: 6px; }
.switch { position: relative; width: 52px; height: 44px; border: 0; background: transparent; padding: 0; flex: 0 0 auto; }
.switch::before { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 28px; border-radius: 20px; background: #dce2d7; }
.switch::after { content: ''; position: absolute; left: 4px; top: 12px; width: 20px; height: 20px; background: white; border-radius: 50%; box-shadow: 0 1px 3px #00000012; transition: transform .2s; }
.switch.on { background: transparent; }
.switch.on::before { background: #7f9e73; }
.switch.on::after { transform: translateX(24px); }
.settings-footnote { font-size: 10px; color: #74816d; line-height: 1.8; margin: 23px 0 0; }
.modal-actions { display: flex; gap: 12px; margin-top: 25px; }
.modal-actions button, .modal-actions a { flex: 1; }
.secondary-button { min-height: 45px; padding: 12px 16px; border: 1px solid #e1e7d5; background: #f6f7ef; color: #8b967b; border-radius: 14px; font-size: 13px; }
.completion { text-align: center; padding-top: 37px; }
.completion .modal-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.completion .modal-actions .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.completion .modal-actions .next-step { grid-column: 1 / -1; }
.completion .celebration { width: 43px; height: 43px; margin: 0 auto 15px; color: #d5a283; }
.completion h2 { font-size: 25px; }
.completion-image { width: min(100%,240px); aspect-ratio: 1; object-fit: contain; display: block; margin: 18px auto; border-radius: 18px; background: #f8f8ee; border: 1px solid #eeeee1; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%,15px); opacity: 0; pointer-events: none; padding: 13px 23px; border-radius: 15px; background: #4f6653ed; color: #fffef5; font-size: 13px; z-index: 50; transition: opacity .2s, transform .2s; max-width: 90%; text-align: center; line-height: 1.8; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.settings-shortcuts { display: flex; gap: 10px; margin-top: 22px; }
.settings-shortcuts .secondary-button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; }
.settings-shortcuts .icon { width: 18px; height: 18px; }


/* A single full-screen canvas; all controls are floating, reachable islands. */
.studio-mode { overflow: hidden; }
.studio { position: fixed; inset: 0; isolation: isolate; background: #fffefb; }
.paper-wrap { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; }
#drawing-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.studio-topline { position: absolute; z-index: 5; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.studio-topline > * { pointer-events: auto; }
.studio-back { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 13px 8px 8px; border: 1px solid #e4e9df; border-radius: 18px; background: #fffefbf5; font-size: 14px; font-weight: 650; text-align: left; }
.studio-back .icon { width: 24px; height: 24px; }
.studio-back small { display: block; font-size: 10px; font-weight: 400; color: #788b79; margin-top: 3px; }
.studio-actions { display: flex; align-items: center; gap: 10px; }
.reference-trigger { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; padding: 3px; border: 1px solid #dce6db; border-radius: 50%; background: #fffefb; overflow: hidden; }
.reference-trigger svg { width: 100%; height: 100%; }
.reference-trigger[aria-expanded="true"] { border-color: #749a7c; box-shadow: 0 0 0 2px #dcebdd; }
.lesson-reference { position: absolute; z-index: 6; top: 90px; right: max(196px, calc(env(safe-area-inset-right) + 180px)); width: 190px; padding: 8px; border: 1px solid #e0e8dd; border-radius: 12px; background: #fffefb; box-shadow: 0 6px 24px #334b3020; }
.lesson-reference-heading { display: flex; align-items: center; justify-content: space-between; padding-left: 5px; color: #526b56; font-size: 12px; }
.reference-close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #71836e; }
.reference-close .icon { width: 18px; height: 18px; }
.lesson-reference-image { width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 8px; }
.lesson-reference-image svg { display: block; width: 100%; height: 100%; }
.studio-settings { height: 48px; width: 48px; flex-basis: 48px; color: #68826d; border-color: #e4e9df; background: #fffefbf5; }
.studio-settings .icon { width: 23px; height: 23px; }
.tool-dock, .palette-panel, .brush-panel, .lesson-bar { background: #fffefbf5; border: 1px solid #e4e9df; box-shadow: 0 4px 20px #41583e08; }
.tool-dock { position: absolute; z-index: 5; left: max(16px, env(safe-area-inset-left)); top: 90px; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 7px; border-radius: 24px; }
.tool-button { min-height: 58px; width: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 17px; color: #73836f; font-size: 11px; font-weight: 550; border: 1px solid transparent; }
.tool-button .icon { width: 28px; height: 28px; }
.tool-button.selected { background: #e8f1e5; border-color: #d3e4cf; color: #426c4e; }
.tool-button[data-tool="fill"] { color: #b97f41; }
.tool-button[data-tool="eraser"] { color: #a4839d; }
.dock-divider { width: 32px; height: 1px; margin: 3px 0; background: #e8ebdf; }
.palette-panel { position: absolute; z-index: 5; right: max(16px, env(safe-area-inset-right)); top: 90px; width: 170px; padding: 9px 7px 5px; border-radius: 24px; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 3px; }
.color-swatch { width: 46px; height: 46px; display: grid; place-items: center; padding: 5px; margin: auto; border-radius: 50%; border: 2px solid transparent; }
.color-swatch > span { display: block; width: 34px; height: 34px; background: var(--swatch); border-radius: 50%; box-shadow: inset 0 0 0 1px #0000000c; }
.color-swatch.selected { border-color: var(--swatch); }
.color-swatch.white > span { border: 1px solid #dce3da; }
.color-swatch.white.selected { border-color: #85997c; }
.size-preview-button { margin-top: 9px; min-height: 48px; width: 100%; border-top: 1px solid #e8ebdf; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 11px; color: #6e806d; }
.brush-dot { display: inline-block; width: var(--brush-size, 8px); height: var(--brush-size, 8px); flex: 0 0 auto; border-radius: 50%; background: var(--brush-color, #eb927f); box-shadow: inset 0 0 0 1px #0000000c; }
.brush-panel { position: absolute; z-index: 7; top: 90px; left: max(106px, calc(env(safe-area-inset-left) + 90px)); width: 330px; max-width: calc(100% - 242px); max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 17px 16px; border-radius: 24px; }
.brush-panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.brush-panel-heading > strong { font-size: 17px; }
.panel-close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #f1f4eb; color: #71836e; }
.panel-close .icon { width: 20px; height: 20px; }
.brush-grid, .pattern-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.brush-option { min-width: 0; min-height: 64px; padding: 8px 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px solid #e9eddf; background: #f7f8f0; border-radius: 15px; font-size: 11px; color: #65785d; }
.brush-option .icon { width: 28px; height: 28px; }
.brush-option.selected { color: #436c4e; background: #e8f1e5; border-color: #b4cfab; }
.brush-option[data-tool="rainbow"] { color: #ad7398; }
.brush-option[data-tool="heart"], .brush-option[data-tool="flower"] { color: #cb8190; }
.brush-option[data-tool="star"], .brush-option[data-tool="sparkle"] { color: #b69347; }
.brush-option[data-tool="butterfly"], .brush-option[data-tool="music"] { color: #9280b6; }
.brush-section-title { font-size: 12px; color: #788772; font-weight: 550; margin: 18px 0 10px; }
.brush-size { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e8ebdf; }
.brush-size-heading { display: flex; align-items: center; justify-content: space-between; height: 34px; font-size: 12px; }
.size-sample { display: flex; align-items: center; gap: 12px; min-width: 65px; justify-content: flex-end; }
.size-sample output { min-width: 26px; font-size: 11px; font-variant-numeric: tabular-nums; color: #7c8a72; }
[data-brush-size] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 5px 0 0; padding: 0; background: transparent; touch-action: none; cursor: pointer; }
[data-brush-size]::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; background: linear-gradient(to right, #7c9f78 0 var(--range-progress, 12%), #e6ebdd var(--range-progress, 12%) 100%); }
[data-brush-size]::-moz-range-track { height: 8px; border-radius: 8px; background: #e6ebdd; }
[data-brush-size]::-moz-range-progress { height: 8px; border-radius: 8px; background: #7c9f78; }
[data-brush-size]::-webkit-slider-thumb { -webkit-appearance: none; height: 30px; width: 30px; border-radius: 50%; margin-top: -11px; border: 3px solid white; background: #688c69; box-shadow: 0 1px 6px #43613b26; }
[data-brush-size]::-moz-range-thumb { height: 25px; width: 25px; border-radius: 50%; border: 3px solid white; background: #688c69; }
[data-brush-size]:focus-visible { outline: 2px solid #b8cfaa; border-radius: 10px; }
.range-labels { display: flex; justify-content: space-between; color: #829076; font-size: 10px; }
.assist-hint { display: none; }
.lesson-bar { position: absolute; z-index: 4; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 24px; width: min(760px, calc(100% - 280px)); }
.instruction-line { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.instruction-copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
#step-progress { font-size: 10px; color: #7b8d74; font-weight: 600; }
#instruction-text { font-size: 13px; color: #49644d; line-height: 1.5; }
.listen-button { flex: 0 0 44px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #eaf2e3; color: #6c8a5d; }
.listen-button .icon { width: 21px; height: 21px; }
.demo-button { display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; min-width: 62px; min-height: 54px; padding: 5px 8px; border: 1px solid #dce9d4; border-radius: 15px; background: #edf5e8; color: #53784b; font-size: 12px; font-weight: 550; flex: 0 0 auto; }
.demo-button .icon { width: 22px; height: 22px; }
.step-navigation { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.step-navigation .previous { display: grid; place-items: center; height: 44px; width: 44px; color: #7c8b73; border-radius: 14px; background: #f0f3e8; }
.step-navigation .next-step { min-width: 98px; }
.free-bar { width: max-content; max-width: calc(100% - 300px); }
.rotate-notice { display: none; }
@media(max-width:1100px) {
  .app-header { padding: 0 28px; }
  .home, .gallery-page { padding-left: 28px; padding-right: 28px; }
  .header-end .save-status { display: none; }
  .hero-friend { width: 105px; height: 120px; }
  .lesson-grid { gap: 15px; }
  .lesson-picture { height: 175px; padding: 6px 10px; }
  .lesson-info { padding: 14px; }
}
@media(max-width:850px) {
  .app-header { padding: 0 20px; gap: 12px; }
  .brand-title { font-size: 17px; }
  .brand img { width: 40px; height: 40px; }
  .nav-item { padding: 12px 14px; font-size: 12px; }
  .home, .gallery-page { padding-left: 20px; padding-right: 20px; }
  .welcome { padding: 22px 25px; min-height: 170px; }
  .welcome h1 { font-size: 30px; }
  .hero-friends { gap: 8px; }
  .hero-friend { width: 88px; height: 105px; border-radius: 18px; }
  .hero-friend:last-child { display: none; }
  .lesson-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .art-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:600px) {
  .app-header { min-height: 132px; flex-wrap: wrap; gap: 12px; padding: 16px 18px; }
  .brand { flex: 1 1 0; min-width: 0; }
  .brand > span { min-width: 0; overflow: hidden; }
  .brand-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-end { flex: 0 0 auto; }
  .main-nav { width: 100%; order: 3; justify-content: center; }
  .nav-item { flex: 1; min-width: 0; justify-content: center; gap: 5px; padding-inline: 6px; }
  .home, .gallery-page { padding-left: 18px; padding-right: 18px; }
  .welcome { padding: 20px; min-height: 155px; border-radius: 22px; }
  .welcome-copy { min-width: 0; }
  .eyebrow { overflow-wrap: anywhere; }
  .welcome h1 { font-size: 26px; }
  .welcome p { font-size: 12px; }
  .eyebrow { letter-spacing: 0; font-size: 11px; }
  .hero-friends { padding-left: 8px; }
  .hero-friend { width: 80px; height: 100px; }
  .hero-friend:nth-child(2) { display: none; }
  .lesson-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .lesson-picture { height: 150px; padding: 5px; }
  .lesson-info { padding: 12px; }
  .lesson-info h3 { font-size: 13px; }
  .lesson-info p { font-size: 10px; }
  .section-heading { gap: 8px; }
  .section-heading h2 { font-size: 19px; }
  .section-heading small { font-size: 10px; }
  .gallery-top .text-button { font-size: 11px; }
  .category-tabs { gap: 8px; }
  .category-tab { padding: 11px 14px; font-size: 12px; }
  .resume-card { padding: 11px; gap: 9px; }
  .resume-copy span { font-size: 10px; }
  .resume-card img { width: 44px; height: 44px; }
  .resume-card .small-button { padding: 10px; }
  .modal { padding: 30px 22px; }
  .gallery-heading h1 { font-size: 24px; letter-spacing: 0; }
  .gallery-heading p { font-size: 11px; }
  .art-grid { gap: 12px; }
  .art-meta { padding: 12px; flex-wrap: wrap; gap: 10px; }
}
@media (max-height:600px) and (orientation:landscape) {
  .app-header { height: 70px; }
  .welcome { min-height: 130px; padding-top: 16px; padding-bottom: 16px; }
  .welcome h1 { font-size: 28px; margin: 10px 0 0; }
  .welcome p { margin-top: 8px; }
  .hero-friend { height: 100px; width: 92px; }
  .studio-topline { top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); }
  .studio-back { min-height: 44px; font-size: 12px; border-radius: 15px; padding: 5px 12px 5px 6px; }
  .studio-back small { display: none; }
  .studio-settings { height: 44px; width: 44px; flex-basis: 44px; }
  .reference-trigger { width: 44px; height: 44px; flex-basis: 44px; }
  .lesson-reference { top: 64px; right: max(132px, calc(env(safe-area-inset-right) + 122px)); width: min(160px, calc(100dvh - 140px)); }
  .studio-actions { gap: 8px; }
  .studio-actions .action-button { min-height: 44px; padding: 8px 14px; font-size: 12px; border-radius: 15px; }
  .tool-dock { top: 64px; left: max(10px, env(safe-area-inset-left)); width: 62px; gap: 2px; padding: 5px; border-radius: 20px; }
  .tool-button { width: 50px; min-height: 46px; gap: 2px; font-size: 9px; border-radius: 13px; }
  .tool-button .icon { width: 23px; height: 23px; }
  .dock-divider { margin: 1px 0; }
  .palette-panel { top: 64px; right: max(10px, env(safe-area-inset-right)); width: 112px; padding: 5px; border-radius: 20px; }
  .colors { grid-template-columns: repeat(2, 1fr); gap: 0; }
  .color-swatch { height: 44px; width: 46px; padding: 3px; border-radius: 19px; }
  .color-swatch > span { width: 30px; height: 30px; }
  .size-preview-button { min-height: 44px; margin-top: 3px; }
  .lesson-bar { width: calc(100% - 236px); max-width: 650px; padding: 6px; gap: 7px; bottom: max(8px, env(safe-area-inset-bottom)); border-radius: 20px; }
  #instruction-text { font-size: 11px; }
  #step-progress { font-size: 9px; }
  .instruction-line { gap: 7px; }
  .step-navigation { gap: 4px; }
  .step-navigation .next-step { min-width: 80px; min-height: 44px; padding: 8px 12px; font-size: 11px; gap: 5px; }
  .step-navigation .previous { width: 44px; }
  .demo-button { min-width: 62px; min-height: 48px; font-size: 12px; padding: 4px 7px; border-radius: 12px; }
  .brush-panel { left: max(82px, calc(env(safe-area-inset-left) + 72px)); top: 64px; width: 350px; max-width: calc(100% - 218px); max-height: calc(100dvh - 76px); padding: 10px 15px; border-radius: 20px; }
  .brush-panel-heading { margin-bottom: 5px; }
  .brush-panel-heading > strong { font-size: 15px; }
  .brush-option { min-height: 50px; padding: 5px 2px; gap: 3px; font-size: 10px; }
  .brush-option .icon { width: 22px; height: 22px; }
  .brush-section-title { margin: 12px 0 8px; }
  .brush-size { margin-top: 10px; padding-top: 8px; }
  .brush-size-heading { height: 30px; }
  [data-brush-size] { margin-top: 0; }
}
@media (max-height:450px) and (orientation:landscape) {
  .palette-panel { width: 162px; }
  .lesson-reference { right: max(182px, calc(env(safe-area-inset-right) + 172px)); }
  .colors { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .color-swatch { height: 44px; width: 44px; }
  .size-preview-button { margin-top: 5px; }
  .lesson-bar { left: max(82px, calc(env(safe-area-inset-left) + 72px)); transform: none; width: calc(100% - 270px); }
  .brush-panel { max-width: calc(100% - 270px); }
  .brush-panel-heading { height: 34px; }
  .brush-panel-heading .panel-close { height: 34px; width: 44px; }
  .brush-size { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 0 12px; align-items: center; }
  .brush-size-heading { height: 36px; gap: 8px; }
  .brush-size-heading label { font-size: 10px; }
  .size-sample { min-width: 20px; }
  .size-sample output { display: none; }
  .range-labels { grid-column: 2; }
}
@media (max-width:700px) and (max-height:450px) and (orientation:landscape) {
  .lesson-bar { flex-wrap: wrap; }
  .instruction-line { flex: 1 1 100%; }
  .step-navigation { margin-left: auto; }
  .free-bar .instruction-line { flex-basis: auto; }
}
.palette-size { margin-top: 9px; padding: 9px 4px 0; border-top: 1px solid #e8ebdf; }
.palette-size-heading { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 7px; font-size: 11px; color: #72856c; }
.palette-size [data-brush-size] { margin: 0; }
.icon-pencil { color: #c58270; }
.icon-crayon { color: #bc9454; }
.icon-rainbow { color: #a67da3; }
.icon-bucket { color: #71a5b2; }
.icon-eraser { color: #a78db7; }
.tool-button.selected .icon-pencil { color: #a96450; }
@media (orientation:portrait) and (min-width:601px) {
  .lesson-bar { width: calc(100% - 220px); max-width: 760px; flex-wrap: wrap; }
  .instruction-line { flex-basis: calc(100% - 82px); }
  .step-navigation { width: 100%; justify-content: flex-end; }
  .brush-panel { max-width: calc(100% - 245px); }
  .free-bar { width: max-content; }
}
@media (max-width:600px) and (orientation:portrait) {
  .studio-topline { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); gap: 8px; }
  .studio-back { min-height: 44px; font-size: 12px; padding: 6px; gap: 3px; min-width: 0; max-width: calc(100% - 205px); }
  .studio-back > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .studio-back small { display: none; }
  .studio-settings { height: 44px; width: 44px; flex-basis: 44px; }
  .reference-trigger { width: 44px; height: 44px; flex-basis: 44px; }
  .lesson-reference { top: max(64px, calc(env(safe-area-inset-top) + 54px)); right: max(10px, env(safe-area-inset-right)); width: min(165px, 44vw); }
  .studio-actions { gap: 7px; }
  .studio-actions .action-button { min-height: 44px; font-size: 12px; padding: 9px 12px; border-radius: 16px; }
  .studio { --lesson-space: 158px; }
  .studio.is-free { --lesson-space: 86px; }
  .tool-dock { left: 10px; right: 10px; top: auto; bottom: max(var(--lesson-space), calc(env(safe-area-inset-bottom) + var(--lesson-space) - 12px)); width: auto; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); padding: 5px; gap: 4px; border-radius: 20px; }
  .dock-divider { display: none; }
  .tool-button { width: 100%; min-height: 48px; font-size: 10px; gap: 2px; border-radius: 14px; }
  .tool-button .icon { width: 25px; height: 25px; }
  .palette-panel { left: 10px; right: 10px; top: auto; bottom: max(calc(var(--lesson-space) + 66px), calc(env(safe-area-inset-bottom) + var(--lesson-space) + 54px)); width: auto; height: 66px; display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 20px; }
  .colors { display: flex; flex: 1; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; }
  .colors::-webkit-scrollbar { display: none; }
  .color-swatch { flex: 0 0 44px; width: 44px; height: 44px; padding: 4px; scroll-snap-align: start; }
  .color-swatch > span { width: 32px; height: 32px; }
  .palette-size { flex: 0 0 112px; width: 112px; padding: 0 0 0 9px; margin: 0; border-top: 0; border-left: 1px solid #e8ebdf; }
  .palette-size-heading { height: 22px; }
  .lesson-bar { left: 10px; right: 10px; transform: none; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; max-width: none; gap: 8px; padding: 9px; flex-wrap: wrap; border-radius: 22px; }
  .instruction-line { flex: 1 1 calc(100% - 78px); gap: 8px; }
  #instruction-text { font-size: 12px; }
  .step-navigation { width: 100%; justify-content: flex-end; }
  .step-navigation .next-step { min-width: 112px; }
  .brush-panel { top: auto; bottom: max(calc(var(--lesson-space) + 66px), calc(env(safe-area-inset-bottom) + var(--lesson-space) + 54px)); left: 10px; right: 10px; width: auto; max-width: none; max-height: calc(100dvh - 285px); padding: 12px; border-radius: 22px; }
  .brush-grid, .pattern-grid { gap: 5px; }
  .brush-option { min-height: 61px; padding: 6px 0; gap: 5px; font-size: 10px; border-radius: 12px; }
  .brush-option .icon { width: 23px; height: 23px; }
  .free-bar .step-navigation { display: none; }
}

.modal h2 { padding-right: 42px; }
.name-setting { margin: 0 0 24px; }
.name-setting > label { display: block; font-size: 13px; font-weight: 650; }
.name-setting > small { display: block; margin: 6px 0 10px; font-size: 11px; color: #71816f; }
.name-setting-row { display: flex; align-items: center; gap: 8px; }
.name-setting-row input { width: 0; flex: 1; min-width: 0; min-height: 46px; padding: 10px 12px; border: 1px solid #dce5d7; border-radius: 13px; background: #fffefb; color: var(--ink); -webkit-user-select: text; user-select: text; font-size: 16px; }
.name-setting-row input:focus { outline: 2px solid #a6c6af; outline-offset: 1px; }
.name-setting-row button { min-height: 46px; flex-shrink: 0; white-space: nowrap; padding: 10px 13px; }

@media (max-height:450px) and (orientation:landscape) {
  .tool-dock, .palette-panel { max-height: calc(100dvh - 74px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  .studio-back { min-width: 0; max-width: calc(100% - 155px); }
  .studio-back > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .palette-panel .palette-size { display: flex; align-items: center; gap: 8px; margin-top: 5px; padding: 5px 2px 0; }
  .palette-panel .palette-size-heading { flex: 0 0 30px; width: 30px; height: 44px; padding: 0; font-size: 11px; }
  .palette-panel .palette-size-heading .brush-dot { display: none; }
  .palette-panel .palette-size [data-brush-size] { flex: 1; min-width: 0; width: 100%; height: 44px; }
}
