/* ===========================================================
   draw-studio.css — Sparkle Drawing Studio (Play page)
   =========================================================== */
.ds {
  /* a little wider than the rest of the page so the paper is BIG */
  width: min(1320px, 96vw);
  margin: 28px 0 28px calc(50% - min(660px, 48vw));
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 16px 18px;
  box-shadow: var(--shadow);
  border: 4px solid var(--pink-soft);
  background-image:
    radial-gradient(circle at 0 0, var(--pink-soft) 0 70px, transparent 71px),
    radial-gradient(circle at 100% 100%, var(--blue-soft) 0 90px, transparent 91px);
}
.ds button { font: inherit; cursor: pointer; color: var(--ink); }
.ds button:disabled { opacity: .35; cursor: default; }

/* ---- top bar ---- */
.ds-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.ds-top h2 { margin: 0; font-size: 1.7rem; }
.ds-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-act {
  border: none; background: var(--purple-soft); border-radius: 16px;
  min-width: 64px; padding: 6px 8px 4px; font-size: 1.5rem; line-height: 1.1;
  box-shadow: 0 4px 0 rgba(61, 44, 92, .15); transition: transform .12s;
}
.ds-act small { display: block; font-size: .7rem; font-weight: 700; color: var(--purple); }
.ds-act:not(:disabled):hover { transform: translateY(-3px) rotate(-3deg); }
.ds-act:not(:disabled):active { transform: scale(.92); }
.ds-act.undo { background: var(--yellow); min-width: 84px; font-size: 1.9rem; }
.ds-act.done { background: var(--pink); }
.ds-act.done small { color: var(--white); }
.ds-act.on { background: var(--blue); }

/* ---- main layout: tools | paper | panel ---- */
.ds-body { display: grid; grid-template-columns: 126px minmax(0, 1fr) 290px; gap: 12px; align-items: start; }

.ds-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ds-tool {
  border: 3px solid transparent; background: var(--pink-soft); border-radius: 14px;
  font-size: 1.7rem; padding: 4px 0 2px; line-height: 1.1; transition: transform .12s;
}
.ds-tool small { display: block; font-size: .62rem; font-weight: 700; }
.ds-tool:nth-child(3n+2) { background: var(--purple-soft); }
.ds-tool:nth-child(3n) { background: var(--blue-soft); }
.ds-tool:hover { transform: scale(1.08) rotate(-4deg); }
.ds-tool.on { border-color: var(--purple); background: var(--yellow); transform: scale(1.06); box-shadow: 0 4px 0 rgba(61,44,92,.2); }

/* the paper */
.ds-paper-col { min-width: 0; }
.ds-paper {
  position: relative;
  aspect-ratio: 1400 / 875;
  width: min(100%, calc((100vh - 190px) * 1.6));
  min-width: min(100%, 520px);
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 4px solid var(--purple);
  box-shadow: 0 8px 0 rgba(61, 44, 92, .15), inset 0 0 0 3px #fff;
  background: #fff;
}
.ds-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ds-ghost { touch-action: none; cursor: crosshair; }
.ds-paper[data-tool="stamp"] #ds-ghost, .ds-paper[data-tool="person"] #ds-ghost { cursor: copy; }
.ds-mirror-line { position: absolute; top: 0; bottom: 0; left: 50%; border-left: 3px dashed rgba(155, 93, 229, .55); display: none; pointer-events: none; }
.ds-paper.mirror .ds-mirror-line { display: block; }

/* under the paper: what I'm using, quick colors, sizes */
.ds-quick { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; margin-top: 10px; }
.ds-now { position: relative; width: 58px; height: 58px; flex: none; }
.ds-now-color { position: absolute; inset: 0; border-radius: 50%; border: 4px solid var(--ink); }
.ds-now-face { position: absolute; right: -10px; bottom: -8px; font-size: 1.8rem; filter: drop-shadow(0 2px 0 #fff); }
.ds-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-color {
  width: 36px; height: 36px; border-radius: 50%; padding: 0;
  border: 3px solid rgba(61, 44, 92, .25); box-shadow: 0 3px 0 rgba(61, 44, 92, .15);
  transition: transform .12s; display: inline-grid; place-items: center; font-size: 1rem;
}
.ds-color:hover { transform: scale(1.15); }
.ds-color.on { border-color: var(--ink); transform: scale(1.2); box-shadow: 0 0 0 3px var(--yellow); }
.ds-color.big { width: 44px; height: 44px; }
.ds-color.more { background: var(--white); }
.ds-color.rainbow { background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); position: relative; cursor: pointer; }
.ds-color.rainbow input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.ds-sizes { display: flex; gap: 6px; align-items: center; background: var(--purple-soft); padding: 4px 8px; border-radius: 999px; }
.ds-size { width: 46px; height: 46px; border-radius: 50%; border: 3px solid transparent; background: var(--white); display: grid; place-items: center; }
.ds-size span { display: block; border-radius: 50%; background: var(--ink); }
.ds-size.on { border-color: var(--pink); background: var(--yellow-soft); }

/* side panel */
.ds-panel { background: var(--purple-soft); border-radius: 18px; padding: 8px; }
.ds-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ds-tab { border: none; border-radius: 12px 12px 6px 6px; background: rgba(255,255,255,.6); font-size: 1.5rem; padding: 4px 0 2px; line-height: 1.1; }
.ds-tab small { display: block; font-size: .58rem; font-weight: 700; }
.ds-tab.on { background: var(--white); box-shadow: 0 -3px 0 var(--pink) inset; }
.ds-pane {
  background: var(--white); border-radius: 12px; margin-top: 6px; padding: 10px;
  max-height: calc(min(100vh - 190px, 640px) - 60px); min-height: 300px; overflow-y: auto;
}
.ds-pane h4 { margin: 2px 0 8px; color: var(--purple); }
.ds-hint { font-size: .85rem; margin: 10px 0 0; color: var(--purple); font-weight: 600; }
.ds-color-grid, .ds-skins { display: flex; flex-wrap: wrap; gap: 8px; }
.ds-skins { margin-bottom: 4px; }
.ds-subtabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 8px; }
.ds-subtab { border: 2px solid transparent; background: var(--pink-soft); border-radius: 10px; font-size: 1.25rem; padding: 3px 0; }
.ds-subtab.on { border-color: var(--pink); background: var(--yellow-soft); }
.ds-stamp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ds-stamp { border: 3px solid transparent; background: var(--yellow-soft); border-radius: 14px; font-size: 2rem; padding: 4px 0; transition: transform .12s; }
.ds-stamp:hover { transform: scale(1.12) rotate(6deg); }
.ds-stamp.on { border-color: var(--purple); background: var(--yellow); }
.ds-people-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.ds-person { border: 3px solid transparent; background: var(--blue-soft); border-radius: 14px; padding: 4px; transition: transform .12s; }
.ds-person img { display: block; width: 100%; height: 86px; object-fit: contain; }
.ds-person small { display: block; font-size: .7rem; font-weight: 700; }
.ds-person:hover { transform: scale(1.06); }
.ds-person.on { border-color: var(--pink); background: var(--yellow-soft); }
.ds-bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ds-bgbtn { border: 3px solid transparent; background: var(--blue-soft); border-radius: 14px; font-size: 2.2rem; padding: 6px 0; }
.ds-bgbtn.on { border-color: var(--purple); background: var(--yellow); }
.ds-fridge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ds-fridge-pic { position: relative; transform: rotate(-2deg); }
.ds-fridge-pic:nth-child(even) { transform: rotate(2deg); }
.ds-fridge-pic img { width: 100%; border-radius: 6px; border: 4px solid #fff; box-shadow: 0 3px 8px rgba(61,44,92,.3); cursor: pointer; display: block; }
.ds-fridge-pic::before { content: "🧲"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 1.2rem; z-index: 1; }
.ds-fridge-x { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--pink); color: #fff !important; font-size: .7rem; }

/* Big screen mode */
.ds:fullscreen, .ds.ds-max { width: 100vw; height: 100vh; margin: 0; border-radius: 0; overflow: auto; border: none; }
.ds.ds-max { position: fixed; inset: 0; z-index: 50; }
.ds:fullscreen .ds-paper, .ds.ds-max .ds-paper { width: min(100%, calc((100vh - 150px) * 1.6)); }

/* medium screens: panel goes under the paper so the paper stays big */
@media (max-width: 1240px) {
  .ds-body { grid-template-columns: 118px minmax(0, 1fr); }
  .ds-panel { grid-column: 1 / -1; }
  .ds-tabs { grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; }
  .ds-subtabs { grid-template-columns: repeat(7, minmax(0, 64px)); }
  .ds-pane { max-height: none; min-height: 0; }
  .ds-stamp-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
  .ds-people-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .ds-bg-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .ds-fridge-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
/* phones / small tablets: tools become a row */
@media (max-width: 760px) {
  .ds-body { grid-template-columns: 1fr; }
  .ds-tools { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
  .ds-paper { min-width: 0; width: 100%; }
}

/* Play page: quick jump buttons under the title */
.jump-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 8px; }
.jump-row a { font-size: 1.1rem; padding: 8px 18px; }
#unicorn-section, #doll-section, #draw-studio { scroll-margin-top: 130px; }
