:root{
  --bg:#0b1020; --ink:#eef2ff; --muted:#a9b2d4;
  --good:#28d17c; --bad:#ff4d6d; --accent:#6ea8fe;
  --card: rgba(18,26,51,.75); --border: rgba(255,255,255,.10);
  --radius: 18px; --shadow: 0 12px 40px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
@font-face{
  font-family: "Faruma";
  src:
    url("./fonts/Faruma.woff") format("woff"),
    url("./fonts/Faruma.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
body{
  margin:0; min-height:100vh; display:flex; justify-content:center; align-items:center;
  padding:24px; background: radial-gradient(1200px 600px at 20% 0%, #18245b 0%, var(--bg) 60%);
  color:var(--ink); font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.thaana{
  font-family: "Faruma", sans-serif;
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: right;
}
.app{ width:min(1020px,100%); }

.topbar{
  display:flex; justify-content:space-between; align-items:flex-end; gap:16px;
  padding:18px; border:1px solid var(--border); border-radius: var(--radius);
  background: rgba(255,255,255,.04); box-shadow: var(--shadow);
}

.brand h1{ margin:0; font-size:20px; font-weight:900; }
.sub{ margin:6px 0 0; color:var(--muted); font-size:13px; }

.controls{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.control{ display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px; }

select, .btn{
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color:var(--ink);
  padding:10px 12px;
  border-radius:12px;
  font-weight:900;
}

.btn{ cursor:pointer; }
.btn:hover, select:hover{ border-color: rgba(255,255,255,.28); }

.grid{
  margin-top:14px;
  display:grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap:14px;
}

@media (max-width: 880px){
  .grid{ grid-template-columns:1fr; }
}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}

.prompt{
  font-size: 30px;
  line-height: 2.0;
  padding:14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  min-height: 120px;
  direction: rtl;
  unicode-bidi: plaintext;
  unicode-bidi: isolate;
}

.typebox{
  margin-top:12px;
  width:100%;
  font-size:26px;
  line-height:1.8;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.18);
  color: var(--ink);
  outline:none;
}

.typebox:focus{
  border-color: rgba(110,168,254,.7);
  box-shadow: 0 0 0 4px rgba(110,168,254,.15);
}

.hint{ margin:10px 0 0; color:var(--muted); font-size:13px; }

.stats .stat{
  display:flex; justify-content:space-between;
  padding:10px 0; border-bottom:1px solid rgba(255,255,255,.08);
}
.stats .stat:last-child{ border-bottom:none; }
.k{ color:var(--muted); font-size:15px; }
.v{ font-size:22px; font-weight:900; }
.mini{ margin:12px 0 0; color:var(--muted); font-size:13px; line-height:1.7; }

/* Per-character coloring (same idea as your shared app.js) [1](https://onedrive.live.com?cid=D0741747760F901D&id=D0741747760F901D!s693e01e5a9d346239ad34319000fe0c7) */
.good { color: var(--good); }
.bad  { color: var(--bad); text-decoration: underline; }
.next { outline: 2px solid rgba(110,168,254,.7); outline-offset: 3px; border-radius: 6px; }
.prompt { white-space: pre-wrap; } /* don't collapse spaces */
.prompt span { display: inline;/*unicode-bidi: isolate; */ direction: rtl; }
/* Animated pulse for the "next character" */
@keyframes nextPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(110,168,254,.55);
    background-color: rgba(110,168,254,.10);
  }
  60% {
    box-shadow: 0 0 0 6px rgba(110,168,254,0);
    background-color: rgba(110,168,254,.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(110,168,254,0);
    background-color: rgba(110,168,254,.10);
  }
}

/* Default untyped characters */
.prompt span {
  color: var(--ink);
  unicode-bidi: isolate;
  direction: rtl;
}

/* Correctly typed */
.prompt .good {
  color: #28d17c;
}

/* Incorrectly typed */
.prompt .bad {
  color: #ff4d6d;
  text-decoration: underline;
}

/* Current expected character (static highlight) */
.prompt .current {
  color: #fffb07;        /* accent */
}
.celebration {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 25, .85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.celebration.hidden {
  display: none;
}

.celebration-card {
  background: rgba(18,26,51,.95);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 18px;
  padding: 28px 24px;
  width: min(420px, 90%);
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.celebration-card h2 {
  margin: 0 0 10px;
  font-size: 26px;
}

.celebration-stats {
  display: flex;
  justify-content: space-around;
  margin: 18px 0;
}

.celebration-stats span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.celebration-stats b {
  font-size: 26px;
}