/* 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: #f7f8f7; --ink: #1b2430; }
.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 — glossy melamine, aluminium frame, marker tray
   ====================================================================== */
.board--whiteboard {
  --surface: #f7f8f7; --ink: #1b2430;
  --ft: 16px; --fw: 16px; --fb: 16px;
  background: #c5c9cd;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    var(--board-shadow);
}
.board--whiteboard .board__frame {
  border-style: solid;
  border-width: var(--ft) var(--fw) var(--fb);
  border-color: #dcdfe2 #b7bcc1 #a3a8ae #cdd1d5; /* top light, right mid, bottom dark, left mid-light: mitered extrusion */
  border-radius: 3px;
}
.board--whiteboard .board__frame::before {
  /* brushed highlight on the top rail */
  inset: 2px var(--fw) auto;
  height: 4px;
  top: calc(var(--ft) / 2 - 4px);
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.55) 20%, rgba(255,255,255,0.55) 80%, rgba(255,255,255,0) 100%);
  border-radius: 2px;
}
.board--whiteboard .board__frame::after {
  /* inner lip: the surface sits a hair below the frame */
  inset: var(--ft) var(--fw) var(--fb);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.16), inset 0 2px 4px rgba(0,0,0,0.14), inset 0 -1px 0 rgba(255,255,255,0.5);
}
.board--whiteboard .board__surface {
  background:
    linear-gradient(#fbfbfa, #f3f4f3);
}
.board--whiteboard .board__surface::before {
  /* marker ghosting: faint wiped smears, never readable */
  background:
    radial-gradient(44% 4% at 58% 36%, rgba(30, 50, 90, 0.035), transparent 70%),
    radial-gradient(32% 3.5% at 34% 62%, rgba(30, 50, 90, 0.03), transparent 70%),
    radial-gradient(24% 3% at 72% 70%, rgba(180, 40, 50, 0.028), transparent 70%),
    radial-gradient(60% 45% at 50% 60%, rgba(120, 130, 140, 0.04), transparent 72%);
  filter: blur(5px);
}
.board--whiteboard .board__surface::after {
  /* glossy sheen from the top-left light */
  background:
    linear-gradient(112deg, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.35) 16%, rgba(255,255,255,0) 40%),
    linear-gradient(0deg, rgba(0,0,0,0.035), transparent 18%);
  mix-blend-mode: normal;
}
/* marker tray under the frame with two markers and a felt eraser */
.board--whiteboard .board__ledge { display: block; }
.board--whiteboard .board__ledge::before {
  content: "";
  position: absolute;
  left: 50%; bottom: -13px;
  width: 42%; height: 14px;
  transform: translateX(-50%);
  background: linear-gradient(#d9dcdf, #c0c4c8 45%, #9ea3a8 50%, #b6babe);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 8px 14px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.6);
}
.board--whiteboard .board__ledge i {
  bottom: -9px;
  height: 9px;
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.board--whiteboard .board__ledge i:nth-child(1) { left: calc(50% - 19%); width: 52px; background: linear-gradient(#f4f5f6, #cfd3d7); }
.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: 15px; border-radius: 0 5px 5px 0;
}
.board--whiteboard .board__ledge i:nth-child(1)::after { background: var(--blue, #1f6feb); }
.board--whiteboard .board__ledge i:nth-child(2) { left: calc(50% - 10%); width: 52px; background: linear-gradient(#f4f5f6, #cfd3d7); }
.board--whiteboard .board__ledge i:nth-child(2)::after { background: var(--red, #d1343b); }
.board--whiteboard .board__ledge i:nth-child(3) { left: calc(50% + 8%); width: 40px; height: 11px; bottom: -10px; border-radius: 3px; background: linear-gradient(#5b6168, #353a40); }
.board--whiteboard .board__ledge i:nth-child(3)::after { content: ""; position: absolute; inset: auto 2px 0; height: 3px; background: #c8ccd0; border-radius: 0 0 2px 2px; }
.board--whiteboard .board__ledge i:nth-child(4) { display: none; }

/* ======================================================================
   2 · chalkboard — green-black slate, chalk haze, wood frame, chalk ledge
   ====================================================================== */
.board--chalkboard {
  --surface: #2b3a34; --ink: #f3efe4;
  --ft: 24px; --fw: 24px; --fb: 24px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 5px, rgba(0,0,0,0.07) 5px 7px, rgba(0,0,0,0) 7px 14px, rgba(255,255,255,0.045) 14px 15px, rgba(0,0,0,0) 15px 26px, rgba(0,0,0,0.05) 26px 27px),
    linear-gradient(#8a5d36, #6e4627 48%, #5c3a20 52%, #7a5231);
  box-shadow: inset 0 1px 0 rgba(255,220,180,0.3), inset 0 -2px 0 rgba(0,0,0,0.35), 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:
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 5px, rgba(0,0,0,0.07) 5px 7px, rgba(0,0,0,0) 7px 14px, rgba(255,255,255,0.045) 14px 15px, rgba(0,0,0,0) 15px 26px, rgba(0,0,0,0.05) 26px 27px),
    linear-gradient(90deg, #7a5231, #6b4426 50%, #5e3b21);
}
.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: repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 5px, rgba(0,0,0,0.07) 5px 7px, rgba(0,0,0,0) 7px 14px, rgba(255,255,255,0.045) 14px 15px, rgba(0,0,0,0) 15px 26px, rgba(0,0,0,0.05) 26px 27px), linear-gradient(90deg, #5e3b21, #6b4426 50%, #7a5231); }
.board--chalkboard .board__surface {
  background: linear-gradient(170deg, #2f403a, #283630 60%, #243029);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5), inset 0 3px 8px rgba(0,0,0,0.45), inset 0 0 60px rgba(0,0,0,0.25);
}
.board--chalkboard .board__surface::before {
  /* chalk dust haze and half-wiped clouds */
  background:
    radial-gradient(38% 30% at 28% 60%, rgba(243,239,228,0.10), transparent 70%),
    radial-gradient(30% 22% at 66% 40%, rgba(243,239,228,0.08), transparent 70%),
    radial-gradient(60% 18% at 50% 88%, rgba(243,239,228,0.12), transparent 72%),
    radial-gradient(20% 14% at 82% 72%, rgba(243,239,228,0.06), transparent 70%),
    var(--noise);
  background-size: auto, auto, auto, auto, 180px 180px;
  opacity: 0.9;
  filter: blur(0.3px);
}
.board--chalkboard .board__surface::after {
  background: var(--noise);
  background-size: 120px 120px;
  opacity: 0.16;
  mix-blend-mode: soft-light;
}
.board--chalkboard .board__ledge { display: block; }
.board--chalkboard .board__ledge::before {
  content: "";
  position: absolute;
  left: 6%; right: 6%; bottom: -12px;
  height: 16px;
  background: linear-gradient(#8a5d36, #6e4627 55%, #4f3119);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 8px 14px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,180,0.25);
}
.board--chalkboard .board__ledge i {
  bottom: -7px;
  height: 8px;
  width: 38px;
  border-radius: 2px;
  box-shadow: 0 1px 2px 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: 46px; width: 26px; background: linear-gradient(var(--accent, #ffd97a), #c9a85a); }
.board--chalkboard .board__ledge i:nth-child(3) { left: 12%; margin-left: 80px; width: 30px; background: linear-gradient(var(--blue, #8fd3ff), #6fa5c9); }
.board--chalkboard .board__ledge i:nth-child(4) { right: 12%; width: 54px; height: 13px; bottom: -10px; border-radius: 3px; background: linear-gradient(#3e3f44, #26272b); }
.board--chalkboard .board__ledge i:nth-child(4)::after { content: ""; position: absolute; inset: auto 3px 0; height: 4px; background: #d7d2c6; opacity: 0.8; border-radius: 0 0 2px 2px; }

/* ======================================================================
   3 · glassboard — smoky tempered glass floating on four 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.14) 0%, rgba(255,255,255,0.06) 28%, rgba(255,255,255,0.0) 46%),
    radial-gradient(120% 90% at 50% 100%, rgba(80,140,170,0.12), transparent 60%),
    linear-gradient(#1c252e, #111820);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.22),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(255,255,255,0.08),
    0 24px 50px rgba(0,0,0,0.5),
    0 60px 90px -30px rgba(0,0,0,0.55);
}
.board--glassboard .board__surface::before {
  /* depth tint: glass over a dark backing */
  background: radial-gradient(70% 60% at 50% 45%, rgba(255,255,255,0.03), transparent 70%);
}
.board--glassboard .board__surface::after {
  /* soft reflection streak */
  background:
    linear-gradient(118deg, transparent 41%, rgba(255,255,255,0.035) 45%, rgba(255,255,255,0.065) 47%, rgba(255,255,255,0.025) 50%, transparent 55%),
    linear-gradient(0deg, rgba(255,255,255,0.03), transparent 22%);
}
.board--glassboard .board__standoffs { display: block; z-index: 5; }
.board--glassboard .board__standoffs i {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffffff 0%, #d9dde1 22%, #9aa0a6 55%, #5a6067 80%, #3b4045 100%);
  box-shadow: 0 4px 8px 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: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #c9ced3, #6f757b 70%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.6);
}
.board--glassboard .board__standoffs i:nth-child(1) { top: 16px; left: 16px; }
.board--glassboard .board__standoffs i:nth-child(2) { top: 16px; right: 16px; }
.board--glassboard .board__standoffs i:nth-child(3) { bottom: 16px; left: 16px; }
.board--glassboard .board__standoffs i:nth-child(4) { bottom: 16px; right: 16px; }

/* ======================================================================
   4 · acrylic — frosted clear panel; you can see the edge thickness
   ====================================================================== */
.board--acrylic {
  --surface: #eef2f4; --ink: #13233a;
  --ft: 0px; --fw: 0px; --fb: 0px;
  background: transparent;
  box-shadow: none;
}
.board--acrylic .board__surface {
  border-radius: 2px;
  background:
    linear-gradient(152deg, rgba(255,255,255,0.75), rgba(255,255,255,0.2) 55%, rgba(255,255,255,0.45)),
    #e9eff2;
  box-shadow:
    /* edge: each layer is a slice of the panel's thickness, acrylic-green at the core */
    -1px 1px 0 #dbeef0,
    -2px 2px 0 #c6e4e6,
    -3px 3px 0 #b3dadd,
    -4px 4px 0 #a3d1d4,
    -5px 5px 0 #96c9cd,
    -6px 6px 0 #8cc2c6,
    -7px 7px 0 #a9d4d7,
    inset 0 0 0 1px rgba(255,255,255,0.9),
    inset -1px -1px 0 rgba(140,194,198,0.5),
    -12px 24px 40px rgba(20, 40, 50, 0.22),
    -4px 8px 12px rgba(20, 40, 50, 0.12);
}
.board--acrylic .board__surface::before {
  /* frost */
  background: var(--noise);
  background-size: 140px 140px;
  opacity: 0.2;
  mix-blend-mode: multiply;
}
.board--acrylic .board__surface::after {
  background:
    linear-gradient(100deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 30%),
    linear-gradient(0deg, rgba(140,194,198,0.08), transparent 10%),
    linear-gradient(270deg, rgba(140,194,198,0.08), transparent 8%);
}
.board--acrylic .board__standoffs { display: block; z-index: 5; }
.board--acrylic .board__standoffs i {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #d4d8dc 40%, #8d939a 80%, #666c73);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 0 0 3px rgba(255,255,255,0.35), 0 0 0 4px rgba(140,194,198,0.35);
}
.board--acrylic .board__standoffs i:nth-child(1) { top: 14px; left: 14px; }
.board--acrylic .board__standoffs i:nth-child(2) { top: 14px; right: 14px; }
.board--acrylic .board__standoffs i:nth-child(3) { bottom: 14px; left: 14px; }
.board--acrylic .board__standoffs i:nth-child(4) { bottom: 14px; right: 14px; }

/* ======================================================================
   5 · flipchart — cream paper pad on a clip bar, easel legs behind
   ====================================================================== */
.board--flipchart {
  --surface: #f6f1e4; --ink: #243b6b;
  --ft: 30px; --fw: 0px; --fb: 0px;
  background: transparent;
  box-shadow: none;
}
.board--flipchart::before, .board--flipchart::after {
  /* easel legs, just a hint */
  content: "";
  position: absolute;
  top: 60%;
  width: 14px;
  height: 70%;
  z-index: 0;
  background: linear-gradient(90deg, #a07a4e, #8a6539 55%, #6e4e2b);
  border-radius: 3px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}
.board--flipchart::before { left: 8%; transform: rotate(4deg); transform-origin: top; }
.board--flipchart::after  { right: 8%; transform: rotate(-4deg); transform-origin: top; }
.board--flipchart .board__surface {
  z-index: 1;
  border-radius: 0 0 3px 3px;
  background:
    linear-gradient(90deg, rgba(60, 80, 140, 0.055) 1px, transparent 1px) 0 0 / calc(100% / 32) 100%,
    linear-gradient(0deg,  rgba(60, 80, 140, 0.055) 1px, transparent 1px) 0 0 / 100% calc(100% / 18),
    linear-gradient(#f9f5ea, #f4eddc);
  box-shadow:
    0 1px 0 #ebe4d1, 0 2px 0 #e6dfca, 0 3px 0 #ddd5bd, 0 4px 0 #d3cab0,
    0 14px 26px rgba(40, 30, 10, 0.22), 0 3px 6px rgba(40, 30, 10, 0.1),
    inset 0 0 0 1px rgba(90, 70, 30, 0.08);
}
.board--flipchart .board__surface::before {
  background: var(--noise);
  background-size: 150px 150px;
  opacity: 0.12;
  mix-blend-mode: multiply;
}
.board--flipchart .board__surface::after {
  /* shadow under the clip bar; paper curl at the bottom */
  background:
    linear-gradient(180deg, rgba(40,30,10,0.18), rgba(40,30,10,0.05) 6px, transparent 22px),
    linear-gradient(0deg, rgba(40,30,10,0.07), transparent 6%);
}
.board--flipchart .board__frame::before {
  /* clip bar */
  inset: 0 0 auto;
  height: var(--ft);
  border-radius: 7px 7px 0 0;
  background: linear-gradient(#60656c, #42474e 55%, #30343a);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 -1px 0 rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.35);
}
.board--flipchart .board__frame::after {
  /* wire rings looping out of the bar into the pad */
  inset: calc(var(--ft) - 9px) 5% auto;
  height: 18px;
  background:
    radial-gradient(circle at 50% 50%, transparent 4px, #aeb4ba 4.5px, #e7eaed 5.5px, #8d9399 7px, transparent 7.5px) 0 0 / 38px 18px repeat-x;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35));
}

/* ======================================================================
   6 · smartboard — matte bezel, dark display, status LED
   ====================================================================== */
.board--smartboard {
  --surface: #0c1117; --ink: #f2f6fa;
  --ft: 18px; --fw: 18px; --fb: 34px;
  border-radius: 12px;
  background: linear-gradient(#262b31, #1a1e23 70%, #15181c);
  box-shadow:
    inset 0 0 0 1px #3a4048,
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    var(--board-shadow);
}
.board--smartboard .board__surface {
  border-radius: 4px;
  background: radial-gradient(95% 85% at 50% 38%, #141b24, #0c1117 72%);
  box-shadow: inset 0 0 0 1px #000, inset 0 0 14px rgba(0,0,0,0.9);
}
.board--smartboard .board__surface::before {
  /* pixel grid shimmer */
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.016) 0 1px, transparent 1px 3px);
}
.board--smartboard .board__surface::after {
  /* anti-glare glass with a faint light reflection */
  background:
    linear-gradient(168deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.015) 30%, transparent 48%);
}
.board--smartboard .board__frame::before {
  /* sensor slot on the chin */
  left: 50%; bottom: 13px;
  width: 54px; height: 4px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #0a0c0f;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.06);
}
.board--smartboard .board__frame::after {
  /* status LED */
  right: 26px; bottom: 13px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent, #4f8cff);
  box-shadow: 0 0 5px 1px var(--accent, #4f8cff), 0 0 14px rgba(79,140,255,0.5);
}

/* 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, body grows upward, rotated about the tip
   --pen-x / --pen-y : css px inside .board__surface (set by the engine)
   --pen-color       : current ink (defaults to the board's --ink)
   ====================================================================== */
.pen {
  --pen-color: var(--ink);
  --tilt: 20deg;
  --lift: -9px;
  position: absolute;
  left: 0;
  top: 0;
  /* the engine moves the tip with the individual `translate` property (never transitioned);
     `transform` stays free for the tilt about the tip at (0,0) */
  width: 0; height: 0;
  z-index: 5;
  pointer-events: none;
  transform: rotate(var(--tilt));
  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: 35deg; --lift: 0px; }
.pen.is-lifted  { --tilt: 20deg; --lift: -9px; }
.pen.is-hidden, .pen[hidden] { opacity: 0; }
body.mode-user .pen.pen--ai-only { opacity: 0; }

.pen__body, .pen__tip {
  position: absolute;
  left: 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: 26px; height: 9px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,0.42), rgba(0,0,0,0) 100%);
  transform: rotate(calc(-1 * var(--tilt))) translate(-40%, -30%);
  transform-origin: 0 0;
  filter: blur(1.5px);
  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(-30%, -10%) scale(1.5); opacity: 0.45; filter: blur(3px); }
.board--chalkboard .pen__shadow, .board--glassboard .pen__shadow, .board--smartboard .pen__shadow { background: radial-gradient(closest-side, rgba(0,0,0,0.7), rgba(0,0,0,0) 100%); }

/* --- marker: fat body, chisel felt tip, cap in the current colour --- */
.pen--marker .pen__tip {
  bottom: 0;
  width: 12px; height: 13px;
  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(12% 0, 88% 0, 72% 100%, 24% 100%);
  opacity: 0.95;
}
.pen--marker .pen__tip::before {
  /* collar */
  left: -3px; bottom: 11px; width: 18px; height: 9px;
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(90deg, #6d7279, #c6cacf 40%, #8a9096 85%, #5c6168);
}
.pen--marker .pen__body {
  bottom: 20px;
  width: 17px; height: 86px;
  border-radius: 4px 4px 3px 3px;
  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 */
  left: 0; right: 0; top: 30px; height: 26px;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), rgba(255,255,255,0.1) 30%, rgba(0,0,0,0.05) 60%, rgba(0,0,0,0.2));
  border-top: 1px solid rgba(0,0,0,0.15);
  border-bottom: 1px solid rgba(0,0,0,0.15);
}
.pen--marker .pen__body::after {
  /* cap */
  left: -1px; right: -1px; top: -26px; height: 30px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pen-color) 70%, black), var(--pen-color) 35%, color-mix(in srgb, var(--pen-color) 85%, white) 55%, color-mix(in srgb, var(--pen-color) 65%, black));
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25);
}

/* --- chalk: short stick, chalky, dust at the tip --- */
.pen--chalk .pen__tip {
  bottom: 0;
  width: 11px; height: 7px;
  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(8% 0, 92% 0, 80% 100%, 25% 100%);
  border-radius: 0 0 2px 2px;
}
.pen--chalk .pen__tip::after {
  /* dust cloud */
  left: -10px; bottom: -6px; width: 30px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--pen-color) 60%, transparent), transparent);
  opacity: 0.45;
  filter: blur(2px);
}
.pen--chalk .pen__body {
  bottom: 6px;
  width: 11px; height: 50px;
  border-radius: 2px 2px 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.25;
  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 {
  bottom: 0;
  width: 8px; height: 9px;
  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 6px 1px color-mix(in srgb, var(--pen-color) 75%, transparent), 0 0 14px color-mix(in srgb, var(--pen-color) 35%, transparent);
}
.pen--liquid .pen__tip::before {
  /* cone collar */
  left: -2px; bottom: 7px; width: 12px; height: 10px;
  background: linear-gradient(90deg, #1e2124, #4a4f55 45%, #2a2e32);
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.pen--liquid .pen__body {
  bottom: 16px;
  width: 11px; height: 92px;
  border-radius: 4px 4px 2px 2px;
  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: 2px; right: 2px; top: 34px; height: 22px;
  border-radius: 2px;
  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: -1px; right: -1px; top: -22px; height: 26px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(90deg, #1b1e22, #3d4248 35%, #2a2e33 60%, #121417);
  border-bottom: 2px solid var(--pen-color);
}

/* --- acrylic paint marker: round white body, coloured cap, round tip --- */
.pen--acrylic .pen__tip {
  bottom: 0;
  width: 10px; height: 10px;
  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: -3px; bottom: 8px; width: 16px; height: 12px;
  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: 19px;
  width: 16px; height: 84px;
  border-radius: 8px 8px 4px 4px;
  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: 26px; height: 16px;
  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: -24px; height: 28px;
  border-radius: 8px 8px 2px 2px;
  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, ink-bleed --- */
.pen--flip .pen__tip {
  bottom: 0;
  width: 9px; height: 10px;
  border-radius: 50% 50% 40% 40% / 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: -3px; bottom: 8px; width: 15px; height: 10px;
  background: linear-gradient(90deg, #2f3337, #5a6066 40%, #3a3f44);
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.pen--flip .pen__body {
  bottom: 17px;
  width: 15px; height: 88px;
  border-radius: 7px 7px 4px 4px;
  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: 28px; height: 22px;
  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: -22px; height: 26px;
  border-radius: 7px 7px 2px 2px;
  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: thin anodised pen, fine tip, cursor glow --- */
.pen--stylus .pen__tip {
  bottom: 0;
  width: 5px; height: 7px;
  background: linear-gradient(90deg, #b9c0c7, #f2f5f8 50%, #9aa2aa);
  clip-path: polygon(0 0, 100% 0, 60% 100%, 40% 100%);
}
.pen--stylus .pen__tip::before {
  /* silver ring */
  left: -1.5px; bottom: 6px; width: 8px; height: 4px;
  background: linear-gradient(90deg, #8f969d, #ffffff 50%, #7f868d);
  border-radius: 1px;
}
.pen--stylus .pen__tip::after {
  /* cursor glow at the contact point */
  left: -7px; bottom: -8px; width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent, #4f8cff) 60%, transparent), transparent 70%);
  opacity: 0.6;
  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.3); }
.pen--stylus .pen__body {
  bottom: 10px;
  width: 7px; height: 112px;
  border-radius: 3px 3px 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: 5px; top: 8px; width: 2px; height: 30px;
  border-radius: 1px;
  background: linear-gradient(90deg, #8a9199, #d9dee3);
}
.pen--stylus .pen__body::after {
  /* flat button */
  left: 1px; right: 1px; top: 48px; height: 10px;
  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 { transition: none; }
}
