:root {
  color-scheme: light;
  --paper: #f2eddf;
  --ink: #332d25;
  --rust: #8f4634;
  --rule: #d8c9ae;
  --moss: #35452f;
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: radial-gradient(ellipse at 48% 0%, #fbf8ef, var(--paper) 65%, #e9e0cc);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.masthead { text-align: center; padding: 24px 16px 20px; }
h1 { font-size: clamp(3rem, 7.4vw, 5.5rem); line-height: .98; letter-spacing: -.065em; font-weight: 400; margin: 0; color: var(--moss); }
.masthead p { margin: 12px 0 0; font-size: clamp(.94rem, 2.4vw, 1.12rem); color: #655541; font-style: italic; }
.storybook {
  max-width: 1120px;
  width: calc(100% - 48px);
  margin: 0 auto 36px;
  display: grid;
  grid-template-columns: 1.24fr 1fr;
  border: 1px solid #c9b99d;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 12px 35px #55452b20;
  background: #faf6ec;
}
.stage { position: relative; background: #c3c3a6; }
canvas { display: block; width: 100%; height: auto; }
.stage.is-target { outline: 3px solid #fff9df; outline-offset: -7px; }
.actions { display: flex; justify-content: center; gap: 10px; position: absolute; inset: auto 0 15px; }
.actions button { border-radius: 4px; border: 1px solid #75684f; padding: 9px 13px; min-height: 44px; background: #fbf5e6; }
.actions button:last-child { background: var(--moss); color: #fff9eb; border-color: var(--moss); }
.wardrobe { padding: clamp(16px, 3vw, 33px); border-left: 1px solid var(--rule); }
h2 { font-size: clamp(1.8rem, 4vw, 2.65rem); font-weight: 400; letter-spacing: -.045em; color: var(--moss); margin: 0 0 6px; }
.instructions { color: #685a48; margin: 0 0 12px; line-height: 1.4; }
.category { margin-top: 12px; border-top: 1px solid var(--rule); }
h3 { margin: 8px 0 6px; color: #794a36; font-size: .9rem; font-weight: 400; }
.options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.options:has(> :last-child:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item { background: #f3eddf; border: 1px solid #e2d6c2; border-radius: 4px; min-width: 0; min-height: 73px; padding: 3px 2px 5px; touch-action: pan-y; user-select: none; }
.item:hover { background: #ede3ce; }
.item[aria-pressed="true"] { border-color: #627351; background: #e5e8d5; box-shadow: inset 0 0 0 1px #627351; }
.item img { display: block; width: 90%; height: 44px; object-fit: contain; margin: 0 auto 3px; pointer-events: none; }
.item span { display: block; font-size: .875rem; line-height: 1.1; overflow-wrap: anywhere; }
.drag-preview { position: fixed; z-index: 3; pointer-events: none; width: 80px; height: 94px; object-fit: contain; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 5px #4d402b60); }
.status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 850px) {
  .masthead { padding-top: 16px; }
  .storybook { width: min(calc(100% - 24px), 510px); grid-template-columns: 1fr; overflow: visible; }
  .stage { position: sticky; top: 0; z-index: 1; }
  canvas { height: min(82vw, 48svh); object-fit: contain; }
  .actions { bottom: 5px; }
  .wardrobe { border-left: 0; padding: 16px; }
}
@media (max-height: 480px) and (max-width: 850px) {
  .stage { position: relative; }
}
@media (min-width: 851px) {
  .stage { aspect-ratio: 5 / 6; align-self: stretch; }
  canvas { position: absolute; inset: 0; height: 100%; object-fit: cover; }
}
