:root{
  --bg: #101b30;
  --bg-deep: #0b1424;
  --plate: #16233d;
  --key: #1d2d4e;
  --key-top: #24365c;
  --key-edge: #0c1526;
  --gold: #fcd116;
  --red: #ce1126;
  --ink: #f3f1e8;
  --muted: #8b93a8;
  --mono: 'IBM Plex Mono', monospace;
  --display: 'Space Grotesk', sans-serif;
  --sans: 'IBM Plex Sans', sans-serif;
}
*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
  margin:0;
  background: radial-gradient(ellipse at top, var(--bg) 0%, var(--bg-deep) 70%);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
}
.wrap{ max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header / Nav ---------- */
header.site{
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 20px 0;
}
.nav-inner{
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.logo{
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo .dot{ color: var(--gold); }
nav.links{
  display:flex;
  gap: 20px;
  flex-wrap: wrap;
}
nav.links a{
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s ease;
}
nav.links a:hover, nav.links a.active{ color: var(--gold); }

/* ---------- Hero / Page head ---------- */
main{ padding: 44px 0 80px; }
.eyebrow{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 14px;
}
h1{
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.15;
  margin: 0 0 16px;
}
h1 .accent{ color: var(--gold); }
p.lede{
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 58ch;
  margin: 0 0 32px;
}

/* ---------- Tool panel ---------- */
.panel{
  background: var(--plate);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 24px 20px 20px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
  margin-bottom: 40px;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.group-label{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.shift-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  background: var(--key);
  border: 1px solid var(--key-edge);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  cursor:pointer;
  user-select:none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  transition: background 0.15s ease;
}
.shift-toggle:hover{ background: var(--key-top); }
.shift-toggle .pill{
  width: 34px; height: 20px;
  background: var(--bg-deep);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
}
.shift-toggle .pill::after{
  content:"";
  position:absolute; top:2px; left:2px;
  width:16px; height:16px;
  border-radius:50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.shift-toggle.on .pill{ background: rgba(252,209,22,0.25); }
.shift-toggle.on .pill::after{ transform: translateX(14px); background: var(--gold); }

.row{ margin-bottom: 18px; }
.row:last-child{ margin-bottom: 0; }
.row-label{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 8px 2px;
}
.keys{ display:flex; flex-wrap: wrap; gap: 8px; }

.key{
  position: relative;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--key-top) 0%, var(--key) 100%);
  border: none;
  border-bottom: 3px solid var(--key-edge);
  border-radius: 10px;
  width: 56px;
  height: 56px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor: pointer;
  transition: transform 0.06s ease, border-bottom-width 0.06s ease, background 0.15s ease;
}
.key.wide{ width: auto; padding: 0 22px; font-size: 26px; }
.key:hover{ background: linear-gradient(180deg, #2a3e69 0%, #223655 100%); }
.key:focus-visible{ outline: 2px solid var(--gold); outline-offset: 2px; }
.key:active, .key.pressed{ transform: translateY(3px); border-bottom-width: 0; }
.key.pressed{ background: linear-gradient(180deg, #3a4d7d 0%, #2a3d68 100%); }
.key .spark{
  position:absolute; top:-9px; left:50%;
  transform: translateX(-50%);
  width:6px; height:6px; border-radius:50%;
  background: var(--gold); opacity:0;
}
.key.pressed .spark{ animation: spark 0.5s ease-out; }
@keyframes spark{
  0%{ opacity:1; transform: translate(-50%, 0) scale(1); }
  100%{ opacity:0; transform: translate(-50%, -14px) scale(0.4); }
}

.toast{
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--bg-deep);
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5);
  z-index: 40;
}
.toast.show{ opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Article content ---------- */
article h2{
  font-family: var(--display);
  font-size: 21px;
  margin: 36px 0 12px;
  color: var(--ink);
}
article h3{
  font-family: var(--display);
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--ink);
}
article p{ color: #d9d6c9; font-size: 15px; margin: 0 0 14px; }
article ul, article ol{ color: #d9d6c9; font-size: 15px; padding-left: 22px; margin: 0 0 14px; }
article li{ margin-bottom: 6px; }
article strong{ color: var(--ink); }
article a{ color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(252,209,22,0.35); }
article a:hover{ border-bottom-color: var(--gold); }
article code{
  font-family: var(--mono);
  background: var(--plate);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13.5px;
  color: var(--gold);
}

table{ width:100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 13px; }
th, td{ text-align: left; padding: 9px 8px; border-bottom: 1px solid rgba(255,255,255,0.06); }
th{
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
td{ color: var(--ink); }
td.mono{ font-family: var(--mono); color: var(--muted); font-size: 12.5px; }

details{ margin-top: 26px; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 18px; }
summary{
  cursor: pointer; font-family: var(--mono); font-size: 13px; color: var(--muted);
  list-style: none; display:flex; align-items:center; gap:8px;
}
summary::-webkit-details-marker{ display:none; }
summary::before{ content:"+"; color: var(--gold); font-size: 16px; width: 16px; }
details[open] summary::before{ content:"–"; }
summary:hover{ color: var(--ink); }

.crosslink{
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-family: var(--mono);
  font-size: 13px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}

footer.site{
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 26px 0 40px;
  font-size: 12.5px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce){
  .key, .key.pressed, .toast, .shift-toggle .pill::after{ transition:none; animation:none; }
}
