.studio-heading { display: flex; align-items: center; gap: 14px; padding: 8px 0 18px; }
.studio-heading img { object-fit: contain; image-rendering: pixelated; }
.studio-heading h1 { font-size: clamp(28px, 4vw, 40px); }
.studio-heading .notebook-link { margin-inline-start: auto; }
.notebook-link { color: var(--green-dark); font-weight: bold; text-decoration: underline; text-underline-offset: 4px; }
.studio-workspace { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.studio-workspace > .panel { min-width: 0; padding: clamp(14px, 2vw, 22px); margin-top: 18px; }
#drawing-input h2, #caption-input label { display: block; font: 24px Jua, sans-serif; }
#caption-input { margin-top: 18px; }
#image-caption {
  display: block; width: 100%; margin-top: 10px; padding: 12px; resize: vertical;
  border: 2px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit;
}
.studio-note { margin-top: 12px; font-size: 14px; }
#sticker-notebook .book-cover:disabled { opacity: .62; cursor: not-allowed; }
.proof-paper {
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center;
  aspect-ratio: 1; margin-top: 12px; padding: clamp(10px, 1.5vw, 18px);
  border: 1px solid var(--line); border-radius: 12px; text-align: center; color: var(--muted);
  background: radial-gradient(#c8d2ba 1px, transparent 1.4px) 0 0 / 12px 12px #f5f7ec;
}
.proof-paper img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px #40553435); }
#result-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
#result-actions .button { padding-inline: clamp(8px, 2vw, 20px); }
#download-image { grid-column: 2; }
.save-sticker-control { display: grid; justify-items: start; gap: 10px; }
.save-sticker-help {
  position: relative;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #294d3a;
  color: #fff9e8;
  font-size: 14px;
}
.save-sticker-help::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 18px;
  border: 5px solid transparent;
  border-bottom-color: #294d3a;
}
#notebook-preview .sticker-collection { gap: 6px; }
#notebook-preview .drawn-sticker {
  width: 64px;
  max-width: 100%;
  padding: 5px;
  gap: 3px;
  margin-top: 7px;
  border-radius: 8px;
  font-size: 11px;
}
#notebook-preview .sticker-origin { padding: 0 3px; font-size: 10px; }
#notebook-preview .sticker-inputs { font-size: 11px; }
#notebook-preview .drawn-sticker:has(details[open]) { width: 128px; }
#notebook-preview .drawn-sticker > img { max-width: 52px; }

#draw-title, #preview-title, #keep-title { scroll-margin-top: var(--header-clearance); }
.sticker-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.notebook-actions { align-items: center; }
.saved-sheet-next {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 16px; margin: 12px 0 16px; padding: 12px 16px;
  border-radius: 12px; background: var(--leaf);
}
.saved-sheet-next p { margin: 0; font-weight: bold; }
.creation-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding-top: 12px;
  container-type: inline-size;
}
.creation-option { position: relative; min-width: 0; display: flex; }
.creation-option:has(.button:disabled) { cursor: not-allowed; }
.creation-option .button:disabled { pointer-events: none; }
.creation-actions .button {
  width: 100%;
  min-width: 0;
  padding-inline: 2px;
  font-size: clamp(9px, 3.15cqw, 18px);
  white-space: nowrap;
}
.creation-tooltip {
  position: absolute;
  z-index: 2;
  bottom: 100%;
  left: 50%;
  translate: -50% 0;
  width: min(215px, 90cqw);
  padding: 9px 11px;
  border-radius: 10px;
  background: #294d3a;
  color: #fff9e8;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 2px 8px #294d3a33;
  visibility: hidden;
}
.creation-option:first-child .creation-tooltip { left: 0; translate: none; }
.creation-option:last-child .creation-tooltip { left: auto; right: 0; translate: none; }
.creation-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: var(--tooltip-tail, 50%);
  translate: -50% 0;
  border: 5px solid transparent;
  border-top-color: #294d3a;
}
.creation-option:first-child { --tooltip-tail: 24px; }
.creation-option:last-child { --tooltip-tail: calc(100% - 24px); }
.creation-option:has(:focus-visible) .creation-tooltip {
  visibility: visible;
}
@media (hover: hover) {
  .creation-option:hover .creation-tooltip { visibility: visible; }
}
.ai-sticker-button { position: relative; }
.ai-bubble {
  position: absolute;
  top: -12px;
  left: 6px;
  padding: 2px 7px;
  border: 1px solid #825120;
  border-radius: 9px;
  background: #ffcf76;
  color: #5b3618;
  font: 800 12px/1.15 system-ui, sans-serif;
  box-shadow: 0 2px 0 #80511f40;
}
.ai-bubble::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 6px;
  width: 5px;
  height: 5px;
  background: inherit;
  border-right: 1px solid #825120;
  border-bottom: 1px solid #825120;
  transform: rotate(45deg);
}
.sticker-status:not(:empty) { margin-top: 10px; }
.generation-alert {
  display: flex;
  align-items: start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 2px solid #bf4b32;
  border-radius: 12px;
  background: #fff0e8;
  color: #782a1c;
  scroll-margin-block: var(--header-clearance) calc(var(--nav-height) + 12px);
}
.generation-alert strong { display: block; font-size: 18px; }
.generation-alert-icon {
  display: grid;
  flex: 0 0 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #a73724;
  color: white;
  font-weight: bold;
}


.drawing-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 0 12px;
}

.drawing-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.drawing-group button,
#draw-width summary {
  min-height: 44px;
  min-width: 44px;
  padding: 0 9px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

#draw-eraser { display: flex; align-items: center; gap: 6px; }
.eraser-sample {
  width: var(--eraser-size, 7px);
  aspect-ratio: 1;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
#draw-width { position: relative; }
#draw-width summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  cursor: pointer;
}
#draw-width summary::-webkit-details-marker { display: none; }
#draw-width summary::after {
  content: '';
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}
.width-sample {
  display: block;
  width: 34px;
  height: var(--sample-size, 7px);
  border-radius: 999px;
  background: currentColor;
}
.width-options {
  position: absolute;
  inset: calc(100% + 4px) auto auto 0;
  z-index: 2;
  display: grid;
  gap: 4px;
  padding: 5px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 12px #4055342b;
}
.width-options button { display: grid; place-items: center; min-width: 56px; }

.drawing-group button[aria-pressed='true'] {
  border-color: var(--green-dark);
  background: var(--leaf);
}

.drawing-group button:disabled {
  opacity: .45;
  cursor: default;
}

.drawing-group .drawing-color {
  display: grid;
  place-items: center;
  padding: 0;
}

.drawing-palette {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 44px));
  width: 100%;
  gap: 4px;
}
.drawing-palette .drawing-color { min-width: 0; }

.drawing-color::before {
  content: '';
  width: 24px;
  height: 24px;
  border: 1px solid #0003;
  border-radius: 50%;
  background: var(--swatch);
}

.drawing-paper {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: white;
}

#drawing-canvas.is-erasing { cursor: none; }
#eraser-cursor {
  position: absolute;
  width: var(--eraser-diameter);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #253029, 0 0 0 2px #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#drawing-canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

@media (min-width: 761px) and (max-width: 1000px) {
  body[data-page='notebook'] .site-header { gap: 8px; }
  body[data-page='notebook'] .site-nav { gap: 0; }
  body[data-page='notebook'] .site-nav a { padding-inline: 6px; }
}

@media (max-width: 760px) {
  .studio-heading { gap: 6px; }
  .studio-heading img { width: 38px; height: 38px; }
  .studio-heading a { font-size: 14px; }
  .studio-workspace { grid-template-columns: 1fr; gap: 0; }
}
