/* Lawh — the six board materials, their frames, and the physical pens.
   Palette vars (--ink --accent --red --blue --green --yellow --surface) are set on .board by ui.js;
   the fallbacks below keep the page honest without JS. */

/* ======================================================================
   shared
   ====================================================================== */
.board { --surface: #fafbfb; --ink: #1b2430; --pen-scale: 1; }
/* the pen and the frames scale with the stage (the stage is the size container) */
@container (max-width: 860px) {
  .board { --pen-scale: 0.82; }
}
@container (max-width: 600px) {
  .board { --pen-scale: 0.62; }
  .board--whiteboard { --ft: 10px; --fw: 10px; --fb: 10px; }
  .board--chalkboard { --ft: 12px; --fw: 12px; --fb: 12px; }
  .board--flipchart  { --ft: 11px; }
  .board--smartboard { --ft: 7px; --fw: 7px; --fb: 7px; }
}

.board__surface { background: var(--surface); }
.board__surface::before, .board__surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.board__surface::before { z-index: 0; }  /* under the ink: texture, haze, grid */
.board__surface::after  { z-index: 3; }  /* over the ink: gloss, reflection, glare */
.board__frame::before, .board__frame::after { content: ""; position: absolute; }
.board__standoffs i, .board__ledge i { position: absolute; display: block; }

/* ======================================================================
   1 · whiteboard — near-white melamine, slim aluminium frame, small tray
   ====================================================================== */
.board--whiteboard {
  --surface: #fafbfb; --ink: #1b2430;
  --ft: 14px; --fw: 14px; --fb: 14px;
  border-radius: 4px;
  background: linear-gradient(180deg, #e4e6e8, #d1d4d7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    var(--board-shadow);
}
.board--whiteboard .board__frame {
  border-style: solid;
  border-width: var(--ft) var(--fw) var(--fb);
  border-color: #e7e9eb #cfd3d6 #b9bec3 #dadde0; /* top light, right mid, bottom dark, left mid-light: mitered bevel */
  border-radius: 4px;
}
.board--whiteboard .board__frame::before {
  /* fine brushed grain, frame only (the surface area is masked out) */
  inset: calc(-1 * var(--ft)) calc(-1 * var(--fw)) calc(-1 * var(--fb));
  padding: var(--ft) var(--fw) var(--fb);
  border-radius: 4px;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0) 0 1px, rgba(255,255,255,0.1) 1px 2px, rgba(0,0,0,0.018) 2px 3px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.board--whiteboard .board__frame::after {
  /* inner lip: the surface sits a hair below the frame */
  inset: 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.16), inset 0 0 0 1px rgba(0,0,0,0.09), inset 0 -1px 0 rgba(255,255,255,0.5);
}
.board--whiteboard .board__surface {
  background: linear-gradient(115deg, #fdfdfd, #fafbfb 50%, #f5f7f7);
}
.board--whiteboard .board__surface::before { background: none; }
.board--whiteboard .board__surface::after {
  /* faint diagonal sheen from the top-left light, fades out before the middle */
  background: linear-gradient(115deg, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0.25) 14%, rgba(255,255,255,0) 32%);
}
/* small marker tray tucked under the frame: two markers and a felt eraser */
.board--whiteboard .board__ledge { display: block; }
.board--whiteboard .board__ledge::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -9px;
  width: 26%; min-width: 140px; height: 10px;
  transform: translateX(-50%);
  background: linear-gradient(#dcdfe2, #c3c7cb 50%, #adb2b7);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.6);
}
.board--whiteboard .board__ledge i {
  bottom: -6px;
  height: 6px;
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.board--whiteboard .board__ledge i:nth-child(1),
.board--whiteboard .board__ledge i:nth-child(2) { width: 34px; background: linear-gradient(#f4f5f6, #d2d6da); }
.board--whiteboard .board__ledge i:nth-child(1) { left: calc(50% - 52px); }
.board--whiteboard .board__ledge i:nth-child(2) { left: calc(50% - 12px); }
.board--whiteboard .board__ledge i:nth-child(1)::after,
.board--whiteboard .board__ledge i:nth-child(2)::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 9px; border-radius: 0 3px 3px 0;
}
.board--whiteboard .board__ledge i:nth-child(1)::after { background: var(--blue, #1f6feb); }
.board--whiteboard .board__ledge i:nth-child(2)::after { background: var(--red, #d1343b); }
.board--whiteboard .board__ledge i:nth-child(3) { left: calc(50% + 30px); width: 24px; height: 7px; bottom: -7px; border-radius: 2px; background: linear-gradient(#5b6168, #353a40); }
.board--whiteboard .board__ledge i:nth-child(3)::after { content: ""; position: absolute; inset: auto 1px 0; height: 2px; background: #c8ccd0; border-radius: 0 0 2px 2px; }
.board--whiteboard .board__ledge i:nth-child(4) { display: none; }

/* ======================================================================
   2 · chalkboard — green-black slate, slim wood frame with grain, chalk ledge
   ====================================================================== */
.board--chalkboard {
  --surface: #2b3a34; --ink: #f3efe4;
  --ft: 18px; --fw: 18px; --fb: 18px;
  --grain-h: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 3px, rgba(0,0,0,0.07) 3px 4px, rgba(0,0,0,0) 4px 8px, rgba(255,255,255,0.05) 8px 9px, rgba(0,0,0,0) 9px 15px, rgba(0,0,0,0.05) 15px 16px);
  --grain-v: repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 3px, rgba(0,0,0,0.07) 3px 4px, rgba(0,0,0,0) 4px 8px, rgba(255,255,255,0.05) 8px 9px, rgba(0,0,0,0) 9px 15px, rgba(0,0,0,0.05) 15px 16px);
  border-radius: 3px;
  background: var(--grain-h), linear-gradient(#95673f, #7c5131 50%, #6b4428);
  box-shadow: inset 0 1px 0 rgba(255,225,190,0.28), inset 0 -1px 0 rgba(0,0,0,0.4), var(--board-shadow);
}
.board--chalkboard .board__frame::before,
.board--chalkboard .board__frame::after {
  /* side rails with vertical grain, mitered into the top/bottom rails */
  top: 0; bottom: 0;
  width: var(--fw);
  background: var(--grain-v), linear-gradient(90deg, #88593a, #7a502f 50%, #6c4529);
}
.board--chalkboard .board__frame::before { left: 0; clip-path: polygon(0 0, 100% var(--ft), 100% calc(100% - var(--fb)), 0 100%); }
.board--chalkboard .board__frame::after  { right: 0; clip-path: polygon(100% 0, 0 var(--ft), 0 calc(100% - var(--fb)), 100% 100%); background: var(--grain-v), linear-gradient(90deg, #6c4529, #7a502f 50%, #88593a); }
.board--chalkboard .board__surface {
  background: linear-gradient(165deg, #32443c, #2b3933 55%, #27342e);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.45), inset 0 2px 6px rgba(0,0,0,0.4);
}
.board--chalkboard .board__surface::before {
  /* slate grain, very subtle */
  background: var(--noise);
  background-size: 160px 160px;
  opacity: 0.08;
  mix-blend-mode: soft-light;
}
.board--chalkboard .board__surface::after {
  /* soft vignette and a breath of dust along the bottom */
  background:
    radial-gradient(70% 12% at 50% 100%, rgba(243,239,228,0.05), transparent 70%),
    radial-gradient(130% 110% at 50% 50%, transparent 62%, rgba(0,0,0,0.16) 100%);
}
.board--chalkboard .board__ledge { display: block; }
.board--chalkboard .board__ledge::before {
  content: "";
  position: absolute;
  left: 8%; right: 8%; bottom: -8px;
  height: 10px;
  background: linear-gradient(#8e6140, #744b2d 55%, #583820);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,225,190,0.22);
}
.board--chalkboard .board__ledge i {
  bottom: -5px;
  height: 5px;
  width: 22px;
  border-radius: 1.5px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.5);
  background: linear-gradient(#fbf8f0, #d9d4c6);
}
.board--chalkboard .board__ledge i:nth-child(1) { left: 12%; }
.board--chalkboard .board__ledge i:nth-child(2) { left: 12%; margin-left: 27px; width: 16px; background: linear-gradient(var(--accent, #ffd97a), #c9a85a); }
.board--chalkboard .board__ledge i:nth-child(3) { left: 12%; margin-left: 48px; width: 18px; background: linear-gradient(var(--blue, #8fd3ff), #6fa5c9); }
.board--chalkboard .board__ledge i:nth-child(4) { right: 12%; width: 30px; height: 7px; bottom: -6px; border-radius: 2px; background: linear-gradient(#3e3f44, #26272b); }
.board--chalkboard .board__ledge i:nth-child(4)::after { content: ""; position: absolute; inset: auto 2px 0; height: 2px; background: #d7d2c6; opacity: 0.8; border-radius: 0 0 2px 2px; }

/* ======================================================================
   3 · glassboard — smoked tempered glass floating on four chrome standoffs
   ====================================================================== */
.board--glassboard {
  --surface: #151b22; --ink: #e8fbff;
  --ft: 0px; --fw: 0px; --fb: 0px;
  background: transparent;
  box-shadow: none;
}
.board--glassboard .board__surface {
  border-radius: 4px;
  background:
    linear-gradient(118deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 30%, rgba(255,255,255,0) 48%),
    linear-gradient(#1b242d, #121920);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.16),
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -1px 0 rgba(255,255,255,0.06),
    0 18px 40px rgba(0,0,0,0.45),
    0 4px 10px rgba(0,0,0,0.3);
}
.board--glassboard .board__surface::before {
  /* depth tint: glass over a dark backing */
  background: radial-gradient(80% 70% at 50% 50%, rgba(255,255,255,0.02), transparent 70%);
}
.board--glassboard .board__surface::after {
  /* one soft diagonal reflection band near the top-left corner, clear of the centre */
  background:
    linear-gradient(118deg, transparent 6%, rgba(255,255,255,0.06) 13%, rgba(255,255,255,0.06) 21%, transparent 28%);
}
.board--glassboard .board__standoffs { display: block; z-index: 5; }
.board--glassboard .board__standoffs i {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #d9dde1 24%, #9aa0a6 58%, #5a6067 82%, #3b4045 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.25);
}
.board--glassboard .board__standoffs i::after {
  content: "";
  position: absolute; inset: 4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c9ced3, #6f757b 70%);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.6);
}
.board--glassboard .board__standoffs i:nth-child(1) { top: 12px; left: 12px; }
.board--glassboard .board__standoffs i:nth-child(2) { top: 12px; right: 12px; }
.board--glassboard .board__standoffs i:nth-child(3) { bottom: 12px; left: 12px; }
.board--glassboard .board__standoffs i:nth-child(4) { bottom: 12px; right: 12px; }

/* ======================================================================
   4 · acrylic — frosted clear panel; thin visible edge, frosted glow inside
   ====================================================================== */
.board--acrylic {
  --surface: #eef2f4; --ink: #13233a;
  --ft: 0px; --fw: 0px; --fb: 0px;
  background: transparent;
  box-shadow: none;
}
.board--acrylic .board__surface {
  border-radius: 3px;
  background:
    linear-gradient(150deg, rgba(255,255,255,0.7), rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.5)),
    #e9eff2;
  box-shadow:
    /* edge: each layer is a slice of the panel's thickness, acrylic-green at the core */
    -1px 1px 0 #d8edef,
    -2px 2px 0 #c2e4e7,
    -3px 3px 0 #acd9dc,
    -4px 4px 0 #a2d1d5,
    inset 0 0 10px rgba(255,255,255,0.95),
    inset 0 0 0 1px rgba(150,205,210,0.55),
    -8px 16px 32px rgba(20, 40, 50, 0.18),
    -2px 4px 8px rgba(20, 40, 50, 0.1);
}
.board--acrylic .board__surface::before {
  /* frost */
  background: var(--noise);
  background-size: 140px 140px;
  opacity: 0.08;
  mix-blend-mode: multiply;
}
.board--acrylic .board__surface::after {
  background:
    linear-gradient(100deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 26%),
    linear-gradient(0deg, rgba(150,205,210,0.1), transparent 7%),
    linear-gradient(270deg, rgba(150,205,210,0.1), transparent 5%);
}
.board--acrylic .board__standoffs { display: block; z-index: 5; }
.board--acrylic .board__standoffs i {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #d4d8dc 40%, #8d939a 80%, #666c73);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 2px rgba(255,255,255,0.4), 0 0 0 3px rgba(150,205,210,0.4);
}
.board--acrylic .board__standoffs i:nth-child(1) { top: 12px; left: 12px; }
.board--acrylic .board__standoffs i:nth-child(2) { top: 12px; right: 12px; }
.board--acrylic .board__standoffs i:nth-child(3) { bottom: 12px; left: 12px; }
.board--acrylic .board__standoffs i:nth-child(4) { bottom: 12px; right: 12px; }

/* ======================================================================
   5 · flipchart — cream paper pad under a slim metal clip bar
   ====================================================================== */
.board--flipchart {
  --surface: #f7f2e6; --ink: #243b6b;
  --ft: 14px; --fw: 0px; --fb: 0px;
  border-radius: 6px 6px 3px 3px;
  /* the padding strip on top IS the clip bar */
  background: linear-gradient(#64696f, #44494f 55%, #30343a) top / 100% var(--ft) no-repeat;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.board--flipchart::before, .board--flipchart::after {
  /* easel legs, just a hint below the pad */
  content: "";
  position: absolute;
  top: 80%;
  width: 6px;
  height: 50%;
  z-index: 0;
  background: linear-gradient(90deg, #9c7a52, #846237 55%, #6d4f30);
  opacity: 0.9;
  border-radius: 2px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
}
.board--flipchart::before { left: 12%; }
.board--flipchart::after  { right: 12%; }
.board--flipchart .board__surface {
  z-index: 1;
  border-radius: 0 0 3px 3px;
  background:
    linear-gradient(90deg, rgba(60, 80, 140, 0.02) 1px, transparent 1px) 0 0 / calc(100% / 32) 100%,
    linear-gradient(0deg,  rgba(60, 80, 140, 0.02) 1px, transparent 1px) 0 0 / 100% calc(100% / 18),
    linear-gradient(#faf6ec, #f5efe1);
  box-shadow:
    /* the next sheets peeking out below */
    0 1px 0 #ece5d3, 0 2px 0 #e3dcc8, 0 3px 0 #d8d0bb,
    0 12px 26px rgba(40, 30, 10, 0.16), 0 2px 5px rgba(40, 30, 10, 0.08),
    inset 0 0 0 1px rgba(90, 70, 30, 0.06);
}
.board--flipchart .board__surface::before {
  /* paper fibre */
  background: var(--noise);
  background-size: 150px 150px;
  opacity: 0.07;
  mix-blend-mode: multiply;
}
.board--flipchart .board__surface::after {
  /* shadow under the clip bar */
  background: linear-gradient(180deg, rgba(40,30,10,0.14), rgba(40,30,10,0.04) 6px, transparent 16px);
}
.board--flipchart .board__frame::before,
.board--flipchart .board__frame::after {
  /* two spring clips on the bar (the frame box spans the whole board here: no border) */
  top: 2px;
  width: 28px; height: 10px;
  border-radius: 2px;
  background: linear-gradient(#e2e5e8, #b6bbc0 50%, #8d939a);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.7);
}
.board--flipchart .board__frame::before { left: 16%; }
.board--flipchart .board__frame::after  { right: 16%; }

/* ======================================================================
   6 · smartboard — 10 px black bezel, thin inner line, dark display, green LED
   ====================================================================== */
.board--smartboard {
  --surface: #0c1117; --ink: #f2f6fa;
  --ft: 10px; --fw: 10px; --fb: 10px;
  border-radius: 8px;
  background: linear-gradient(#15181c, #0f1215);
  box-shadow:
    inset 0 0 0 1px #2a2f36,
    inset 0 1px 0 rgba(255,255,255,0.08),
    var(--board-shadow);
}
.board--smartboard .board__surface {
  border-radius: 3px;
  background: radial-gradient(90% 80% at 50% 40%, #121923, #0c1117 75%);
  box-shadow: inset 0 0 0 1px #262c33, inset 0 0 12px rgba(0,0,0,0.8);
}
.board--smartboard .board__surface::before { background: none; }
.board--smartboard .board__surface::after {
  /* anti-glare glass with a faint light reflection */
  background: linear-gradient(165deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.01) 28%, transparent 42%);
}
.board--smartboard .board__frame::before { display: none; }
.board--smartboard .board__frame::after {
  /* status LED in the bottom bezel (the frame box spans the whole board here: no border) */
  right: 14px; bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 4px 1px rgba(61,220,132,0.8), 0 0 10px rgba(61,220,132,0.4);
}

/* dark boards: hint sits brighter */
.board--chalkboard .board__hint, .board--glassboard .board__hint, .board--smartboard .board__hint { opacity: 0.4; }

/* ======================================================================
   the pen — tip at the element origin (0,0), body grows up and leans up-left,
   rotated and scaled about the tip. ≈ 56 px long × 10 px wide at --pen-scale: 1.
   --pen-x / --pen-y : css px inside .board__surface (set by the engine; the
                       engine also sets `translate`, which is the only thing that moves it)
   --pen-color       : current ink (defaults to the board's --ink)
   --pen-scale       : set on .board from the stage width (1 → 0.62 on phones)
   ====================================================================== */
.pen {
  --pen-color: var(--ink);
  --tilt: -22deg;
  --lift: -5px;
  position: absolute;
  left: 0;
  top: 0;
  width: 0; height: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.86;
  /* `transform` is the stylesheet's: tilt + scale about the tip at (0,0) */
  transform: rotate(var(--tilt)) scale(var(--pen-scale, 1));
  transform-origin: 0 0;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  will-change: translate, transform;
}
.pen.is-instant, .pen.is-instant * { transition: none !important; }
.pen.is-pressed { --tilt: -32deg; --lift: 0px; opacity: 0.92; }
.pen.is-lifted  { --tilt: -22deg; --lift: -5px; }
.pen.is-hidden, .pen[hidden] { opacity: 0; visibility: hidden; }
body.mode-user .pen.pen--ai-only { opacity: 0; visibility: hidden; }

.pen__body, .pen__tip {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translate(-50%, var(--lift));
  transition: transform var(--t-fast) var(--ease);
}
.pen__body::before, .pen__body::after, .pen__tip::before, .pen__tip::after { content: ""; position: absolute; }
.pen__shadow {
  position: absolute;
  left: 0; top: 0;
  width: 14px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,0.34), rgba(0,0,0,0) 100%);
  transform: rotate(calc(-1 * var(--tilt))) translate(-45%, -40%);
  transform-origin: 0 0;
  filter: blur(1px);
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  opacity: 0.9;
}
.pen.is-lifted .pen__shadow { transform: rotate(calc(-1 * var(--tilt))) translate(-35%, -20%) scale(1.4); opacity: 0.35; filter: blur(2px); }
.board--chalkboard .pen__shadow, .board--glassboard .pen__shadow, .board--smartboard .pen__shadow { background: radial-gradient(closest-side, rgba(0,0,0,0.6), rgba(0,0,0,0) 100%); }

/* --- marker: short fat body, chisel felt tip, dark cap --- */
.pen--marker .pen__tip {
  width: 7px; height: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 85%, black), var(--pen-color) 45%, color-mix(in srgb, var(--pen-color) 75%, black));
  clip-path: polygon(10% 0, 90% 0, 72% 100%, 26% 100%);
  opacity: 0.95;
}
.pen--marker .pen__tip::before {
  /* collar */
  left: -2px; bottom: 5px; width: 11px; height: 4px;
  border-radius: 1.5px 1.5px 1px 1px;
  background: linear-gradient(90deg, #6d7279, #c6cacf 40%, #8a9096 85%, #5c6168);
}
.pen--marker .pen__body {
  bottom: 9px;
  width: 11px; height: 34px;
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(90deg, #a9aeb4, #f1f2f3 30%, #e4e6e8 55%, #b4b9be 85%, #868b91);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}
.pen--marker .pen__body::before {
  /* label band in the ink colour */
  left: 0; right: 0; top: 11px; height: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 70%, black), var(--pen-color) 40%, color-mix(in srgb, var(--pen-color) 85%, white) 60%, color-mix(in srgb, var(--pen-color) 65%, black));
  opacity: 0.9;
}
.pen--marker .pen__body::after {
  /* dark cap */
  left: -0.5px; right: -0.5px; top: -12px; height: 13px;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(90deg, #1f2328, #4a5058 38%, #343a41 60%, #171a1e);
  box-shadow: inset 0 -1px 0 rgba(0,0,0,0.4);
}

/* --- chalk: a stub, chalky, a puff of dust at the tip --- */
.pen--chalk .pen__tip {
  width: 8px; height: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 80%, #8a8578), var(--pen-color) 45%, color-mix(in srgb, var(--pen-color) 85%, #8a8578));
  clip-path: polygon(6% 0, 94% 0, 82% 100%, 22% 100%);
}
.pen--chalk .pen__tip::after {
  /* dust */
  left: -5px; bottom: -3px; width: 16px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--pen-color) 60%, transparent), transparent);
  opacity: 0.35;
  filter: blur(1.5px);
}
.pen--chalk .pen__body {
  bottom: 2px;
  width: 8px; height: 28px;
  border-radius: 1.5px 1.5px 1px 1px;
  background:
    var(--noise) 0 0 / 60px 60px,
    linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 78%, #6b6558), var(--pen-color) 40%, color-mix(in srgb, var(--pen-color) 92%, white) 55%, color-mix(in srgb, var(--pen-color) 80%, #6b6558));
  background-blend-mode: soft-light, normal;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.pen--chalk .pen__body::after {
  inset: 0; opacity: 0.2;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0 1px, transparent 1px 3px);
}

/* --- liquid chalk: slim black marker, colour window, glowing bullet tip --- */
.pen--liquid .pen__tip {
  width: 4px; height: 5px;
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--pen-color) 70%, white), var(--pen-color) 60%);
  box-shadow: 0 0 4px 1px color-mix(in srgb, var(--pen-color) 75%, transparent), 0 0 9px color-mix(in srgb, var(--pen-color) 35%, transparent);
}
.pen--liquid .pen__tip::before {
  /* cone collar */
  left: -1.5px; bottom: 4px; width: 7px; height: 4px;
  background: linear-gradient(90deg, #1e2124, #4a4f55 45%, #2a2e32);
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.pen--liquid .pen__body {
  bottom: 8px;
  width: 7px; height: 40px;
  border-radius: 3px 3px 1.5px 1.5px;
  background: linear-gradient(90deg, #1b1e22, #3d4248 35%, #2a2e33 60%, #121417);
  box-shadow: inset 1px 0 0 rgba(255,255,255,0.14);
}
.pen--liquid .pen__body::before {
  /* colour window */
  left: 1.5px; right: 1.5px; top: 13px; height: 9px;
  border-radius: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 70%, black), var(--pen-color));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5);
}
.pen--liquid .pen__body::after {
  /* cap */
  left: -0.5px; right: -0.5px; top: -10px; height: 11px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(90deg, #1b1e22, #3d4248 35%, #2a2e33 60%, #121417);
  border-bottom: 1px solid var(--pen-color);
}

/* --- acrylic paint marker: round white body, coloured cap, round tip --- */
.pen--acrylic .pen__tip {
  width: 6px; height: 6px;
  border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--pen-color) 80%, white), var(--pen-color) 55%, color-mix(in srgb, var(--pen-color) 80%, black));
}
.pen--acrylic .pen__tip::before {
  left: -1.5px; bottom: 5px; width: 9px; height: 4px;
  background: linear-gradient(90deg, #cfd3d7, #ffffff 40%, #dfe2e5 70%, #b3b8bd);
  clip-path: polygon(0 0, 100% 0, 82% 100%, 18% 100%);
}
.pen--acrylic .pen__body {
  bottom: 9px;
  width: 10px; height: 34px;
  border-radius: 5px 5px 2.5px 2.5px;
  background: linear-gradient(90deg, #c2c7cc, #ffffff 35%, #eef0f2 60%, #b7bcc1);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.pen--acrylic .pen__body::before {
  /* paint stripe */
  left: 0; right: 0; top: 10px; height: 7px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 70%, black), var(--pen-color) 40%, color-mix(in srgb, var(--pen-color) 80%, white) 60%, color-mix(in srgb, var(--pen-color) 70%, black));
}
.pen--acrylic .pen__body::after {
  /* cap */
  left: 0; right: 0; top: -11px; height: 12px;
  border-radius: 5px 5px 1px 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 65%, black), var(--pen-color) 40%, color-mix(in srgb, var(--pen-color) 85%, white) 60%, color-mix(in srgb, var(--pen-color) 65%, black));
}

/* --- flip chart marker: full-colour body, bullet tip --- */
.pen--flip .pen__tip {
  width: 5px; height: 6px;
  border-radius: 50% 50% 35% 35% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 40% 30%, color-mix(in srgb, var(--pen-color) 75%, white), var(--pen-color) 50%, color-mix(in srgb, var(--pen-color) 75%, black));
}
.pen--flip .pen__tip::before {
  left: -1.5px; bottom: 5px; width: 8px; height: 4px;
  background: linear-gradient(90deg, #2f3337, #5a6066 40%, #3a3f44);
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.pen--flip .pen__body {
  bottom: 9px;
  width: 9px; height: 36px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 62%, black), var(--pen-color) 38%, color-mix(in srgb, var(--pen-color) 82%, white) 58%, color-mix(in srgb, var(--pen-color) 62%, black));
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
}
.pen--flip .pen__body::before {
  /* white label */
  left: 0; right: 0; top: 12px; height: 9px;
  background: linear-gradient(90deg, #d8dbde, #ffffff 40%, #e8eaec 65%, #c9cdd1);
  border-top: 1px solid rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(0,0,0,0.2);
}
.pen--flip .pen__body::after {
  left: 0; right: 0; top: -10px; height: 11px;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 55%, black), color-mix(in srgb, var(--pen-color) 85%, black) 40%, color-mix(in srgb, var(--pen-color) 70%, black) 60%, color-mix(in srgb, var(--pen-color) 50%, black));
}

/* --- stylus: very thin anodised pen, fine tip, glowing contact dot --- */
.pen--stylus .pen__tip {
  width: 3px; height: 4px;
  background: linear-gradient(90deg, #b9c0c7, #f2f5f8 50%, #9aa2aa);
  clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
}
.pen--stylus .pen__tip::before {
  /* silver ring */
  left: -1px; bottom: 3.5px; width: 5px; height: 2px;
  background: linear-gradient(90deg, #8f969d, #ffffff 50%, #7f868d);
  border-radius: 0.5px;
}
.pen--stylus .pen__tip::after {
  /* cursor glow at the contact point */
  left: -3.5px; bottom: -5px; width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent, #4f8cff) 65%, transparent), transparent 70%);
  opacity: 0.55;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.pen.is-pressed.pen--stylus .pen__tip::after { opacity: 1; transform: scale(1.25); }
.pen--stylus .pen__body {
  bottom: 5.5px;
  width: 5px; height: 50px;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(90deg, #262a2f, #6f767e 40%, #4b5159 60%, #1d2024);
  box-shadow: inset 1px 0 0 rgba(255,255,255,0.18);
}
.pen--stylus .pen__body::before {
  /* clip */
  left: 3.5px; top: 4px; width: 1.5px; height: 14px;
  border-radius: 1px;
  background: linear-gradient(90deg, #8a9199, #d9dee3);
}
.pen--stylus .pen__body::after {
  /* flat button */
  left: 1px; right: 1px; top: 22px; height: 5px;
  border-radius: 1px;
  background: rgba(0,0,0,0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

@media (prefers-reduced-motion: reduce) {
  .pen, .pen__body, .pen__tip, .pen__shadow, .pen--stylus .pen__tip::after { transition: none; }
}
