:root {
  --ink: #543448;
  --wine: #a53669;
  --paper: #fff9e9;
  --cover: #e99baa;
  --edge: #b77585;
  --display: 'Luckiest Guy', Baloo, 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: #f6d7de;
}
body {
  background-color: #f6d7de;
  background-image:
    linear-gradient(90deg, #fff5e83b 50%, transparent 50%),
    linear-gradient(#fff5e83b 50%, transparent 50%);
  background-size: 42px 42px;
  background-repeat: repeat;
}
.atelier { width: min(100% - 40px, 1100px); margin: auto; padding: 0 0 45px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; white-space: nowrap; clip-path: inset(50%); }
.desk-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 76px; padding: 11px 3px 14px; }
.desk-link, .icon-button, .dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border: 2px solid #8e5a72;
  border-radius: 16px;
  padding: 4px 14px;
  background: #fff8ee;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 2px #fff, 0 3px #bb8696;
}
:where(span[data-icon]) { display: inline-flex; flex: none; align-items: center; justify-content: center; }
[data-icon] > svg, .open-sheet svg { display: block; width: 24px; height: 24px; }
.signature { display: inline-flex; align-items: center; gap: 4px; color: #9a406c; font: 400 27px/1 var(--display); text-shadow: 0 2px #fff8ed; }
.signature svg { width: 36px; height: 36px; }
.desk-bar .signature, .studio-bar .edit-actions { margin-inline-start: auto; }
.album, .workbook {
  position: relative;
  isolation: isolate;
  border: 2px solid #946679;
  border-radius: 26px 34px 32px 24px;
  background-color: var(--paper);
  background-image: radial-gradient(#dfbda749 .7px, transparent .95px), radial-gradient(#e7cfad44 .7px, transparent .95px);
  background-size: 11px 13px, 17px 19px;
  background-position: 3px 3px, 9px 6px;
  box-shadow: 0 3px #ead8be, 0 4px #bd9ba1, 0 7px #f6e9d2, 0 8px #b49591, 0 12px var(--cover), 0 14px #ae7082, 0 22px 23px -11px #97556665;
}
.album { padding: clamp(18px, 2.5vw, 32px) clamp(18px, 3.25vw, 42px) clamp(28px, 3.2vw, 42px) clamp(45px, 5.7vw, 78px); }
.album::before { content: ''; position: absolute; top: 0; bottom: 0; left: clamp(26px, 3.3vw, 45px); border-right: 1px solid #e1bbc0; box-shadow: 3px 0 #f6e2d8; }
.binding {
  position: absolute;
  top: 35px;
  bottom: 30px;
  left: -10px;
  width: 40px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 56'%3E%3Cellipse cx='29' cy='14' rx='7' ry='6.5' fill='%23ba8b8c'/%3E%3Cellipse cx='29' cy='13.3' rx='5.4' ry='4.9' fill='%23826370'/%3E%3Cpath d='M29 14C25 7 5 7 5 13c0 3 3 4 6 4' fill='none' stroke='%23956274' stroke-width='6' stroke-linecap='round'/%3E%3Cpath d='M28 12C22 7 8 8 6 11' fill='none' stroke='%23ffdfd4' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center top / 40px 56px repeat-y;
}
.album-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 10px 12px 0; }
.album-heading h1 { margin: 0; max-width: 840px; color: #b63770; font-size: clamp(38px, 5vw, 59px); line-height: 1.06; letter-spacing: -.025em; }
.album-heading h1 span { color: #694260; }
.album-heading h1 i {
  display: inline-block;
  transform: rotate(-6deg) translateY(-.2em);
  margin-left: .1em;
  padding: .24em .46em .14em;
  border: 2px solid #9f6586;
  border-radius: 40% 24% 35% 18% / 22% 38% 25% 40%;
  background: #ffcedc;
  color: #87375f;
  font-family: Baloo, sans-serif;
  font-size: .39em;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 2px 2px #e7c9b7;
}
.album-heading p { margin: 6px 0 0; color: #805e70; font-size: clamp(16px, 2vw, 21px); font-weight: 650; }
.art-cup svg { width: clamp(105px, 12vw, 160px); height: auto; }
.album-section { display: flex; align-items: center; gap: 14px; margin: 0 0 17px; }
.album-section::after { content: ''; order: 1; flex: 1; border-bottom: 2px dashed #dfb9b9; }
.album-section h2, .tool-tray h2, .paint-tray h2 { margin: 0; font: 800 18px/1.25 Baloo, 'Trebuchet MS', sans-serif; }
.album-count { order: 2; display: inline-flex; align-items: center; gap: 5px; color: #785468; font-size: 15px; font-weight: 800; white-space: nowrap; }
.album-count svg { width: 22px; height: 22px; }
.sheet-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(17px, 2.1vw, 28px) clamp(13px, 1.9vw, 26px); }
.sheet-card {
  position: relative;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 6px 6px 3px;
  border: 1.6px solid #b39596;
  border-radius: 12px 14px 12px 15px;
  background: #fffcf6;
  color: var(--ink);
  text-align: left;
  box-shadow: 1px 3px 0 #ddcabb, 1px 4px 5px #78545527;
  transition: transform .18s ease-out, box-shadow .18s ease-out;
}
.sheet-pic { position: relative; display: block; width: 100%; overflow: hidden; border: 1px solid #bca6a0; border-radius: 7px; background: #fbe6e9; aspect-ratio: 520 / 400; }
.sheet-pic > svg { width: 100%; height: 100%; display: block; }
.sheet-index { display: grid; place-items: center; position: absolute; left: 6px; top: 6px; min-width: 28px; height: 25px; padding: 0 5px; border: 1px solid #a77d88; border-radius: 6px; background: #fff9eb; color: #774c65; font: 800 13px/1 Baloo, sans-serif; font-variant-numeric: tabular-nums; }
.sheet-caption { flex: 1; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 48px; padding: 5px 4px 3px; }
.sheet-name { line-height: 1.12; font-weight: 800; font-size: clamp(16px, 1.7vw, 21px); text-wrap: balance; }
.open-sheet { flex: none; display: grid; place-items: center; width: 27px; height: 27px; border: 1.5px solid #bc9286; border-radius: 50%; background: #ffebaf; }
.open-sheet svg { width: 17px; height: 17px; }
.sheet-state { position: absolute; display: flex; align-items: center; gap: 2px; top: 13px; right: 13px; border: 1px solid #9f7684; border-radius: 5px; background: #fff7e6; color: #6d4d64; padding: 1px 5px; font-size: 12px; font-weight: 750; }
.sheet-state svg { width: 15px; height: 15px; }
@media (hover: hover) { .sheet-card:not(:disabled):hover { filter: none; transform: translateY(-3px) rotate(-.45deg); box-shadow: 1px 5px #ddcabb, 1px 7px 8px #78545527; } }

.studio-bar { min-height: 72px; }
.edit-actions { display: flex; align-items: center; gap: 8px; }
.icon-button { padding: 4px; min-width: 46px; }
.icon-button[aria-pressed='true'] { background: #e6f0d8; }
#sound[aria-pressed='true'] .sound-off, #sound[aria-pressed='false'] .sound-on { display: none; }
.photo { background: #ffdf93; }
.workbook { padding: clamp(14px, 2.2vw, 30px); }
.studio-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 1px 17px; }
.studio-heading h1 { margin: 0; max-width: 77%; color: #a53669; font-size: clamp(24px, 3.3vw, 44px); line-height: 1.05; letter-spacing: -.017em; }
.sheet-progress { display: flex; align-items: center; gap: 6px; color: #795063; font-size: 16px; font-weight: 800; white-space: nowrap; }
.sheet-progress > span:first-child { rotate: -7deg; }
#progress { width: clamp(45px, 7vw, 95px); height: 13px; border: 1.5px solid #a77d8e; border-radius: 8px; background: #f4dfdf; overflow: hidden; appearance: none; }
#progress::-webkit-progress-bar { border-radius: inherit; background: #f4dfdf; }
#progress::-webkit-progress-value { border-radius: inherit; background: #eb91aa; }
#progress::-moz-progress-bar { border-radius: inherit; background: #eb91aa; }
.work-area { display: grid; grid-template-columns: minmax(90px, 112px) minmax(0, 1fr) minmax(112px, 132px); align-items: start; justify-content: center; gap: clamp(10px, 1.6vw, 22px); }
.tool-tray, .paint-tray { min-width: 0; padding: 12px 7px 13px; border: 2px solid #bc969d; border-radius: 19px; background: #f7d9de; box-shadow: inset 0 3px #fff2ed, 0 3px #dfc2b1; text-align: center; }
.paint-tray { background: #dcece7; border-color: #a1aaa2; box-shadow: inset 0 3px #f6faf1, 0 3px #c6c9b5; }
.tool-tray h2, .paint-tray h2 { margin: 0 0 10px; color: #775365; font-size: 14px; }
#tools { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.tool { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; min-height: 67px; padding: 4px 1px; border: 1.6px solid #b48d98; border-radius: 13px; background: #fff6ed; color: var(--ink); font-size: 14px; font-weight: 800; line-height: 1; box-shadow: inset 0 2px #fff, 0 2px #bd98a1; }
.tool svg { width: 36px; height: 36px; }
.tool[aria-pressed='true'] { background: #ffde8e; border-color: #82546c; box-shadow: inset 0 0 0 2px #fff3c7, 0 3px #a77a8a; }
.drawing-page { align-self: start; justify-self: center; width: 100%; min-width: 0; padding: 6px 6px 0; border: 2px solid #b69392; border-radius: 15px; background: #fffdf6; box-shadow: 0 3px #ddc7b5; }
#board { box-sizing: border-box; position: relative; isolation: isolate; width: 100%; aspect-ratio: 520/400; overflow: hidden; border: 1px solid #c5aaa2; border-radius: 9px; background: #fff; touch-action: none; }
.paper-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 3px 1px; }
.paper-controls button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 44px; min-height: 44px; padding: 2px 8px; border: 0; border-radius: 9px; background: transparent; color: #74556c; font-size: 16px; font-weight: 800; }
.magnifier { display: flex; align-items: center; border-radius: 13px; background: #f7e9e5; }
.magnifier svg { width: 18px; height: 18px; }
.zoom-lens svg { width: 20px; height: 20px; }
#palette { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-items: center; gap: 7px 4px; }
.paint-well { position: relative; display: grid; place-items: center; min-width: 44px; min-height: 44px; width: 100%; max-width: 52px; aspect-ratio: 1; padding: 0; border: 1px solid #9fa9a3; border-radius: 50%; background: conic-gradient(from 0deg, #79566d var(--progress, 0%), #fffaf0 0); color: #463242; }
.paint-well[aria-pressed='true'] { outline: 2px solid #885574; outline-offset: 1px; box-shadow: 0 3px 0 #c1ada7; }
.paint-well svg { width: 100%; height: 100%; }
.well-number, .well-check { position: absolute; inset: 0; display: grid; place-items: center; font: 800 clamp(18px, 2vw, 23px)/1 Baloo, sans-serif; text-shadow: 0 1px 1px #fffbef, 1px 0 #fffbef; }
.well-check { display: none; }
.paint-well[data-complete='true'] .well-number { display: none; }
.paint-well[data-complete='true'] .well-check { display: grid; }
@keyframes well-done { 45% { transform: scale(1.16) rotate(-8deg); } }
.paint-well[data-complete='true'] { animation: well-done .4s ease-out; }
#status { margin: 10px 3px 0; text-align: center; color: #765269; font: 700 15px/1.3 Baloo, sans-serif; }
#status:empty { display: none; }
#celebration { position: fixed; z-index: 5; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#reset-dialog { width: min(370px, calc(100% - 32px)); padding: 24px 18px; border: 2px solid #9c6f82; border-radius: 24px; background: var(--paper); color: var(--ink); text-align: center; box-shadow: 0 6px #d099a0, 0 15px 30px #6636554d; }
#reset-dialog::backdrop { background: #5c3a5466; }
.reset-sticker { width: 52px; height: 52px; margin-bottom: 8px; border: 2px solid #bc899d; border-radius: 16px; background: #f9d3df; }
#reset-dialog h2 { margin: 3px 0 5px; color: var(--wine); font-size: 30px; }
#reset-dialog p { margin: 0 0 16px; font-weight: 600; line-height: 1.35; }
.dialog-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dialog-actions button { padding: 5px 10px; }
#reset-no { background: #ffe391; }
:focus-visible { outline: 3px solid #69395a; outline-offset: 3px; }
:is(#sheet-title, #album-title):focus { outline: none; }

@media (max-width: 760px) {
  .atelier { width: calc(100% - 24px); }
  .desk-bar { min-height: 66px; }
  .album { padding: 17px 16px 24px 37px; }
  .album::before { left: 23px; }
  .binding { left: -14px; }
  .album-heading h1 { font-size: clamp(30px, 6vw, 46px); }
  .sheet-list { gap: 16px 11px; }
  .work-area { grid-template-columns: 78px minmax(0, 1fr) 108px; gap: 8px; }
  .tool-tray, .paint-tray { padding: 9px 5px; }
  .tool-tray h2, .paint-tray h2 { font-size: 11px; }
  .tool { min-height: 58px; }
}
@media (max-width: 630px) {
  .atelier { width: calc(100% - 20px); }
  .album { padding: 17px 11px 23px 23px; border-radius: 20px; }
  .binding { top: 18px; bottom: 15px; left: -10px; width: 25px; background-size: 25px 41px; }
  .album::before { left: 15px; }
  .album-heading { gap: 1px; padding: 0 0 9px; min-height: 84px; }
  .album-heading h1 { font-size: clamp(30px, 6.9vw, 42px); }
  .album-heading h1 i { font-size: .46em; border-width: 1px; }
  .album-heading p { margin-top: 5px; font-size: 15px; }
  .art-cup svg { width: clamp(62px, 15vw, 93px); }
  .album-section { gap: 8px; margin-bottom: 12px; }
  .album-section h2 { font-size: 17px; }
  .sheet-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 9px; }
  .sheet-card { border-radius: 10px; padding: 4px 4px 1px; }
  .sheet-caption { min-height: 46px; gap: 3px; padding: 6px 1px; }
  .sheet-name { font-size: clamp(14px, 3.5vw, 19px); }
  .sheet-index { left: 4px; top: 4px; min-width: 20px; height: 19px; font-size: 11px; }
  .open-sheet { width: 21px; height: 21px; }
  .open-sheet svg { width: 14px; height: 14px; }
  .sheet-state { top: 10px; right: 9px; font-size: 10px; }
  .studio-bar { gap: 4px; padding-inline: 0; }
  .desk-link { padding-inline: 8px; }
  .edit-actions { gap: 3px; }
  .edit-actions button, #gallery-back { min-width: 44px; min-height: 44px; border-radius: 13px; }
  .edit-actions .photo { padding-inline: 4px; }
  .photo-label { display: none; }
  .workbook { padding: 11px 7px 14px; border-radius: 18px; }
  .studio-heading { gap: 5px; margin: 2px 2px 10px; }
  .studio-heading h1 { max-width: 76%; font-size: clamp(21px, 4.7vw, 29px); }
  .sheet-progress { gap: 3px; font-size: 13px; }
  .sheet-progress svg { width: 17px; height: 17px; }
  #progress { width: 30px; height: 10px; }
  .work-area { grid-template-columns: minmax(0, 1fr); grid-template-areas: "board" "palette" "tools"; gap: 10px; }
  .drawing-page { grid-area: board; padding: 4px 4px 0; }
  .paint-tray { grid-area: palette; }
  .tool-tray { grid-area: tools; }
  .tool-tray, .paint-tray { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 5px; border-radius: 14px; }
  .tool-tray h2, .paint-tray h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #tools, #palette { display: flex; flex-flow: row wrap; align-items: center; justify-content: center; gap: 5px; }
  .tool-tray #tools { width: 100%; }
  .tool { flex: 1; flex-direction: row; gap: 4px; min-width: 0; min-height: 44px; }
  .tool svg { width: 27px; height: 27px; }
  .paint-well { width: 44px; flex: none; }
  .paper-controls { min-height: 44px; padding: 1px 0; }
  #status { font-size: 14px; }
}
@media (max-width: 385px) {
  .desk-bar { min-height: 60px; gap: 5px; }
  .signature { font-size: 23px; }
  .signature [data-icon] { display: none; }
  .album-heading h1 i { transform: rotate(-5deg); }
  .art-cup svg { width: 51px; }
  .studio-bar { display: grid; grid-template-columns: 1fr auto; }
  .studio-bar .edit-actions { grid-area: 2 / 1 / auto / -1; width: 100%; justify-content: space-between; }
  #gallery-back { justify-self: start; gap: 3px; padding: 1px 5px; font-size: 14px; }
  #gallery-back svg { width: 18px; }
  .tool { font-size: 13px; }
}
@media (min-width: 631px) and (max-height: 590px) {
  .studio-bar { min-height: 52px; padding-block: 3px 6px; }
  .workbook { padding: 9px 12px; }
  .studio-heading { margin-bottom: 6px; }
  .studio-heading h1 { font-size: 25px; }
  .work-area { grid-template-columns: 82px minmax(270px, min(64vw, calc((100svh - 165px) * 1.3))) minmax(110px, 172px); }
  .tool-tray { padding: 6px; }
  #tools { gap: 5px; }
  .tool { flex-direction: row; min-height: 44px; font-size: 12px; }
  .tool svg { width: 24px; height: 24px; }
  .tool-tray h2, .paint-tray h2 { margin-bottom: 4px; font-size: 11px; }
  #palette { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 4px; }
  .paint-well { max-width: 45px; }
}
:root[data-motion='reduced'] *, :root[data-motion='reduced'] *::before, :root[data-motion='reduced'] *::after { animation: none !important; transition: none !important; }
