/* VORTEX — المظهر التطبيقي: الحساب والإشعارات والمكتبة والسجل وتخصيص الملف.
   يُحمَّل آخراً ليغلب على الأنماط القديمة في هذه الأقسام فقط. */
:root {
  --vx-card: #0e1626;
  --vx-card-2: #121c31;
  --vx-line: rgba(255,255,255,.08);
  --vx-line-2: rgba(118,229,253,.22);
  --vx-ink: #eef3ff;
  --vx-ink-2: #b9c4d8;
  --vx-ink-3: #7f8ba3;
  --vx-accent: #13ABD2;
  --vx-accent-2: #76E5FD;
  --vx-grad: linear-gradient(135deg, #13abd2, #76e5fd);
  --vx-shadow: 0 22px 50px rgba(0,0,0,.55);
  --vx-r: 18px;
}
[hidden] { display: none !important; }
html { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

/* ---------- قائمة الحساب (تُركَّب في body) ---------- */
#acct-menu.acct-menu {
  position: fixed; z-index: 400; padding: 8px; border-radius: 20px;
  background: rgba(12,19,32,.96); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--vx-line-2); box-shadow: var(--vx-shadow);
  transform-origin: top right; animation: vx-pop .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes vx-pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
#acct-menu a, #acct-menu button { min-height: 46px; border-radius: 14px; padding: 0 12px; gap: 12px; }
#acct-menu a > svg, #acct-menu button > svg { width: 18px; height: 18px; padding: 7px; box-sizing: content-box; width: 18px; height: 18px; background: rgba(118,229,253,.1); border-radius: 10px; }
#acct-menu a:active, #acct-menu button:active { transform: scale(.98); }
#acct-menu .acct-me { gap: 12px; padding: 12px !important; border-radius: 16px; background: linear-gradient(135deg, rgba(19,171,210,.14), rgba(118,229,253,.04)); margin-bottom: 4px; }
#acct-menu .acct-me span:last-child b { font-size: 16px; }
#acct-menu .acct-sep { margin: 6px 8px; }
#acct-menu .acct-out { color: #ff9aa6; }
#acct-menu .acct-out > svg { background: rgba(255,120,140,.1); color: #ff9aa6; }

/* ---------- الجرس والنافذة (تُركَّب في body) ---------- */
#nb-panel.nb-panel {
  position: fixed; z-index: 400; max-height: min(72vh, 560px); display: flex; flex-direction: column;
  border-radius: 20px; background: rgba(12,19,32,.97); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--vx-line-2); box-shadow: var(--vx-shadow); overflow: hidden;
  transform-origin: top right; animation: vx-pop .18s cubic-bezier(.2,.8,.2,1);
}
#nb-panel .nb-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--vx-line); }
#nb-panel .nb-head b { font-size: 16px; }
#nb-panel .nb-link { background: rgba(118,229,253,.1); border-radius: 999px; padding: 6px 12px; font-weight: 700; }
#nb-panel .nb-list { padding: 8px; }
#nb-panel .nb-foot { padding: 14px; font-weight: 800; border-top: 1px solid var(--vx-line); }
.nb-btn { width: 40px; height: 40px; }
.nb-btn svg { width: 19px; height: 19px; }

/* عناصر الإشعارات: مشتركة بين النافذة والصفحة */
.nx-item { border-radius: 14px; padding: 12px; gap: 12px; transition: background .15s, transform .12s; }
.nx-item:active { transform: scale(.985); }
.nx-item:focus-visible { outline: 2px solid var(--vx-accent-2); outline-offset: -2px; }
.nx-ico { width: 40px; height: 40px; border-radius: 14px; background: linear-gradient(135deg, rgba(19,171,210,.22), rgba(118,229,253,.06)); }
.nx-ico svg { width: 18px; height: 18px; }
.nx-main b { font-size: 15px; font-weight: 800; }
.nx-body { font-size: 14px; color: var(--vx-ink-2); }
.nx-main small { font-size: 12px; color: var(--vx-ink-3); }
.nx-new { width: 9px; height: 9px; }
.nb-empty { padding: 34px 12px; font-size: 14px; }

/* صفحة الإشعارات */
.nt { width: min(780px, 100% - 28px); padding: 26px 0 110px; }
.nt-head { padding: 4px 4px 0; margin-bottom: 18px; }
.nt-head h1 { font-size: 28px; letter-spacing: -.01em; }
.nt-btn { border-radius: 999px; padding: 9px 16px; font-weight: 700; background: rgba(19,171,210,.12); }
.nx-page { gap: 10px; }
.nx-page .nx-item { background: var(--vx-card); border: 1px solid var(--vx-line); border-radius: 18px; padding: 15px; }
.nx-page .nx-item.unread { background: linear-gradient(135deg, rgba(19,171,210,.12), rgba(19,171,210,.03)); border-color: var(--vx-line-2); }
.nx-page .nx-item:hover { background: var(--vx-card-2); }

/* ---------- المكتبة والسجل ---------- */
.lib, .hist, main.lib-page, main.hist-page { padding-bottom: 110px; }
.lib-empty { display: grid; place-items: center; gap: 8px; padding: 48px 16px; text-align: center; color: var(--vx-ink-3); font-size: 14px; background: var(--vx-card); border: 1px dashed var(--vx-line-2); border-radius: var(--vx-r); }

/* ---------- تخصيص الملف ---------- */
.ps { width: min(720px, 100% - 28px); margin: 0 auto; padding: 26px 0 120px; color: var(--vx-ink); }
.ps-top { margin-bottom: 18px; }
.ps-top h1 { margin: 0 0 6px; font-size: 28px; font-weight: 900; letter-spacing: -.01em; }
.ps-top p { margin: 0; color: var(--vx-ink-3); font-size: 14px; }
.ps-card { background: var(--vx-card); border: 1px solid var(--vx-line); border-radius: var(--vx-r); padding: 18px; margin-bottom: 14px; }
.ps-card-h { display: grid; gap: 3px; margin-bottom: 14px; }
.ps-card-h h2 { margin: 0; font-size: 16px; font-weight: 800; }
.ps-card-h small { color: var(--vx-ink-3); font-size: 13px; }

.ps-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ps-swatch { position: relative; display: grid; justify-items: center; gap: 8px; padding: 14px 8px; border-radius: 16px; background: var(--vx-card-2); border: 1.5px solid var(--vx-line); cursor: pointer; transition: border-color .15s, transform .12s; }
.ps-swatch input, .ps-tile input { position: absolute; opacity: 0; pointer-events: none; }
.ps-swatch span { width: 38px; height: 38px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.2); }
.ps-swatch em { font-style: normal; font-size: 13px; color: var(--vx-ink-2); }
.ps-swatch:has(input:checked) { border-color: var(--vx-accent-2); box-shadow: 0 0 0 3px rgba(118,229,253,.15); }
.ps-swatch:has(input:checked) em { color: #fff; font-weight: 800; }
.ps-swatch:active, .ps-tile:active, .ps-row:active { transform: scale(.98); }

.ps-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ps-tile { position: relative; height: 84px; border-radius: 16px; overflow: hidden; cursor: pointer; border: 1.5px solid var(--vx-line); display: flex; align-items: flex-end; padding: 10px; }
.ps-tile span { position: relative; z-index: 1; font-weight: 800; font-size: 14px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.ps-tile::before { content: ""; position: absolute; inset: 0; }
.t-nebula::before { background: radial-gradient(circle at 30% 20%, #7b5cff, transparent 55%), radial-gradient(circle at 80% 80%, #13abd2, transparent 60%), #0b0f2a; }
.t-ocean::before { background: linear-gradient(160deg, #0a3d62, #13abd2 70%, #76e5fd); }
.t-night::before { background: linear-gradient(160deg, #05070d, #1a2440 70%, #2c3e66); }
.t-ember::before { background: radial-gradient(circle at 70% 30%, #ff8a3d, transparent 55%), linear-gradient(160deg, #3a0d0d, #7a2a10); }
.ps-tile:has(input:checked) { border-color: var(--vx-accent-2); box-shadow: 0 0 0 3px rgba(118,229,253,.18); }

.ps-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 4px; border-top: 1px solid var(--vx-line); cursor: pointer; }
.ps-row:first-of-type { border-top: 0; }
.ps-row b { font-size: 15px; font-weight: 700; }
.ps-switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: #2a3550; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.ps-switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: inset-inline-start .2s; }
.ps-switch:checked { background: var(--vx-grad); }
.ps-switch:checked::after { inset-inline-start: 23px; }
.ps-switch:focus-visible { outline: 2px solid var(--vx-accent-2); outline-offset: 2px; }

.ps-actions { position: sticky; bottom: 12px; display: grid; gap: 8px; padding: 12px; border-radius: 20px; background: rgba(12,19,32,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--vx-line-2); box-shadow: var(--vx-shadow); }
.ps-msg { margin: 0; min-height: 18px; font-size: 13px; color: var(--vx-ink-2); text-align: center; }
.ps-save { height: 50px; border: 0; border-radius: 14px; background: var(--vx-grad); color: #04151c; font: inherit; font-size: 16px; font-weight: 900; cursor: pointer; }
.ps-save:active { transform: scale(.985); }
.ps-save:disabled { opacity: .6; cursor: wait; }
.ps-guard { display: grid; justify-items: center; gap: 12px; padding: 40px 18px; text-align: center; background: var(--vx-card); border: 1px solid var(--vx-line); border-radius: var(--vx-r); }
.ps-cta { display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: 999px; background: var(--vx-grad); color: #04151c; text-decoration: none; font-weight: 800; }

@media (max-width: 560px) {
  .ps-swatches { grid-template-columns: 1fr 1fr 1fr; }
  .ps-top h1, .nt-head h1 { font-size: 24px; }
}

/* ===== خيارات جديدة في صفحة التخصيص ===== */
.ps-field { display: grid; gap: 10px; }
.ps-field > span { font-size: 13px; color: var(--vx-ink-2); font-weight: 700; }
.ps-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ps-opt { position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 8px; border-radius: 18px; border: 1.5px solid var(--vx-line); background: var(--vx-card-2); cursor: pointer; text-align: center; }
.ps-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ps-opt-ico { font-size: 26px; color: var(--vx-accent-2); line-height: 1; margin-bottom: 4px; }
.ps-opt em { font-style: normal; font-weight: 800; font-size: 14px; }
.ps-opt small { color: var(--vx-ink-3); font-size: 11px; line-height: 1.4; }
.ps-opt:has(input:checked) { border-color: var(--vx-accent-2); box-shadow: 0 0 0 3px rgba(118,229,253,.15); }
.ps-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--vx-card-2); border: 1px solid var(--vx-line); }
.ps-seg label { position: relative; }
.ps-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ps-seg span { display: grid; place-items: center; height: 38px; border-radius: 10px; font-size: 14px; color: var(--vx-ink-2); font-weight: 700; cursor: pointer; }
.ps-seg label:has(input:checked) span { background: var(--vx-grad); color: #04151c; }
.ps-shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ps-shape { position: relative; display: grid; justify-items: center; gap: 8px; padding: 14px 6px; border-radius: 18px; border: 1.5px solid var(--vx-line); background: var(--vx-card-2); cursor: pointer; }
.ps-shape input { position: absolute; opacity: 0; pointer-events: none; }
.ps-shape em { font-style: normal; font-size: 13px; color: var(--vx-ink-2); }
.sh { width: 52px; height: 52px; display: block; background: var(--vx-grad); }
.sh-squircle { border-radius: 34%; } .sh-circle { border-radius: 50%; } .sh-rounded { border-radius: 22%; } .sh-square { border-radius: 6%; }
.ps-shape:has(input:checked) { border-color: var(--vx-accent-2); box-shadow: 0 0 0 3px rgba(118,229,253,.15); }
.ps-sticky-preview { position: sticky; top: 72px; z-index: 5; }
@media (max-width: 560px) { .ps-opts { grid-template-columns: 1fr; } .ps-shapes { grid-template-columns: repeat(2, 1fr); } }

/* ===== تحسينات المظهر: حدود الشاشة، التركيز، وتقليل الحركة ===== */
#acct-menu.acct-menu, #nb-panel.nb-panel { max-width: calc(100vw - 24px); }
#acct-menu a:focus-visible, #acct-menu button:focus-visible,
#nb-panel a:focus-visible, #nb-panel button:focus-visible,
.nb-panel .nb-link:focus-visible, .nx-item:focus-visible {
  outline: 2px solid var(--vx-accent-2); outline-offset: 2px;
}
#acct-menu a:hover, #acct-menu button:hover { background: rgba(118,229,253,.07); }
#nb-panel .nx-item:hover { background: var(--vx-card-2); }
@media (prefers-reduced-motion: reduce) {
  #acct-menu.acct-menu, #nb-panel.nb-panel { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
@media (max-width: 380px) {
  #nb-panel.nb-panel { width: calc(100vw - 24px) !important; }
  #nb-panel .nb-head { padding: 14px 14px 10px; }
}
