/* PROTECTED — generated by tools/extract.py from baseline/styles.css
   (Soroban 47ad519, styles.css?v=20261028a). Do not edit by hand: every line
   below is a verbatim copy of lines 14-18, 82-96, 651-701, 732-746, 752-763, 765-1159, 1161-1168 of the original, and
   tests/protect.mjs fails if a line changes or a design stylesheet restyles
   these selectors (beyond the layout-only exceptions it lists). */

/* ---- baseline lines 14-18 ---- */
:root {
  --accent: #b89a6a;
  /* Board materials */
  --rail-hi: rgba(96, 76, 57, 0.6);
  --rail-lo: rgba(60, 47, 36, 0.6);
  --field: rgba(8, 6, 4, 0.6);
  --rod: rgba(150, 128, 98, 0.55);
}

/* ---- baseline lines 82-96 ---- */
/* The board's textures, fetched once the room has loaded (soroban.js adds
   .board-warm then), so a board opens with its teak and bead grain in the
   first frame rather than flat until they arrive. A zero-size box draws
   nothing; the board's own rules reuse the fetched images. */
.board-warm .scene::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  background-image:
    url("assets/teak-h.webp"),
    url("assets/teak-v.webp"),
    url("assets/smoked-walnut-grain.webp"),
    url("assets/smoke-speckled-grain.webp");
}

/* ---- baseline lines 732-746 ---- */
.board-wrap {
  width: 100%;
  container-type: inline-size;
  display: flex;
  justify-content: center;
}

.board {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}


/* ---- baseline lines 752-763 ---- */
.board::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -34px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65), transparent 70%);
  filter: blur(7px);
  z-index: -1;
}

/* ---- baseline lines 765-1159 ---- */
/* ---------- Soroban ---------- */

.frame {
  /* Rod spacing scales with the space available; everything derives from it. */
  --rods: 17;
  --th: 0.7;  /* heaven travel, bead heights (set from soroban.js) */
  --te: 0.9;  /* earth gap, bead heights */
  --rw: clamp(18px, calc((100cqw - 4px) / (var(--rods) + 0.9)), 76px);
  --bh: calc(var(--rw) * 0.56);
  --rail: calc(var(--rw) * 0.42);
  --bar: calc(var(--rw) * 0.3);

  position: relative;
  padding: var(--rail);
  border-radius: 0; /* square outer corners, so the mitres run right out to them */
  /* Teak (strips from the owner's teak_veneer): grain runs along each
     member, across the top and bottom rails and the middle bar, down the
     side rails. The side rails are the frame's own background; the top and
     bottom rails are ::before, mitred into them at 45 degrees from inner
     to outer corner; the middle bar's pointed ends run half a rail into
     the side rails. Each joint line is drawn on both pieces, so it sits
     centred on the joint; the inner field stays see-through. */
  --teak-h: url("assets/teak-h.webp");
  --teak-v: url("assets/teak-v.webp");
  --tip: calc(var(--rail) * 0.5);  /* how far the bar's points reach into a side rail */
  --bar-y: calc(var(--rail) + var(--bh) * (1 + var(--th)));  /* the bar's top, from the frame's top */
  /* Joint lines: exact gradient lines, each running corner to corner of
     its box, whose edges are the wood's edges, so a line always reaches
     both ends of its joint. --seam-w is set per board (thinner on the
     full board, seen from further away). */
  --seam-w: 0.9px;
  --seam-c: rgba(52, 31, 16, 0.62);
  --seam-down: linear-gradient(to top right, transparent calc(50% - var(--seam-w) / 2), var(--seam-c) 0, var(--seam-c) calc(50% + var(--seam-w) / 2), transparent 0);
  --seam-up: linear-gradient(to bottom right, transparent calc(50% - var(--seam-w) / 2), var(--seam-c) 0, var(--seam-c) calc(50% + var(--seam-w) / 2), transparent 0);
  background:
    /* the side-rail half of the middle bar's joint lines */
    var(--seam-up) calc(var(--rail) - var(--tip)) var(--bar-y) / var(--tip) calc(var(--bar) / 2) no-repeat,
    var(--seam-down) calc(var(--rail) - var(--tip)) calc(var(--bar-y) + var(--bar) / 2) / var(--tip) calc(var(--bar) / 2) no-repeat,
    var(--seam-down) calc(100% - var(--rail) + var(--tip)) var(--bar-y) / var(--tip) calc(var(--bar) / 2) no-repeat,
    var(--seam-up) calc(100% - var(--rail) + var(--tip)) calc(var(--bar-y) + var(--bar) / 2) / var(--tip) calc(var(--bar) / 2) no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.004 0.22' numOctaves='3' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 1.1 -0.35'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>") 0 0 / 600px 120px,
    linear-gradient(180deg, rgba(255, 228, 190, 0.07), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.18)),
    var(--teak-v) 0 0 / var(--rail) auto repeat-y,
    var(--teak-v) 100% -611px / var(--rail) auto repeat-y,
    linear-gradient(180deg, var(--rail-hi), var(--rail-lo));
  /* the old fine grain only tints the inner field, as before */
  background-clip: border-box, border-box, border-box, border-box, content-box, border-box, border-box, border-box, border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 205, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 235, 205, 0.04),
    0 2px 0 rgba(30, 22, 16, 0.9),
    0 30px 70px -26px rgba(0, 0, 0, 0.85);
  touch-action: none;
  -webkit-user-select: none;
          user-select: none;
  -webkit-touch-callout: none;
}

/* Invisible margin around the board that still takes touches, for thumbs
   landing just off the frame (the toolbar stays above it). */
.frame::after {
  content: "";
  position: absolute;
  --touch: max(16px, var(--bh) * 0.8);
  --touch-x: var(--touch);  /* sideways reach (narrower on short landscape screens) */
  inset: calc(-1 * var(--touch)) calc(-1 * var(--touch-x));
  /* the four corner mitre lines, drawn whole over both rails */
  background:
    var(--seam-down) var(--touch-x) var(--touch) / var(--rail) var(--rail) no-repeat,
    var(--seam-up) calc(100% - var(--touch-x)) var(--touch) / var(--rail) var(--rail) no-repeat,
    var(--seam-up) var(--touch-x) calc(100% - var(--touch)) / var(--rail) var(--rail) no-repeat,
    var(--seam-down) calc(100% - var(--touch-x)) calc(100% - var(--touch)) / var(--rail) var(--rail) no-repeat;
}

/* Top and bottom rails: horizontal grain, each end mitred at 45 degrees
   from the inner corner of the frame to its outer corner. The clip covers
   just the two rails (joined by a zero-width run down the left edge). */
.frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  clip-path: polygon(
    0 0, 100% 0, calc(100% - var(--rail)) var(--rail), var(--rail) var(--rail), 0 0,
    0 100%, var(--rail) calc(100% - var(--rail)), calc(100% - var(--rail)) calc(100% - var(--rail)), 100% 100%, 0 100%);
  background:
    /* the frame's light top edge and dark bottom edge, and its top-to-bottom light */
    linear-gradient(180deg, rgba(255, 235, 205, 0.16) 0 1px, rgba(255, 228, 190, 0.07) 1px, rgba(255, 228, 190, 0.04)) top / 100% var(--rail) no-repeat,
    linear-gradient(180deg, rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0.18) calc(100% - 1px), rgba(0, 0, 0, 0.35) calc(100% - 1px)) bottom / 100% var(--rail) no-repeat,
    var(--teak-h) 0 0 / auto var(--rail) repeat-x,
    var(--teak-h) -930px 100% / auto var(--rail) repeat-x;
  pointer-events: none;
}

.rods {
  position: relative;
  display: flex;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(60, 46, 34, 0.18), transparent 75%),
    var(--field);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 235, 205, 0.07);
}

.rod {
  position: relative;
  width: var(--rw);
  display: flex;
  flex-direction: column;
}

.rod::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: max(4.5px, calc(var(--rw) * 0.096)); /* 3x the original rod */
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(90, 76, 58, 0.6), rgba(196, 172, 136, 0.7) 45%, rgba(90, 76, 58, 0.6));
}

.heaven, .earth {
  position: relative;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

.heaven { height: calc(var(--bh) * (1 + var(--th))); }
.earth  { height: calc(var(--bh) * (4 + var(--te))); }
.held   { cursor: grabbing; }

.bar {
  position: relative;
  height: var(--bar);
  z-index: 4; /* spacer that carries the unit dots above the beam */
}

/* One continuous reckoning bar across all rods */
.beam {
  position: absolute;
  top: calc(var(--bh) * (1 + var(--th)));
  height: var(--bar);
  /* The bar's ends run into the side rails as broad points (--tip deep),
     drawn over the frame; the frame's outer edge stays straight. */
  left: calc(-1 * var(--tip));
  right: calc(-1 * var(--tip));
  clip-path: polygon(0 50%, var(--tip) 0, calc(100% - var(--tip)) 0, 100% 50%, calc(100% - var(--tip)) 100%, var(--tip) 100%);
  /* solid teak, grain along the bar and filling its full height (the
     compact board's bar is taller than its rails): the tatami never shows
     through; a fine seam traces each pointed end */
  background:
    var(--seam-up) 0 0 / var(--tip) 50% no-repeat,
    var(--seam-down) 0 100% / var(--tip) 50% no-repeat,
    var(--seam-down) 100% 0 / var(--tip) 50% no-repeat,
    var(--seam-up) 100% 100% / var(--tip) 50% no-repeat,
    linear-gradient(180deg, rgba(255, 235, 205, 0.05), rgba(0, 0, 0, 0.12)),
    var(--teak-h) -1490px 50% / auto max(var(--rail), 100%) repeat-x;
  box-shadow: inset 0 1px 0 rgba(255, 235, 205, 0.12);
  z-index: 3; /* over the rail shadows, which tuck under its edges */
  pointer-events: none;
}

.bar.dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--bar) * 0.26);
  height: calc(var(--bar) * 0.26);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.85;
}

/* Bicone bead seen side-on: between an oval and a soft hexagon, with a
   ridge across the middle. */
.bead {
  --pos: 0;
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(var(--rw) * 0.94);
  height: var(--bh);
  transform: translate(-50%, calc(var(--pos) * var(--bh)));
  transition: transform var(--glide, 200ms) cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  z-index: 2;
  pointer-events: none;
}

/* Soft contact shadow, painted once with the bead (cheaper than a filter) */
.bead::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 30%;
  bottom: -9%;
  border-radius: 50%;
  background: radial-gradient(ellipse closest-side, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25) 60%, transparent);
  z-index: 0;
}

.bead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: polygon(57.2% 0.0%, 70.6% 4.2%, 76.3% 8.3%, 80.7% 12.5%, 84.3% 16.7%, 87.3% 20.8%, 90.0% 25.0%, 92.3% 29.2%, 94.3% 33.3%, 96.1% 37.5%, 97.6% 41.7%, 98.9% 45.8%, 100.0% 50.0%, 98.9% 54.2%, 97.6% 58.3%, 96.1% 62.5%, 94.3% 66.7%, 92.3% 70.8%, 90.0% 75.0%, 87.3% 79.2%, 84.3% 83.3%, 80.7% 87.5%, 76.3% 91.7%, 70.6% 95.8%, 57.2% 100.0%, 42.8% 100.0%, 29.4% 95.8%, 23.7% 91.7%, 19.3% 87.5%, 15.7% 83.3%, 12.7% 79.2%, 10.0% 75.0%, 7.7% 70.8%, 5.7% 66.7%, 3.9% 62.5%, 2.4% 58.3%, 1.1% 54.2%, 0.0% 50.0%, 1.1% 45.8%, 2.4% 41.7%, 3.9% 37.5%, 5.7% 33.3%, 7.7% 29.2%, 10.0% 25.0%, 12.7% 20.8%, 15.7% 16.7%, 19.3% 12.5%, 23.7% 8.3%, 29.4% 4.2%, 42.8% 0.0%);
}

.held .bead { transition: none; }

/* Plain, faint straightedges used by Reset board */
.ruler {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: max(4px, calc(var(--rw) * 0.11));
  /* brushed bronze, as see-through as the original grey */
  background: linear-gradient(180deg,
    rgba(206, 146, 84, 0.5) 0%,
    rgba(166, 108, 58, 0.46) 45%,
    rgba(118, 74, 40, 0.46) 100%);
  box-shadow: inset 0 1px 0 rgba(238, 192, 140, 0.26);
  opacity: 0;
  z-index: 1; /* under the middle bar (same level, later in the page) */
  pointer-events: none;
  will-change: transform, opacity;
}

/* Reset linkage: two bronze triangles joined at their bases, pivoting on a
   unit dot with their tips pinned to the rulers (sized from soroban.js). */
.slider {
  --rb: 50%;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  z-index: 0; /* behind the rulers and the middle beam (both 1) */
  pointer-events: none;
  transform-origin: var(--rb) 50%;
  will-change: transform, opacity;
}

.slider-body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.slider .pin {
  position: absolute;
  top: 50%;
  left: var(--ins, 0);
  width: max(2.5px, calc(var(--rw) * 0.07));
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 35%, #d8a46a, #74492a 70%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.slider .pin.mid { left: var(--rb); }
.slider .pin:last-child { left: calc(100% - var(--ins, 0px)); }

/* Compact board: big rods on a slim frame.
   Bead height grows with the screen height (portrait phones) up to a cap. */
.frame[data-rods="4"] {
  --chrome: 230px; /* top bar, toolbar and stage padding */
  --rw: clamp(40px, calc((100cqw - 4px) / (var(--rods) + 0.45)), 128px);
  --rail: calc(var(--rw) * 0.17);
  --bar: calc(var(--rw) * 0.2);
  --seam-w: 1.4px; /* joint lines: seen closer than the full board's */
  --bh: clamp(
    calc(var(--rw) * 0.5),
    calc((100dvh - var(--chrome) - var(--rw) * 0.54) / (5 + var(--th) + var(--te))),
    calc(var(--rw) * 0.6));
  border-radius: 0; /* square, like the full board */
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 205, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 2px 0 rgba(30, 22, 16, 0.9),
    0 18px 40px -10px rgba(0, 0, 0, 0.75),
    0 50px 120px -20px rgba(0, 0, 0, 0.9);
}

/* Short landscape phones (568x320, 667x375 ...): the compact board is
   taller than the screen and filled its width, and its invisible touch
   margin swallowed the rest, leaving no place to swipe the page up to the
   lower beads. Here the board stays at least 60px clear of each screen
   edge and the touch margin reaches only 12px past it sideways, leaving a
   ~48px scroll gutter each side. Wider and taller screens are unchanged. */
@media (orientation: landscape) and (max-height: 440px) and (max-width: 760px) {
  .frame[data-rods="4"] {
    --rw: clamp(40px, min(calc((100cqw - 4px) / (var(--rods) + 0.45)), calc((100vw - 120px) / 4.34)), 128px);
  }
  .frame[data-rods="4"]::after { --touch-x: 12px; }
}


/* Rounded bead shape (Settings): oval with very slightly pointed ends;
   the default .bead shape is the bicone. */
[data-shape="oval"] .bead {
  width: calc(var(--rw) * 0.88);
}

[data-shape="oval"] .bead::before {
  inset: 1px 0;
  clip-path: polygon(100.0% 50.0%, 99.8% 45.6%, 99.2% 41.3%, 98.1% 37.1%, 96.7% 32.9%, 94.8% 28.9%, 92.6% 25.0%, 90.1% 21.3%, 87.2% 17.9%, 84.0% 14.6%, 80.6% 11.7%, 77.0% 9.0%, 73.1% 6.7%, 69.2% 4.7%, 65.2% 3.0%, 61.1% 1.7%, 57.1% 0.8%, 53.3% 0.2%, 50.0% 0.0%, 46.7% 0.2%, 42.9% 0.8%, 38.9% 1.7%, 34.8% 3.0%, 30.8% 4.7%, 26.9% 6.7%, 23.0% 9.0%, 19.4% 11.7%, 16.0% 14.6%, 12.8% 17.9%, 9.9% 21.3%, 7.4% 25.0%, 5.2% 28.9%, 3.3% 32.9%, 1.9% 37.1%, 0.8% 41.3%, 0.2% 45.6%, 0.0% 50.0%, 0.2% 54.4%, 0.8% 58.7%, 1.9% 62.9%, 3.3% 67.1%, 5.2% 71.1%, 7.4% 75.0%, 9.9% 78.7%, 12.8% 82.1%, 16.0% 85.4%, 19.4% 88.3%, 23.0% 91.0%, 26.9% 93.3%, 30.8% 95.3%, 34.8% 97.0%, 38.9% 98.3%, 42.9% 99.2%, 46.7% 99.8%, 50.0% 100.0%, 53.3% 99.8%, 57.1% 99.2%, 61.1% 98.3%, 65.2% 97.0%, 69.2% 95.3%, 73.1% 93.3%, 77.0% 91.0%, 80.6% 88.3%, 84.0% 85.4%, 87.2% 82.1%, 90.1% 78.7%, 92.6% 75.0%, 94.8% 71.1%, 96.7% 67.1%, 98.1% 62.9%, 99.2% 58.7%, 99.8% 54.4%);
}

/* Bead inner shadow: a soft dark band traced from each shape's clip-path
   polygon and blurred, kept inside the bead by that clip; faint along the
   top, stronger at the sides and bottom, the centre left clear. The blur
   runs in sRGB: in the default linearRGB the near-black brown loses its
   blue and green to rounding and the shade turns red at the rims. */
.bead { --inner-shade: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23140a03' stop-opacity='0.32'/><stop offset='0.45' stop-color='%23140a03' stop-opacity='0.38'/><stop offset='1' stop-color='%23140a03' stop-opacity='0.58'/></linearGradient><filter id='b' color-interpolation-filters='sRGB' x='-20%' y='-20%' width='140%' height='140%'><feGaussianBlur stdDeviation='3.2 4.5'/></filter></defs><path d='M57.2 0.0 L70.6 4.2 L76.3 8.3 L80.7 12.5 L84.3 16.7 L87.3 20.8 L90.0 25.0 L92.3 29.2 L94.3 33.3 L96.1 37.5 L97.6 41.7 L98.9 45.8 L100.0 50.0 L98.9 54.2 L97.6 58.3 L96.1 62.5 L94.3 66.7 L92.3 70.8 L90.0 75.0 L87.3 79.2 L84.3 83.3 L80.7 87.5 L76.3 91.7 L70.6 95.8 L57.2 100.0 L42.8 100.0 L29.4 95.8 L23.7 91.7 L19.3 87.5 L15.7 83.3 L12.7 79.2 L10.0 75.0 L7.7 70.8 L5.7 66.7 L3.9 62.5 L2.4 58.3 L1.1 54.2 L0.0 50.0 L1.1 45.8 L2.4 41.7 L3.9 37.5 L5.7 33.3 L7.7 29.2 L10.0 25.0 L12.7 20.8 L15.7 16.7 L19.3 12.5 L23.7 8.3 L29.4 4.2 L42.8 0.0Z' fill='none' stroke='url(%23g)' stroke-width='16' stroke-linejoin='round' filter='url(%23b)'/></svg>") 0 0 / 100% 100% no-repeat; }
[data-shape="oval"] .bead { --inner-shade: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='%23140a03' stop-opacity='0.32'/><stop offset='0.45' stop-color='%23140a03' stop-opacity='0.38'/><stop offset='1' stop-color='%23140a03' stop-opacity='0.58'/></linearGradient><filter id='b' color-interpolation-filters='sRGB' x='-20%' y='-20%' width='140%' height='140%'><feGaussianBlur stdDeviation='3.2 4.5'/></filter></defs><path d='M100.0 50.0 L99.8 45.6 L99.2 41.3 L98.1 37.1 L96.7 32.9 L94.8 28.9 L92.6 25.0 L90.1 21.3 L87.2 17.9 L84.0 14.6 L80.6 11.7 L77.0 9.0 L73.1 6.7 L69.2 4.7 L65.2 3.0 L61.1 1.7 L57.1 0.8 L53.3 0.2 L50.0 0.0 L46.7 0.2 L42.9 0.8 L38.9 1.7 L34.8 3.0 L30.8 4.7 L26.9 6.7 L23.0 9.0 L19.4 11.7 L16.0 14.6 L12.8 17.9 L9.9 21.3 L7.4 25.0 L5.2 28.9 L3.3 32.9 L1.9 37.1 L0.8 41.3 L0.2 45.6 L0.0 50.0 L0.2 54.4 L0.8 58.7 L1.9 62.9 L3.3 67.1 L5.2 71.1 L7.4 75.0 L9.9 78.7 L12.8 82.1 L16.0 85.4 L19.4 88.3 L23.0 91.0 L26.9 93.3 L30.8 95.3 L34.8 97.0 L38.9 98.3 L42.9 99.2 L46.7 99.8 L50.0 100.0 L53.3 99.8 L57.1 99.2 L61.1 98.3 L65.2 97.0 L69.2 95.3 L73.1 93.3 L77.0 91.0 L80.6 88.3 L84.0 85.4 L87.2 82.1 L90.1 78.7 L92.6 75.0 L94.8 71.1 L96.7 67.1 L98.1 62.9 L99.2 58.7 L99.8 54.4Z' fill='none' stroke='url(%23g)' stroke-width='16' stroke-linejoin='round' filter='url(%23b)'/></svg>") 0 0 / 100% 100% no-repeat; }

/* Rail shadows: soft occlusion cast from the board's rails into the bead
   chambers, over the beads and rods: the top rail down, the middle bar both
   up and down, the bottom rail up. One overlay that takes no touches. */
.rods::after {
  --cast: calc(var(--bh) * 0.5);
  --cast-mid: calc(var(--bh) * 0.33); /* the middle bar's shorter, darker shade */
  --beam-top: calc(var(--bh) * (1 + var(--th)));
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 4, 2, 0.52), rgba(8, 4, 2, 0.19) 45%, transparent)
      0 0 / 100% var(--cast) no-repeat,
    linear-gradient(0deg, rgba(8, 4, 2, 0.48) 2px, rgba(8, 4, 2, 0.16) calc(2px + 40%), transparent)
      0 calc(var(--beam-top) - var(--cast-mid)) / 100% calc(var(--cast-mid) + 2px) no-repeat,
    linear-gradient(180deg, rgba(8, 4, 2, 0.52) 2px, rgba(8, 4, 2, 0.18) calc(2px + 40%), transparent)
      0 calc(var(--beam-top) + var(--bar) - 2px) / 100% calc(var(--cast-mid) + 2px) no-repeat,
    linear-gradient(0deg, rgba(8, 4, 2, 0.48), rgba(8, 4, 2, 0.17) 45%, transparent)
      0 100% / 100% var(--cast) no-repeat;
}

/* ---------- Bead colours (Settings > Board customization) ---------- */

/* Dark walnut: the same finish as Honey hazel (top-centre highlight, edges
   curving into shade, soft underside, fine grain) on a deep walnut base,
   about a fifth darker than before but still clear of the dark board */
[data-wood="dark"] .bead::before {
  background:
    var(--inner-shade),
    radial-gradient(ellipse 36% 28% at 50% 27%, rgba(255, 232, 205, 0.36), rgba(255, 226, 190, 0.12) 55%, transparent 100%),
    radial-gradient(ellipse 56% 72% at 50% 40%, transparent 48%, rgba(18, 9, 3, 0.55) 100%),
    linear-gradient(180deg, transparent 44%, rgba(25, 14, 6, 0.22) 53%, rgba(16, 9, 4, 0.48) 100%),
    url("assets/smoked-walnut-grain.webp") var(--grain-at) / var(--grain-size) auto repeat,
    linear-gradient(180deg, #6b5440 0%, #533f2f 48%, #3f2f22 54%, #2c2117 100%);
  background-blend-mode: normal, normal, normal, normal, overlay, normal;
}

/* Grain (both woods): a seamless veneer tile overlay-blended on each
   wood's own base colour under the existing lighting. Dark walnut uses
   assets/smoked-walnut-grain.webp and Honey hazel
   assets/smoke-speckled-grain.webp (grey maps from the owner's
   smoked_walnut_veneer_diff_4k and smoke_speckled_veneer_diff_4k). */
/* Honey hazel: a soft highlight centred on the upper middle, edges curving
   away into shade, darker underside, fine horizontal grain */
[data-wood="honey"] .bead::before {
  background:
    var(--inner-shade),
    radial-gradient(ellipse 36% 28% at 50% 27%, rgba(255, 244, 225, 0.55), rgba(255, 236, 205, 0.2) 55%, transparent 100%),
    radial-gradient(ellipse 56% 72% at 50% 40%, transparent 48%, rgba(25, 13, 5, 0.5) 100%),
    linear-gradient(180deg, transparent 44%, rgba(40, 24, 12, 0.2) 53%, rgba(28, 16, 7, 0.45) 100%),
    url("assets/smoke-speckled-grain.webp") var(--grain-at) / var(--grain-size) auto repeat,
    linear-gradient(180deg, #c39463 0%, #a3764a 48%, #7e5633 54%, #5a3c23 100%);
  background-blend-mode: normal, normal, normal, normal, overlay, normal;
}

/* Each bead shows its own crop of the grain tile: soroban.js gives every
   bead a fixed offset (--gx, --gy, in tiles), scale (--gs) and sometimes a
   mirror (--gf: -1). The lighting, shades and outline are symmetric left to
   right, so the mirror only flips the grain. */
[data-wood] .bead::before {
  --grain-size: calc(var(--rw) * 3.2 * var(--gs, 1));
  --grain-at: calc(var(--gx, 0) * var(--grain-size) * -1) calc(var(--gy, 0) * var(--grain-size) * -1);
  transform: scaleX(var(--gf, 1));
}

/* ---- baseline lines 1161-1168 ---- */
.stage[data-rods="4"] .board::after {
  left: -4%;
  right: -4%;
  bottom: -52px;
  height: 60px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8), transparent 70%);
  filter: blur(12px);
}
