/* ================= مذاكرة عبدالرحمن — الستايل ================= */
:root, [data-theme="night"] {
  --bg: #090716; --bg2: #140f2e; --card: rgba(255,255,255,.055); --card2: rgba(255,255,255,.09);
  --stroke: rgba(255,255,255,.11); --text: #f4f1ff; --muted: #a59fc8; --acc: #7c5cff; --acc2: #00e0ff;
  --good: #4dffa6; --bad: #ff5d7a; --warn: #ffb547; --shadow: 0 12px 40px rgba(0,0,0,.45);
  --blob1: #7c5cff; --blob2: #00e0ff; --blob3: #ff5ce1;
}
[data-theme="day"] {
  --bg: #f4f1ff; --bg2: #ffffff; --card: rgba(255,255,255,.72); --card2: rgba(255,255,255,.95);
  --stroke: rgba(40,25,110,.11); --text: #1b1636; --muted: #6b6590; --acc: #6a4cff; --acc2: #0aa5d4;
  --good: #0fbf74; --bad: #e8385a; --warn: #e58a00; --shadow: 0 12px 34px rgba(60,40,140,.14);
  --blob1: #b9a8ff; --blob2: #8fe9ff; --blob3: #ffb3ea;
}
[data-theme="ocean"] { --bg: #03141f; --bg2: #072536; --acc: #00e5c3; --acc2: #3aa0ff; --muted: #8fb5c4; --blob1: #00e5c3; --blob2: #3aa0ff; --blob3: #6b5cff; }
[data-theme="sunset"] { --bg: #1a0b14; --bg2: #2a1220; --acc: #ff7a59; --acc2: #ffcc4d; --muted: #c9a3a8; --blob1: #ff7a59; --blob2: #ffcc4d; --blob3: #ff3d7f; }
[data-theme="neon"] { --bg: #050505; --bg2: #101010; --acc: #39ff14; --acc2: #ff00e6; --muted: #9a9a9a; --blob1: #39ff14; --blob2: #ff00e6; --blob3: #00e0ff; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Cairo', system-ui, sans-serif; background: var(--bg); color: var(--text);
  overflow-x: hidden; -webkit-font-smoothing: antialiased; transition: background .5s, color .5s;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; line-height: 1.25; }
.display { font-family: 'Lalezar', 'Cairo', sans-serif; font-weight: 400; letter-spacing: .3px; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .82rem; }
.row { display: flex; align-items: center; } .gap { gap: 10px; } .grow { flex: 1; } .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; } .mt { margin-top: 14px; } .mt2 { margin-top: 24px; } .mb { margin-bottom: 12px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.hide { display: none !important; }

/* ---------- الخلفية ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; transition: opacity .26s; }
.blobs { position: fixed; inset: 0; z-index: -3; overflow: hidden; pointer-events: none; }
.blobs i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(80px); opacity: .28; animation: blob 22s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { background: var(--blob1); top: -25vmax; right: -20vmax; }
.blobs i:nth-child(2) { background: var(--blob2); bottom: -30vmax; left: -25vmax; animation-duration: 28s; animation-delay: -6s; }
.blobs i:nth-child(3) { background: var(--blob3); top: 30%; left: 30%; width: 35vmax; height: 35vmax; opacity: .14; animation-duration: 34s; }
[data-theme="day"] .blobs i { opacity: .45; }
@keyframes blob { 0% { transform: translate(0,0) scale(1); } 50% { transform: translate(8vmax,6vmax) scale(1.15); } 100% { transform: translate(-6vmax,10vmax) scale(.9); } }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- الشريط العلوي ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 85%, transparent), color-mix(in srgb, var(--bg) 40%, transparent));
}
.avatar { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; flex: none; }
.avatar-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--acc), var(--acc2), var(--acc)); animation: spin 6s linear infinite; }
.avatar-l { position: relative; width: 38px; height: 38px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-family: Lalezar; font-size: 1.35rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.top-mid { flex: 1; min-width: 0; }
.top-hello { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpbar { height: 6px; border-radius: 6px; background: var(--card2); margin-top: 6px; overflow: hidden; }
.xpbar span { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width 1s cubic-bezier(.2,.9,.2,1); box-shadow: 0 0 12px var(--acc2); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card2); border: 1px solid var(--stroke); font-size: .9rem; white-space: nowrap; }
.streak-chip b { font-size: 1rem; }
.streak-chip.hot { animation: hot 1.6s ease-in-out infinite; }
@keyframes hot { 50% { box-shadow: 0 0 22px #ff8a3d88; transform: scale(1.05); } }

/* ---------- المحتوى ---------- */
.view { padding: 6px 16px 20px; max-width: 1040px; margin: 0 auto; }
.view.enter { animation: pageIn .5s cubic-bezier(.2,.9,.2,1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.rv { opacity: 0; transform: translateY(22px); transition: opacity .6s, transform .6s cubic-bezier(.2,.9,.2,1); transition-delay: var(--d, 0ms); }
.rv.in { opacity: 1; transform: none; }

.sec { position: relative; margin-top: 18px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-h h2 { font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.sec-h h2::before { content: ''; width: 8px; height: 22px; border-radius: 4px; background: linear-gradient(var(--acc), var(--acc2)); }

.card {
  position: relative; background: var(--card); border: 1px solid var(--stroke); border-radius: 22px; padding: 16px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); overflow: hidden;
}
.card.glow::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--acc2) 18%, transparent), transparent 60%); }
.tilt { transition: transform .25s ease; transform-style: preserve-3d; will-change: transform; }
/* أشكال عائمة جوه السكاشن */
.floaty { position: absolute; pointer-events: none; opacity: .5; animation: floaty 9s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(20deg); } }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 720px) { .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g-md2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- أزرار ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 14px; border: 1px solid var(--stroke); background: var(--card2); cursor: pointer;
  font-weight: 700; transition: transform .15s, box-shadow .2s, background .2s; user-select: none; min-height: 44px;
}
.btn:active { transform: scale(.95); }
.btn.primary { background: linear-gradient(135deg, var(--acc), var(--acc2)); border: 0; color: #fff; box-shadow: 0 8px 24px color-mix(in srgb, var(--acc) 45%, transparent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; min-height: 36px; border-radius: 11px; font-size: .88rem; }
.btn.icon { width: 44px; padding: 0; }
.btn.danger { color: var(--bad); }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); animation: rip .6s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }
.tap { position: relative; overflow: hidden; cursor: pointer; }

input[type=text], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--stroke); background: var(--card2);
  outline: none; transition: border .2s, box-shadow .2s; font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc) 22%, transparent); }
select option { background: var(--bg2); }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; margin-top: 12px; font-weight: 700; font-size: .9rem; }
label.f > span { display: block; margin-bottom: 6px; color: var(--muted); }

/* سويتش */
.sw { position: relative; width: 52px; height: 30px; flex: none; }
.sw input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw i { position: absolute; inset: 0; border-radius: 99px; background: var(--card2); border: 1px solid var(--stroke); transition: .3s; }
.sw i::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: .3s cubic-bezier(.3,1.5,.5,1); }
.sw input:checked + i { background: linear-gradient(135deg, var(--acc), var(--acc2)); }
.sw input:checked + i::after { right: 25px; background: #fff; }

/* ---------- البار السفلي ---------- */
.nav {
  position: fixed; z-index: 30; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px;
  border-radius: 26px; background: color-mix(in srgb, var(--bg2) 78%, transparent); border: 1px solid var(--stroke);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5); box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.nav a { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px; color: var(--muted); transition: color .3s; }
.nav a .ni { transition: transform .4s cubic-bezier(.3,1.6,.5,1); }
.nav a.on { color: #fff; } [data-theme="day"] .nav a.on { color: #fff; }
.nav a.on .ni { transform: translateY(-2px) scale(1.12); }
.nl { font-size: .7rem; font-weight: 700; }
.nav-blob { position: absolute; top: 7px; bottom: 7px; border-radius: 19px; background: linear-gradient(135deg, var(--acc), var(--acc2)); transition: left .45s cubic-bezier(.3,1.3,.5,1), width .45s; box-shadow: 0 6px 20px color-mix(in srgb, var(--acc) 55%, transparent); }

/* ---------- توست + شيت ---------- */
.toasts { position: fixed; z-index: 60; top: calc(70px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--bg2) 92%, transparent); border: 1px solid var(--stroke); box-shadow: var(--shadow); backdrop-filter: blur(14px); animation: tIn .45s cubic-bezier(.3,1.5,.5,1); font-weight: 700; }
.toast.out { animation: tOut .35s forwards; }
.toast-i { font-size: 1.4rem; }
.toast.gold { border-color: #ffb54788; box-shadow: 0 0 30px #ffb54744; }
@keyframes tIn { from { opacity: 0; transform: translateY(-20px) scale(.9); } }
@keyframes tOut { to { opacity: 0; transform: translateY(-14px) scale(.95); } }

.sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet.open { pointer-events: auto; }
.sheet-back { position: absolute; inset: 0; background: rgba(5,3,15,.55); opacity: 0; transition: opacity .3s; backdrop-filter: blur(3px); }
.sheet.open .sheet-back { opacity: 1; }
.sheet-panel {
  position: absolute; bottom: 0; left: 50%; width: min(620px, 100%); max-height: 88vh; overflow: auto; translate: -50% 0;
  background: var(--bg2); border: 1px solid var(--stroke); border-radius: 28px 28px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .4s cubic-bezier(.2,.9,.2,1); box-shadow: 0 -20px 60px rgba(0,0,0,.4);
}
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-grip { width: 100%; height: 26px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-grip::after { content: ''; width: 46px; height: 5px; border-radius: 5px; background: var(--stroke); }
.sheet-title { font-size: 1.2rem; margin-bottom: 6px; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

/* ---------- حلقة التقدم ---------- */
.ring-bar { transition: stroke-dashoffset 1.4s cubic-bezier(.2,.9,.2,1); }
.ring-txt { fill: var(--text); font-weight: 900; font-family: Cairo; }

/* ================= الصفحة الرئيسية ================= */
.hero { padding: 22px 18px; min-height: 190px; }
.hero h1 { font-size: clamp(1.9rem, 7vw, 3rem); }
.hero h1 .name { background: linear-gradient(90deg, var(--acc), var(--acc2), var(--acc)); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 4s linear infinite; }
@keyframes shine { to { background-position: 200% center; } }
.hero .sub { margin-top: 6px; min-height: 1.6em; }
.hero .sub::after { content: '|'; animation: blink 1s steps(1) infinite; margin-inline-start: 2px; color: var(--acc2); }
.hero .sub.typed::after { display: none; }
@keyframes blink { 50% { opacity: 0; } }
.hero .orb { position: absolute; left: -30px; top: -30px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, var(--acc2), var(--acc) 60%, transparent 70%); opacity: .35; filter: blur(8px); animation: floaty 7s ease-in-out infinite; }

.countdown { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.cd-u { text-align: center; }
.flipd { position: relative; min-width: 62px; height: 72px; border-radius: 14px; background: linear-gradient(180deg, var(--card2) 50%, var(--card) 50%); border: 1px solid var(--stroke); display: grid; place-items: center; font-family: Lalezar; font-size: 2.3rem; perspective: 300px; overflow: hidden; }
.flipd::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0,0,0,.35); }
.flipd span { display: inline-block; }
.flipd.tick span { animation: flipNum .5s cubic-bezier(.3,1.4,.5,1); }
@keyframes flipNum { from { transform: rotateX(-90deg); opacity: .2; } }
.cd-l { font-size: .75rem; color: var(--muted); margin-top: 4px; font-weight: 700; }

.quote { font-size: 1.1rem; line-height: 1.8; padding-inline-start: 34px; }
.quote::before { content: '❝'; position: absolute; right: 14px; top: 6px; font-size: 2.2rem; color: var(--acc2); opacity: .7; }

.stat { padding: 14px; text-align: center; }
.stat .n { font-family: Lalezar; font-size: 2rem; line-height: 1.1; }
.stat .l { font-size: .8rem; color: var(--muted); font-weight: 700; }

.mood-row { display: flex; justify-content: space-between; gap: 6px; }
.mood { flex: 1; display: grid; place-items: center; gap: 2px; padding: 8px 2px; border-radius: 14px; border: 1px solid transparent; background: transparent; cursor: pointer; transition: .25s; }
.mood b { font-size: 1.7rem; transition: transform .3s cubic-bezier(.3,1.8,.5,1); }
.mood span { font-size: .68rem; color: var(--muted); }
.mood.on { background: var(--card2); border-color: var(--acc); }
.mood.on b { transform: scale(1.3) rotate(-8deg); }

/* مهام */
.task { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed var(--stroke); }
.task:last-child { border: 0; }
.task .tx { flex: 1; min-width: 0; transition: .3s; }
.task.done .tx { text-decoration: line-through; color: var(--muted); }
.cbx { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--stroke); display: grid; place-items: center; flex: none; cursor: pointer; transition: .25s; background: transparent; padding: 0; color: #fff; }
.cbx svg { opacity: 0; transform: scale(.3); transition: .3s cubic-bezier(.3,1.8,.5,1); }
.on > .cbx, .cbx.on { background: linear-gradient(135deg, var(--acc), var(--acc2)); border-color: transparent; }
.on > .cbx svg, .cbx.on svg { opacity: 1; transform: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }

.next-class { display: flex; align-items: center; gap: 12px; }
.next-class .big { font-family: Lalezar; font-size: 1.6rem; }

/* ================= المواد ================= */
.subj-card { display: block; padding: 18px; min-height: 150px; border-radius: 24px; color: var(--text); }
.subj-card .glyph { position: absolute; left: -6px; bottom: -22px; font-family: Lalezar; font-size: 6.5rem; opacity: .14; line-height: 1; transition: transform .6s; }
.subj-card:hover .glyph { transform: rotate(-12deg) scale(1.1); }
.subj-card h3 { font-size: 1.25rem; }
.subj-card .bar { height: 8px; border-radius: 8px; background: var(--card2); margin-top: 12px; overflow: hidden; }
.subj-card .bar i { display: block; height: 100%; width: 0; border-radius: 8px; transition: width 1.2s cubic-bezier(.2,.9,.2,1); }
.subj-card::after { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, var(--sc), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.subj-badge { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-family: Lalezar; font-size: 1.4rem; color: #10091f; flex: none; box-shadow: 0 8px 22px -6px var(--sc); }

.subj-head { padding: 20px 18px; }
.subj-head h1 { font-size: 1.8rem; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; margin: 4px 0 6px; }

.chapter { margin-top: 12px; padding: 0; }
.ch-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; }
.ch-head h3 { font-size: 1rem; flex: 1; }
.ch-head .arr { transition: transform .35s; color: var(--muted); }
.chapter.open .ch-head .arr { transform: rotate(90deg); }
.ch-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s cubic-bezier(.2,.9,.2,1); }
.chapter.open .ch-body { grid-template-rows: 1fr; }
.ch-body > div { overflow: hidden; }
.lesson { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--stroke); flex-wrap: wrap; }
.lesson .lt { flex: 1 1 140px; min-width: 0; font-weight: 600; }
.lesson.full .lt { color: var(--good); }
.steps { display: flex; gap: 6px; }
.step { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--stroke); background: transparent; font-size: .78rem; font-weight: 800; cursor: pointer; transition: .25s; color: var(--muted); min-height: 34px; }
.step.on { color: #10091f; background: var(--sc, var(--acc)); border-color: transparent; transform: scale(1.04); box-shadow: 0 4px 14px -4px var(--sc); }
.step.pop { animation: pop .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes pop { 40% { transform: scale(1.3); } }
.l-tools { display: flex; gap: 2px; }
.l-tools .btn { width: 34px; min-height: 34px; padding: 0; border-radius: 10px; background: transparent; border: 0; color: var(--muted); }
.l-tools .has { color: var(--acc2); }

/* ================= التركيز ================= */
.timer-wrap { display: grid; place-items: center; padding: 10px 0; }
.timer { position: relative; width: min(78vw, 320px); aspect-ratio: 1; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer .track { stroke: var(--stroke); }
.timer .prog { transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 10px var(--acc2)); }
.timer .mid { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.timer .time { font-family: Lalezar; font-size: clamp(3.2rem, 16vw, 4.6rem); line-height: 1; direction: ltr; }
.timer .phase { color: var(--muted); font-weight: 700; }
.timer .pulse { position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--acc) 30%, transparent), transparent 70%); animation: breathe 4s ease-in-out infinite; }
.running .timer .pulse { animation-duration: 2.5s; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .5; } }
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--card); cursor: pointer; font-weight: 700; transition: .25s; }
.pill.on { background: var(--sc, var(--acc)); color: #10091f; border-color: transparent; transform: translateY(-2px); box-shadow: 0 6px 16px -6px var(--sc, var(--acc)); }
body.zen .topbar, body.zen .nav, body.zen .zen-hide { opacity: 0; pointer-events: none; transition: opacity .6s; }
body.zen .zen-exit { display: inline-flex !important; }

/* ================= المراجعة ================= */
.tool { padding: 16px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.tool .ti { font-size: 2rem; transition: transform .4s cubic-bezier(.3,1.8,.5,1); }
.tool:hover .ti, .tool:active .ti { transform: scale(1.2) rotate(-10deg); }
.tool b { font-size: 1.05rem; }
.fc-stage { perspective: 1200px; margin: 10px auto; max-width: 520px; }
.fc { position: relative; height: 260px; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3,1.3,.5,1); cursor: pointer; }
.fc.flip { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 26px; display: grid; place-items: center; padding: 22px; text-align: center; font-size: 1.25rem; font-weight: 800; border: 1px solid var(--stroke); box-shadow: var(--shadow); }
.fc-front { background: linear-gradient(145deg, var(--bg2), color-mix(in srgb, var(--sc, var(--acc)) 18%, var(--bg2))); }
.fc-back { transform: rotateY(180deg); background: linear-gradient(145deg, color-mix(in srgb, var(--sc, var(--acc)) 28%, var(--bg2)), var(--bg2)); font-size: 1.15rem; }
.fc-face small { position: absolute; top: 14px; right: 16px; font-size: .75rem; color: var(--muted); }
.fc.out-l { animation: outL .4s forwards; } .fc.out-r { animation: outR .4s forwards; }
@keyframes outL { to { transform: translateX(-120%) rotate(-14deg); opacity: 0; } }
@keyframes outR { to { transform: translateX(120%) rotate(14deg); opacity: 0; } }
.boxes { display: flex; gap: 6px; justify-content: center; }
.boxes span { padding: 4px 10px; border-radius: 10px; background: var(--card2); font-size: .78rem; font-weight: 700; }
.formula { padding: 14px 16px; }
.formula .fq { color: var(--muted); font-size: .88rem; font-weight: 700; }
.formula .fa { font-size: 1.15rem; font-weight: 800; margin-top: 4px; direction: ltr; text-align: right; unicode-bidi: plaintext; }
.qopt { width: 100%; text-align: right; justify-content: flex-start; margin-top: 8px; padding: 14px; }
.qopt.right { background: color-mix(in srgb, var(--good) 25%, transparent); border-color: var(--good); }
.qopt.wrong { background: color-mix(in srgb, var(--bad) 25%, transparent); border-color: var(--bad); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }
.qbar { height: 6px; border-radius: 6px; background: var(--card2); overflow: hidden; }
.qbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .4s; }
.ptable { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; direction: ltr; }
.el { aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--stroke); background: var(--card); display: grid; place-items: center; align-content: center; cursor: pointer; transition: .3s cubic-bezier(.3,1.6,.5,1); }
.el b { font-size: 1.4rem; line-height: 1; } .el small { font-size: .65rem; color: var(--muted); }
.el:hover, .el.on { transform: translateY(-4px) scale(1.06); border-color: var(--sc, var(--acc)); box-shadow: 0 10px 24px -8px var(--sc, var(--acc)); }
.mist { padding: 14px; } .mist .fix { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--good) 14%, transparent); }
.mist.ok { opacity: .55; }

/* ================= خطتي ================= */
.week { display: grid; gap: 10px; }
.day-col { padding: 12px; }
.day-col h4 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.day-col.today { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc), var(--shadow); }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--card2); margin-top: 6px; border-inline-start: 4px solid var(--sc); }
.slot .tm { font-weight: 900; direction: ltr; }
.plan-day { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--stroke); }
.plan-day:last-child { border: 0; }
.plan-day .dd { width: 58px; flex: none; text-align: center; }
.plan-day .dd b { display: block; font-family: Lalezar; font-size: 1.5rem; line-height: 1.1; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: color-mix(in srgb, var(--sc) 20%, transparent); border: 1px solid color-mix(in srgb, var(--sc) 40%, transparent); margin: 3px 0 0 4px; }

/* ================= صفحتي ================= */
.me-head { display: flex; align-items: center; gap: 16px; padding: 20px; }
.big-av { width: 86px; height: 86px; border-radius: 28px; display: grid; place-items: center; font-family: Lalezar; font-size: 2.8rem; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; animation: morph 8s ease-in-out infinite; flex: none; }
@keyframes morph { 0%,100% { border-radius: 28px; transform: rotate(0); } 33% { border-radius: 50% 30% 50% 30%; transform: rotate(6deg); } 66% { border-radius: 30% 50% 30% 50%; transform: rotate(-6deg); } }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 6px; direction: ltr; }
.heat i { width: 13px; height: 13px; border-radius: 3px; background: var(--card2); }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--acc2) 30%, transparent); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--acc2) 55%, transparent); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--acc2) 80%, transparent); }
.heat i[data-l="4"] { background: var(--acc2); box-shadow: 0 0 8px var(--acc2); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; max-width: 34px; border-radius: 10px 10px 4px 4px; background: linear-gradient(var(--acc2), var(--acc)); height: 0; transition: height 1s cubic-bezier(.2,.9,.2,1); min-height: 3px; }
.bars .b small { font-size: .68rem; color: var(--muted); font-weight: 700; }
.bars .b em { font-style: normal; font-size: .7rem; font-weight: 800; }
.badge { padding: 12px 6px; text-align: center; border-radius: 18px; }
.badge .bi { font-size: 2rem; display: block; filter: grayscale(1); opacity: .35; transition: .4s; }
.badge.got .bi { filter: none; opacity: 1; animation: floaty 5s ease-in-out infinite; }
.badge b { font-size: .8rem; display: block; margin-top: 4px; } .badge small { font-size: .66rem; color: var(--muted); }
.g4 { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (min-width: 620px) { .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.theme-sw { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-sw button { position: relative; width: 64px; height: 64px; border-radius: 18px; border: 2px solid var(--stroke); cursor: pointer; padding: 0; overflow: hidden; }
.theme-sw button.on { border-color: var(--acc2); transform: scale(1.06); }
.theme-sw button[disabled] { opacity: .45; cursor: not-allowed; }
.theme-sw small { position: absolute; bottom: 2px; left: 0; right: 0; font-size: .62rem; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--stroke); }
.set-row:last-child { border: 0; }
.set-row .grow b { display: block; } .set-row .grow small { color: var(--muted); }
.calc-row { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; margin-top: 8px; }
.gauge { position: relative; height: 16px; border-radius: 16px; background: var(--card2); overflow: visible; margin: 18px 0 8px; }
.gauge i { display: block; height: 100%; border-radius: 16px; background: linear-gradient(90deg, var(--bad), var(--warn), var(--good)); transition: width 1s; }
.gauge .tgt { position: absolute; top: -8px; bottom: -8px; width: 3px; background: var(--text); border-radius: 3px; }
.gauge .tgt::after { content: 'هدفك'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.line-chart { width: 100%; height: 160px; }

/* ================= أول مرة ================= */
.onb { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.onb .card { width: 100%; max-width: 480px; padding: 26px 20px; }
.onb .wave { font-size: 3.4rem; display: inline-block; animation: wave 2s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 10%,30% { transform: rotate(14deg); } 20%,40% { transform: rotate(-8deg); } }
.coll { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.empty { text-align: center; padding: 22px 10px; color: var(--muted); }
.empty .e { font-size: 2.6rem; display: block; animation: floaty 4s ease-in-out infinite; }

@media (min-width: 760px) {
  .view { padding: 12px 28px 30px; }
  .hero { padding: 30px; min-height: 220px; }
  .week { grid-template-columns: repeat(2, 1fr); }
  .fc { height: 300px; }
  .ptable { grid-template-columns: repeat(10, 1fr); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ================= v2: أيقونات Phosphor + لمسات ستايل ================= */
[class^="ph-"], [class*=" ph-"] { line-height: 1; vertical-align: -0.14em; }
.ic { display: inline-block; }
.nav .ni .ic { font-size: 24px !important; }
.nav a.on .ni i { animation: navPop .5s cubic-bezier(.3,1.8,.5,1); }
@keyframes navPop { 40% { transform: scale(1.35) rotate(-10deg); } }

/* مربع أيقونة متدرج */
.it {
  --g1: var(--acc); --g2: var(--acc2);
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 46px; height: 46px; border-radius: 15px; font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 10px 22px -8px var(--g1), inset 0 1px 0 rgba(255,255,255,.35);
}
.it::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(160deg, rgba(255,255,255,.35), transparent 45%); pointer-events: none; }
.it.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; }
.set-row:nth-child(5n+2) .it { --g1: #ff5d8f; --g2: #ff9a62; }
.set-row:nth-child(5n+3) .it { --g1: #00c2a8; --g2: #3ee6ff; }
.set-row:nth-child(5n+4) .it { --g1: #ffb547; --g2: #ff7a3d; }
.set-row:nth-child(5n+5) .it { --g1: #b98bff; --g2: #ff5ce1; }

/* حدود متدرجة رفيعة لكل الكروت + لمعة فوق */
.card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--sc, var(--acc2)) 55%, transparent), transparent 35%, transparent 65%, color-mix(in srgb, var(--acc) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.card { border-color: transparent; background: linear-gradient(160deg, var(--card2), var(--card) 40%); }

.sec-h h2 { font-family: 'Lalezar', 'Cairo', sans-serif; font-weight: 400; font-size: 1.45rem; letter-spacing: .3px; }
.sec-h h2::before { width: 10px; height: 10px; border-radius: 3px; transform: rotate(45deg); box-shadow: 0 0 14px var(--acc2); }

/* هيرو: حلقة بتلف */
.hero::after { content: ''; position: absolute; width: 220px; height: 220px; left: -60px; bottom: -110px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, var(--acc2), transparent 40%, var(--acc), transparent 75%); opacity: .35;
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%); animation: spin 9s linear infinite; padding: 0; }

/* الإحصائيات */
.stat { display: grid; justify-items: center; gap: 6px; }
.stat .n { font-size: 2.2rem; }

/* أدوات المراجعة */
.tool .it { width: 54px; height: 54px; font-size: 30px; border-radius: 18px; }
.tool:nth-child(6n+2) .it { --g1: #ffb547; --g2: #ff5d8f; }
.tool:nth-child(6n+3) .it { --g1: #3ee6ff; --g2: #3d7bff; }
.tool:nth-child(6n+4) .it { --g1: #ff5d8f; --g2: #b98bff; }
.tool:nth-child(6n+5) .it { --g1: #b98bff; --g2: #ff5ce1; }
.tool:nth-child(6n+6) .it { --g1: #4dffa6; --g2: #00c2a8; }
.tool .ti { font-size: inherit; }

/* المواد */
.subj-badge { font-size: 1.5rem; color: #fff; }
.subj-card .glyph { font-size: 7.5rem; left: -10px; bottom: -26px; opacity: .13; }

/* المود */
.mood b { font-size: 2rem; color: var(--muted); }
.mood.on b { color: var(--acc2); }
.mood:nth-child(1).on b { color: #ff7a8a; } .mood:nth-child(2).on b { color: #ffb547; } .mood:nth-child(5).on b { color: #4dffa6; }

/* الأوسمة: ميدالية */
.badge .bi { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; font-size: 28px; background: var(--card2); color: var(--muted); filter: none; opacity: .5; }
.badge.got .bi { opacity: 1; color: #fff; background: conic-gradient(from 210deg, #ffd24d, #ff8a3d, #ff5d8f, #b98bff, #3ee6ff, #ffd24d); box-shadow: 0 0 0 3px var(--bg2), 0 0 0 5px #ffd24d66, 0 10px 24px -6px #ff8a3d; }

/* حالات فاضية + توست */
.empty .e { font-size: 3rem; color: var(--acc2); }
.toast-i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 22px; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); flex: none; }
.toast.gold .toast-i { background: linear-gradient(135deg, #ffd24d, #ff8a3d); }

/* زرار أساسي بلمعة */
.btn.primary::before { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); animation: sheen 3.8s ease-in-out infinite; }
@keyframes sheen { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.wave i { color: #ffb547; }
.onb .card > div > i, .onb h2 + * { }
.chip i { color: var(--acc2); }
.streak-chip i { color: #ff8a3d; }
