/* Felt design system: tokens, material and shared controls; kit.html shows every piece live.
   Only classes and tokens here, so linking it changes nothing until markup opts in. */

@font-face {
  font-family: "Nunito";
  src: url(fonts/nunito-cyrillic.woff2) format("woff2");
  font-weight: 600 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  src: url(fonts/nunito-latin.woff2) format("woff2");
  font-weight: 600 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  src: url(fonts/golos-cyrillic.woff2) format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url(fonts/golos-latin.woff2) format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Caveat";
  src: url(fonts/caveat-cyrillic.woff2) format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Caveat";
  src: url(fonts/caveat-latin.woff2) format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  color-scheme: light;

  /* dyed sheets */
  --forest: #2e4430;
  --moss: #496a37;
  --sage: #8ba678;
  --oat: #d6c9aa;
  --cream: #efe6d0;
  --gold: #d49d36;
  --char: #394135;
  --berry: #b4473c;
  --lake: #3d6a86;
  --silver: #b9b8a8;
  --bronze: #b5794a;

  /* roles: always style with these, never with the raw sheets above */
  --panel: var(--cream);
  --panel-alt: var(--oat);
  --row: var(--cream);
  --control: var(--oat);
  --control-hover: #dfd3b6;
  --icon-btn: var(--control);
  --icon-btn-hover: var(--control-hover);
  --icon-btn-press: #c7b994;
  --icon-btn-ink: var(--ink);
  --icon-btn-stitch: var(--stitch-on-light);
  --primary: var(--moss);
  --primary-hover: #557a41;
  /* gold buttons are for spending and cashing in; the ink stays dark on gold in both themes */
  --gold-btn: var(--gold);
  --gold-btn-hover: color-mix(in oklab, var(--gold) 82%, #fff);
  --gold-btn-press: color-mix(in oklab, var(--gold) 85%, #000);
  --gold-btn-ink: #2b2410;
  --stitch-on-gold: #5a3f0c99;
  --badge: var(--forest);
  --field: var(--cream);
  --track: #b5a888;
  --knob: #efe6d0;
  --lip-light: #a99d80;
  /* char thinned toward oat: a solid char key shouted louder than the button it labels */
  --kbd: color-mix(in oklab, var(--char) 70%, var(--oat));
  --kbd-ink: var(--on-dark);
  --kbd-lip: color-mix(in oklab, #1f241c 70%, var(--oat));

  --ink: #26301f;
  --ink-soft: #485240;
  --on-dark: #f3ecd9;
  --on-dark-soft: #c9d3b8;
  --mark: #7a5512;
  --toast: var(--sage);
  --ok: var(--moss);
  --off: var(--berry);
  /* derived from --ink, so they flip with the theme by themselves */
  --tint: color-mix(in oklab, var(--ink) 7%, transparent);
  --hairline: color-mix(in oklab, var(--ink) 16%, transparent);
  --decor: color-mix(in oklab, var(--ink) 24%, transparent);

  --stitch-on-dark: #efe6d080;
  --stitch-on-light: #6d7a5770;
  --stitch-panel: var(--stitch-on-light);
  --stitch-gold: #f0c66a;
  --focus: var(--gold);
  --fibre: url(img/felt.png);
  --tag-fibre: url(img/felt.png);
  --paper: url(img/paper.png);
  --scene-veil: #0003;
  /* the full call page: oatmeal linen; in the dark a warm brown wool, not the green of the panels */
  --cloth: color-mix(in oklab, var(--oat) 55%, var(--cream));
  --book-cover: #777451;
  --book-page: #efdfbb;
  --book-edge: #b7a17a;
  --book-ink: #302b20;
  --book-muted: #544a32;
  --book-card: #ead8b1;
  --book-picture: #f1e7d2;
  --book-picture-ink: #302b20;
  --book-close: #765337;
  --book-danger: #8a3028;
  /* warm stones that carry light text: the room code (tan) and the people button (clay) */
  --stone-tan: color-mix(in oklab, var(--bronze) 80%, #5a4636);
  --stone-clay: color-mix(in oklab, var(--berry) 55%, var(--bronze));

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --press: 120ms cubic-bezier(.25, 1, .5, 1);
  --toggle: 180ms cubic-bezier(.25, 1, .5, 1);
  --font: "Nunito", ui-rounded, system-ui, sans-serif;
  /* long text people read line by line, where Nunito's heavy rounded shapes tire the eye */
  --font-read: "Golos Text", system-ui, sans-serif;
  --hand: "Caveat", cursive;

  /* nametags and touch controls sit on the 3D scene, so they keep one look in both themes */
  --tag: #efe6d0;
  --tag-ink: #26301f;
  --tag-lip: #a99d80;
  --tag-me: #496a37;
  --tag-me-ink: #f3ecd9;
  --tag-me-lip: #2e4430;
  --tag-talk: #7fd36a;
  --tag-off: #b4473c;
  --tag-off-on-me: #ffb3a6;

  --stone: color-mix(in oklab, var(--oat) 55%, var(--silver));
  --stone-sand: color-mix(in oklab, var(--oat) 75%, var(--bronze));
  --stone-grey: var(--silver);
  --stone-on: color-mix(in oklab, var(--bronze) 62%, #2b2622);
  --stone-on-ink: var(--on-dark);
  --stone-well: color-mix(in oklab, var(--silver) 70%, var(--oat));
  --stone-carve: inset 0 3px 7px #0004, inset 0 1px 2px #0003, inset 0 -2px 1px #fff6;
}

/* On dark, depth reads as lightness: scene < panel < row < control, each a clear step up.
   Any element can carry data-theme="dark", so tokens built from others are restated. */
[data-theme="dark"] {
  color-scheme: dark;
  --forest: #151d17;
  --moss: #3f6a2f;
  --sage: #3d5c33;
  --oat: #232e22;
  --cream: #283426;
  --gold: #d9a640;
  --char: #4b5b46;
  --berry: #c4574a;
  --lake: #35607a;

  --panel: #283426;
  --panel-alt: #232e22;
  --row: #3a4a37;
  --control: #4b5b46;
  --control-hover: #596b53;
  --icon-btn: #4b5b46;
  --icon-btn-hover: #596b53;
  --icon-btn-press: #1b231a;
  --icon-btn-ink: var(--on-dark);
  --icon-btn-stitch: var(--stitch-on-dark);
  --primary-hover: #4a7a38;
  --gold-btn: var(--gold);
  --gold-btn-hover: color-mix(in oklab, var(--gold) 85%, #fff);
  --gold-btn-press: color-mix(in oklab, var(--gold) 80%, #000);
  --gold-btn-ink: #2b2410;
  --stitch-on-gold: #5a3f0c99;
  --field: #141b14;
  --track: #121813;
  --lip-light: #0b0f0c;
  --kbd: var(--knob);
  --kbd-ink: #26301f;
  --kbd-lip: var(--lip-light);

  --ink: #f1e9d3;
  --ink-soft: #bcc8aa;
  --on-dark-soft: #cdd7bc;
  --mark: #f0c66a;
  --toast: #3f6a2f;
  --ok: #9fd186;
  --off: #f08572;

  --stitch-on-dark: #f1e9d359;
  --stitch-on-light: #f1e9d340;
  --stitch-panel: #f1e9d324;
  --fibre: url(img/felt-soft.png);
  --scene-veil: #0b110d66;
  --cloth: #262729;
  --book-cover: #292d24;
  --book-page: #37372f;
  --book-edge: #565347;
  --book-ink: #f1e9d3;
  --book-muted: #c9c3ad;
  --book-card: #45453a;
  --book-picture: #f1e7d2;
  --book-close: #e1c29b;
  --book-danger: #ffb6a0;
  --stone-tan: color-mix(in oklab, color-mix(in oklab, var(--bronze) 80%, var(--gold)) 70%, #2b2622);
  --stone-clay: color-mix(in oklab, color-mix(in oklab, var(--berry) 75%, var(--bronze)) 70%, #2b2622);
  --primary: var(--moss);
  --badge: var(--forest);
  --focus: var(--gold);
  --tint: color-mix(in oklab, var(--ink) 7%, transparent);
  --hairline: color-mix(in oklab, var(--ink) 16%, transparent);
  --decor: color-mix(in oklab, var(--ink) 22%, transparent);
  /* sand barely tinted, or it merges with the clay of the picked pebble */
  --stone: color-mix(in oklab, var(--silver) 34%, #262624);
  --stone-sand: color-mix(in oklab, var(--bronze) 16%, #34322d);
  --stone-grey: color-mix(in oklab, var(--silver) 22%, #262624);
  --stone-on: color-mix(in oklab, var(--bronze) 78%, #2b2622);
  --stone-well: color-mix(in oklab, var(--silver) 20%, #23231f);
  --stone-carve: inset 0 3px 8px #000a, inset 0 1px 2px #0008, inset 0 -2px 1px #ffffff14;
}

/* ---------- material ---------- */
.felt {
  position: relative;
  background-color: var(--c, var(--panel));
  /* a second, denser pass of the tile thickens the fibres; one layer alone looked printed */
  background-image: var(--fibre), var(--fibre);
  background-size: 160px, 90px;
  background-position: 0 0, 57px 31px;
  background-blend-mode: soft-light;
  --rr: var(--r, var(--r-md));
  /* puff (light top, shaded bottom), a lighter cut rim, then fuzzy edge, lip and drop */
  box-shadow:
    inset 0 2px 1px #ffffff2e, inset 0 -3px 5px #0000001f, inset 0 0 0 1px #ffffff21,
    0 0 1.5px color-mix(in oklab, var(--c, var(--panel)) 55%, #000),
    0 2px 0 color-mix(in oklab, var(--c, var(--panel)) 70%, #000), var(--drop, 0 5px 8px #0003);
}
[data-theme="dark"] .felt {
  box-shadow:
    inset 0 2px 1px #ffffff14, inset 0 -3px 5px #0000003d, inset 0 0 0 1px #ffffff0f,
    0 0 1.5px color-mix(in oklab, var(--c, var(--panel)) 35%, #000),
    0 2px 0 color-mix(in oklab, var(--c, var(--panel)) 45%, #000), var(--drop, 0 6px 10px #0008);
}
/* a 2px thread gives longer stitches; its shadow sinks it into the felt */
.felt::after {
  content: ""; position: absolute; inset: var(--inset, 5px); pointer-events: none;
  border: 2px dashed var(--stitch, var(--stitch-on-light));
  --rr: calc(var(--r, var(--r-md)) - var(--inset, 5px) + 2px);
  filter: drop-shadow(0 1px 0 #00000038);
}
/* hand-cut felt: no two corners alike */
.felt, .felt::after {
  border-radius:
    calc(var(--rr) * 1.14) calc(var(--rr) * .86) calc(var(--rr) * 1.07) calc(var(--rr) * .93) /
    calc(var(--rr) * .86) calc(var(--rr) * 1.07) calc(var(--rr) * .93) calc(var(--rr) * 1.14);
}
/* stray fibres past the cut: a ring of the felt's colour roughened by #felt-fray in the page's svg */
.felt::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  border: 1.5px solid color-mix(in oklab, var(--c, var(--panel)) 94%, #000);
  filter: url(#felt-fray);
}
/* three noise seeds so neighbours never fray the same way */
.felt:nth-child(3n+2)::before { filter: url(#felt-fray-b); }
.felt:nth-child(3n)::before { filter: url(#felt-fray-c); }
.felt.panel { --c: var(--panel); --r: var(--r-lg); --inset: 7px; --stitch: var(--stitch-panel); color: var(--ink); }
.felt.panel::after { filter: none; }
.felt.panel.alt { --c: var(--panel-alt); }
.felt.row { --c: var(--row); --inset: 4px; }
/* Paper instead of felt: shop stalls and the cards laid on them. */
.felt.paper { --fibre: var(--paper); background-image: var(--paper); background-size: 256px; }
.felt.badge { --c: var(--badge); --stitch: var(--stitch-on-dark); --r: var(--r-sm); --inset: 3px; color: var(--on-dark); }

/* ---------- scrollbars ---------- */
/* A thin rounded thumb without arrows; a surface retints it by setting --scroll. */
.felt.panel { --scroll: var(--hairline); }
@supports not selector(::-webkit-scrollbar) {
  .felt.panel, .felt.panel * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
}
.felt.panel::-webkit-scrollbar, .felt.panel ::-webkit-scrollbar { width: 10px; height: 10px; }
.felt.panel::-webkit-scrollbar-track, .felt.panel ::-webkit-scrollbar-track { background: transparent; }
.felt.panel::-webkit-scrollbar-button, .felt.panel ::-webkit-scrollbar-button { display: none; }
.felt.panel::-webkit-scrollbar-thumb, .felt.panel ::-webkit-scrollbar-thumb {
  background: var(--scroll); background-clip: padding-box; border: 3px solid transparent; border-radius: 10px;
}

/* ---------- buttons ---------- */
.btn {
  --c: var(--control); --r: var(--r-md); --inset: 4px; --stitch: var(--stitch-on-light);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; cursor: pointer;
  font: 800 16px/1 var(--font); color: var(--ink);
  transition: transform var(--press), box-shadow var(--press), background-color var(--press);
}
[data-theme="dark"] .btn { --stitch: var(--stitch-on-dark); }
.btn:hover:where(:not([disabled])) { --c: var(--control-hover); }
.btn.primary { --c: var(--primary); --stitch: var(--stitch-on-dark); color: var(--on-dark); }
.btn.primary:hover:where(:not([disabled])) { --c: var(--primary-hover); }
.btn.danger { --c: var(--berry); --stitch: var(--stitch-on-dark); color: var(--on-dark); }
.btn.gold { --c: var(--gold-btn); --stitch: var(--stitch-on-gold); color: var(--gold-btn-ink); }
.btn.gold:hover:where(:not([disabled])) { --c: var(--gold-btn-hover); }
.btn.gold:active:where(:not([disabled])) { --c: var(--gold-btn-press); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 2px 4px #0005; }
/* Cut into a narrow strip: no thread or lip of its own, so it can sit right at the strip's seam. */
.felt.pocket { --c: color-mix(in oklab, var(--panel) 86%, #000); box-shadow: inset 0 2px 3px #0000004d, inset 0 -1px 0 #ffffff26; }
[data-theme="dark"] .felt.pocket { --c: color-mix(in oklab, var(--panel) 70%, #000); box-shadow: inset 0 2px 4px #0009, inset 0 -1px 0 #ffffff17; }
.felt.pocket::after { content: none; }
.btn.pocket:hover:where(:not([disabled])) { --c: color-mix(in oklab, var(--panel) 93%, #000); }
.btn.pocket:active { transform: none; box-shadow: inset 0 3px 5px #0006; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.ib {
  --c: var(--icon-btn); --stitch: var(--icon-btn-stitch); --r: var(--r-sm); --inset: 4px;
  width: 52px; height: 52px; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  color: var(--icon-btn-ink); font: inherit;
  transition: transform var(--press), box-shadow var(--press), background-color var(--press);
}
.ib:hover:where(:not([disabled])) { --c: var(--icon-btn-hover); }
.ib[aria-pressed="true"] { --c: var(--primary); --stitch: var(--stitch-gold); color: var(--on-dark); }
.ib:active:where(:not([aria-pressed="true"])) { --c: var(--icon-btn-press); }
.ib:active { transform: translateY(2px); box-shadow: inset 0 2px 4px #0006; }

/* ---------- pebbles: unstitched felt stones with lopsided corners; neighbours alternate .sand/.grey ---------- */
.felt.pebble, .felt.pebble::after { border-radius: var(--r); }
/* stone is smooth: no fray ring */
.felt.pebble::before { content: none; }
.felt.pebble { --c: var(--stone); --r: 16px 19px 15px 18px / 17px 14px 18px 15px; --inset: 4px; --stitch: transparent; color: var(--ink); }
.felt.pebble.sand { --c: var(--stone-sand); --r: 18px 15px 19px 14px / 14px 18px 15px 17px; }
.felt.pebble.grey { --c: var(--stone-grey); --r: 15px 18px 17px 16px / 18px 15px 16px 14px; }
.felt.pebble:is(.tan, .clay) { color: var(--stone-on-ink); }
.felt.pebble.tan { --c: var(--stone-tan); }
.felt.pebble.clay { --c: var(--stone-clay); }
.felt.pebble:hover:where(:not(.on, [aria-selected="true"], [aria-pressed="true"], [aria-expanded="true"], [disabled])) { filter: brightness(1.05); }
.felt.pebble:is(.on, [aria-selected="true"], [aria-pressed="true"], [aria-expanded="true"]) { --c: var(--stone-on); --stitch: transparent; color: var(--stone-on-ink); }
.felt.pebble.off { --c: var(--berry); --stitch: transparent; color: var(--on-dark); }
.felt.pebble.off:hover:where(:not([disabled])) { --c: color-mix(in oklab, var(--berry) 85%, #fff); filter: none; }
/* the dark .felt shadow is more specific than :active, so press needs its own dark rule */
[data-theme="dark"] :is(.btn, .ib):active { box-shadow: inset 0 2px 4px #0006; }
[data-theme="dark"] .btn.pocket:active { box-shadow: inset 0 3px 6px #000b, inset 0 -1px 0 #ffffff17; }
.ib[aria-pressed="true"]::before {
  content: ""; position: absolute; inset: auto -3px -3px auto; width: 12px; height: 12px; border-radius: 50%;
  border: 0; filter: none; background: #7fd36a; box-shadow: 0 0 0 2px var(--cream);
}
.ib.off { --c: var(--berry); --stitch: var(--stitch-on-dark); color: var(--on-dark); }
.ib.off:hover:where(:not([disabled])) { --c: color-mix(in oklab, var(--berry) 88%, #fff); }
.ib.close-btn {
  --c: color-mix(in srgb, color-mix(in srgb, var(--berry) 80%, var(--forest)) 95%, var(--panel));
  --stitch: var(--stitch-on-dark); color: var(--on-dark);
  width: 38px; height: 38px; flex: none;
}
.ib.close-btn:hover:where(:not([disabled])) {
  --c: color-mix(in srgb, color-mix(in srgb, var(--berry) 88%, var(--forest)) 95%, var(--panel));
}
.ib.close-btn > svg { width: 18px; height: 18px; stroke-width: 2.2; }
/* The transparent rim keeps a 44px touch target without enlarging the felt patch. */
.ib.close-btn::before { inset: -3px; border: 0; filter: none; pointer-events: auto; }
/* No focus rings anywhere: the meadow is played by mouse and the rings read as a stray selection. */
:focus-visible { outline: none; }
/* The menu walks its buttons with the arrow keys, so there the ring is the cursor. */
#menu :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- inputs: a hollow carved into stone; no focus ring, the shadow already says where to type ---------- */
.field {
  width: 100%; height: 40px; box-sizing: border-box; padding: 0 14px; border: 0; outline: none;
  border-radius: 14px 19px 16px 18px / 18px 15px 19px 14px;
  background: var(--fibre) 0 0 / 160px, var(--fibre) 57px 31px / 90px, var(--stone-well); background-blend-mode: soft-light;
  color: var(--ink); font: 700 16px var(--font); box-shadow: var(--stone-carve);
}
.field::placeholder { color: var(--ink-soft); }

/* JS sets --v to the value in %, since the webkit track has no native fill */
.range { --v: 50%; flex: 1; height: 28px; margin: 0; appearance: none; background: none; cursor: pointer; border-radius: 6px; }
.range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: var(--fibre) 0 0 / 120px, linear-gradient(90deg, var(--primary) var(--v), var(--track) 0); background-blend-mode: soft-light; box-shadow: inset 0 2px 2px #0003; }
.range::-moz-range-track { height: 12px; border-radius: 6px; background: var(--fibre) 0 0 / 120px, linear-gradient(90deg, var(--primary) var(--v), var(--track) 0); background-blend-mode: soft-light; box-shadow: inset 0 2px 2px #0003; }
/* The knob stays cream in both themes, so its stitch is ink-based: --stitch-on-light turns cream in dark. */
.range::-webkit-slider-thumb {
  appearance: none; width: 26px; height: 26px; margin-top: -7px; border: 0; border-radius: 8px;
  background: var(--knob) var(--fibre) 0 0 / 160px; background-blend-mode: soft-light;
  outline: 1.5px dashed color-mix(in oklab, var(--tag-ink) 45%, transparent); outline-offset: -5px;
  box-shadow: inset 0 0 0 1px var(--tag-lip), inset 0 -2px 3px #0002, 0 2px 0 var(--tag-lip), 0 3px 6px #0003;
}
.range::-moz-range-thumb {
  width: 26px; height: 26px; border: 0; border-radius: 8px;
  background: var(--knob) var(--fibre) 0 0 / 160px; background-blend-mode: soft-light;
  outline: 1.5px dashed color-mix(in oklab, var(--tag-ink) 45%, transparent); outline-offset: -5px;
  box-shadow: inset 0 0 0 1px var(--tag-lip), inset 0 -2px 3px #0002, 0 2px 0 var(--tag-lip), 0 3px 6px #0003;
}

.switch {
  position: relative; width: 56px; height: 30px; margin: 0; appearance: none; cursor: pointer;
  border-radius: 15px; background: var(--track) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light;
  box-shadow: inset 0 2px 3px #0003; transition: background-color var(--press);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--knob) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light;
  box-shadow: inset 0 -2px 3px #0002, 0 2px 0 var(--lip-light); transition: transform var(--toggle);
}
.switch:checked { background-color: var(--primary); }
.switch:checked::after { transform: translateX(26px); }
.switch:disabled { opacity: .45; cursor: default; }

.tab { --c: var(--control); --r: var(--r-sm); --inset: 3px; height: 42px; padding: 0 14px; border: 0; cursor: pointer; font: 800 15px var(--font); color: var(--ink); }
.tab:hover:where(:not([disabled])) { --c: var(--control-hover); }
.tab:is([aria-selected="true"], [aria-checked="true"], [aria-pressed="true"]) { --c: var(--primary); --stitch: var(--stitch-on-dark); color: var(--on-dark); }

/* em-sized: the same key sits in a 13px status line and a 16px [E] prompt */
kbd {
  display: inline-grid; place-items: center; min-width: 1.9em; height: 1.9em; padding: 0 .45em; box-sizing: border-box;
  border-radius: .45em; background: var(--kbd); color: var(--kbd-ink); font: 900 .95em/1 var(--font);
  box-shadow: 0 2px 0 var(--kbd-lip);
}

.meter { height: 14px; border-radius: 7px; background: var(--track) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light; box-shadow: inset 0 2px 2px #0003; overflow: hidden; }
.meter > i {
  display: block; height: 100%; width: var(--v, 0%); border-radius: inherit;
  background: var(--primary) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light; transition: width 200ms ease-out;
}
.meter.hot > i { background-color: var(--gold); }

/* leaderboard places: dyed felt discs, the rim is the same dye lighter */
.medal {
  --m: var(--gold); display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--m) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light; color: #26301f; font: 900 17px/1 var(--font);
  box-shadow: inset 0 0 0 3px color-mix(in oklab, var(--m) 60%, #fff), 0 2px 0 color-mix(in oklab, var(--m) 60%, #000);
}
.medal.silver { --m: var(--silver); }
.medal.bronze { --m: var(--bronze); }

/* ---------- decor: grayscale line art used as a mask, so its ink follows the theme ---------- */
.felt.panel { isolation: isolate; }
.decor {
  position: absolute; z-index: -1; pointer-events: none; width: var(--w, 120px); aspect-ratio: var(--ar);
  background: var(--decor); mask: var(--img) center / contain no-repeat;
}
.decor.mountains { --img: url(img/decor/mountains.webp); --ar: 640 / 171; }
.decor.firs { --img: url(img/decor/firs.webp); --ar: 320 / 423; }
.decor.compass { --img: url(img/decor/compass.webp); --ar: 320 / 325; }
.decor.reeds { --img: url(img/decor/reeds.webp); --ar: 560 / 345; }
.decor.map { --img: url(img/decor/map.webp); --ar: 640 / 960; }
.decor.pond { --img: url(img/decor/pond.webp); --ar: 541 / 200; }
.decor.medal { --img: url(img/decor/medal.webp); --ar: 546 / 180; }
/* the sprig is cut from dyed felt rather than drawn */
.decor.sprig {
  --img: url(img/decor/sprig.webp); --ar: 160 / 222; --w: 26px;
  background: var(--sage) var(--fibre) 0 0 / 120px; background-blend-mode: soft-light;
}
.handnote { font: 600 19px/1 var(--hand); color: var(--ink-soft); text-align: center; rotate: -6deg; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .felt, .felt::after, .btn, .ib, .switch, .switch::after, .meter > i { transition: none; }
  .btn:active, .ib:active { transform: none; }
}
