/* ============================================================
   PK Khmer Type — Obsidian Cyber-Temple Dark Theme & Authentic Keyboard
   ============================================================ */

:root {
  color-scheme: dark;
  --paper: #060911;
  --paper-soft: #0a0f1d;
  --white: #101828;
  --ink: #f4f8ff;
  --ink-soft: #bac8de;
  --muted: #7e8fa8;
  --rule: #1b273d;
  --gold: #ffd166;
  --gold-bright: #ffd166;
  --gold-dim: #e5b94f;
  --signal: #5de9d5;
  --signal-strong: #20cab8;
  --ember: #ffa36e;
  --stone-1: #0e1322;
  --stone-2: #141a2c;
  --stone-3: #1e263d;
  --stone-edge: #050811;
  --surface: #0c1322;
  --surface-raised: #121c2e;
}

::selection {
  background: rgba(93, 233, 213, 0.3);
  color: #ffffff;
}

body {
  background:
    radial-gradient(ellipse 70rem 45rem at 90% -5%, rgba(45, 130, 160, 0.14), transparent 70%),
    radial-gradient(ellipse 60rem 38rem at -15% 40%, rgba(35, 75, 140, 0.13), transparent 75%),
    radial-gradient(ellipse 50rem 30rem at 50% 100%, rgba(255, 209, 102, 0.06), transparent 70%),
    var(--paper);
  color: var(--ink);
  position: relative;
}

/* Ambient Cyber Khmer Constellations Canvas */
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 0.88;
}

body.no-motion .ambient-canvas {
  display: none !important;
}

/* Subtle background particle grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(rgba(176, 205, 232, 0.28) 0.8px, transparent 0.8px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, #000 10%, transparent 90%);
}

/* ---------- Header & Navigation ---------- */
.site-header {
  background: rgba(6, 9, 17, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease, height .25s ease;
}

.site-header.is-scrolled {
  background: rgba(6, 9, 17, 0.94);
  border-bottom: 1px solid rgba(255, 209, 102, 0.22);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 209, 102, 0.06);
}

.nav-links a.is-active {
  color: var(--gold) !important;
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.5);
}

.brand img {
  box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.35), 0 0 20px rgba(255, 209, 102, 0.2);
}

/* ---------- Hero Visual Frame ---------- */
.hero-visual {
  border-color: rgba(255, 209, 102, 0.28);
  background: linear-gradient(155deg, rgba(20, 29, 48, 0.96), rgba(9, 14, 25, 0.98));
  box-shadow:
    0 25px 75px rgba(0, 0, 0, 0.65),
    0 0 35px rgba(255, 209, 102, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform .18s var(--ease), box-shadow .35s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.hero-visual:hover {
  box-shadow:
    0 34px 95px rgba(0, 0, 0, 0.78),
    0 0 55px rgba(93, 233, 213, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hero-visual::after {
  content: "";
  position: absolute;
  bottom: -22px;
  left: 8%;
  right: 8%;
  height: 48px;
  background: radial-gradient(ellipse 65% 100% at center, rgba(93, 233, 213, 0.4), rgba(255, 209, 102, 0.22) 45%, transparent 75%);
  filter: blur(28px);
  z-index: -1;
  opacity: 0.85;
  animation: hero-underglow-pulse 4.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes hero-underglow-pulse {
  0% { opacity: 0.55; transform: scaleX(0.92); filter: blur(24px); }
  100% { opacity: 0.95; transform: scaleX(1.05); filter: blur(34px); }
}

/* ============================================================
   AUTHENTIC KEYBOARD DECK (Mirroring PK Khmer Type Studio)
   ============================================================ */

.board-wrap {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 20px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #131929, #0a0e19);
  border: 1px solid #283650;
  box-shadow:
    0 30px 70px -15px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(93, 233, 213, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color .2s ease, box-shadow .2s ease;
  user-select: none;
}

.board-wrap.layer-shift {
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow:
    0 30px 70px -15px rgba(0, 0, 0, 0.7),
    0 0 50px rgba(255, 209, 102, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.board-wrap.layer-ctrl {
  border-color: rgba(45, 212, 167, 0.55);
  box-shadow:
    0 30px 70px -15px rgba(0, 0, 0, 0.7),
    0 0 50px rgba(45, 212, 167, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.board-wrap.layer-altgr {
  border-color: rgba(255, 90, 112, 0.55);
  box-shadow:
    0 30px 70px -15px rgba(0, 0, 0, 0.7),
    0 0 50px rgba(255, 90, 112, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Ambient bar under the chassis */
.board-wrap::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255, 209, 102, 0.35), transparent 75%);
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- Chassis Header Bar ---------- */
.board-chassis-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 14px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
}

.chassis-deck-id {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #c9d8eb;
  user-select: none;
}

.chassis-led-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-bright, #ffd166);
  box-shadow: 0 0 8px var(--gold-bright, #ffd166);
  flex-shrink: 0;
  animation: chassis-led-pulse 2.2s ease-in-out infinite;
}

@keyframes chassis-led-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; box-shadow: 0 0 6px var(--gold-bright, #ffd166); }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 14px 2px var(--gold-bright, #ffd166), 0 0 4px #ffffff; }
}

.chassis-name {
  color: #f2f7ff;
  letter-spacing: 0.05em;
}

.chassis-slash {
  color: rgba(255, 255, 255, 0.25);
  font-weight: 400;
}

.chassis-layout-label {
  color: var(--gold-bright, #ffd166);
  letter-spacing: 0.07em;
  font-weight: 700;
}

.chassis-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.15), rgba(255, 157, 46, 0.08));
  border: 1px solid rgba(255, 209, 102, 0.35);
  color: var(--gold-bright, #ffd166);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: all .2s ease;
}

.chassis-version-badge:hover {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.28), rgba(255, 157, 46, 0.18));
  border-color: var(--gold);
  color: #fff9e6;
  transform: translateY(-1px);
}

.chassis-ver-pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
  animation: chassis-ver-glow 2s ease-in-out infinite;
}

@keyframes chassis-ver-glow {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); box-shadow: 0 0 10px #38bdf8, 0 0 4px #fff; }
}

.chassis-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chassis-dash-btn,
.chassis-docs-btn,
.chassis-3d-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 8px;
  color: #c9d8eb;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all .18s cubic-bezier(.22, 1, .36, 1);
  cursor: pointer;
}

.chassis-dash-btn:hover,
.chassis-docs-btn:hover,
.chassis-3d-btn:hover {
  color: #ffffff;
  border-color: rgba(93, 233, 213, 0.4);
  background: rgba(93, 233, 213, 0.1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(93, 233, 213, 0.2);
  transform: translateY(-1.5px);
}

.chassis-dash-icon,
.chassis-docs-icon,
.chassis-3d-icon {
  flex-shrink: 0;
  color: var(--gold-bright, #ffd166);
  transition: transform .2s ease;
}

.chassis-dash-btn:hover .chassis-dash-icon { transform: rotate(-4deg) scale(1.1); }
.chassis-docs-btn:hover .chassis-docs-icon { transform: rotate(-6deg) scale(1.1); }
.chassis-3d-btn:hover .chassis-3d-icon { transform: rotate(8deg) scale(1.1); }

.chassis-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 209, 102, 0.15);
  color: var(--gold-bright, #ffd166);
  border: 1px solid rgba(255, 209, 102, 0.3);
}

/* ---------- The Keyboard Rows & Keys ---------- */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
  user-select: none;
}

.row {
  display: flex;
  gap: 7px;
}

.key {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1f2a40, #151d2d);
  border: 1px solid #2e3e5c;
  border-bottom: 3.5px solid #0f1624;
  border-radius: 9px;
  color: #f1f6ff;
  font-family: var(--font-khmer);
  font-size: 1.05rem;
  user-select: none;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), background .14s ease, border-color .14s ease, box-shadow .14s ease;
  overflow: hidden;
}

.key::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(255, 209, 102, 0.45) 0%, transparent 75%);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  z-index: 0;
}

.key::after {
  content: "";
  position: absolute;
  inset: 2px 2px auto 2px;
  height: 38%;
  border-radius: 7px 7px 11px 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.key .glyph {
  position: relative;
  z-index: 1;
  line-height: 1;
}

/* Corner preview of shift-layer glyph */
.shift-badge {
  position: absolute;
  top: 3px;
  right: 5px;
  z-index: 2;
  font-family: var(--font-serif);
  font-size: 0.62rem;
  line-height: 1;
  color: var(--gold-bright, #ffd166);
  opacity: 0.65;
  text-shadow: 0 0 6px rgba(255, 209, 102, 0.35);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.key:hover .shift-badge {
  opacity: 0.95;
  color: #ffffff;
}

.board-wrap.layer-shift .shift-badge {
  opacity: 0;
  transform: translateY(-3px) scale(0.7);
}

.key:hover {
  background: linear-gradient(180deg, #2b3b5a, #1c273e);
  transform: translateY(-1.5px);
  border-color: rgba(93, 233, 213, 0.55);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(93, 233, 213, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  z-index: 3;
}

.key.pressed, .key:active {
  transform: translateY(3px) scale(0.975);
  border-bottom-width: 1px;
  filter: brightness(1.3);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    inset 0 2px 5px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 209, 102, 0.65),
    0 0 18px rgba(255, 209, 102, 0.4);
  transition: transform .04s cubic-bezier(.2, .8, .2, 1), box-shadow .04s ease;
}

.key.pressed::before {
  animation: key-strike-shockwave .36s cubic-bezier(.1, .9, .2, 1) forwards;
}

@keyframes key-strike-shockwave {
  0% { opacity: 0.95; transform: scale(0.85); filter: brightness(1.6); }
  100% { opacity: 0; transform: scale(1.45); filter: brightness(1); }
}

/* Procedural tactile ripple on key strikes */
.key-ripple {
  position: absolute;
  pointer-events: none;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93, 233, 213, 0.75) 0%, rgba(255, 209, 102, 0.35) 45%, transparent 75%);
  animation: ripple-burst 0.45s cubic-bezier(.16, 1, .3, 1) forwards;
  z-index: 10;
}

@keyframes ripple-burst {
  0% { transform: scale(0.2); opacity: 0.95; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* Tactile homing bumps on F and J */
.key.homing::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 13px;
  height: 2.5px;
  border-radius: 999px;
  background: var(--gold-bright, #ffd166);
  opacity: 0.75;
  box-shadow: 0 0 4px rgba(255, 209, 102, 0.5);
}

/* Target key highlighted in live practice drill */
.key.is-target {
  border-color: var(--signal, #5de9d5) !important;
  box-shadow:
    0 0 0 1.5px rgba(93, 233, 213, 0.8),
    0 0 24px rgba(93, 233, 213, 0.45),
    0 4px 8px rgba(0, 0, 0, 0.4) !important;
  background: linear-gradient(180deg, #1c454e, #132d34) !important;
  animation: key-beacon 1.3s ease-in-out infinite alternate;
}

@keyframes key-beacon {
  0% { box-shadow: 0 0 0 1.5px rgba(93, 233, 213, 0.6), 0 0 14px rgba(93, 233, 213, 0.25); }
  100% { box-shadow: 0 0 0 2px rgba(93, 233, 213, 0.95), 0 0 28px rgba(93, 233, 213, 0.6); }
}

.key.is-target .glyph {
  color: #5de9d5 !important;
  text-shadow: 0 0 10px rgba(93, 233, 213, 0.8);
}

.key.empty {
  opacity: 0.28;
}

.key.is-modifier {
  background: linear-gradient(180deg, #192233, #111724);
  color: #b7c7dc;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
}

.key.space {
  flex-grow: 8;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.key.space .space-glyph {
  font-family: var(--font-khmer);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-bright, #ffd166);
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 209, 102, 0.35);
}

.key.space .space-label {
  font-family: var(--font-khmer);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: #b7c7dc;
  opacity: 0.88;
}

.key.space:hover .space-label {
  color: #ffffff;
  opacity: 1;
}

/* ---------- Temple Torches ---------- */
.torch {
  position: absolute;
  top: -12px;
  width: 14px;
  height: 48px;
  pointer-events: none;
  z-index: 3;
}
.torch.left { left: 16px; }
.torch.right { right: 16px; }
.torch .glow {
  position: absolute;
  top: -8px; left: -14px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.35) 0%, transparent 70%);
  animation: torch-glow 2.4s ease-in-out infinite alternate;
}
.torch .flame {
  position: absolute;
  top: 0; left: 3px;
  width: 8px; height: 16px;
  border-radius: 50% 50% 30% 30%;
  background: linear-gradient(180deg, #fff7d6, #ffb830 55%, #ff4d00);
  box-shadow: 0 0 10px rgba(255, 184, 48, 0.8);
  animation: torch-flicker 1.8s ease-in-out infinite alternate;
}
.torch .stick {
  position: absolute;
  top: 15px; left: 5px;
  width: 4px; height: 26px;
  border-radius: 2px;
  background: linear-gradient(180deg, #5c4424, #2a1e0f);
}
@keyframes torch-glow {
  0% { opacity: 0.6; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1.15); }
}
@keyframes torch-flicker {
  0% { transform: scaleY(1) rotate(-2deg); opacity: 0.9; }
  50% { transform: scaleY(1.15) rotate(2deg); opacity: 1; }
  100% { transform: scaleY(0.95) rotate(-1deg); opacity: 0.85; }
}

/* ---------- Hand Color Swatch Duo ---------- */
.hand-color-swatch-duo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.hand-color-swatch-duo span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  display: inline-block;
}

/* ---------- 3D Kinematic Hands Stage & Overlay (44% Default Opacity) ---------- */
.keyboard-stage {
  position: relative;
}

.hands-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible;
  opacity: var(--hands-opacity, 0.44);
  transition: opacity .35s ease, visibility .35s ease;
}

.hands-overlay.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
}

.hands-overlay .hand-group {
  filter: url(#handShadow);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
  animation: hand-resting-breath 2.6s ease-in-out infinite alternate;
}

.hands-overlay .hand-group.side-r {
  filter: url(#handShadowR);
  animation-delay: -1.3s;
}

@keyframes hand-resting-breath {
  0% { transform: translateY(0px) scale(1); }
  100% { transform: translateY(-3.5px) scale(1.008); }
}

.hands-overlay .palm-shape {
  fill: url(#palmGrad);
  stroke: var(--hand-l-stroke, rgba(56, 189, 248, 0.72));
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 12px var(--hand-l-shadow, rgba(2, 132, 199, 0.28)));
  transition: d .24s cubic-bezier(.22, 1, .36, 1), opacity .25s ease;
}

.hands-overlay .hand-group.side-r .palm-shape {
  fill: url(#palmGradR);
  stroke: var(--hand-r-stroke, rgba(244, 114, 182, 0.72));
  filter: drop-shadow(0 4px 12px var(--hand-r-shadow, rgba(192, 38, 211, 0.28)));
}

.hands-overlay .palm-shade {
  fill: none;
  stroke: var(--hand-l-crease, rgba(56, 189, 248, 0.55));
  stroke-width: 0.95;
  stroke-linecap: round;
  opacity: 0.28;
  mix-blend-mode: normal;
  transition: d .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .palm-shade {
  stroke: var(--hand-r-crease, rgba(244, 114, 182, 0.55));
}

.hands-overlay .palm-highlight {
  fill: url(#palmHighlight);
  opacity: 0.55;
  mix-blend-mode: screen;
  transition: cx .24s cubic-bezier(.22, 1, .36, 1), cy .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .palm-highlight {
  fill: url(#palmHighlightR);
}

.hands-overlay .palm-core {
  display: none !important;
}

.hands-overlay .finger-shape {
  fill: url(#fingerGradActive);
  stroke: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0;
  filter: none;
  transition: opacity .2s ease, filter .2s ease, d .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .finger-shape {
  fill: url(#fingerGradActiveR);
}

.hands-overlay .finger-shine {
  fill: none;
  stroke: var(--hand-l-shine, rgba(186, 230, 253, 0.48));
  stroke-width: 0.95;
  stroke-linecap: round;
  opacity: 0.65;
  transition: opacity .25s ease, d .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .finger-shine {
  stroke: var(--hand-r-shine, rgba(251, 207, 232, 0.48));
}

.hands-overlay .finger-shine2,
.hands-overlay .finger-energy,
.hands-overlay .target-reticle,
.hands-overlay .impact-sparks,
.hands-overlay .impact-ring,
.hands-overlay .impact-ring-2 {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.hands-overlay .finger-crease {
  fill: none;
  stroke: var(--hand-l-crease, rgba(56, 189, 248, 0.55));
  stroke-width: 0.85;
  stroke-linecap: round;
  opacity: 0.52;
  transition: opacity .25s ease, stroke .25s ease, d .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .finger-crease {
  stroke: var(--hand-r-crease, rgba(244, 114, 182, 0.55));
}

.hands-overlay .finger-joint {
  display: none !important;
  opacity: 0 !important;
}

.hands-overlay .finger-nail {
  fill: var(--hand-l-nail-fill, rgba(56, 189, 248, 0.28));
  stroke: var(--hand-l-nail-stroke, rgba(186, 230, 253, 0.68));
  stroke-width: 0.95;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.82;
  transition: opacity .25s ease, d .24s cubic-bezier(.22, 1, .36, 1), transform .24s cubic-bezier(.22, 1, .36, 1);
}

.hands-overlay .hand-group.side-r .finger-nail {
  fill: var(--hand-r-nail-fill, rgba(244, 114, 182, 0.28));
  stroke: var(--hand-r-nail-stroke, rgba(251, 207, 232, 0.68));
}

.hands-overlay .finger-tip {
  fill: var(--hand-l-tip-fill, rgba(56, 189, 248, 0.6));
  stroke: var(--hand-l-tip-stroke, rgba(224, 242, 254, 0.85));
  stroke-width: 1;
  r: 3.5;
  opacity: 0;
  filter: drop-shadow(0 0 6px var(--hand-l-glow, rgba(56, 189, 248, 0.8)));
  transition: cx .24s cubic-bezier(.22, 1, .36, 1), cy .24s cubic-bezier(.22, 1, .36, 1), fill .25s ease, r .25s ease, opacity .25s ease;
}

.hands-overlay .hand-group.side-r .finger-tip {
  fill: var(--hand-r-tip-fill, rgba(244, 114, 182, 0.6));
  stroke: var(--hand-r-tip-stroke, rgba(253, 242, 248, 0.85));
  filter: drop-shadow(0 0 6px var(--hand-r-glow, rgba(244, 114, 182, 0.8)));
}

.hands-overlay .finger.active .finger-shape,
.hands-overlay .finger.struck .finger-shape {
  fill: url(#fingerGradActive);
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.5;
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--hand-l-glow, rgba(56, 189, 248, 0.9))) drop-shadow(0 0 18px rgba(255, 209, 102, 0.55));
}

.hands-overlay .hand-group.side-r .finger.active .finger-shape,
.hands-overlay .hand-group.side-r .finger.struck .finger-shape {
  fill: url(#fingerGradActiveR);
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.5;
  opacity: 1;
  filter: drop-shadow(0 0 10px var(--hand-r-glow, rgba(244, 114, 182, 0.9))) drop-shadow(0 0 18px rgba(255, 209, 102, 0.55));
}

.hands-overlay .finger.active .finger-shine { stroke: #ffffff; opacity: 0.85; }
.hands-overlay .finger.active .finger-crease { stroke: #ffffff; opacity: 0.82; }
.hands-overlay .finger.active .finger-nail { fill: #ffffff; stroke: #ffffff; opacity: 0.95; }

.hands-overlay .finger.active .finger-tip,
.hands-overlay .hand-group.side-r .finger.active .finger-tip {
  fill: #ffd166;
  stroke: #ffffff;
  stroke-width: 1.4;
  r: 5;
  opacity: 1;
  filter: drop-shadow(0 0 8px #ffffff) drop-shadow(0 0 16px var(--hand-l-glow, rgba(56, 189, 248, 0.92)));
  animation: active-finger-beacon 1.25s ease-in-out infinite alternate;
}

.hands-overlay .hand-group.side-r .finger.active .finger-tip {
  filter: drop-shadow(0 0 8px #ffffff) drop-shadow(0 0 16px var(--hand-r-glow, rgba(244, 114, 182, 0.92)));
}

@keyframes active-finger-beacon {
  0% { r: 5; stroke-width: 1.4; }
  100% { r: 7; stroke-width: 2.0; }
}

.hands-overlay .finger.struck {
  animation: finger-strike-impact 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
  transform-origin: 50% 100%;
}

@keyframes finger-strike-impact {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(4.5px) scale(0.93); }
  70% { transform: translateY(-2px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}

.key-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.55), transparent 70%);
  transform: translate(-50%, -50%) scale(0);
  width: 120px;
  height: 120px;
  pointer-events: none;
  animation: ripple-anim .45s ease-out forwards;
  z-index: 0;
}

@keyframes ripple-anim {
  to { transform: translate(-50%, -50%) scale(1.1); opacity: 0; }
}

/* ---------- Active Modifier Layer Color Highlights ---------- */
.board-wrap.layer-shift .key.key-shift,
.key.key-shift.pressed {
  background: linear-gradient(180deg, #ffd166, #b07d1e) !important;
  color: #1a1202 !important;
  border-color: #ffd166 !important;
  box-shadow: 0 2px 8px rgba(255, 209, 102, 0.45) !important;
  transform: translateY(1.5px) !important;
}

.board-wrap.layer-ctrl .key.key-ctrl,
.key.key-ctrl.pressed {
  background: linear-gradient(180deg, #2dd4a7, #13775a) !important;
  color: #04211a !important;
  border-color: #2dd4a7 !important;
  box-shadow: 0 2px 8px rgba(45, 212, 167, 0.45) !important;
  transform: translateY(1.5px) !important;
}

.board-wrap.layer-altgr .key.key-altgr,
.key.key-altgr.pressed {
  background: linear-gradient(180deg, #ff5a70, #9e1f2f) !important;
  color: #ffffff !important;
  border-color: #ff5a70 !important;
  box-shadow: 0 2px 8px rgba(255, 90, 112, 0.45) !important;
  transform: translateY(1.5px) !important;
}

.board-wrap.layer-shift .key:not(.empty):not(.is-modifier) .glyph {
  color: var(--gold-bright);
}

.board-wrap.layer-ctrl .key:not(.empty):not(.is-modifier) .glyph {
  color: #2dd4a7;
}

.board-wrap.layer-altgr .key:not(.empty):not(.is-modifier) .glyph {
  color: #ff8595;
}

/* ---------- Key Inspector & Telemetry HUD ---------- */
.key-inspector-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-top: 14px;
  border-radius: 12px;
  background: rgba(12, 18, 30, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  flex-wrap: wrap;
}

.inspector-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.inspector-glyph-box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.15), rgba(93, 233, 213, 0.08));
  border: 1px solid rgba(255, 209, 102, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-khmer);
  font-size: 1.8rem;
  color: var(--gold-bright, #ffd166);
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.4);
  flex-shrink: 0;
}

.inspector-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.inspector-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #92a4bb;
}

.inspector-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f6ff;
}

.inspector-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inspector-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c9d8eb;
}

.inspector-chip.chip-gold {
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.3);
  color: var(--gold-bright, #ffd166);
}

.inspector-chip.chip-cyan {
  background: rgba(93, 233, 213, 0.1);
  border-color: rgba(93, 233, 213, 0.3);
  color: var(--signal, #5de9d5);
}

.keyboard-footnote {
  margin: 10px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Responsive Keyboard Tweaks ---------- */
@media (max-width: 900px) {
  .board-wrap {
    padding: 16px 12px 14px;
    border-radius: 16px;
  }
  .key {
    height: 42px;
    border-radius: 7px;
    font-size: 0.95rem;
  }
  .key .space-glyph {
    font-size: 0.95rem;
  }
  .key .space-label {
    font-size: 0.58rem;
  }
  .shift-badge {
    font-size: 0.54rem;
    top: 2px;
    right: 3px;
  }
  .chassis-actions {
    display: none;
  }
}

@media (max-width: 600px) {
  .board-wrap {
    padding: 12px 8px 10px;
  }
  .keyboard {
    gap: 4px;
  }
  .row {
    gap: 4px;
  }
  .key {
    height: 34px;
    border-radius: 5px;
    border-bottom-width: 2px;
    font-size: 0.82rem;
  }
  .shift-badge {
    display: none;
  }
  .key-inspector-hud {
    padding: 10px;
  }
  .inspector-glyph-box {
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
  }
}

/* ---------- Motion Reduced Overrides ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}

body.no-motion * {
  animation: none !important;
  transition: none !important;
}
