/* ============================================================
   ميم AI — visual identity: cinematic dark, mint-green accent
   ============================================================ */

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}

:root{
  --bg:#07090A;
  --bg-soft:#0B0F0E;
  --surface:#111614;
  --surface-2:#0C1210;
  --line:#1E2A24;
  --text:#F2F5F3;
  --muted:#8A9A92;
  --accent:#00E676;
  --accent-dim:#0B3D2A;
  --on-accent:#04170D;
  --danger:#FF5A5F;
  --danger-dim:#3A1416;
  --r-lg:22px;
  --r-md:18px;
  --r-sm:14px;
  --glow:0 0 22px rgba(0,230,118,.22);
  --shadow:0 18px 50px rgba(0,0,0,.45);
}

body.light{
  --bg:#F5F8F6;
  --bg-soft:#EDF3EF;
  --surface:#FFFFFF;
  --surface-2:#F1F7F3;
  --line:#DDE7E1;
  --text:#0A1410;
  --muted:#5C6E67;
  --accent:#00A556;
  --accent-dim:#DCF5E7;
  --on-accent:#FFFFFF;
  --danger:#D93438;
  --danger-dim:#FBE3E4;
  --glow:0 0 18px rgba(0,165,86,.18);
  --shadow:0 14px 40px rgba(12,40,28,.10);
}

html{height:100%}
body{
  margin:0;min-height:100%;
  background:var(--bg);color:var(--text);
  font-family:'IBM Plex Sans Arabic','Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:16px;line-height:1.65;
  -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
  -webkit-user-select:none;user-select:none;
}
input,textarea{-webkit-user-select:text;user-select:text;font-family:inherit}
button{font-family:inherit;font-size:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
button:disabled{cursor:default}
h1,h2,h3,h4,p{margin:0}
a{color:var(--accent);text-decoration:none}
.hidden{display:none !important}
svg{display:block}

/* ---------- splash ---------- */
#splash{
  position:fixed;inset:0;z-index:9999;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:18px;
  background:#07090A;color:#F2F5F3;
  transition:opacity .4s ease, visibility .4s;
}
#splash.gone{opacity:0;visibility:hidden}
.splash-logo{
  width:84px;height:84px;border-radius:24px;background:#000;border:1px solid #1E2A24;
  display:grid;place-items:center;font-family:'Inter',sans-serif;font-weight:700;
  font-size:46px;color:#00E676;box-shadow:0 0 40px rgba(0,230,118,.35);
  animation:pop .7s cubic-bezier(.2,.9,.3,1.3) both;
}
.splash-name{font-size:15px;letter-spacing:.06em;color:#8A9A92;font-weight:600}
@keyframes pop{from{transform:scale(.7);opacity:0}to{transform:scale(1);opacity:1}}

/* ---------- views ---------- */
.view{display:none;padding:0 16px 26px;max-width:840px;margin:0 auto}
.view.active{display:block}
body.with-tabs #view-home.active,
body.with-tabs #view-gallery.active,
body.with-tabs #view-settings.active{padding-bottom:106px}
#view-chat.active{display:flex;flex-direction:column;height:100dvh;padding-bottom:0;max-width:none}
.pad{padding-top:4px}

/* ---------- topbar ---------- */
.topbar{
  display:flex;align-items:center;gap:10px;
  padding:14px 0 10px;position:sticky;top:0;z-index:30;
  background:var(--bg);
}
#view-chat .topbar,#view-learn .topbar,#view-image .topbar,#view-video .topbar{
  padding:14px 16px 10px;margin:0 -16px;
}
#view-chat .topbar{flex-shrink:0;margin:0}
.brand{display:flex;align-items:center;gap:11px;flex:1;min-width:0}
.brand-txt{min-width:0}
.brand-name{font-weight:700;font-size:16px;letter-spacing:.01em;line-height:1.25}
.brand-sub{font-size:11.5px;color:var(--muted);line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.logo{
  flex-shrink:0;width:40px;height:40px;border-radius:11px;
  background:#000;border:1px solid #20302A;
  display:grid;place-items:center;
  font-family:'Inter',sans-serif;font-weight:700;font-size:21px;color:var(--accent);
  letter-spacing:-.02em;box-shadow:0 0 18px rgba(0,230,118,.20);
}
body.light .logo{border-color:#12201A}
.title-wrap{flex:1;min-width:0;text-align:start}
.title{font-weight:600;font-size:15.5px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.title-wrap .sub{font-size:11.5px;color:var(--muted);line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.icon-btn{
  flex-shrink:0;width:42px;height:42px;border-radius:13px;
  display:grid;place-items:center;
  background:var(--surface);border:1px solid var(--line);color:var(--text);
  transition:transform .14s ease,background .14s ease;
}
.icon-btn:active{transform:scale(.93)}
.icon-btn svg{width:20px;height:20px}
.icon-btn.accent{background:var(--accent-dim);border-color:var(--accent);color:var(--accent)}
[dir="rtl"] .back svg{transform:scaleX(-1)}

/* ---------- hero ---------- */
.hero{padding:18px 0 6px}
.greet{font-size:13.5px;color:var(--muted);font-weight:500;margin-bottom:6px}
.hero-title{
  font-size:clamp(28px,8.4vw,38px);font-weight:700;line-height:1.22;
  letter-spacing:-.01em;margin-bottom:8px;
}
.hero-sub{font-size:14px;color:var(--muted);line-height:1.6;max-width:38ch}

/* ---------- tool cards ---------- */
.cards{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:20px}
@media(min-width:700px){.cards{grid-template-columns:repeat(4,1fr)}}
.card{
  position:relative;text-align:start;color:var(--text);
  background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:15px 14px 14px;
  min-height:138px;display:flex;flex-direction:column;justify-content:space-between;gap:12px;
  transition:transform .16s ease,border-color .16s ease;
}
.card:active{transform:scale(.972);border-color:var(--accent)}
.card .ic{
  width:38px;height:38px;border-radius:12px;display:grid;place-items:center;
  background:var(--accent-dim);color:var(--accent);
}
.card .ic svg{width:20px;height:20px}
.card h3{font-size:14.5px;font-weight:600;line-height:1.35;margin-bottom:3px}
.card p{font-size:11.8px;color:var(--muted);line-height:1.45;margin:0}
.card.primary{
  background:linear-gradient(155deg,#0B3D2A 0%,#111614 72%);
  border-color:#1C4B35;
}
body.light .card.primary{background:linear-gradient(155deg,#DCF5E7 0%,#FFFFFF 72%);border-color:#BDE7D0}

/* ---------- recent ---------- */
.recent-wrap{margin-top:26px}
.sec-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.sec-head h2{font-size:15px;font-weight:600}
.link{font-size:12.5px;font-weight:600;color:var(--accent);padding:6px 2px;background:none}
.link.danger{color:var(--danger)}
.recent-row{display:flex;gap:10px;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
.recent-row::-webkit-scrollbar{display:none}
.ritem{
  flex:0 0 124px;height:150px;border-radius:var(--r-md);overflow:hidden;
  background:var(--surface);border:1px solid var(--line);
  display:flex;flex-direction:column;align-items:stretch;text-align:start;color:var(--text);
}
.ritem img{width:100%;height:150px;object-fit:cover;display:block}
.ritem .rtxt{font-size:10.5px;color:var(--muted);padding:8px;line-height:1.35;height:100%;display:flex;align-items:center}
.recent-empty{
  border:1px dashed var(--line);border-radius:var(--r-md);padding:20px 16px;
  color:var(--muted);font-size:13px;text-align:center;line-height:1.6;
}

/* ---------- banner ---------- */
.banner{
  margin-top:12px;border-radius:var(--r-md);padding:12px 14px;font-size:13px;line-height:1.6;
  background:var(--danger-dim);color:var(--text);border:1px solid var(--danger);
}
.banner.warn{background:var(--accent-dim);border-color:var(--accent)}

/* ---------- chat ---------- */
.chat-scroll{flex:1;overflow-y:auto;padding:8px 16px 16px;-webkit-overflow-scrolling:touch}
#chatMsgs{display:flex;flex-direction:column;gap:14px;padding-bottom:8px}
.msg{display:flex;flex-direction:column;max-width:100%}
.msg.me{align-items:flex-end}
.msg.ai{align-items:flex-start}
.bubble{
  max-width:88%;padding:12px 15px;border-radius:18px;
  font-size:15px;line-height:1.72;white-space:pre-wrap;overflow-wrap:anywhere;
  word-break:break-word;
}
.msg.me .bubble{background:var(--accent-dim);color:var(--text);border:1px solid transparent}
.msg.ai .bubble{background:var(--surface);color:var(--text);border:1px solid var(--line)}
.bubble code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;
  background:var(--surface-2);border:1px solid var(--line);border-radius:6px;padding:1px 5px;
}
body.light .bubble code{background:#F1F7F3}
.bubble img{max-width:220px;border-radius:12px;display:block;margin-bottom:8px}
.msg-actions{display:flex;gap:6px;margin-top:6px;padding-inline-start:4px}
.mini-btn{
  display:inline-flex;align-items:center;gap:5px;
  font-size:11.5px;color:var(--muted);font-weight:600;
  background:var(--surface-2);border:1px solid var(--line);
  border-radius:999px;padding:5px 10px;min-height:30px;
}
.mini-btn:active{color:var(--accent)}
.mini-btn svg{width:13px;height:13px}

.typing{display:inline-flex;gap:4px;align-items:center;padding:14px 16px}
.typing i{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:blink 1.2s infinite}
.typing i:nth-child(2){animation-delay:.15s}
.typing i:nth-child(3){animation-delay:.3s}
@keyframes blink{0%,60%,100%{opacity:.28;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}

.chat-empty{padding:26px 6px 10px;text-align:center}
.chat-empty .ce-logo{
  width:56px;height:56px;border-radius:16px;background:#000;border:1px solid #20302A;
  color:var(--accent);display:grid;place-items:center;margin:0 auto 14px;
  font-family:'Inter',sans-serif;font-weight:700;font-size:28px;box-shadow:var(--glow);
}
.chat-empty h3{font-size:17px;font-weight:600;margin-bottom:6px}
.chat-empty p{font-size:13px;color:var(--muted);line-height:1.6;margin-bottom:16px}
.sugg{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.sugg button{
  font-size:12.5px;padding:9px 13px;border-radius:999px;
  background:var(--surface);border:1px solid var(--line);color:var(--text);
}
.sugg button:active{border-color:var(--accent);color:var(--accent)}

.composer{
  flex-shrink:0;border-top:1px solid var(--line);background:var(--bg);
  padding:10px 14px 12px;
}
.composer-row{display:flex;align-items:flex-end;gap:8px}
.cbtn{
  flex-shrink:0;width:46px;height:46px;border-radius:50%;
  display:grid;place-items:center;background:var(--surface);
  border:1px solid var(--line);color:var(--muted);
}
.cbtn:active{color:var(--accent);border-color:var(--accent)}
.cbtn svg{width:20px;height:20px}
.chat-input{
  flex:1;min-height:46px;max-height:132px;resize:none;
  background:var(--surface);border:1px solid var(--line);border-radius:22px;
  padding:11px 16px;font-size:15.5px;line-height:1.5;color:var(--text);outline:none;
}
.chat-input::placeholder{color:var(--muted)}
.chat-input:focus{border-color:var(--accent)}
.send-btn{
  flex-shrink:0;width:46px;height:46px;border-radius:50%;
  display:grid;place-items:center;
  background:var(--accent);color:var(--on-accent);box-shadow:var(--glow);
  transition:transform .14s ease,opacity .14s;
}
.send-btn:active{transform:scale(.92)}
.send-btn:disabled{opacity:.45;box-shadow:none}
.send-btn svg{width:20px;height:20px}
[dir="rtl"] .send-btn svg{transform:scaleX(-1)}
.composer-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:6px 4px 0}
.hint{font-size:10.5px;color:var(--muted);line-height:1.3;text-align:start;flex:1}
.cost-chip{
  font-size:11px;font-weight:600;color:var(--accent);
  background:var(--accent-dim);border-radius:999px;padding:3px 9px;white-space:nowrap;
}
.attach-preview{
  display:flex;align-items:center;gap:8px;margin-bottom:8px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);
  padding:6px;width:max-content;
}
.attach-preview img{width:44px;height:44px;object-fit:cover;border-radius:10px;display:block}
.attach-x{width:26px;height:26px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line);display:grid;place-items:center;color:var(--muted)}
.attach-x svg{width:13px;height:13px}

/* ---------- generic form ---------- */
.lbl{display:block;font-size:13px;font-weight:600;color:var(--text);margin:18px 0 8px;text-align:start}
.lbl:first-child{margin-top:6px}
.field{
  width:100%;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-md);padding:13px 15px;color:var(--text);
  font-size:15.5px;line-height:1.6;resize:none;outline:none;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.field::placeholder{color:var(--muted)}
.field:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(0,230,118,.12)}
input.field{height:52px;padding:0 15px}

.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{
  padding:9px 14px;border-radius:999px;min-height:38px;
  border:1px solid var(--line);background:var(--surface);color:var(--muted);
  font-size:13px;font-weight:500;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.chip:active{transform:scale(.97)}
.chip.on{background:var(--accent-dim);border-color:var(--accent);color:var(--accent);font-weight:600}

.btn{
  display:flex;align-items:center;justify-content:center;gap:9px;
  width:100%;min-height:56px;border-radius:var(--r-md);
  font-size:16px;font-weight:600;
  background:var(--accent);color:var(--on-accent);box-shadow:var(--glow);
  margin-top:20px;
  transition:transform .14s ease,opacity .14s ease,background .14s;
}
.btn:active{transform:scale(.985)}
.btn:disabled{opacity:.45;box-shadow:none}
.btn svg{width:19px;height:19px;flex-shrink:0}
.btn.ghost{background:var(--surface);color:var(--text);border:1px solid var(--line);box-shadow:none}
.btn.ghost:active{border-color:var(--accent)}
.btn.danger{background:var(--danger);color:#fff;box-shadow:none}
.btn.danger-ghost{background:transparent;color:var(--danger);border:1px solid var(--danger);box-shadow:none;margin-top:14px;min-height:50px;font-size:14.5px}
.btn-cost{
  font-size:12px;font-weight:600;background:rgba(0,0,0,.16);
  border-radius:999px;padding:2px 9px;white-space:nowrap;
}
.btn-cost:empty{display:none}
body.light .btn-cost{background:rgba(255,255,255,.28)}
.fine{font-size:11.5px;color:var(--muted);line-height:1.6;margin-top:10px;text-align:start}

/* ---------- segmented ---------- */
.seg{
  display:flex;gap:4px;background:var(--surface);border:1px solid var(--line);
  border-radius:14px;padding:4px;margin:6px 0 4px;
}
.seg-btn{
  flex:1;min-height:42px;border-radius:11px;font-size:13px;font-weight:600;
  color:var(--muted);transition:background .15s,color .15s;
}
.seg-btn.on{background:var(--accent-dim);color:var(--accent)}

/* ---------- results ---------- */
.result-out,.learn-out{margin-top:18px}
.res-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  overflow:hidden;
}
.res-card img{width:100%;display:block;background:var(--surface-2)}
.res-body{padding:14px}
.res-prompt{font-size:13px;color:var(--muted);line-height:1.55;margin-bottom:12px;overflow-wrap:anywhere}
.res-actions{display:flex;gap:8px;flex-wrap:wrap}
.act{
  flex:1;min-width:calc(50% - 4px);min-height:48px;
  display:flex;align-items:center;justify-content:center;gap:7px;
  border-radius:14px;font-size:13.5px;font-weight:600;
  background:var(--surface-2);border:1px solid var(--line);color:var(--text);
}
.act:active{border-color:var(--accent);color:var(--accent)}
.act svg{width:16px;height:16px}
.act.primary{background:var(--accent);color:var(--on-accent);border-color:transparent;box-shadow:var(--glow)}

.learn-text{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
  padding:16px;font-size:15px;line-height:1.85;white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.learn-text strong{color:var(--accent);font-weight:700}

/* ---------- errors ---------- */
.err-card{
  background:var(--danger-dim);border:1px solid var(--danger);border-radius:var(--r-lg);
  padding:16px;
}
.err-card h4{font-size:14px;font-weight:700;margin-bottom:6px;color:var(--text)}
.err-card p{font-size:13px;line-height:1.6;color:var(--text);opacity:.9;margin-bottom:12px}
.err-actions{display:flex;gap:8px;flex-wrap:wrap}
.err-actions button,.err-actions a{
  min-height:44px;padding:0 16px;border-radius:12px;font-size:13.5px;font-weight:600;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  background:var(--surface);border:1px solid var(--line);color:var(--text);
}
.unavail{
  background:var(--surface);border:1px dashed var(--line);border-radius:var(--r-lg);
  padding:18px;font-size:13.5px;color:var(--muted);line-height:1.65;text-align:center;
}

/* ---------- learning templates ---------- */
.learn-out .res-actions{margin-top:12px}

/* ---------- video ---------- */
.duration-badge{
  display:inline-flex;align-items:center;gap:8px;
  background:var(--accent-dim);border:1px solid var(--accent);color:var(--accent);
  border-radius:999px;padding:8px 14px;font-size:12.5px;font-weight:600;margin-top:6px;
}
.duration-badge svg{width:15px;height:15px}
.upload-row{margin-top:14px}
.upload-btn{
  display:flex;align-items:center;justify-content:center;gap:9px;width:100%;
  min-height:52px;border-radius:var(--r-md);
  border:1px dashed var(--line);background:var(--surface-2);color:var(--muted);
  font-size:14px;font-weight:600;
}
.upload-btn:active{border-color:var(--accent);color:var(--accent)}
.upload-btn svg{width:18px;height:18px}
.vid-thumb{
  display:flex;align-items:center;gap:10px;margin-top:10px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-sm);padding:8px;
}
.vid-thumb img{width:52px;height:52px;border-radius:10px;object-fit:cover;display:block}
.vid-thumb-info{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}
.vid-thumb-info span{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vid-thumb-info .link{align-self:flex-start;padding:0;font-size:12px}

.progress-card{
  margin-top:18px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-lg);padding:16px;
}
.prog-head{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.spinner{
  width:26px;height:26px;border-radius:50%;flex-shrink:0;
  border:2.5px solid var(--line);border-top-color:var(--accent);
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.prog-title{font-size:14px;font-weight:600;line-height:1.4}
.prog-sub{font-size:11.5px;color:var(--muted);line-height:1.4;margin-top:2px}
.prog-bar{position:relative;height:6px;border-radius:99px;background:var(--line);overflow:hidden}
.prog-bar i{
  position:absolute;top:0;bottom:0;left:0;width:38%;border-radius:99px;
  background:var(--accent);animation:slide 1.35s ease-in-out infinite;
}
@keyframes slide{0%{transform:translateX(-110%)}100%{transform:translateX(300%)}}
.prog-foot{display:flex;align-items:center;justify-content:space-between;margin-top:10px}
.prog-foot span{font-size:12px;color:var(--muted);font-family:'Inter',sans-serif}

.video-frame{
  width:100%;border-radius:var(--r-md);overflow:hidden;background:#000;
  margin-bottom:12px;
}
.video-frame video{width:100%;display:block;max-height:56vh;background:#000}
.timeline{display:flex;gap:4px;margin:10px 0 4px}
.timeline i{
  flex:1;height:6px;border-radius:99px;background:var(--line);
  transition:background .2s ease;
}
.timeline i.on{background:var(--accent)}
.timeline i.now{background:var(--accent);box-shadow:0 0 10px rgba(0,230,118,.7)}
.tl-label{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted);font-family:'Inter',sans-serif}

/* ---------- gallery ---------- */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.gitem{
  position:relative;border-radius:var(--r-md);overflow:hidden;
  background:var(--surface);border:1px solid var(--line);
  aspect-ratio:4/5;display:block;width:100%;color:var(--text);
  transition:transform .15s ease,border-color .15s;
}
.gitem:active{transform:scale(.975);border-color:var(--accent)}
.gitem img{width:100%;height:100%;object-fit:cover;display:block}
.gitem .gcap{
  position:absolute;inset-inline:0;bottom:0;padding:22px 9px 8px;
  font-size:10.5px;line-height:1.35;color:#F2F5F3;text-align:start;
  background:linear-gradient(to top,rgba(0,0,0,.88),rgba(0,0,0,0));
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
.gvid{
  aspect-ratio:9/16;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:8px;background:linear-gradient(160deg,#0C1210,#111614);
}
body.light .gvid{background:linear-gradient(160deg,#F1F7F3,#FFFFFF)}
.gvid .play-ic{
  width:44px;height:44px;border-radius:50%;display:grid;place-items:center;
  background:var(--accent-dim);color:var(--accent);border:1px solid var(--accent);
}
.gvid .play-ic svg{width:18px;height:18px}
[dir="rtl"] .gvid .play-ic svg{transform:scaleX(-1)}
.gvid span{font-size:10.5px;color:var(--muted)}
.gvid .gcap{position:static;background:none;padding:0 9px;-webkit-line-clamp:2;text-align:center;color:var(--text)}
.chat-row{
  display:flex;align-items:center;gap:12px;width:100%;
  padding:14px;border-radius:var(--r-md);background:var(--surface);
  border:1px solid var(--line);margin-bottom:8px;text-align:start;color:var(--text);
}
.chat-row:active{border-color:var(--accent)}
.chat-row .cr-ic{
  width:36px;height:36px;border-radius:11px;flex-shrink:0;display:grid;place-items:center;
  background:var(--accent-dim);color:var(--accent);
}
.chat-row .cr-ic svg{width:17px;height:17px}
.chat-row .cr-txt{flex:1;min-width:0}
.chat-row .cr-t{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-row .cr-s{font-size:11.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.empty{
  text-align:center;padding:44px 20px;color:var(--muted);font-size:13.5px;line-height:1.7;
  border:1px dashed var(--line);border-radius:var(--r-lg);margin-top:14px;
}
.empty strong{display:block;color:var(--text);font-size:15px;margin-bottom:6px;font-weight:600}

/* ---------- settings ---------- */
.profile-card{
  display:flex;align-items:center;gap:14px;margin-top:8px;padding:16px;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);
}
.avatar{
  width:54px;height:54px;border-radius:16px;flex-shrink:0;
  background:var(--accent-dim);color:var(--accent);
  display:grid;place-items:center;font-size:22px;font-weight:700;
  border:1px solid var(--accent);
}
.p-name{font-size:16px;font-weight:700;line-height:1.3}
.p-sub{font-size:11.5px;color:var(--muted);line-height:1.4;margin-top:2px}
.set-block{margin-top:22px}
.row-line{
  display:flex;align-items:center;justify-content:space-between;
  padding:13px 15px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r-md);font-size:13.5px;color:var(--muted);
}
.row-line strong{color:var(--text);font-family:'Inter',sans-serif;font-size:13px}
.account-box{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--r-md);
  padding:14px;font-size:13px;line-height:1.6;color:var(--muted);
}
.account-box .btn{margin-top:12px;min-height:48px;font-size:14px}
.about{font-size:11.5px;color:var(--muted);line-height:1.7;margin-top:26px;text-align:center}

/* ---------- tabbar ---------- */
.tabbar{
  position:fixed;inset-inline:0;bottom:0;z-index:60;
  display:none;justify-content:space-around;align-items:center;
  padding:8px 10px 10px;
  background:rgba(9,13,12,.84);
  -webkit-backdrop-filter:blur(20px) saturate(150%);
  backdrop-filter:blur(20px) saturate(150%);
  border-top:1px solid var(--line);
}
body.light .tabbar{background:rgba(255,255,255,.86)}
body.with-tabs .tabbar{display:flex}
.tab{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-width:70px;min-height:52px;color:var(--muted);
  font-size:10.5px;font-weight:600;
  transition:color .15s ease;
}
.tab svg{width:21px;height:21px}
.tab.on{color:var(--accent)}

/* ---------- overlays ---------- */
.sheet-wrap,.modal-wrap{
  position:fixed;inset:0;z-index:200;
  display:flex;justify-content:center;
  background:rgba(0,0,0,.62);
  -webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);
  animation:fade .18s ease;
}
.sheet-wrap{align-items:flex-end}
.modal-wrap{align-items:flex-end}
.modal-wrap.center{align-items:center;padding:16px}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet-panel{
  width:100%;max-width:560px;max-height:82dvh;
  background:var(--surface);color:var(--text);
  border:1px solid var(--line);border-bottom:0;
  border-radius:26px 26px 0 0;
  padding:14px 16px 22px;overflow:auto;
  animation:up .24s cubic-bezier(.2,.9,.3,1);
}
.modal-panel{
  width:100%;max-width:560px;max-height:90dvh;
  background:var(--surface);color:var(--text);
  border:1px solid var(--line);
  border-radius:26px 26px 0 0;
  padding:14px 16px 22px;overflow:auto;
  animation:up .24s cubic-bezier(.2,.9,.3,1);
}
.modal-wrap.center .modal-panel{border-radius:24px;padding:20px}
.modal-panel.small{max-width:400px}
.modal-panel.tall{max-height:92dvh}
@keyframes up{from{transform:translateY(28px);opacity:.6}to{transform:translateY(0);opacity:1}}
.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;padding-top:4px}
.sheet-head h3{font-size:15.5px;font-weight:700;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sheet-body{display:flex;flex-direction:column}
.viewer-body{display:flex;flex-direction:column}
.viewer-body img{width:100%;border-radius:var(--r-md);display:block;background:var(--surface-2)}
.viewer-body .viewer-prompt{font-size:12.5px;color:var(--muted);line-height:1.6;margin:12px 0;overflow-wrap:anywhere}
.confirm-text{font-size:13.5px;color:var(--muted);line-height:1.65;margin:8px 0 18px}
.confirm-actions{display:flex;gap:10px}
.confirm-actions .btn{margin-top:0;min-height:50px;font-size:14.5px}

/* ---------- toast ---------- */
.toast{
  position:fixed;inset-inline:16px;bottom:96px;z-index:400;
  margin-inline:auto;max-width:380px;
  background:#0E1512;color:#F2F5F3;border:1px solid #26382F;
  border-radius:14px;padding:12px 16px;font-size:13px;line-height:1.5;text-align:center;
  opacity:0;transform:translateY(12px);pointer-events:none;
  transition:opacity .22s ease,transform .22s ease;
  box-shadow:0 12px 32px rgba(0,0,0,.5);
}
.toast.show{opacity:1;transform:translateY(0)}

/* ---------- misc ---------- */
@media (prefers-reduced-motion: reduce){
  *{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important}
}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-thumb{background:var(--line);border-radius:99px}

@media print{
  body{background:#fff;color:#000}
  .tabbar,.topbar,.composer,.btn,.act,.mini-btn,.toast,.modal-wrap,.sheet-wrap{display:none !important}
  .view{display:none !important}
  .view.active{display:block !important;padding:0}
  .learn-text,.res-card{border:0;padding:0}
}