/* Built to Khushi's three designs (Sketchbook, Drawing workspace, Export
   artwork; 390 × 884 frames). Every size and colour below is read from those
   files: 24px gutters, 56px buttons with 16px corners, 41px round buttons,
   16px cards on #FFFDF8 with a #DDD9CE line, warm #F6F2E9 paper, bold Inter.
   The app is a phone app: the layout is capped at phone width everywhere. */
:root {
  --paper: #F6F2E9;
  --white: #FFFDF8;
  --canvas: #FFFFFF;
  --line: #DDD9CE;
  --line-strong: #D9D1C2;
  --surface: #DDD9CE;
  --chip: #FFFDF8;
  --ink: #24251F;
  --mid: #24251F;
  --soft: #4E4F47;
  --muted: #7A796F;
  --blue: #2854E7;
  --blue-tint: #E7EDFF;
  --yellow: #FFD34B;
  --red: #F05A42;
  --pink: #EC4899;
  --green: #10B981;

  /* Card art tints, in the Sketchbook order. */
  --tint-1: #FFFDF8;
  --tint-2: #FBE3D6;
  --tint-3: #E8E1F5;
  --tint-4: #E5EBD9;

  --f-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --f-serif: 'Libre Baskerville', Georgia, serif;

  --phone: 430px;    /* widest phone; desktop shows this column */
  --gutter: 24px;
  --tap: 41px;
  --radius: 16px;
  --tabbar: 78px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  cursor: pointer;
}
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: inherit; }
svg { flex: none; }

/* ---------- Screen shell ---------- */

.screen {
  position: relative;
  width: 100%;
  max-width: var(--phone);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding:
    max(14px, env(safe-area-inset-top))
    var(--gutter)
    max(28px, env(safe-area-inset-bottom));
}

/* On a wide screen the phone column gets a quiet edge, like a device. */
@media (min-width: 600px) {
  .screen {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* The drawing screen is pinned to the viewport so nothing scrolls under a finger. */
body[data-screen="draw"] { overflow: hidden; }
.draw {
  height: 100vh;
  height: 100dvh;
  gap: 12px;
  padding-bottom: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
}
.bar > :last-child:not(:first-child) { margin-left: auto; }

.bar-label { font-size: 18px; color: var(--ink); }

.wordmark {
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -.03em;
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--blue);
}
.wordmark--lg { font-size: 40px; line-height: 1; letter-spacing: -.045em; }
.wordmark--lg::after { width: 9px; height: 9px; margin-left: 4px; vertical-align: 6px; }

/* Khushi's logo in the yellow avatar of the Sketchbook header. */
.badge {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border: 1.2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
}
.badge svg { width: 18px; height: 17px; fill: currentColor; }

.chip {
  flex: none;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
}

.title {
  margin: 0;
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.intro .sub,
.intro .status { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }

.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */

.cta, .btn-secondary {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  transition: background-color .15s ease, transform .12s ease;
}
:is(.cta, .btn-secondary):not(:disabled):active { transform: scale(.98); }

.cta { background: var(--blue); border-color: var(--blue); color: #FFF; }
.cta:not(:disabled):active { background: #1E45CC; }
.cta:disabled { background: var(--line); border-color: var(--line); color: var(--muted); }
.cta--icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-secondary { background: var(--white); border-color: var(--line); color: var(--ink); }

.round {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  transition: transform .12s ease;
}
.round:not(:disabled):active { transform: scale(.94); }
.round svg, .segment-pill svg, .share-icon svg, .tabbar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.round--primary { background: var(--blue); border-color: var(--blue); color: #FFF; }
.round--primary:disabled { background: var(--line); border-color: var(--line); color: var(--muted); }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

/* ---------- Bottom tab bar (Sketchbook) ---------- */

.landing, .gallery { padding-bottom: calc(var(--tabbar) + max(20px, env(safe-area-inset-bottom))); }

.tabbar {
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--phone));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px var(--gutter) max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 -8px 24px rgba(36, 37, 31, .06);
}
.tabbar a {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  transition: transform .12s ease;
}
.tabbar a:active { transform: scale(.97); }
.tabbar svg { width: 22px; height: 22px; }
/* The active tab is warm ink, not blue: darker than the paper, from the same
   palette, and it leaves blue to the one main action on the page. */
.tabbar a[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* ---------- Landing (Sketchbook) ---------- */

.landing { gap: 24px; }
.landing .bar { margin-top: 16px; }

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 16px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}
.count-chip {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}
.section-link {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.sketches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sketch {
  min-width: 0;
  overflow: hidden;
}
/* 163 × 154 art area, as on the Sketchbook cards. */
.sketch-art {
  aspect-ratio: 163 / 154;
  padding: 10px;
  background: var(--tint, var(--tint-1));
}
.sketch:nth-child(4n + 2) { --tint: var(--tint-2); }
.sketch:nth-child(4n + 3) { --tint: var(--tint-3); }
.sketch:nth-child(4n + 4) { --tint: var(--tint-4); }
/* Multiply drops each drawing's white paper so the ink sits on the tint. */
.sketch-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.sketch-name {
  margin: 0;
  padding: 12px 12px 14px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wall-empty {
  margin: 0;
  padding: 24px 18px;
  font-size: 14px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Drawing (Drawing workspace) ---------- */

.bar-heading { min-width: 0; }
.bar-title {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.02em;
}
.bar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.bar-status.is-warning { color: var(--red); }
.bar-status.is-warning::before { background: var(--red); }
.bar-status::before,
.intro .status::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Undo | clear, the 100 × 33 split pill. */
.segment-pill {
  display: flex;
  align-items: center;
  height: 33px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}
.segment-pill button {
  width: 50px;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
}
.segment-pill svg { width: 18px; height: 18px; }
.segment-pill button:disabled { color: var(--line); }
.segment-pill button:first-child { border-radius: 999px 0 0 999px; }
.segment-pill button:last-child { border-radius: 0 999px 999px 0; }
.segment-pill button:not(:disabled):active { background: var(--paper); }
.segment-pill [data-action="clear"]:not(:disabled) { color: var(--red); }
.divider { width: 1px; height: 16px; background: var(--line); }

.step { font-size: 14px; color: var(--muted); }

/* Full-bleed board, and all of it is canvas: draw.js sizes .pad to the whole
   stage, so the layout never scrolls and every bit of the board takes ink. */
.board {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0 calc(-1 * var(--gutter));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--paper-now, var(--canvas));
  transition: background-color .2s ease;
  overflow: hidden;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pad {
  position: relative;
  width: 100%;
  height: 100%;
}

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The prompt floats over the top of the canvas and steps aside at the first
   stroke, so the whole board stays drawable. */
.prompt {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 22px 20px 4px;
  pointer-events: none;
  transition: opacity .25s ease;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 17px;
  text-align: center;
  color: var(--muted);
}
/* On a dark background the board's text turns light. */
.board[data-dark] .prompt { color: rgba(255, 253, 248, .72); }
.draw.has-ink .prompt { opacity: 0; }

/* White tool sheet, full width, rounded on top, right below the board. */
.sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 16px var(--gutter) max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: var(--white);
}

/* Brush / Eraser / Layers tabs. */
.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.seg {
  height: 57px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
}
.seg { position: relative; }
.seg svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* How many layers there are, once there is more than one. */
.tool-count {
  position: absolute;
  top: 7px;
  right: calc(50% - 22px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--blue);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  color: #FFF;
}
.seg[aria-pressed="true"] { background: var(--blue-tint); color: var(--blue); }

/* Ten slots (nine colours + "+") share the row, so the dots shrink a little on
   narrow phones instead of overflowing. A dot is 73% of its slot (25 of 34px). */
.swatches {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 34px));
  justify-content: space-between;
}
.swatch {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--c) 72%, transparent 74%);
  cursor: pointer;
}
/* Light colours (white, yellow) get an outline so they read on the sheet. */
.swatch[data-light] {
  background: radial-gradient(circle closest-side, var(--c) 69%, var(--line) 70% 73%, transparent 75%);
}
.swatch[aria-checked="true"] {
  box-shadow: inset 0 0 0 2px var(--blue);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 40% no-repeat,
    radial-gradient(circle closest-side, var(--c) 72%, transparent 74%);
}
.swatch[data-light][aria-checked="true"] {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2324251F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 40% no-repeat,
    radial-gradient(circle closest-side, var(--c) 69%, var(--line) 70% 73%, transparent 75%);
}

/* "+" always shows a plus: on an outlined circle at first, then on the custom
   colour in use (dark plus on light colours). */
.swatch--custom,
.swatch--custom[aria-checked="true"] {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2324251F' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 48% no-repeat,
    radial-gradient(circle closest-side, var(--white) 69%, var(--line) 70% 73%, transparent 75%);
}
.swatch--custom[data-picked]:not([data-light]),
.swatch--custom[data-picked]:not([data-light])[aria-checked="true"] {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 48% no-repeat,
    radial-gradient(circle closest-side, var(--c) 72%, transparent 74%);
}
.swatch--custom[data-picked][data-light],
.swatch--custom[data-picked][data-light][aria-checked="true"] {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2324251F' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 48% no-repeat,
    radial-gradient(circle closest-side, var(--c) 69%, var(--line) 70% 73%, transparent 75%);
}

/* ---------- Bottom panels: custom colour + layers ---------- */

.panel-scrim {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(36, 37, 31, .28);
}
.panel {
  position: fixed;
  z-index: 21;
  bottom: 0;
  left: 50%;
  width: min(100%, var(--phone));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px var(--gutter) max(20px, env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--white);
  box-shadow: 0 -12px 40px rgba(36, 37, 31, .18);
  animation: panel-up .2s ease-out;
}
@keyframes panel-up { from { transform: translate(-50%, 24px); opacity: 0; } }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.round--sm { width: 34px; height: 34px; }
.round--sm svg { width: 16px; height: 16px; }

/* Saturation left → right, brightness bottom → top, over the chosen hue. */
.picker-sv {
  position: relative;
  height: clamp(150px, 30vh, 220px);
  border-radius: 12px;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #FFF, transparent),
    hsl(calc(var(--hue, 0) * 1deg) 100% 50%);
  touch-action: none;
  cursor: crosshair;
}
.picker-hue {
  position: relative;
  height: 14px;
  margin: 0 7px;
  border-radius: 999px;
  background: linear-gradient(to right, #F00, #FF0, #0F0, #0FF, #00F, #F0F, #F00);
  touch-action: none;
  cursor: pointer;
}
/* A wide invisible hit area so the thin strip is easy to grab with a thumb. */
.picker-hue::before { content: ""; position: absolute; inset: -14px -7px; }
.picker-thumb {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 3px solid #FFF;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(36, 37, 31, .25), 0 2px 6px rgba(36, 37, 31, .3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.picker-hue .picker-thumb { top: 50%; }

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.picker-swatch {
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.picker-hex {
  flex: 1;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 13px;
  color: var(--muted);
}
.picker-hex input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 17px;   /* keeps iOS from zooming on focus */
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  color: var(--ink);
  outline: none;
}
.picker-row .cta { height: 44px; }

/* Background colours: two rows of five, larger than the brush dots. */
.paper-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px 8px;
  justify-items: center;
}
.paper-swatches .swatch { width: 52px; max-width: 100%; }

/* Layers list: top layer first; the highlighted row is the one drawn on. */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
.layer-row[data-active] { border-color: var(--blue); background: var(--blue-tint); }
.layer-eye {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
}
.layer-eye svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.layer-row[data-hidden] .layer-eye { color: var(--muted); }
.layer-delete {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--red);
}
.layer-delete svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.layer-delete:not(:disabled):active { background: rgba(240, 90, 66, .1); }
.layer-delete:disabled { color: var(--line); cursor: default; }
.layer-pick {
  flex: 1;
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.layer-pick small { font-size: 12px; font-weight: 400; color: var(--muted); }
.layer-row[data-active] .layer-pick { color: var(--blue); }
.layer-row[data-hidden] .layer-pick span { color: var(--muted); text-decoration: line-through; }

.panel-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.panel-row { display: flex; gap: 10px; }
.panel-row > * { flex: 1; height: 48px; }
.btn-secondary:disabled { color: var(--muted); opacity: .6; }

/* "Round brush · 24 px" and its slider. */
.brush { display: flex; flex-direction: column; gap: 10px; }
.brush-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.brush-value { color: var(--ink); font-variant-numeric: tabular-nums; }

.brush-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  touch-action: pan-x;
  cursor: pointer;
}
.brush-range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(var(--blue), var(--blue)) 0 / var(--fill, 30%) 100% no-repeat, var(--line);
}
.brush-range::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(var(--blue), var(--blue)) 0 / var(--fill, 30%) 100% no-repeat, var(--line);
}
.brush-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7.5px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: var(--white);
}
.brush-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: var(--white);
}

/* Live brush-size circle in the middle of the pad while the size changes. */
.brush-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(36, 37, 31, .25);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.brush-preview.is-visible { opacity: 1; transition-duration: 0s; }

/* Short phones (iPhone SE and smaller): flatter tools, so the pad keeps its size. */
@media (max-height: 700px) {
  .draw { gap: 8px; }
  .prompt { padding-top: 12px; font-size: 15px; }
  .sheet { gap: 10px; padding-top: 10px; }
  .seg { height: 44px; gap: 2px; }
  .seg svg { width: 17px; height: 17px; }
  .brush { gap: 4px; }
}

/* ---------- Details + thank you (Export artwork) ---------- */

.preview {
  margin: 0;
  padding: 10px;
}
/* 322 × 222 inner art panel. */
.preview-art {
  aspect-ratio: 322 / 222;
  padding: 12px;
  border-radius: 10px;
  background: var(--paper);
  overflow: hidden;
}
.preview-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.preview-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 6px 6px;
}
.preview-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-meta { flex: none; font-size: 12px; color: var(--muted); }

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label { font-size: 14px; font-weight: 500; color: var(--ink); }
.label em { font-style: normal; font-weight: 400; color: var(--muted); }

/* 17px+ keeps iOS Safari from zooming in when a field gets focus. */
.field input {
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.field input[aria-invalid="true"] { border-color: var(--red); }
.field input::placeholder { color: var(--muted); }

.error { font-size: 13px; line-height: 1.45; color: var(--red); font-weight: 500; }



.form .cta { margin-top: 6px; }

/* Says plainly that the drawing will be public, where the opt-in switch was. */
.wall-note {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.intro .status { display: flex; align-items: center; gap: 8px; }
.intro .status::before { width: 7px; height: 7px; background: var(--yellow); }
.intro .status.is-saved::before { background: var(--green); }

.credit {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
}
.credit a { font-weight: 600; color: var(--ink); text-underline-offset: 3px; }

/* 37px round link buttons, after the AirDrop / Messages row. */
.share-row {
  display: flex;
  justify-content: space-around;
  padding: 0 4px;
}
.share-row a,
.share-row button {
  display: flex;
  padding: 0;
  border: 0;
  background: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
}
.share-icon {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
}
.share-icon svg { width: 17px; height: 17px; }

/* ---------- Share (thank-you screen) ---------- */

.thanks { gap: 18px; }

/* Instagram's own gradient, so the button is recognised at a glance. */
.cta--instagram {
  border: 0;
  background: linear-gradient(45deg, #F58529, #DD2A7B 45%, #8134AF 75%, #515BD4);
}
.cta--instagram:not(:disabled):active { background: linear-gradient(45deg, #D9741F, #C02368 45%, #6E2C96 75%, #4650B8); }

/* A short message above the bottom edge (caption copied, file saved). */
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(calc(100% - 48px), 380px);
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  color: var(--paper);
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 8px 24px rgba(36, 37, 31, .25);
  animation: panel-up .2s ease-out;
}

/* ---------- Handoff after Save image ---------- */

.handoff {
  align-items: center;
  gap: 14px;
  text-align: center;
}
.handoff-check {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
}
.handoff-check svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #FFF;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.handoff-text strong { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.handoff-note { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.handoff-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.handoff-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}
/* 2.2s, the same as HANDOFF_MS in share.js. */
.handoff[data-counting] .handoff-bar span { animation: handoff-fill 2.2s linear forwards; }
@keyframes handoff-fill { to { width: 100%; } }
.handoff .panel-row { width: 100%; }
.handoff .panel-row .cta { display: flex; }

/* ---------- Wall (gallery page) ---------- */

.empty {
  margin: 0;
  padding: 28px 20px;
  text-align: center;
}
.empty h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.empty p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 4px;
}
.actions--inline { margin-top: 0; padding-top: 0; }

/* ---------- Admin ---------- */

.admin { max-width: 880px; }

.link-button {
  padding: 8px 4px;
  border: 0;
  background: none;
  font-size: 15px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-button.danger { color: var(--red); }
.btn-secondary.btn-danger { color: var(--red); border-color: #F3C7BF; }
.btn-secondary.btn-danger:not(:disabled):active { background: #FDECE8; }

.cta.btn-small, .btn-secondary.btn-small {
  height: 44px;
  padding: 0 20px;
  font-size: 15px;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-tools { display: flex; gap: 8px; }


/* All collected emails in one box, ready to copy. */
.emails { padding: 14px 16px; }
.emails-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.emails-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.emails-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
/* Name, email, Copy on one line; the email wraps under the name on phones. */
.email-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name copy" "address copy";
  align-items: center;
  gap: 2px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  user-select: text;
}
.email-name { grid-area: name; font-size: 14px; font-weight: 600; }
.email-address { grid-area: address; font-size: 14px; color: var(--soft); word-break: break-all; }
.email-row .btn-small { grid-area: copy; height: 36px; padding: 0 14px; font-size: 14px; }
@media (min-width: 640px) {
  .email-row { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) auto; grid-template-areas: "name address copy"; }
}
.emails-empty { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

.admin-note { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--soft); }

.rows {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px 14px;
  align-items: center;
  padding: 10px;
}
.row-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.row-info { min-width: 0; }
.row-info p { margin: 0; }
.row-name { font-weight: 600; font-size: 17px; }
.row-contact {
  margin-top: 2px !important;
  font-size: 14px;
  color: var(--soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px !important;
  font-size: 12px;
  color: var(--muted);
}
.row-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-actions .link-button { margin-left: auto; }
@media (min-width: 640px) {
  .row { grid-template-columns: 84px 1fr auto; }
  .row-actions { grid-column: auto; }
}


@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .handoff[data-counting] .handoff-bar span { width: 100%; }
}
