/* TezType — shared styles. Google Fonts only. */
:root{
  --bg:#14161f; --bg2:#1c1f2b; --fg:#e8eaf2; --dim:#5b6079; --muted:#a2a8c0;
  --accent:#2dd4a8; --accent2:#38bdf8; --good:#2dd4a8; --bad:#fb7185;
  --card:#1c1f2b; --border:#2a2e40; --caret:#2dd4a8;
}
[data-theme="light"]{ --bg:#f6f7f9; --bg2:#ffffff; --fg:#1e2230; --dim:#b7bcc9; --muted:#5d6378;
  --accent:#0d9d6c; --accent2:#0284c7; --good:#0d9d6c; --bad:#e11d48;
  --card:#ffffff; --border:#e4e6ec; --caret:#0d9d6c; }
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{background:var(--bg);color:var(--fg);font-family:'Inter',system-ui,sans-serif;min-height:100vh;display:flex;flex-direction:column;transition:background .25s}
::selection{background:var(--accent);color:#fff}
a{color:var(--accent);text-decoration:none}
button{font-family:inherit;cursor:pointer}
/* Noto Nastaliq Urdu via Google Fonts (link in HTML head).
   NOTE: renamed to 'TezNastaliq' to avoid matching broken locally-installed copies. */
@font-face{
  font-family:'TezNastaliq'; font-style:normal; font-weight:400; font-display:swap;
  src:url(https://fonts.gstatic.com/s/notonastaliqurdu/v23/LhWNMUPbN-oZdNFcBy1-DJYsEoTq5pudQ9L940pGPkB3Qt_-PK-V2t_8.woff2) format('woff2');
  unicode-range:U+0600-06FF,U+0750-077F,U+0870-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC;
}
@font-face{
  font-family:'TatweelFix'; font-style:normal; font-weight:400; font-display:swap;
  src:url(https://fonts.gstatic.com/s/notonaskharabic/v44/RrQ5bpV-9Dd1b1OAGA6M9PkyDuVBePeKNaxcsss0Y7bwvc5Urqcyx_M.woff2) format('woff2');
  unicode-range:U+0640,U+0656,U+0610-U+0613; /* tatweel ـ + small diacritics that render invisibly in Nastaliq */
}
/* ـ (U+0640 tatweel) and small diacritics render invisibly in Noto Nastaliq Urdu —
   force them from Noto Naskh Arabic so users can SEE what they typed. Listed first
   so it wins for these codepoints even though Nastaliq has them. */
.ur{font-family:'TezNastaliq','Inter',serif;direction:rtl;line-height:2.3}
/* header */
header.site{border-bottom:1px solid var(--border);background:var(--bg2);position:sticky;top:0;z-index:20}
.hwrap{padding:8px 20px;display:flex;align-items:center;gap:14px;flex-wrap:nowrap;direction:ltr}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;font-size:21px;color:var(--fg)}
.logo .mark{width:34px;height:34px;border-radius:10px;background:linear-gradient(135deg,var(--accent),var(--accent2));display:flex;align-items:center;justify-content:center;color:#fff;font-family:'JetBrains Mono',monospace;font-size:16px;font-weight:700}
nav.main{display:flex;gap:2px;flex-wrap:nowrap;overflow-x:auto;white-space:nowrap;scrollbar-width:none}
nav.main::-webkit-scrollbar{display:none}
nav.main a{color:var(--muted);font-weight:600;font-size:14px;padding:8px 13px;border-radius:8px}
nav.main a:hover{color:var(--fg);background:rgba(127,127,160,.12)}
nav.main a.active{color:var(--accent)}
.hspace{flex:1}
.btn{background:var(--accent);color:#fff;border:0;border-radius:10px;padding:10px 22px;font-weight:700;font-size:14px}
.btn:hover{filter:brightness(1.08)}
.btn.ghost{background:transparent;color:var(--muted);border:1px solid var(--border)}
.btn.ghost:hover{color:var(--fg);border-color:var(--accent)}
.iconbtn{background:transparent;border:1px solid var(--border);color:var(--muted);border-radius:10px;padding:8px;font-size:13px;font-weight:600;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:border-color .15s,color .15s}
.iconbtn:hover{border-color:var(--accent);color:var(--fg)}
.iconbtn svg{width:17px;height:17px;display:block}
html[data-theme="dark"] .ic-sun{display:block}html[data-theme="dark"] .ic-moon{display:none}
html[data-theme="light"] .ic-sun{display:none}html[data-theme="light"] .ic-moon{display:block}
/* compact hero: 1-second clarity */
.hero.compact{padding:26px 16px 18px}
.hero.compact h1{margin:0 0 6px}
.hero.compact p{margin:6px auto}
.chips{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-top:12px}
.chips span{background:var(--bg2);border:1px solid var(--border);border-radius:20px;padding:4px 13px;font-size:12.5px;color:var(--muted)}
.hintline .ex{background:var(--bg2);border:1px solid var(--border);border-radius:16px;padding:3px 12px}
.hintline .ex bdi{font-family:'JetBrains Mono',monospace;font-weight:700;color:var(--fg)}
/* compact centered toolbar (replaces stretched full-width modebars) */
.toolbar{display:flex;justify-content:center;margin:0;background:var(--bg2);border-bottom:1px solid var(--border);padding:8px 20px}
.hamb{display:none}
.mtoolbar{display:none}
#mLayoutLearn{display:none}
.tbar{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:center;width:100%;max-width:1120px;margin:0 auto}
.tgroup{display:flex;gap:2px;align-items:center;flex-wrap:wrap;justify-content:center}
.tsep{width:1px;height:22px;background:var(--border);flex:none}
.tlabel{font-size:12.5px;color:var(--dim);white-space:nowrap}
.customtime{display:flex;align-items:center;gap:6px}
.customtime input{width:64px;background:var(--bg);border:1px solid var(--border);border-radius:8px;color:var(--fg);font-size:13px;padding:6px 8px;font-family:inherit}
.customtime input:focus{outline:none;border-color:var(--accent)}
.customtime input::-webkit-outer-spin-button,.customtime input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.customtime input[type=number]{-moz-appearance:textfield;appearance:textfield}
/* keyboard show/hide + weak keys */
.kbctl{display:flex;justify-content:flex-end;margin:14px 2px 6px}
.wkey{background:var(--bg2);border:1px solid var(--bad);color:var(--fg);border-radius:10px;padding:6px 14px;font-size:22px;line-height:1.4;min-width:44px}
.wkey small{display:block;font-size:11px;color:var(--muted);font-family:'Inter',sans-serif}
#btnPara svg{flex:none}
/* layout */
main{max-width:1120px;width:100%;margin:0 auto;padding:0 20px 60px;flex:1}
.hero{text-align:center;padding:2px 10px 2px}
.hero h1{font-size:clamp(22px,3.6vw,32px);font-weight:800;letter-spacing:-1px;margin-bottom:4px}
.hero h1 .ur{font-size:.85em}
.hero p{color:var(--muted);font-size:16px;max-width:640px;margin:0 auto 6px}
.hero p.ur{font-size:19px}
/* mode bar */
.modebar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;background:var(--bg2);border:1px solid var(--border);border-radius:14px;padding:8px 12px;margin:18px 0 8px;font-size:14px}
.modebar .grp{display:flex;gap:2px;align-items:center}
.mbtn{background:transparent;border:0;color:var(--muted);font-weight:600;font-size:13.5px;padding:7px 12px;border-radius:8px}
.mbtn:hover{color:var(--fg);background:rgba(127,127,160,.12)}
.mbtn.active{color:var(--accent)}
.sep{width:4px;height:4px;border-radius:50%;background:var(--dim);margin:0 8px}
/* test area */
#livebar{display:flex;gap:18px;margin:8px 0 2px;padding-left:16px;font-family:'JetBrains Mono',monospace;font-size:25px;color:var(--accent);font-weight:700;min-height:34px;align-items:center;flex-wrap:wrap}
#livebar .mbtn{font-size:13px}
.mdrop{background:var(--bg);border:1px solid var(--border);color:var(--muted);font-weight:600;font-size:13.5px;padding:7px 10px;border-radius:8px;font-family:'Inter',sans-serif;cursor:pointer}
.mdrop:focus{outline:none;border-color:var(--accent);color:var(--fg)}
#livebar .lbl{font-size:11px;color:var(--dim);font-family:'Inter';font-weight:600;display:block;letter-spacing:1px}
#testwrap{position:relative;margin-top:2px;outline:none;cursor:text;max-width:760px;margin-left:auto;margin-right:auto}
#words{font-family:'JetBrains Mono',monospace;font-size:29px;line-height:50px;color:var(--dim);user-select:none;max-height:152px;overflow:hidden;position:relative}
#words.urdu{font-family:'TezNastaliq',serif;direction:rtl;text-align:right;font-size:27px;line-height:88px;letter-spacing:0;max-height:284px;padding:10px 0}
/* Force Nastaliq on all paragraph children (overlay spans etc.) — inheritance can fail */
#words.urdu .w,#words.urdu .wb,#words.urdu .wo,#words.urdu .we,#words.urdu ch{font-family:'TezNastaliq',serif}
/* Urdu letters must stay inline (not inline-block) or Arabic joining breaks */
/* Urdu overlays: .wb=gray base (full word, perfect shaping), .wo=white/red typed
   overlay (width=typed portion), .we=red wrong overlay (hidden by default). */
.wb{color:var(--dim)}
.wo{position:absolute;top:0;right:0;width:0;overflow:hidden;white-space:nowrap;color:var(--fg)}
.we{position:absolute;top:0;right:0;width:0;overflow:hidden;white-space:nowrap;color:var(--bad);pointer-events:none;opacity:0}
#words.urdu ch{display:inline}
#words .w{display:inline-block;margin-right:.55em;white-space:nowrap}
#words.urdu .w{margin-right:0;margin-left:.55em}
#words ch{display:inline-block;position:relative}
#words ch.ok{color:var(--fg)} #words ch.bad{color:var(--bad)} #words ch.extra{color:var(--bad);opacity:.7}
#caret{position:absolute;width:3px;height:36px;background:var(--caret);border-radius:2px;transition:left .07s ease-out,top .12s ease-out;animation:blink 1.1s infinite;pointer-events:none;z-index:2}
@keyframes blink{0%,45%{opacity:1}50%,95%{opacity:0}}
#testwrap.typing #caret{animation:none}
#hiddenInput{position:absolute;opacity:0;pointer-events:none;top:0;left:0;width:10px}
.hintline{margin:14px 0 0;color:var(--dim);font-size:12px;display:flex;gap:18px;flex-wrap:wrap;justify-content:center;opacity:.7}
.hintline kbd{background:var(--bg2);border:1px solid var(--border);border-bottom-width:2px;border-radius:6px;padding:2px 8px;font-family:'JetBrains Mono',monospace;font-size:12px;color:var(--muted)}
/* results */
#results{display:none;background:var(--bg2);border:1px solid var(--border);border-radius:18px;padding:28px;margin-top:14px}
#results.show{display:block}
.rgrid{display:flex;gap:34px;flex-wrap:wrap;justify-content:center;text-align:center}
.rstat .v{font-family:'JetBrains Mono',monospace;font-size:44px;font-weight:700;color:var(--accent);line-height:1}
.rstat .v small{font-size:16px;color:var(--dim)}
.rstat .l{font-size:11px;color:var(--dim);font-weight:600;letter-spacing:1.5px;margin-top:6px;text-transform:uppercase}
.rstat.hero .v{font-size:72px;color:var(--fg);text-shadow:0 0 24px rgba(45,212,168,.25)}
.rgrid{align-items:flex-end}
#graph{width:100%;height:160px;margin:16px 0 6px;background:var(--bg);border-radius:12px}
.ractions{display:flex;gap:22px;margin-top:16px;flex-wrap:wrap;justify-content:center;align-items:center}
.tlink{color:var(--accent);font-weight:600;font-size:14px;cursor:pointer}
.tlink:hover{text-decoration:underline}
.tlink.dim{color:var(--dim);font-weight:500}
.tlink kbd{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:1px 7px;font-family:'JetBrains Mono',monospace;font-size:11px;color:var(--muted)}
#verdict{justify-content:center}
.fbrand{max-width:300px}
.fbrand p{color:var(--dim);font-size:13px;margin:10px 0 0;line-height:1.6}
.fbrand .logo{font-size:19px}
/* results verdict */
#verdict{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px;font-size:15px}
.rankbadge{background:linear-gradient(135deg,var(--accent),var(--accent2));color:#fff;font-weight:700;font-size:13px;padding:5px 16px;border-radius:20px;white-space:nowrap}
#verdict .dim{color:var(--dim);font-size:13px}
#verdict .pbline{color:var(--accent);font-weight:600;font-size:13px}
/* urdu on-screen keyboard */
#oskb{margin:20px auto 0;max-width:720px;user-select:none;direction:ltr}
.kbrow{display:flex;gap:6px;justify-content:center;margin-bottom:6px}
.key{min-width:40px;height:52px;border-radius:8px;background:var(--bg2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-family:'TatweelFix','TezNastaliq',serif;font-size:19px;color:var(--muted);transition:all .1s;flex:1;max-width:62px;padding-top:8px}
.key.next{background:var(--accent);color:#fff;border-color:var(--accent);transform:scale(1.1)}
.key:active{transform:scale(.94)}
.key.on{background:var(--accent);color:#fff;border-color:var(--accent)} /* shift active: clearly visible */
.key.nomap{opacity:.32} /* shift has no mapping for this key — pressing it does nothing */
.kbrow .key.fn{font-family:'Inter';font-size:12px;font-weight:700;max-width:92px;padding-top:0}
.key.wide{flex:3;max-width:260px} /* space bar + shift: visibly wider than letter keys */
#freeBox{width:100%;min-height:220px;max-width:760px;margin:0 auto;display:block;font-family:'TatweelFix','TezNastaliq',serif;font-size:26px;line-height:80px;background:var(--bg2);border:1px solid var(--border);border-radius:12px;color:var(--fg);padding:18px;resize:vertical}
#freeBox::placeholder{color:var(--muted);opacity:.6}
/* cards / content */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;margin:26px 0}
.card{background:var(--bg2);border:1px solid var(--border);border-radius:16px;padding:22px}
.card h3{font-size:17px;margin-bottom:8px}
.card p{color:var(--muted);font-size:14px;line-height:1.65}
.card p.ur{font-size:16px}
.prose{max-width:780px;margin:0 auto}
.prose h2{font-size:24px;margin:30px 0 12px}
.prose p,.prose li{color:var(--muted);line-height:1.85;font-size:15.5px;margin-bottom:12px}
.prose p.ur,.prose li.ur{font-size:18px;color:var(--fg)}
.prose ul{padding-left:22px;margin-bottom:14px}
.prose .faq{background:var(--bg2);border:1px solid var(--border);border-radius:12px;padding:16px 18px;margin-bottom:12px}
.prose .faq b{color:var(--fg);display:block;margin-bottom:6px}
/* footer */
footer.site{border-top:1px solid var(--border);background:var(--bg2)}
.fwrap{padding:30px 20px;display:flex;gap:26px;flex-wrap:wrap;color:var(--dim);font-size:13.5px;direction:ltr}
#graph{display:none}
.fwrap .fcol{min-width:150px}
.fwrap b{color:var(--fg);display:block;margin-bottom:10px;font-size:13px}
.fwrap a{display:block;color:var(--dim);margin-bottom:7px}
.fwrap a:hover{color:var(--accent)}
.fbottom{max-width:1120px;margin:0 auto;padding:0 20px 24px;color:var(--dim);font-size:12px}
/* forms */
.field{margin-bottom:14px}
.field label{display:block;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:6px}
.field input,.field textarea{width:100%;background:var(--bg);border:1px solid var(--border);border-radius:10px;padding:12px 14px;color:var(--fg);font-size:15px;outline:none;font-family:inherit}
.field input:focus,.field textarea:focus{border-color:var(--accent)}
.note{background:var(--bg2);border:1px dashed var(--border);border-radius:12px;padding:16px;color:var(--muted);font-size:14px;margin:18px 0}
@media(max-width:700px){
  #words{font-size:21px;line-height:40px}
  #words.urdu{font-size:21px;line-height:76px;max-height:248px}
  .key{height:44px;font-size:15px;min-width:0}
  .rstat .v{font-size:32px}.rstat.hero .v{font-size:44px}
  nav.main a{padding:7px 9px;font-size:13px}
  /* mobile: hamburger nav + compact 3-dropdown toolbar */
  main{padding:8px 12px 40px}
  .hwrap{padding:8px 12px;gap:8px;flex-wrap:nowrap;position:relative}
  .logo{font-size:18px}
  .logo .mark{width:30px;height:30px;font-size:14px;border-radius:8px}
  /* hamburger: 3 lines, toggles a dropdown nav */
  .hamb{display:flex;flex-direction:column;justify-content:center;gap:5px;background:none;border:0;padding:8px;cursor:pointer}
  .hamb span{display:block;width:20px;height:2px;border-radius:2px;background:var(--fg);transition:transform .2s,opacity .2s}
  .hamb.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
  .hamb.open span:nth-child(2){opacity:0}
  .hamb.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
  nav.main{display:none}
  nav.main.open{display:flex;position:absolute;top:calc(100% + 6px);left:8px;right:8px;flex-direction:column;gap:2px;background:var(--bg2);border:1px solid var(--border);border-radius:14px;padding:8px;z-index:50;box-shadow:0 12px 32px rgba(0,0,0,.35)}
  nav.main.open a{padding:10px 12px;font-size:15px;border-radius:10px}
  nav.main.open a.active{background:var(--accent);color:#fff}
  /* desktop toolbar hidden on mobile; compact 3-dropdown bar instead */
  .toolbar{display:none}
  .mtoolbar{display:flex;gap:8px;align-items:center;margin:0;background:var(--bg2);border-bottom:1px solid var(--border);padding:8px 12px}
  .mtoolbar .mdrop{flex:1;min-width:0;background:var(--bg2);border:1px solid var(--border);border-radius:12px;color:var(--fg);font-size:13.5px;font-weight:600;padding:10px 8px;font-family:inherit}
  /* learn page: dropdown instead of 3 layout buttons */
  #layGrpLearn{display:none}
  #mLayoutLearn{display:block;max-width:260px;margin:0 auto}
  .layrow{flex-wrap:wrap}
  #livebar{font-size:19px;gap:10px;padding-left:12px;min-height:30px}
  #livebar .mbtn{font-size:12px;padding:6px 10px}
  #livebar .lbl{font-size:10px}
  .kbrow{gap:4px;margin-bottom:4px}
  /* mobile: no on-screen keyboard at all — users type with their native
     keyboard app. The keyboard (and its toggle) shows on desktop/tablet only. */
  #oskb{display:none !important}
  .kbctl{display:none !important}
  .hintline .dsk{display:none}
}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Left sidebar ad (desktop only, below timer) */
#adSidebarLeft{
  display:none;
  position:fixed;
  left:12px;
  top:180px;
  width:160px;
  min-height:600px;
  text-align:center;
  z-index:50;
}
@media(min-width:1280px){
  #adSidebarLeft{ display:block; }
}
