/* Wordmap — deep-space glass. One committed dark look.
   Layout: full-height app; map fills the middle; glass panels float over a live starfield. */
:root {
  --bg: #05060D;
  --ink: #F4F6FF;
  --muted: #B8BEDA;
  --soft: #D3D7EE;
  --dim: #8F95B2;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-2: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.14);
  --line-2: rgba(255, 255, 255, 0.08);
  --b: 79, 245, 230;     /* Basic: cyan */
  --i: 255, 195, 77;     /* Intermediate: gold */
  --a: 240, 98, 216;     /* Advanced: magenta */
  --j: 111, 168, 255;    /* Jargon: sky blue */
  --gold: #FFC34D;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'Noto Naskh Arabic', 'Geeza Pro', 'Arabic Typesetting', 'Segoe UI', serif;
  --font-ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', 'Noto Naskh Arabic', 'Segoe UI', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Space background ---------- */
#space { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
#stars, #fx { position: absolute; inset: 0; width: 100%; height: 100%; }
.neb { position: absolute; border-radius: 50%; filter: blur(30px); animation: nebula 36s ease-in-out infinite alternate; }
.neb-1 { left: -30vw; top: 5vh; width: 110vw; height: 50vh; max-width: 900px; background: radial-gradient(closest-side, rgba(124,58,237,0.55), rgba(124,58,237,0)); }
.neb-2 { left: 40vw; top: 28vh; width: 85vw; height: 40vh; max-width: 760px; background: radial-gradient(closest-side, rgba(219,39,160,0.36), rgba(219,39,160,0)); animation-delay: -12s; }
.neb-3 { left: 25vw; top: 62vh; width: 100vw; height: 42vh; max-width: 820px; background: radial-gradient(closest-side, rgba(20,184,166,0.38), rgba(20,184,166,0)); animation-delay: -20s; }
.neb-4 { left: -30vw; top: 72vh; width: 90vw; height: 38vh; max-width: 760px; background: radial-gradient(closest-side, rgba(37,99,235,0.42), rgba(37,99,235,0)); animation-delay: -6s; }
@keyframes nebula { to { transform: translate(28px, -22px) scale(1.18); } }

/* Black hole: drifts across the sky on a slow loop */
#bh { position: absolute; left: 0; top: 0; width: 0; height: 0; animation: bhpath 90s linear infinite; animation-delay: -28s; }
#bh > * { position: absolute; }
@keyframes bhpath {
  0% { transform: translate(-40vw, 22vh) scale(0.5) rotate(0deg); }
  25% { transform: translate(15vw, 32vh) scale(0.66) rotate(-3deg); }
  50% { transform: translate(62vw, 46vh) scale(0.84) rotate(2deg); }
  80% { transform: translate(115vw, 64vh) scale(1.06) rotate(-2deg); }
  88%, 100% { transform: translate(150vw, 72vh) scale(1.15) rotate(0deg); }
}
.bh-halo { left: -230px; top: -230px; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgba(255,170,80,0.30) 0%, rgba(255,120,60,0.10) 35%, rgba(124,58,237,0) 65%); animation: pulse 5s ease-in-out infinite; }
.bh-lens { left: -150px; top: -150px; width: 300px; height: 300px; border-radius: 50%; -webkit-backdrop-filter: blur(1.5px) brightness(1.5) saturate(1.4); backdrop-filter: blur(1.5px) brightness(1.5) saturate(1.4); -webkit-mask: radial-gradient(circle, transparent 46%, #000 52%, transparent 72%); mask: radial-gradient(circle, transparent 46%, #000 52%, transparent 72%); }
.bh-disk { left: -210px; top: -210px; width: 420px; height: 420px; transform: rotate(-8deg) scaleY(0.13); }
.bh-disk > div { position: absolute; inset: 0; border-radius: 50%; }
.bh-disk-front { clip-path: inset(50% 0 0 0); }
.d-base { background: radial-gradient(circle, rgba(255,240,210,0) 33%, rgba(255,246,225,1) 35%, rgba(255,200,120,0.95) 44%, rgba(235,120,45,0.6) 56%, rgba(160,50,20,0) 70%); filter: blur(1px); }
.d-doppler { background: linear-gradient(90deg, rgba(255,252,240,0.75) 0%, rgba(255,252,240,0) 48%, rgba(5,6,13,0) 52%, rgba(5,6,13,0.6) 100%); -webkit-mask: radial-gradient(circle, transparent 33%, #000 35%, #000 62%, transparent 70%); mask: radial-gradient(circle, transparent 33%, #000 35%, #000 62%, transparent 70%); }
.d-streaks { background: repeating-conic-gradient(rgba(255,255,255,0.22) 0deg 2deg, rgba(255,255,255,0) 2deg 9deg); -webkit-mask: radial-gradient(circle, transparent 34%, #000 37%, #000 60%, transparent 68%); mask: radial-gradient(circle, transparent 34%, #000 37%, #000 60%, transparent 68%); animation: spin 9s linear infinite; }
.bh-arc-top { left: -100px; top: -100px; width: 200px; height: 200px; transform: rotate(-8deg); clip-path: inset(0 0 50% 0); }
.bh-arc-top > div { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(from 270deg, rgba(255,250,232,1), rgba(255,205,130,0.95) 25%, rgba(225,105,40,0.55) 50%, rgba(255,250,232,1) 100%); -webkit-mask: radial-gradient(circle, transparent 70%, #000 73%, #000 84%, transparent 98%); mask: radial-gradient(circle, transparent 70%, #000 73%, #000 84%, transparent 98%); filter: blur(1.4px); }
.bh-arc-bottom { left: -84px; top: -84px; width: 168px; height: 168px; transform: rotate(-8deg); clip-path: inset(52% 0 0 0); }
.bh-arc-bottom > div { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(from 90deg, rgba(225,105,40,0.5), rgba(255,205,130,0.75) 25%, rgba(255,250,232,0.9) 50%, rgba(225,105,40,0.5) 100%); -webkit-mask: radial-gradient(circle, transparent 84%, #000 87%, #000 93%, transparent 100%); mask: radial-gradient(circle, transparent 84%, #000 87%, #000 93%, transparent 100%); filter: blur(1px); }
.bh-photon { left: -73px; top: -73px; width: 146px; height: 146px; border-radius: 50%; border: 1.5px solid rgba(255,238,205,0.95); box-shadow: 0 0 10px rgba(255,205,140,0.8), 0 0 30px rgba(255,150,70,0.35); }
.bh-shadow { left: -71px; top: -71px; width: 142px; height: 142px; border-radius: 50%; background: #000; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

#ufo { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.ufo-bob { animation: bob 1.8s ease-in-out infinite; }
.ufo-light { animation: blink 0.9s steps(2) infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes blink { to { opacity: 0.2; } }

/* ---------- App shell ---------- */
#app {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; gap: 12px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: -0.01em; text-shadow: 0 0 18px rgba(var(--i), 0.45); }
.top-right { display: flex; align-items: center; gap: 10px; }
.learned-pill { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 24px; }
.col { width: 100%; max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-b { background: rgb(var(--b)); box-shadow: 0 0 6px rgb(var(--b)); }
.dot-i, .dot-int { background: rgb(var(--i)); box-shadow: 0 0 6px rgb(var(--i)); }
.dot-a { background: rgb(var(--a)); box-shadow: 0 0 6px rgb(var(--a)); }
.dot-j { background: rgb(var(--j)); box-shadow: 0 0 6px rgb(var(--j)); }

.icon-btn, .glass-btn {
  min-width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--ink);
}
.glass-btn { padding: 0 14px; font-size: 14px; }
.icon-btn:hover, .glass-btn:hover { border-color: rgba(255,255,255,0.3); }

.chip {
  height: 34px; padding: 0 11px; border-radius: 17px;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--glass-2);
  font-size: 12.5px; white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; }
.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }

/* ---------- Map view ---------- */
.map-tools { padding: 4px 16px 6px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 620px; margin: 0 auto; }
.search { position: relative; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--muted);
}
.search-box input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--ink); font: inherit; font-size: 16px; }
.search-box input::placeholder { color: var(--dim); }
.search-box input::-webkit-search-cancel-button { filter: invert(1); }
.results {
  position: absolute; left: 0; right: 0; top: 50px; z-index: 20; margin: 0; padding: 6px; list-style: none;
  background: rgba(16, 18, 34, 0.94); border: 1px solid var(--line); border-radius: 12px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  max-height: 50vh; overflow-y: auto;
}
.results button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; min-height: 44px; }
.results button:hover, .results button.is-active { background: rgba(255,255,255,0.08); }
.results .r-word { font-weight: 600; }
.results .r-def { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results .empty { padding: 10px; color: var(--muted); font-size: 14px; }

#map { position: relative; flex: 1; min-height: 260px; overflow: hidden; touch-action: none; cursor: grab; }
#map.is-dragging { cursor: grabbing; }
#links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#nodes { position: absolute; inset: 0; }
#nodes.flyout { animation: flyout 0.45s ease-in forwards; }
@keyframes flyout { to { transform: scale(2.6); opacity: 0; filter: blur(4px); } }
.orbit { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; }
.orbit-1 { width: 76vmin; height: 76vmin; max-width: 560px; max-height: 560px; transform: translate(-50%, -50%); border: 1px solid rgba(160,170,255,0.14); animation: spinc 120s linear infinite; }
.orbit-2 { width: 56vmin; height: 92vmin; max-width: 420px; max-height: 680px; transform: translate(-50%, -50%); border: 1px dashed rgba(160,170,255,0.11); animation: spinc 160s linear infinite reverse; }
@keyframes spinc { to { transform: translate(-50%, -50%) rotate(360deg); } }

.node {
  --c: var(--b);
  position: absolute; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 4px; white-space: nowrap;
  font-size: 15px; font-weight: 500; color: #F7F8FF;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(var(--c), 0.8);
  box-shadow: 0 0 14px rgba(var(--c), 0.45), inset 0 0 12px rgba(var(--c), 0.12);
  text-shadow: 0 0 8px rgba(var(--c), 0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  will-change: transform, opacity;
  transform-origin: 0 0;
}
.node .dot { background: rgb(var(--c)); box-shadow: 0 0 8px rgb(var(--c)); }
.node.far { font-size: 12px; padding: 5px 10px; font-weight: 400; }
.node.far .dot { width: 6px; height: 6px; }
.node.is-learned::after { content: ''; width: 12px; height: 12px; margin-left: -1px; background: no-repeat center/12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E"); opacity: 0.8; }
.node.center {
  flex-direction: column; gap: 4px; padding: 16px 24px;
  background: rgba(12, 8, 24, 0.55);
  border-color: rgba(var(--c), 0.95);
  box-shadow: 0 0 22px rgba(var(--c), 0.7), 0 0 70px rgba(255,150,60,0.30), inset 0 0 18px rgba(var(--c), 0.22);
}
.node.center .c-word { font-family: var(--font-display); font-size: 27px; font-weight: 700; color: #fff; text-shadow: 0 0 14px rgba(var(--c), 0.8); }
.node.center .c-level { font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; color: rgb(var(--c)); text-shadow: 0 0 8px rgba(var(--c), 0.6); }
.pop { animation: pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes pop { from { opacity: 0; scale: 0.2; } to { opacity: 1; scale: 1; } }

.back-btn { position: absolute; left: 12px; top: 8px; z-index: 5; }
.map-ctrl { position: absolute; right: 12px; top: 8px; display: flex; gap: 8px; z-index: 5; }
.legend { position: absolute; left: 16px; right: 16px; bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--muted); pointer-events: none; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.ln { width: 18px; border-top: 2px solid #C9CEEA; display: inline-block; }
.ln-o { border-top-style: dashed; }
.ln-f { border-top-style: dotted; }
.ln-r { border-top: 2px solid rgb(var(--j)); }

.map-foot { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 620px; margin: 0 auto; }
.hint { font-size: 12px; color: var(--muted); text-align: center; }
.peek {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 16px; text-align: left;
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--ink);
}
.peek-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.peek-head { display: flex; align-items: baseline; gap: 8px; }
.peek-word { font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.peek-pos { font-size: 13px; color: var(--muted); }
.peek-def { font-size: 14px; color: var(--soft); }
.peek svg { color: var(--muted); flex: none; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; justify-content: space-around; padding: 4px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line-2); background: rgba(5, 6, 13, 0.6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 72px; padding: 6px 0; font-size: 11px; color: var(--muted); text-decoration: none; }
.tab[aria-current="page"] { color: var(--gold); }

/* ---------- Shared pieces ---------- */
.glass { background: var(--glass-2); border: 1px solid var(--line); border-radius: 6px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.pad { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.label { font-size: 12px; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.label-b { color: rgb(var(--b)); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px; border: 1px solid rgba(var(--c, var(--i)), 0.7); color: rgb(var(--c, var(--i))); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; }
.tag-plain { border-color: rgba(255,255,255,0.2); color: var(--soft); letter-spacing: 0; font-weight: 400; font-size: 12px; }
.example { font-size: 15px; line-height: 1.5; color: var(--soft); font-style: italic; }
.example b { color: #fff; font-style: italic; text-shadow: 0 0 8px rgba(var(--c, var(--i)), 0.7); }
.round-btn { width: 44px; height: 44px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 1px solid rgba(var(--c, var(--i)), 0.6); background: var(--glass); color: #fff; }
.round-btn.filled { background: rgb(var(--c, var(--i))); border: 0; color: #120a06; box-shadow: 0 0 16px rgba(var(--c, var(--i)), 0.6); }
.primary-btn { height: 48px; padding: 0 18px; border-radius: 24px; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: rgb(var(--c, var(--i))); color: #120a06; font-weight: 600; box-shadow: 0 0 18px rgba(var(--c, var(--i)), 0.55); }
.ghost-btn { height: 48px; padding: 0 18px; border-radius: 24px; border: 1px solid rgba(255,255,255,0.2); background: var(--glass); color: var(--ink); font-weight: 500; }
.page-title { font-family: var(--font-display); font-size: 30px; font-weight: 700; text-shadow: 0 0 18px rgba(var(--i), 0.45); }
.block { display: flex; flex-direction: column; gap: 10px; }
.block-title { font-size: 18px; font-weight: 600; }
.block-title.sm { font-size: 16px; }
.note { font-size: 12px; color: var(--dim); }

/* ---------- Today ---------- */
.today-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 6px; }
.date { font-size: 13px; color: var(--muted); }
.streak { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 16px; background: var(--glass); border: 1px solid rgba(var(--i), 0.5); box-shadow: 0 0 12px rgba(var(--i), 0.3); font-size: 13px; color: var(--ink); white-space: nowrap; }
.streak svg { color: var(--gold); }
.wotd {
  --c: var(--a);
  position: relative; overflow: hidden; padding: 20px; border-radius: 6px;
  background: rgba(20, 10, 36, 0.55); border: 1px solid rgba(var(--c), 0.85);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 12px;
  animation: shine 4s ease-in-out infinite;
}
@keyframes shine { 0%, 100% { box-shadow: 0 0 22px rgba(var(--c), 0.45), inset 0 0 22px rgba(var(--c), 0.12); } 50% { box-shadow: 0 0 34px rgba(var(--c), 0.7), inset 0 0 26px rgba(var(--c), 0.2); } }
.comet { position: absolute; left: 100%; width: 120px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #fff, rgba(var(--c), 0.6) 30%, rgba(var(--c), 0)); box-shadow: 0 0 8px rgba(255,220,245,0.8); transform-origin: 0 50%; opacity: 0; animation: comet 7s ease-in infinite; pointer-events: none; }
@keyframes comet { 0% { opacity: 0; transform: translate(0,0) rotate(-24deg); } 3% { opacity: 1; } 18% { opacity: 0; transform: translate(-280px,125px) rotate(-24deg); } 100% { opacity: 0; transform: translate(-280px,125px) rotate(-24deg); } }
.wotd-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 12px; letter-spacing: 0.1em; font-weight: 600; color: rgb(var(--c)); }
.eyebrow .dot { background: rgb(var(--c)); box-shadow: 0 0 8px rgb(var(--c)); }
.wotd-word-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wotd-word { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; color: #fff; text-shadow: 0 0 16px rgba(var(--c), 0.8); overflow-wrap: anywhere; }
.wotd-pos { font-size: 14px; color: var(--soft); }
.wotd-def { font-size: 16px; }
.wotd-actions { display: flex; gap: 10px; padding-top: 4px; }
.wotd-actions .primary-btn { flex: 1; height: 44px; font-size: 15px; }

.list { margin: 0; padding: 0; list-style: none; overflow: hidden; }
.list li + li { border-top: 1px solid var(--line-2); }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; background: transparent; text-align: left; color: var(--ink); min-height: 56px; }
.row:hover { background: rgba(255,255,255,0.04); }
.row .rank { font-family: var(--font-display); font-size: 16px; color: var(--gold); width: 16px; text-shadow: 0 0 8px rgba(var(--i), 0.6); font-variant-numeric: tabular-nums; }
.row .r-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .r-word { font-size: 16px; font-weight: 600; }
.row .r-sub { font-size: 13px; color: var(--muted); }

.jar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.jar {
  --c: var(--j);
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 6px; text-align: left;
  background: var(--glass); border: 1px solid rgba(var(--c), 0.6);
  box-shadow: 0 0 12px rgba(var(--c), 0.22), inset 0 0 12px rgba(var(--c), 0.08);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--ink); min-width: 0;
}
.jar .j-cat { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.jar .j-word { font-family: var(--font-display); font-size: 19px; font-weight: 700; text-shadow: 0 0 10px rgba(var(--c), 0.5); overflow-wrap: anywhere; }
.jar .j-def { font-size: 13px; line-height: 1.4; color: var(--soft); }

.levels { display: flex; flex-direction: column; gap: 12px; }
.lvl { display: flex; flex-direction: column; gap: 6px; }
.lvl-head { display: flex; justify-content: space-between; font-size: 13px; }
.lvl-head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.1); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: rgb(var(--c)); box-shadow: 0 0 10px rgba(var(--c), 0.7); transition: width 0.6s ease; }

/* ---------- Learned ---------- */
.learned-group { display: flex; flex-direction: column; gap: 8px; }
.learned-group h2 { font-size: 13px; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.learned-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.empty-state { padding: 22px 18px; text-align: center; color: var(--soft); display: flex; flex-direction: column; gap: 6px; }
.empty-state strong { font-family: var(--font-display); font-size: 19px; color: var(--ink); }
.reset-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.reset-row .ghost-btn { height: 40px; font-size: 14px; }
.reset-confirm { font-size: 13px; color: rgb(var(--a)); }

/* Word chips (sheet + learned list) */
.wchip {
  --c: var(--b);
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 4px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(var(--c), 0.75); box-shadow: 0 0 10px rgba(var(--c), 0.3);
  color: #F7F8FF; font-size: 14px;
}
.wchip .dot { width: 7px; height: 7px; background: rgb(var(--c)); box-shadow: 0 0 6px rgb(var(--c)); }
.wchip.rel-o { border-style: dashed; box-shadow: none; }
.wchip.rel-f { border-style: dotted; box-shadow: none; }

/* ---------- Sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-scrim { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,0.55); }
.sheet-panel { position: relative; width: 100%; max-width: 620px; margin: 0 auto; animation: sheetUp 0.32s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }

.word-panel {
  height: 100%; display: flex; flex-direction: column;
  background: rgba(7, 8, 18, 0.72); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  padding-top: env(safe-area-inset-top, 0px);
}
.ws-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; }
.ws-crumb { font-size: 13px; color: var(--muted); text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-crumb b { color: rgb(var(--c, var(--i))); font-weight: 500; }
.ws-spacer { width: 44px; flex: none; }
.ws-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.ws-hero {
  padding: 20px; border-radius: 6px; display: flex; flex-direction: column; gap: 10px;
  background: rgba(24, 16, 24, 0.45); border: 1px solid rgba(var(--c), 0.85);
  box-shadow: 0 0 24px rgba(var(--c), 0.4), inset 0 0 22px rgba(var(--c), 0.12);
}
.ws-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.ws-word { font-family: var(--font-display); font-size: 46px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.02; color: #fff; overflow-wrap: anywhere; animation: glow 4s ease-in-out infinite; }
@keyframes glow { 0%, 100% { text-shadow: 0 0 14px rgba(var(--c), 0.6); } 50% { text-shadow: 0 0 26px rgba(var(--c), 0.95); } }
.ws-say { display: flex; align-items: center; gap: 10px; }
.ws-say-label { font-size: 14px; color: var(--muted); }
.meaning { display: flex; gap: 12px; }
.meaning + .meaning { border-top: 1px solid var(--line-2); padding-top: 12px; }
.meaning .num { font-family: var(--font-display); font-size: 20px; color: rgb(var(--c, var(--i))); text-shadow: 0 0 10px rgba(var(--c, var(--i)), 0.7); flex: none; width: 14px; }
.meaning .m-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.meaning .m-def { font-size: 16px; }
.link-group { display: flex; flex-direction: column; gap: 6px; }
.link-group .lg-name { font-size: 13px; color: var(--muted); }
.link-group .lg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.turn { border-color: rgba(var(--b), 0.45); box-shadow: 0 0 14px rgba(var(--b), 0.15); }
.turn label { font-size: 15px; }
.turn input { height: 46px; padding: 0 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.18); background: rgba(5,6,13,0.6); color: var(--ink); font: inherit; font-size: 16px; }
.turn input::placeholder { color: var(--dim); }
.saved { font-size: 12px; color: rgb(var(--b)); }
.ws-actions { display: flex; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-2); }
.ws-actions > * { flex: 1; }
.primary-btn.is-done { background: transparent; color: rgb(var(--c, var(--i))); border: 1px solid rgba(var(--c, var(--i)), 0.8); box-shadow: 0 0 12px rgba(var(--c, var(--i)), 0.3); }

.settings-panel {
  border-radius: 22px 22px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(20, 22, 40, 0.94); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  max-height: 88%; overflow-y: auto;
}
.st-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.st-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.st-body { display: flex; flex-direction: column; gap: 18px; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.st-row .st-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-row .st-name { font-size: 15px; font-weight: 600; }
.st-row .st-sub { font-size: 13px; color: var(--muted); }
.st-seg { display: flex; flex-direction: column; gap: 8px; }
.st-seg .st-sub { font-size: 13px; color: var(--muted); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg button { height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.16); background: transparent; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.seg button:disabled { opacity: 0.4; cursor: default; }
.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 3px; display: flex; background: #3A3F55; flex: none; transition: background 0.2s; }
.switch i { width: 26px; height: 26px; border-radius: 13px; background: #fff; transition: transform 0.2s; }
.switch[aria-checked="true"] { background: var(--gold); }
.switch[aria-checked="true"] i { transform: translateX(20px); }

#warp { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 35; pointer-events: none; }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  padding: 10px 16px; border-radius: 22px; font-size: 14px;
  background: rgba(20, 22, 40, 0.94); border: 1px solid rgba(var(--i), 0.6); box-shadow: 0 0 16px rgba(var(--i), 0.35);
  white-space: nowrap; animation: fadeIn 0.25s ease both;
}

/* Arabic + Urdu */
[lang="ar"] { font-family: var(--font-ar); }
[lang="ur"] { font-family: var(--font-ur); line-height: 2.1; }
.ws-tr { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.tr-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.tr-label { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; width: 58px; flex: none; }
.tr-text { flex: 1; min-width: 0; font-size: 23px; color: #fff; text-shadow: 0 0 10px rgba(var(--c, var(--i)), 0.45); }
.tr-text[lang="ur"] { font-size: 21px; }
.tr-say { width: 40px; height: 40px; border-radius: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--glass); border: 1px solid rgba(var(--c, var(--i)), 0.5); color: #fff; }
.tr-inline { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px 14px; font-size: 15px; color: var(--soft); }
.tr-inline:empty { display: none; }
.tr-item { display: inline-flex; align-items: center; gap: 6px; }
.tr-tag { font-family: var(--font-body); font-size: 10px; letter-spacing: 0.08em; font-weight: 600; color: var(--dim); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; line-height: 16px; }
.tr-inline span[lang="ur"] { font-size: 14px; line-height: 1.9; }
.tr-lg { font-size: 19px; color: #fff; }
.tr-lg span[lang="ur"] { font-size: 17px; }
.ex-tr { display: flex; align-items: flex-start; gap: 8px; margin: 0; }
.ex-tr .tr-tag { margin-top: 6px; flex: none; }
.ex-tr-text { flex: 1; min-width: 0; font-size: 17px; line-height: 1.7; color: var(--soft); }
.ex-tr-text[lang="ur"] { font-size: 16px; line-height: 2.2; }
.wbw-wrap { display: flex; flex-direction: column; gap: 8px; padding-left: 30px; }
.wbw-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass-2); color: var(--muted); font-size: 13px; }
.wbw-btn svg { transition: transform 0.2s; }
.wbw-btn.is-open { color: var(--ink); border-color: rgba(var(--c, var(--i)), 0.6); }
.wbw-btn.is-open svg { transform: rotate(180deg); }
.wbw { display: flex; flex-wrap: wrap; gap: 6px; }
.wbw-box { display: flex; flex-direction: column; align-items: stretch; min-width: 54px; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,0.04); overflow: hidden; text-align: center; }
.wbw-src { padding: 6px 10px 2px; font-size: 20px; line-height: 1.6; color: #fff; }
.wbw-src[lang="ur"] { font-size: 18px; line-height: 2.1; }
.wbw-en { padding: 4px 8px 6px; border-top: 1px solid var(--line-2); font-family: var(--font-body); font-size: 12px; line-height: 1.3; color: var(--muted); }
.wbw-box.is-key { border-color: rgba(var(--c, var(--i)), 0.85); background: rgba(var(--c, var(--i)), 0.12); box-shadow: 0 0 10px rgba(var(--c, var(--i)), 0.35); }
.wbw-box.is-key .wbw-en { color: rgb(var(--c, var(--i))); border-top-color: rgba(var(--c, var(--i)), 0.4); }
.wbw-bar { display: flex; align-items: center; gap: 8px; }
.wbw-info-btn { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass-2); color: var(--muted); font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.wbw-info-btn.is-open { color: var(--ink); border-color: rgba(var(--c, var(--i)), 0.7); background: rgba(var(--c, var(--i)), 0.14); }
.wbw-info { padding: 12px 14px; border-radius: 6px; background: rgba(10, 12, 26, 0.75); border: 1px solid rgba(var(--c, var(--i)), 0.45); display: flex; flex-direction: column; gap: 6px; }
.wbw-info h4 { margin: 0; font-size: 14px; font-weight: 600; }
.wbw-info-ex { font-size: 13px; color: var(--muted); font-style: italic; }
.wbw-info ul { margin: 2px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; color: var(--soft); }
.wbw-info b { color: var(--ink); font-weight: 600; }
.lv-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.lv-inner { position: relative; width: max-content; min-width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.lv-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.lv-lab { direction: ltr; text-align: right; font-size: 11px; letter-spacing: 0.08em; color: var(--dim); font-weight: 600; text-transform: uppercase; }
.lv-row { display: flex; gap: 6px; position: relative; z-index: 1; }
.lv-gap { height: 48px; }
.lv-hint { margin: 4px 0 0; font-size: 12px; color: var(--dim); }
.lv .wbw-box { flex: none; border-color: var(--lc, var(--line)); background: rgba(8, 10, 22, 0.85); }
.lv .wbw-src { white-space: nowrap; }
.lv .wbw-en { white-space: nowrap; }
.lv .wbw-box.is-free { border-style: dashed; border-color: rgba(255,255,255,0.3); }
.lv .wbw-box.is-key { background: rgba(var(--c, var(--i)), 0.16); }
.seg.seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Level colour hooks */
.lv-b { --c: var(--b); }
.lv-i { --c: var(--i); }
.lv-a { --c: var(--a); }
.lv-j { --c: var(--j); }

@media (min-width: 700px) {
  .jar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .node { font-size: 16px; }
  .node.center .c-word { font-size: 32px; }
}
@media (max-width: 360px) {
  .brand { font-size: 22px; }
  .chip { padding: 0 9px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  #bh { animation: none; transform: translate(70vw, 30vh) scale(0.7); }
  .comet { display: none; }
}
