.theme-basic{--mat-top:#fbfbfc;--mat-base:#d9dfe8;--mat-line:#d6d8de;--num-color:#34343a}
  .theme-wood{--mat-top:linear-gradient(180deg,#d7b07c 0%,#cca168 100%);--mat-base:#a97b48;--mat-line:#b88446;--num-color:#5b3514}
  .theme-stone{--mat-top:linear-gradient(180deg,#dcdee2 0%,#cbced5 100%);--mat-base:#aeb3bb;--mat-line:#bec3cb;--num-color:#4b535e}
  .theme-glass{--mat-top:linear-gradient(180deg,rgba(241,250,255,.9),rgba(203,232,255,.78));--mat-base:rgba(132,190,231,.55);--mat-line:#b2d8f2;--num-color:#3a6690}
  .theme-metal{--mat-top:linear-gradient(180deg,#686e76 0%,#444b53 52%,#242a2f 100%);--mat-base:#20252b;--mat-line:#747d86;--num-color:#171b20}
  .theme-gel{--mat-top:linear-gradient(180deg,#f4d6ff 0%,#d9b7ff 100%);--mat-base:#b285ea;--mat-line:#d8b0f7;--num-color:#5d398f}

/* The board's active theme drives the sibling reset/fullscreen buttons.
   Add the same tokens for future .theme-wood, .theme-stone, etc. */
.scene-macro[data-theme="basic"]{
  --action-icon:#151515;
  --action-border:#c9c9cd;
  --action-base:#a7a9ad;
  --action-surface:linear-gradient(155deg,#fff 0%,#f8f8f9 22%,#eeeef0 58%,#d8d8dc 100%);
  --action-hover:linear-gradient(155deg,#fff,#e9e9ed);
  --action-pressed:linear-gradient(155deg,#dedee2,#f5f5f6);
  --action-shadow:inset 0 1px 1px #fff,inset 0 -1px 2px #ffffff80,0 2px 4px #17212999,0 0 0 2px #161d2640;
}

/* Wood: an independently rendered, oil-finished walnut keycap. */
:root{--basic-keycap:url('../assets/keycaps/cherry-c-keycap.png');--walnut-keycap:url('../assets/keycaps/wood-walnut-keycap.png')}
:root{--walnut-atlas:url('../assets/keycaps/wood-keycap-atlas.webp')}
.board.theme-wood{
  --num-color:#21140d;
}
.board.theme-wood .keycap-top,
.board.theme-wood .key.dead .keycap-top{
  background:var(--walnut-atlas) var(--material-x,0%) var(--material-y,0%) / 500% 500% no-repeat;
}
/* The rendered walnut slot occupies x=21.5–78.5%, y=64.6–72.2%;
   align the unchanged LED fill to its recessed opening. */
.board.theme-wood .level-track{top:64.6%;height:7.6%}
/* Carved legends: shaded upper inner edge, gently lit bottom lip.
   Remain real DOM text so each stack value, including 6, stays dynamic. */
.board.theme-wood .num,
.board.theme-wood .key.dead .num{
  color:var(--num-color);
  font-weight:700;
  text-shadow:0 -.045em .025em #120b07e6,0 .045em .015em #e9b782a6;
  -webkit-text-stroke:.012em #21140d;
}
.scene-macro[data-theme="wood"]{
  --action-icon:#51301e;
  --action-border:#94613c;
  --action-base:#59361e;
  --action-surface:linear-gradient(155deg,#f5d0aa15,#35160833),var(--walnut-keycap) center 15% / 160% 280%;
  --action-hover:linear-gradient(155deg,#f5d0aa38,#3516081a),var(--walnut-keycap) center 15% / 160% 280%;
  --action-pressed:linear-gradient(155deg,#35160855,#f5d0aa15),var(--walnut-keycap) center 15% / 160% 280%;
  --action-shadow:inset 0 1px 1px #d9ad8099,inset 0 -1px 2px #6c4426,0 2px 4px #17212999,0 0 0 2px #161d2640;
}
.scene-macro[data-theme="wood"] .macro-action .ui-icon{
  filter:drop-shadow(0 1px 0 #d2a77a) drop-shadow(0 -1px 0 #2d190e80);
}

/* Glass: thick polished optical crystal, with a softly translucent core.
   The live numeral resembles an engraving suspended below the surface. */
:root{--crystal-keycap:url('../assets/keycaps/glass-crystal-glossy-keycap.png')}
.board.theme-glass{--num-color:#edfaff}
.board.theme-glass .keycap-top,
.board.theme-glass .key.dead .keycap-top{
  background:var(--crystal-keycap) center / 100% 100% no-repeat;
}
/* Measured from the glass sprite's dark LED cavity (400 x 392). */
.board.theme-glass .level-track{left:22%;right:22%;top:58.7%;height:7.5%}
.board.theme-glass .num,
.board.theme-glass .key.dead .num{
  color:var(--num-color);
  font-weight:760;
  text-shadow:none;
  -webkit-text-stroke:0;
  filter:url('#glass-engraving');
}
.scene-macro[data-theme="glass"]{
  --action-icon:#24475e;
  --action-border:#a8c5d5;
  --action-base:#55798f;
  --action-surface:linear-gradient(155deg,#f2fbff 0%,#a5ccdd 16%,#bddee9 30%,#89b5cb 75%,#d8eff7 100%);
  --action-hover:linear-gradient(155deg,#fff,#cbe9f4 30%,#9fcadd 75%,#eaf8fb);
  --action-pressed:linear-gradient(155deg,#759fb5,#badce8 55%,#e0f3f9);
  --action-shadow:inset 0 2px 1px #fff,inset 0 -2px 3px #e5f8ffb0,0 2px 4px #17212999,0 0 0 2px #161d2640;
}

/* Steel: CNC-machined, satin gunmetal with deep black recessed numerals. */
:root{--gunmetal-keycap:url('../assets/keycaps/steel-gunmetal-keycap.png')}
.board.theme-metal{--num-color:#171b20}
.board.theme-metal .keycap-top,
.board.theme-metal .key.dead .keycap-top{
  background:var(--gunmetal-keycap) center / 100% 100% no-repeat;
}
/* Match the measured LED slot within the generated 400 × 392 sprite. */
.board.theme-metal .level-track{left:21.7%;right:21.7%;top:61.5%;height:7.5%}
.board.theme-metal .num,
.board.theme-metal .key.dead .num{
  color:var(--num-color);
  font-weight:740;
  text-shadow:0 -.032em .012em #0a0c10,0 .034em .01em #aeb7bf;
  -webkit-text-stroke:0;
}
.scene-macro[data-theme="metal"]{
  --action-icon:#d8dfe5;
  --action-border:#878e96;
  --action-base:#272d33;
  --action-surface:linear-gradient(155deg,#c5d0dd15,#11182055),var(--gunmetal-keycap) center 16% / 160% 285%;
  --action-hover:linear-gradient(155deg,#c5d0dd38,#11182022),var(--gunmetal-keycap) center 16% / 160% 285%;
  --action-pressed:linear-gradient(155deg,#11182066,#c5d0dd11),var(--gunmetal-keycap) center 16% / 160% 285%;
  --action-shadow:inset 0 1px 1px #bcc7d4a0,inset 0 -1px 2px #111820,0 2px 4px #17212999,0 0 0 2px #161d2640;
}

/* Stone: finely polished natural granite, with carved dark numerals. */
:root{--granite-keycap:url('../assets/keycaps/stone-polished-granite-keycap.png')}
:root{--granite-atlas:url('../assets/keycaps/stone-keycap-atlas.webp')}
.board.theme-stone{--num-color:#353638}
.board.theme-stone .keycap-top,
.board.theme-stone .key.dead .keycap-top{
  background:var(--granite-atlas) var(--material-x,0%) var(--material-y,0%) / 500% 500% no-repeat;
}
.board.theme-stone .level-track{left:21.7%;right:21.7%;top:61.5%;height:7.5%}
.board.theme-stone .num,
.board.theme-stone .key.dead .num{
  color:var(--num-color);
  font-weight:740;
  text-shadow:0 -.04em .018em #1c1c1de6,0 .04em .014em #e4e0d8d9;
  -webkit-text-stroke:0;
}
.scene-macro[data-theme="stone"]{
  --action-icon:#353638;
  --action-border:#a9a7a1;
  --action-base:#777570;
  --action-surface:linear-gradient(155deg,#ffffff10,#34343125),var(--granite-keycap) center 16% / 160% 285%;
  --action-hover:linear-gradient(155deg,#ffffff40,#34343110),var(--granite-keycap) center 16% / 160% 285%;
  --action-pressed:linear-gradient(155deg,#34343148,#ffffff10),var(--granite-keycap) center 16% / 160% 285%;
  --action-shadow:inset 0 1px 1px #f2f0e7b0,inset 0 -1px 2px #585750,0 2px 4px #17212999,0 0 0 2px #161d2640;
}

/* Gel: pastel lavender silicone + frosted jelly, thick soft rounded skirt. */
:root{--gel-keycap:url('../assets/keycaps/gel-lavender-keycap.webp')}
.board.theme-gel{--num-color:#3c205b}
.board.theme-gel .keycap-top,
.board.theme-gel .key.dead .keycap-top{
  background:var(--gel-keycap) center / 100% 100% no-repeat;
}
/* Use the shared keyboard press motion without changing the sprite shape. */
.board.theme-gel .level-track{left:22%;right:22.5%;top:62.7%;height:6.8%}
.board.theme-gel .num,
.board.theme-gel .key.dead .num{
  color:var(--num-color);
  font-weight:700;
  text-shadow:0 1px 1px #ead9ff50;
  -webkit-text-stroke:0;
}
.scene-macro[data-theme="gel"]{
  --action-icon:#3c205b;
  --action-border:#b59bcf;
  --action-base:#9981ba;
  --action-surface:linear-gradient(155deg,#eadcff 0%,#d8c0f1 36%,#c0a6e1 75%,#ab92cf 100%);
  --action-hover:linear-gradient(155deg,#f0e3ff,#d8c2f6 65%,#b9a0dc);
  --action-pressed:linear-gradient(155deg,#a98dcf,#d6bdf2 80%);
  --action-shadow:inset 0 1px 3px #f8eeffbd,inset 0 -2px 3px #b39bd1,0 2px 4px #17212980,0 0 0 2px #161d2640;
}
