:root{--blue:#2563eb;--blue2:#1e40af;--red:#dc2626;--green:#15803d;--amber:#f59e0b;--ink:#0f172a;--muted:#64748b;--line:#dbe3ee;--card:#ffffff;--bg:#f1f5f9}
*{box-sizing:border-box}
body{margin:0;font-family:"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink);background:var(--bg);min-height:100vh}
header{background:linear-gradient(120deg,#1e3a8a,#2563eb 60%,#0ea5e9);color:#fff;padding:18px 20px;box-shadow:0 4px 18px rgba(30,58,138,.25)}
header h1{margin:0;font-size:22px;font-weight:700}
header p{margin:4px 0 0;font-size:13px;opacity:.9}
main{max-width:980px;margin:18px auto;padding:0 14px 40px}
.card{background:var(--card);border-radius:16px;padding:20px;box-shadow:0 1px 3px rgba(15,23,42,.06),0 8px 24px rgba(15,23,42,.05);margin-bottom:16px}
.hidden{display:none!important}
h2{margin:0 0 4px;font-size:20px}
.sub{color:var(--muted);font-size:14px;margin:0 0 16px}
.form{display:grid;grid-template-columns:200px 1fr;gap:12px 16px;align-items:center}
.form>label,.lbl{font-weight:600;font-size:14px;color:#334155}
input[type=text],input[type=tel],input[type=number],select{width:100%;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;font-size:15px;background:#fff;color:var(--ink)}
input:focus,select:focus,textarea:focus,button:focus-visible{outline:3px solid #93c5fd;outline-offset:1px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border:1px solid #cbd5e1;border-radius:999px;font-size:14px;cursor:pointer;background:#fff;user-select:none}
.chip input{accent-color:var(--blue)}
.chip:has(input:checked){border-color:var(--blue);background:#eff6ff;color:var(--blue2);font-weight:600}
.notice{color:var(--red);font-size:13px}
.btn{padding:12px 18px;border:0;border-radius:12px;font-size:15px;font-weight:700;cursor:pointer;transition:transform .1s ease,box-shadow .2s ease}
.btn:active{transform:scale(.98)}
.btn-exam{background:linear-gradient(135deg,#dc2626,#f97316);color:#fff;box-shadow:0 6px 16px rgba(220,38,38,.25)}
.btn-practice{background:linear-gradient(135deg,#2563eb,#06b6d4);color:#fff;box-shadow:0 6px 16px rgba(37,99,235,.25)}
.btn-ghost{background:#fff;color:var(--blue);border:2px solid var(--blue)}
.btn-danger{background:#fff;color:var(--red);border:2px solid #fecaca}
.actions{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:18px}
.tip{color:var(--muted);font-size:13px;margin-top:12px}
.history table{width:100%;border-collapse:collapse;font-size:14px}
.history th,.history td{padding:8px 6px;border-bottom:1px solid #eef2f7;text-align:left}
.history th{color:var(--muted);font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.4px}
.metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:14px}
.m{background:linear-gradient(180deg,#ffffff,#f8fafc);border:1px solid var(--line);border-radius:14px;padding:12px;text-align:center}
.m .k{font-size:12px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);font-weight:700}
.m .v{font-size:30px;font-weight:800;color:var(--blue2);margin:4px 0 0;font-variant-numeric:tabular-nums}
.m .u{font-size:12px;color:var(--muted)}
.m.warn .v{color:var(--red)}
.m.timer .v{color:var(--ink)}
.hiddenlive .v{color:#94a3b8;font-size:22px}
.progress{height:10px;background:#e2e8f0;border-radius:999px;overflow:hidden;margin:6px 0 14px}
.progress i{display:block;height:100%;width:0;background:linear-gradient(90deg,#22c55e,#06b6d4);transition:width .2s ease}
.passages{margin:4px 0 12px;padding:16px 18px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:14px;height:230px;overflow:auto;font:22px/1.6 Georgia,"Times New Roman",serif;color:#475569;white-space:pre-wrap}
.word{padding:1px 2px;border-radius:4px}
.word.current{background:#fef08a;color:#1e293b}
.word.correct{color:#15803d}
.word.incorrect{background:#fee2e2;color:#b91c1c;text-decoration:underline wavy #ef4444}
.word.hidden-state{color:#475569}
#typing{width:100%;height:54px;padding:12px 16px;font-size:19px;border:2px solid #cbd5e1;border-radius:12px;outline:none;font-family:inherit}
#typing:focus{border-color:var(--blue)}
.tools{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;margin-top:12px}
.tools .group{display:flex;gap:6px;flex-wrap:wrap}
.toolbtn{min-width:40px;padding:7px 10px;border:1px solid #cbd5e1;background:#fff;border-radius:8px;font-size:15px;cursor:pointer;color:#334155}
.toolbtn.on{background:#e0e7ff;border-color:#818cf8}
.status{margin-top:10px;color:var(--muted);font-size:14px;min-height:20px}
.summary{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:12px 0}
.graph{background:#f8fafc;border:1px solid var(--line);border-radius:14px;padding:12px}
.graph svg{width:100%;height:160px;display:block}
.errs{max-height:220px;overflow:auto;font-size:14px}
.errs div{padding:6px 0;border-bottom:1px solid #f1f5f9}
.badge{display:inline-block;padding:4px 10px;border-radius:999px;font-size:13px;font-weight:700}
.ok{background:#dcfce7;color:#166534}.no{background:#fee2e2;color:#991b1b}
.certbox{border:1px solid var(--line);border-radius:14px;padding:18px;margin-top:14px;background:#fbfdff}
.certbox input{margin:6px 0 14px;font-size:16px;padding:11px 12px}
.cert-form input{width:100%}
#certificate{border:8px double var(--blue);padding:30px;text-align:center;margin:20px 0;background:#fffdf7;border-radius:6px}
#certificate .tag{font-size:14px;letter-spacing:3px;color:var(--blue)}
#certificate h1{font-family:Georgia,serif;color:var(--ink);font-size:34px;margin:8px 0}
#certificate .nm{font-size:30px;color:var(--blue);border-bottom:1px solid #bbb;padding-bottom:10px;margin:10px 0}
.foot{font-size:12px;color:#78828d}
@media(max-width:760px){
  .form{grid-template-columns:1fr}
  .metrics{grid-template-columns:1fr 1fr}
  .summary{grid-template-columns:1fr 1fr}
  .m .v{font-size:24px}
  .passages{font-size:18px;height:200px}
  .btn{width:100%}
  .actions{flex-direction:column}
}
@media print{
  body *{visibility:hidden!important}
  #certificate,#certificate *{visibility:visible!important}
  #certificate{display:block!important;position:absolute;left:0;top:0;width:100%;margin:0!important;border-radius:0}
  @page{size:A4 landscape;margin:12mm}
}
/* ===== Palak Infotech branding ===== */
.devbanner{background:linear-gradient(90deg,#0b1f4d,#1e40af 50%,#f97316);color:#fff;display:flex;align-items:center;justify-content:center;gap:10px;padding:7px 14px;font-size:13px;letter-spacing:.3px;text-align:center;flex-wrap:wrap}
.devbanner img{width:26px;height:26px;border-radius:6px;background:#fff;object-fit:contain}
.devbanner b{font-weight:800}
.brandrow{display:flex;align-items:center;gap:12px}
.brandrow img{width:46px;height:46px;border-radius:10px;background:#fff;object-fit:contain;padding:3px;box-shadow:0 4px 12px rgba(0,0,0,.2)}
.brandrow small{display:block;font-size:12px;opacity:.9;font-weight:500}
/* ===== Startup animation ===== */
#splash{position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;align-items:center;justify-content:center;background:radial-gradient(circle at 50% 40%,#1e3a8a 0%,#0b1f4d 60%,#050d24 100%);color:#fff;overflow:hidden;transition:opacity .6s ease,visibility .6s}
#splash.gone{opacity:0;visibility:hidden}
#splash .ring{position:absolute;width:520px;height:520px;max-width:150vw;max-height:150vw;border-radius:50%;border:2px solid rgba(251,146,60,.35);animation:spin 6s linear infinite}
#splash .ring.r2{width:380px;height:380px;border-color:rgba(56,189,248,.35);animation-duration:4s;animation-direction:reverse}
#splash img{width:130px;height:130px;border-radius:24px;background:#fff;object-fit:contain;padding:8px;box-shadow:0 0 40px rgba(251,146,60,.6);animation:pop .9s cubic-bezier(.2,1.4,.4,1) both;position:relative}
#splash .name{margin-top:22px;font-size:clamp(28px,6vw,46px);font-weight:900;letter-spacing:6px;display:flex;gap:2px;position:relative}
#splash .name span{display:inline-block;opacity:0;transform:translateY(18px) scale(.8);animation:letter .5s ease forwards;background:linear-gradient(180deg,#fff,#fde68a 60%,#fb923c);-webkit-background-clip:text;background-clip:text;color:transparent}
#splash .sub{margin-top:8px;font-size:14px;letter-spacing:4px;text-transform:uppercase;color:#7dd3fc;opacity:0;animation:fadeup .8s .9s ease forwards;position:relative}
#splash .bar{margin-top:26px;width:220px;height:4px;background:rgba(255,255,255,.15);border-radius:4px;overflow:hidden;position:relative}
#splash .bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#38bdf8,#f97316);animation:load 2.6s ease forwards}
#splash .skip{position:absolute;bottom:18px;right:18px;background:none;border:1px solid rgba(255,255,255,.4);color:#fff;padding:6px 12px;border-radius:999px;font-size:12px;cursor:pointer}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes pop{from{transform:scale(.2) rotate(-20deg);opacity:0}to{transform:none;opacity:1}}
@keyframes letter{to{opacity:1;transform:none}}
@keyframes fadeup{to{opacity:1}}
@keyframes load{to{width:100%}}
@media (prefers-reduced-motion:reduce){#splash *{animation-duration:.01s!important;animation-iteration-count:1!important}}
/* ===== Certificate ===== */
#certificate{position:relative;border:10px double #1e40af;padding:26px 34px;text-align:center;margin:20px 0;background:linear-gradient(135deg,#fffdf7,#f5f9ff);border-radius:6px;overflow:hidden}
#certificate:before{content:"";position:absolute;inset:0;background:url("https://palakinfotech.in/logo1.png") center/260px no-repeat;opacity:.05;pointer-events:none}
#certificate .cHead{display:flex;align-items:center;justify-content:center;gap:14px;position:relative}
#certificate .cHead img{width:70px;height:70px;object-fit:contain;border-radius:10px;background:#fff}
#certificate .cn{text-align:left}
#certificate .cn b{display:block;font-size:22px;color:#0b1f4d;letter-spacing:1px}
#certificate .cn small{display:block;font-size:12.5px;color:#334155;margin-top:2px}
#certificate .grade{display:inline-block;margin-top:10px;padding:6px 18px;border-radius:999px;font-weight:900;letter-spacing:3px;font-size:14px;color:#fff}
#certificate .grade.exc{background:linear-gradient(90deg,#15803d,#22c55e)}
#certificate .grade.sat{background:linear-gradient(90deg,#1d4ed8,#38bdf8)}
#certificate h1{font-family:Georgia,serif;color:#0f172a;font-size:32px;margin:12px 0 4px;position:relative}
#certificate .nm{font-family:Georgia,serif;font-size:32px;color:#1e40af;border-bottom:2px solid #f97316;display:inline-block;padding:0 16px 6px;margin:8px 0;position:relative}
#certificate .stats{display:flex;justify-content:center;gap:26px;flex-wrap:wrap;margin:14px 0;position:relative;font-size:15px}
#certificate .stats div{min-width:120px}
#certificate .stats b{display:block;font-size:24px;color:#0b1f4d}
#certificate .sigrow{display:flex;justify-content:space-between;align-items:flex-end;margin-top:26px;position:relative;gap:20px}
#certificate .sig{width:240px;text-align:center}
#certificate .sig .line{border-top:2px solid #334155;padding-top:6px;font-size:14px;color:#0f172a}
#certificate .sig .line b{display:block;font-size:16px}
#certificate .stamp{width:140px;height:140px;border-radius:50%;object-fit:contain;transform:rotate(-10deg);mix-blend-mode:multiply;opacity:.92}
#certificate .foot{font-size:11px;color:#64748b;margin-top:14px;position:relative}
.footbrand{text-align:center;font-size:12px;color:#64748b;margin:18px 0 6px}

/* ===== Colourful modern front page (setup screen) ===== */
body{background:
  radial-gradient(circle at 10% 0%,rgba(99,102,241,.22),transparent 40%),
  radial-gradient(circle at 95% 10%,rgba(236,72,153,.18),transparent 40%),
  radial-gradient(circle at 50% 100%,rgba(20,184,166,.18),transparent 45%),
  linear-gradient(180deg,#eef2ff 0%,#fdf4ff 55%,#ecfeff 100%);
  background-attachment:fixed}
.devbanner{background:linear-gradient(90deg,#6366f1,#ec4899,#f59e0b,#14b8a6);background-size:300% 100%;animation:flow 10s linear infinite;box-shadow:0 4px 16px rgba(99,102,241,.25)}
@keyframes flow{to{background-position:300% 0}}
header{background:linear-gradient(120deg,#4338ca 0%,#7c3aed 35%,#db2777 70%,#f97316 100%);box-shadow:0 10px 30px rgba(124,58,237,.35)}
header h1{text-shadow:0 2px 10px rgba(0,0,0,.2)}
main .card{position:relative;overflow:hidden;border:1px solid rgba(255,255,255,.8);background:rgba(255,255,255,.92);backdrop-filter:blur(6px);box-shadow:0 12px 30px rgba(99,102,241,.12)}
main .card:before{content:"";position:absolute;left:0;top:0;right:0;height:5px;background:linear-gradient(90deg,#6366f1,#ec4899,#f59e0b,#14b8a6)}
main h2{background:linear-gradient(90deg,#4338ca,#db2777);-webkit-background-clip:text;background-clip:text;color:transparent;font-size:24px}
.form>label,.lbl{color:#4338ca;font-weight:700}
input[type=text],input[type=tel],input[type=number],select{border:2px solid #e0e7ff;background:#fff;transition:border-color .2s,box-shadow .2s}
input[type=text]:focus,input[type=tel]:focus,input[type=number]:focus,select:focus{border-color:#a855f7;box-shadow:0 0 0 4px rgba(168,85,247,.18);outline:none}
.chip{border:2px solid #e0e7ff;background:linear-gradient(180deg,#fff,#f5f3ff);color:#4338ca;transition:transform .15s,box-shadow .2s}
.chip:hover{transform:translateY(-1px);box-shadow:0 6px 14px rgba(99,102,241,.18)}
.chip:has(input:checked){border-color:transparent;background:linear-gradient(90deg,#6366f1,#ec4899);color:#fff;box-shadow:0 6px 16px rgba(236,72,153,.3)}
.chip:has(input:checked) input{accent-color:#fff}
.btn{transition:transform .15s,box-shadow .2s,filter .2s;letter-spacing:.2px}
.btn:hover{transform:translateY(-2px);filter:brightness(1.05)}
.btn-exam{background:linear-gradient(135deg,#f43f5e,#f97316)!important}
.btn-practice{background:linear-gradient(135deg,#06b6d4,#6366f1)!important}
.btn-ghost{border:2px solid transparent;background:linear-gradient(#fff,#fff) padding-box,linear-gradient(90deg,#6366f1,#ec4899) border-box;color:#4338ca}
.btn-danger{background:linear-gradient(#fff,#fff) padding-box,linear-gradient(90deg,#f43f5e,#f97316) border-box;border:2px solid transparent;color:#e11d48}
.tip{color:#7c3aed;background:#f5f3ff;border-radius:10px;padding:8px 12px}
.history th{color:#7c3aed;background:#f5f3ff}
.history td{border-bottom:1px solid #ede9fe}
.history tbody tr:nth-child(odd){background:#fdf4ff}
.history tbody tr:nth-child(even){background:#f0fdfa}
.notice{background:#fff1f2;border-radius:8px;padding:4px 10px;display:inline-block}
.devbanner img,.brandrow img{box-shadow:0 0 0 3px rgba(255,255,255,.6)}
.foot,.footbrand{color:#6b7280}

/* ===== Pause, exam strip, on-screen keyboard ===== */
.examstrip{display:flex;flex-wrap:wrap;gap:6px 18px;background:#1e293b;color:#cbd5e1;border-radius:10px;padding:9px 14px;font-size:13px;margin-bottom:12px}
.examstrip b{color:#fff;font-weight:700}
.passwrap{position:relative}
.pauseov{position:absolute;inset:0;background:rgba(241,245,249,.97);display:flex;align-items:center;justify-content:center;text-align:center;border-radius:14px;padding:16px}
.pauseov h3{margin:0 0 6px;font-size:22px;color:var(--ink)}
.pauseov p{color:var(--muted);font-size:14px;margin:0 0 14px}
.kbdwrap{margin-top:14px;background:linear-gradient(#e2e8f0,#cbd5e1);border-radius:14px;padding:12px 10px;box-shadow:inset 0 -3px 0 rgba(0,0,0,.12);overflow-x:auto}
.kbd{display:flex;flex-direction:column;gap:6px;min-width:620px}
.krow{display:flex;gap:6px;justify-content:center}
.key{position:relative;flex:1;max-width:58px;height:40px;display:flex;align-items:center;justify-content:center;background:linear-gradient(#ffffff,#f1f5f9);border:1px solid #94a3b8;border-bottom-width:3px;border-radius:7px;font-size:14px;font-weight:600;color:#334155;user-select:none;transition:background .12s,box-shadow .12s}
.key.wide{flex:none;font-size:12px;color:#475569}
.key.space{flex:none;width:340px;max-width:none}
.key.bump::after{content:"";position:absolute;bottom:5px;left:50%;transform:translateX(-50%);width:10px;height:3px;background:#64748b;border-radius:2px}
.key.next,.key.shiftnext{background:linear-gradient(#fde68a,#f59e0b);border-color:#b45309;color:#1e293b;box-shadow:0 0 0 3px rgba(251,191,36,.35)}
.kbdnote{font-size:12px;color:#475569;margin:8px 2px 0}
@media(max-width:760px){.key{height:34px;font-size:12px}.key.space{width:220px}}

/* ===== Back to home button ===== */
header{position:relative}
.homebtn{position:absolute;top:14px;right:18px;display:inline-block;padding:7px 14px;border-radius:999px;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.55);color:#fff;font-size:13px;font-weight:700;text-decoration:none;backdrop-filter:blur(4px)}
.homebtn:hover{background:rgba(255,255,255,.3)}
.homebtn-inline{text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
@media(max-width:760px){.homebtn{position:static;display:inline-block;margin-top:10px}}

/* ===== Keyboard: RGB glow theme ===== */
.kbd-rgb{background:linear-gradient(160deg,#0b1020,#111827);border-radius:16px;padding:14px 12px;box-shadow:0 0 0 1px rgba(148,163,184,.15),0 10px 30px rgba(0,0,0,.35)}
.kbd-rgb .key{color:#e2e8f0;background:linear-gradient(180deg,#1f2937,#111827);border:1px solid rgba(148,163,184,.25);
  animation:rgbBorder 6s linear infinite;transition:transform .12s ease,filter .12s ease}
.kbd-rgb .key.bump{border-color:rgba(250,204,21,.7)}
.kbd-rgb .key.next,.kbd-rgb .key.shiftnext{color:#fff;transform:translateY(-2px) scale(1.06);
  background:linear-gradient(90deg,#ff0080,#7928ca,#00d4ff,#22c55e,#facc15,#ff0080);background-size:300% 100%;
  animation:rgbSweep 1.6s linear infinite,rgbBorder 1.6s linear infinite;border-color:#fff;z-index:1}
.kbd-rgb .key.space{box-shadow:none}

@keyframes rgbBorder{
  0%{box-shadow:0 0 6px #ff0080,inset 0 0 6px rgba(255,0,128,.15)}
  25%{box-shadow:0 0 6px #facc15,inset 0 0 6px rgba(250,204,21,.15)}
  50%{box-shadow:0 0 6px #22c55e,inset 0 0 6px rgba(34,197,94,.15)}
  75%{box-shadow:0 0 6px #00d4ff,inset 0 0 6px rgba(0,212,255,.15)}
  100%{box-shadow:0 0 6px #ff0080,inset 0 0 6px rgba(255,0,128,.15)}
}
@keyframes rgbSweep{ from{background-position:0% 50%} to{background-position:300% 50%} }

/* ===== Keyboard: plain theme (no animation) ===== */
.kbd-plain .key{animation:none}

/* ===== Toolbar keyboard toggle state ===== */
#kbdToggle.on{background:#1e3a8a;color:#fff;border-color:#1e3a8a}

/* ===== RGB keyboard — strong colour design (overrides the earlier RGB block) ===== */
@property --h { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

.kbd-rgb{
  --h: 0deg;
  animation: kbdHue 10s linear infinite;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.10), transparent 60%),
    linear-gradient(160deg,#050816,#0d1224);
  border-radius:18px;
  padding:16px 14px;
  box-shadow: 0 0 0 2px hsl(calc(var(--h) + 0deg) 100% 60%), 0 0 28px hsl(calc(var(--h) + 60deg) 100% 50%), 0 12px 36px rgba(0,0,0,.5);
}
.kbd-rgb .key{
  animation:none;
  color:#fff;
  font-weight:700;
  text-shadow:0 0 6px rgba(255,255,255,.6);
  background:linear-gradient(180deg, hsl(calc(var(--h) + var(--o)) 95% 55%), hsl(calc(var(--h) + var(--o)) 90% 30%));
  border:1px solid hsl(calc(var(--h) + var(--o)) 100% 78%);
  box-shadow: 0 0 10px hsl(calc(var(--h) + var(--o)) 100% 55%), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.kbd-rgb .key.bump{ outline:2px solid rgba(255,255,255,.55); outline-offset:-4px; }
.kbd-rgb .key.next,
.kbd-rgb .key.shiftnext{
  background:#ffffff;
  color:#0b1020;
  text-shadow:none;
  border-color:#fff;
  transform:translateY(-3px) scale(1.08);
  box-shadow: 0 0 6px #fff, 0 0 22px #fff, 0 0 40px hsl(calc(var(--h) + var(--o)) 100% 60%);
  z-index:2;
}
.kbd-rgb .key.space{ box-shadow: 0 0 10px hsl(calc(var(--h) + 120deg) 100% 55%), inset 0 1px 0 rgba(255,255,255,.35); }

@keyframes kbdHue{ from{ --h:0deg } to{ --h:360deg } }

.kbdcredit{ text-align:center; margin:10px 0 0; font-size:12.5px; color:#64748b; letter-spacing:.5px; }
.kbdcredit b{ color:#7c3aed; }

/* ===== RGB keyboard — backlit "real keyboard" look (matches reference photo) ===== */
.kbd-rgb{
  background:
    linear-gradient(180deg,#c9ced8 0%,#8d94a3 45%,#5b6270 100%);
  border-radius:20px;
  padding:18px 16px 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.5);
}
/* dark translucent keycap */
.kbd-rgb .key{
  background:linear-gradient(180deg,#2b303b 0%,#171b23 100%);
  color: hsl(calc(var(--h) + var(--o)) 100% 68%);
  font-weight:800;
  font-size:15px;
  text-shadow: 0 0 6px hsl(calc(var(--h) + var(--o)) 100% 60%), 0 0 14px hsl(calc(var(--h) + var(--o)) 100% 55%);
  border:1px solid rgba(255,255,255,.07);
  border-top-color:rgba(255,255,255,.14);
  box-shadow:
    0 6px 0 #0b0d12,                                             /* keycap depth */
    0 0 14px -2px hsla(calc(var(--h) + var(--o)), 100%, 55%, .65), /* colored underglow */
    inset 0 1px 0 rgba(255,255,255,.08);
}
/* lit wide keys (Tab, Shift, Caps...) get the same glow */
.kbd-rgb .key.wide,
.kbd-rgb .key.space{
  color: hsl(calc(var(--h) + var(--o)) 100% 68%);
}
/* the key to press next: brighter cap, strong glow, white legend */
.kbd-rgb .key.next,
.kbd-rgb .key.shiftnext{
  background:linear-gradient(180deg,#3a4150 0%,#222733 100%);
  color:#ffffff;
  text-shadow:0 0 6px #fff, 0 0 16px hsl(calc(var(--h) + var(--o)) 100% 60%);
  border-color:hsla(calc(var(--h) + var(--o)),100%,70%,.9);
  transform:translateY(-2px);
  box-shadow:
    0 6px 0 #0b0d12,
    0 0 6px hsla(calc(var(--h) + var(--o)),100%,65%,.9),
    0 0 26px hsla(calc(var(--h) + var(--o)),100%,60%,.85),
    inset 0 1px 0 rgba(255,255,255,.15);
  z-index:2;
}
.kbd-rgb .key.space{
  box-shadow:0 6px 0 #0b0d12, 0 0 16px -2px hsla(calc(var(--h) + 120deg),100%,55%,.6), inset 0 1px 0 rgba(255,255,255,.08);
}

/* ===== Real keyboard pattern: key sizes come from --u ===== */
.kbd{ --u: clamp(26px, 5.4vw, 44px); }
.kbd .krow{ display:flex; justify-content:center; gap:calc(var(--u) * .12); margin:calc(var(--u) * .12) 0; }
.kbd .key{
  position:relative; flex:none; height:var(--u); min-width:0;
  display:flex; align-items:center; justify-content:center;
  border-radius:calc(var(--u) * .18); font-size:calc(var(--u) * .42);
  padding:0;
}
.kbd .key.fn{ font-size:calc(var(--u) * .3); letter-spacing:.3px; text-transform:uppercase; }
.kbd .key .top{ position:absolute; top:calc(var(--u) * .08); left:calc(var(--u) * .14); font-size:calc(var(--u) * .3); opacity:.85; font-weight:700; }
.kbd .key .bot{ margin-top:calc(var(--u) * .22); }
.kbd .key.space{ height:var(--u); }
.kbd-letters .krow{ margin:calc(var(--u) * .14) 0; }
.kbd .key.bksp{ font-size:calc(var(--u) * .19); letter-spacing:0; }

/* ===== STRONG GLOW (final) — uses per-key --c colour set in app.js ===== */
.kbd.kbd-rgb{
  background:linear-gradient(180deg,#1b2030 0%,#0c0f18 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 0 40px rgba(59,130,246,.35), 0 20px 50px rgba(0,0,0,.6);
}
.kbd.kbd-rgb .key{
  background:linear-gradient(180deg,#262c3a 0%,#141822 100%);
  color:var(--c);
  text-shadow: 0 0 6px var(--c), 0 0 14px var(--c), 0 0 24px var(--c);
  border:1px solid var(--c);
  box-shadow:
    0 6px 0 #05070b,
    0 0 10px 1px var(--c),
    0 0 26px -2px var(--c),
    inset 0 0 12px -4px var(--c);
  animation: keyPulse 3.2s ease-in-out infinite;
}
.kbd.kbd-rgb .key.next,
.kbd.kbd-rgb .key.shiftnext{
  background:linear-gradient(180deg,#ffffff 0%,#dfe6f3 100%);
  color:#0b0f1a;
  text-shadow:none;
  border-color:#ffffff;
  transform:translateY(-3px);
  box-shadow:
    0 6px 0 #05070b,
    0 0 12px #ffffff,
    0 0 34px var(--c),
    0 0 60px var(--c);
  animation:none;
  z-index:2;
}
.kbd.kbd-rgb .key.space{ animation-delay:-1.6s; }
@keyframes keyPulse{
  0%,100%{ filter:brightness(1); }
  50%{ filter:brightness(1.25) saturate(1.2); }
}
