/* Typing Ki Dunia - light & dark theme */
:root{color-scheme:light;
--bg:#f5f7fb;--surface:#fff;--surface2:#f0f3f9;--ink:#0f172a;--mut:#5a6578;--line:#e1e7ef;
--btn:#2563eb;--btn-h:#1d4ed8;--link:#1d4ed8;--soft:#e8effd;--ring:#93b4f8;
--ok:#15803d;--bad:#dc2626;--badbg:rgba(220,38,38,.12);--word:#e1ebfd;--gold:#fbbf24;--goldink:#1f2937;
--shadow:0 10px 30px rgba(15,23,42,.08);--hero1:#e6eefd;--hero2:#f5f7fb;--heroink:#0f172a;--herop:#4b5a70;
--arena1:#0f2147;--arena2:#1e40af}
[data-theme=dark]{color-scheme:dark;
--bg:#0b1120;--surface:#111a2e;--surface2:#16213a;--ink:#e8edf6;--mut:#9aa7bd;--line:#223050;
--btn:#2563eb;--btn-h:#3b82f6;--link:#7db0ff;--soft:#172a52;--ring:#2f5bb0;
--ok:#4ade80;--bad:#f87171;--badbg:rgba(248,113,113,.16);--word:#1c2c52;
--shadow:0 10px 30px rgba(0,0,0,.45);--hero1:#10192f;--hero2:#0b1120;--heroink:#f1f5fb;--herop:#9aa7bd;
--arena1:#0a1226;--arena2:#18306b}
*{box-sizing:border-box}
body{margin:0;font:16px/1.65 "Plus Jakarta Sans",system-ui,sans-serif;color:var(--ink);background:var(--bg);transition:background .2s,color .2s}
a{color:var(--link)}.wrap{max-width:1040px;margin:0 auto;padding:0 20px}
.top,.card,footer,.seg,.stats div,textarea,input,.ghost,.res{transition:background .2s,border-color .2s,color .2s}

/* header */
.top{background:var(--surface);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
.top .wrap{max-width:1160px}.bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding-top:10px;padding-bottom:10px}
.logo{font-weight:800;font-size:1.15rem;color:var(--ink);text-decoration:none;display:inline-flex;align-items:center;flex:none}
.logo::before{content:"T";display:inline-grid;place-items:center;width:30px;height:30px;border-radius:9px;background:var(--btn);color:#fff;margin-right:9px;font-size:1rem}
nav{display:flex;gap:2px;flex-wrap:nowrap;flex:1;min-width:0}
nav a{white-space:nowrap;padding:6px 10px;border-radius:8px;text-decoration:none;color:var(--mut);font-weight:500;font-size:.95rem}
nav a:hover,nav a[aria-current]{background:var(--soft);color:var(--link)}
.tools{display:flex;align-items:center;gap:8px;flex:none}
.iconbtn{width:38px;height:38px;display:inline-grid;place-items:center;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:10px;cursor:pointer;padding:0}
.iconbtn:hover{background:var(--soft)}.iconbtn svg{width:18px;height:18px}
.ico-sun{display:none}[data-theme=dark] .ico-sun{display:block}[data-theme=dark] .ico-moon{display:none}
.sm{padding:7px 14px!important;font-size:.92rem}
.me{display:inline-flex;align-items:center;gap:8px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:999px;padding:3px 12px 3px 3px;font:inherit;font-weight:600;font-size:.92rem;cursor:pointer;max-width:170px}
.me:hover{background:var(--soft)}.me i{font-style:normal;width:30px;height:30px;border-radius:50%;background:var(--btn);color:#fff;display:grid;place-items:center;font-weight:700;flex:none}
.me span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* hero */
.hero{background:linear-gradient(180deg,var(--hero1),var(--hero2));color:var(--heroink);padding:56px 0 100px}
.hero h1{font-size:clamp(2rem,5vw,3rem);line-height:1.2;margin:0 0 12px;font-weight:800;letter-spacing:-.02em}
.hero p{max-width:520px;color:var(--herop);margin:0}
.hero-cta{display:flex;gap:10px;flex-wrap:wrap;margin-top:22px}

/* cards, controls */
.card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:22px}
.test{margin-top:-64px;box-shadow:var(--shadow)}
.ctl{display:flex;gap:12px;flex-wrap:wrap;align-items:center;justify-content:space-between}
.seg{display:flex;background:var(--surface2);border-radius:10px;padding:3px}
.seg button{border:0;background:none;padding:7px 16px;border-radius:8px;font:inherit;font-weight:500;color:var(--mut);cursor:pointer}
.seg .on{background:var(--surface);color:var(--link);box-shadow:0 1px 3px rgba(0,0,0,.15);font-weight:700}
.ghost,.btn{font:inherit;font-weight:700;border-radius:10px;cursor:pointer;text-decoration:none;display:inline-block;text-align:center}
.ghost{background:var(--surface);border:1px solid var(--line);padding:7px 14px;color:var(--ink)}.ghost:hover{background:var(--soft)}
.btn{background:var(--btn);color:#fff;border:0;padding:10px 20px}.btn:hover{background:var(--btn-h)}
.full{width:100%}
.stats{display:flex;gap:12px;margin:18px 0}
.stats div{flex:1;background:var(--surface2);border-radius:10px;padding:10px;text-align:center}
.stats b{display:block;font-size:1.8rem;line-height:1.2}.stats small{color:var(--mut)}

/* typing text */
.text{font-size:1.25rem;line-height:1.9;padding:16px;border:1px solid var(--line);border-radius:10px;min-height:120px;margin-bottom:12px;user-select:none;background:var(--surface)}
.text.ur{direction:rtl;font-family:"Noto Nastaliq Urdu",serif;font-size:1.45rem;line-height:2.4}
.text span{border-radius:4px}
.text .w{background:var(--word)}
.text .ok{color:var(--ok)}
.text .bad{color:var(--bad);background:var(--badbg)}
.text .cur{background:var(--gold);color:var(--goldink)}
textarea,input:not([type=checkbox]){width:100%;font:inherit;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
textarea::placeholder,input::placeholder{color:var(--mut)}
textarea:focus,input:focus,button:focus-visible,a:focus-visible{outline:3px solid var(--ring);outline-offset:1px}
textarea.ur{direction:rtl;font-family:"Noto Nastaliq Urdu",serif}
.res{margin-top:14px;padding:14px;border-radius:10px;background:var(--soft);font-weight:700}
.res:empty{display:none}
.res .lnk{background:none;border:0;padding:0;font:inherit;font-weight:700;color:var(--link);text-decoration:underline;cursor:pointer}
.ad{margin:24px 0;min-height:90px;border:1px dashed var(--line);border-radius:10px;display:flex;align-items:center;justify-content:center;color:var(--mut)}

/* content */
.sec{margin:40px 0 16px}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:16px}
.pcard{text-decoration:none;color:var(--ink);display:block}.pcard:hover{border-color:var(--btn)}
.pcard h3{margin:0 0 6px}.pcard p{color:var(--mut);margin:0 0 8px;font-size:.95rem}.pcard span{color:var(--link);font-weight:700}
.pg{padding-top:40px;padding-bottom:20px}.pg h1{font-size:2rem;margin:0 0 8px;letter-spacing:-.01em}
.lead{color:var(--mut);margin-bottom:24px}.narrow{max-width:700px}
.post{margin-bottom:20px}.post h2{margin-top:0}.post h3{margin-bottom:4px}.tips li{margin:8px 0 8px 18px}
form label{display:block;font-weight:700;margin-bottom:14px}form input,form textarea{margin-top:6px;font-weight:400}
.pr{font:500 1.05rem ui-monospace,Menlo,Consolas,monospace;background:var(--surface2);padding:8px 12px;border-radius:8px;margin:8px 0 0;word-break:break-word}
.pr.ur{direction:rtl;font-family:"Noto Nastaliq Urdu",serif;font-size:1.2rem;line-height:2.2}
footer{margin-top:48px;background:var(--surface);border-top:1px solid var(--line);padding:20px 0;color:var(--mut);font-size:.9rem}
footer .wrap{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}

/* game */
.arena{position:relative;height:340px;overflow:hidden;background:linear-gradient(var(--arena1),var(--arena2));border-radius:12px;margin:14px 0}
.fw{position:absolute;top:0;color:#fff;background:rgba(255,255,255,.16);padding:2px 12px;border-radius:999px;font-weight:700}
.fw.ur{font-family:"Noto Nastaliq Urdu",serif}.fw.m{background:var(--gold);color:var(--goldink)}

/* login / signup dialog */
dialog.modal{border:1px solid var(--line);border-radius:16px;padding:22px;background:var(--surface);color:var(--ink);width:min(420px,calc(100% - 32px));box-shadow:0 24px 60px rgba(0,0,0,.35)}
dialog.modal::backdrop{background:rgba(8,15,32,.6);backdrop-filter:blur(2px)}
.mh{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.mh h2{margin:0;font-size:1.25rem}
.x{border:0;background:none;color:var(--mut);font-size:1.6rem;line-height:1;cursor:pointer;padding:4px 8px;border-radius:8px}.x:hover{background:var(--soft)}
.tabs{display:flex;background:var(--surface2);border-radius:10px;padding:3px;margin-bottom:16px}
.tabs button{flex:1;border:0;background:none;padding:8px;border-radius:8px;font:inherit;font-weight:600;color:var(--mut);cursor:pointer}
.tabs .on{background:var(--surface);color:var(--link);box-shadow:0 1px 3px rgba(0,0,0,.15)}
.f{display:block;font-weight:600;margin-bottom:12px;font-size:.95rem}
.chk{display:flex!important;align-items:center;gap:8px;font-weight:500!important;color:var(--mut);margin-bottom:10px!important;font-size:.9rem}
.err{color:var(--bad);font-size:.9rem;margin:0 0 10px;min-height:1.3em}
.note{color:var(--mut);font-size:.85rem;margin:14px 0 0}
.who{display:flex;align-items:center;gap:12px;margin-bottom:16px}.who i{font-style:normal;width:46px;height:46px;border-radius:50%;background:var(--btn);color:#fff;display:grid;place-items:center;font-weight:800;font-size:1.2rem;flex:none}
.who b{display:block}.who small{color:var(--mut);word-break:break-all}
.tiles{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}
.tiles div{background:var(--surface2);border-radius:10px;padding:10px;text-align:center}.tiles b{display:block;font-size:1.5rem;line-height:1.3}.tiles small{color:var(--mut)}
.hist{list-style:none;margin:6px 0 16px;padding:0;font-size:.92rem}.hist li{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px solid var(--line)}.hist span{color:var(--mut)}
.row{display:flex;gap:10px;flex-wrap:wrap}.danger{color:var(--bad)!important}

@media(max-width:1000px){nav{order:3;flex:1 0 100%;overflow-x:auto;padding-bottom:2px}.tools{margin-left:auto}}
@media(max-width:560px){.stats b{font-size:1.4rem}.me span{display:none}.me{padding:3px}.hero{padding:40px 0 90px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
