@font-face { font-family: "Readex Pro"; src: url("fonts/readex-ar.woff2") format("woff2"); font-weight: 160 700; unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC, U+200C-200E; }
@font-face { font-family: "Readex Pro"; src: url("fonts/readex-lat.woff2") format("woff2"); font-weight: 160 700; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Sora"; src: url("fonts/sora-lat.woff2") format("woff2"); font-weight: 100 800; unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+20AC; }

:root {
    --text: #f5f2fa;
    --dim: rgba(245, 242, 250, 0.72);
    --faint: rgba(245, 242, 250, 0.5);
    --card: #232029;
    --card-2: #2b2733;
    --card-border: rgba(255, 255, 255, 0.09);
    --green: #34c759; --red: #cd5c5c; --amber: #e8c85a; --blue: #4c9db0; --wisteria: #c69fd5; --pink: #ffbdc5; --orange: #e85d25;
    --radius: 26px;
    --accent: #ffbdc5;
}

/* خلفية لكل صفحة من تجميعات البوست، زي خلفيات الايفون */
body[data-tab="today"]    { --accent: #ffbdc5; background: radial-gradient(130% 90% at 85% 100%, rgba(255,189,197,0.32), rgba(255,189,197,0) 60%), linear-gradient(165deg, #3d0a24 0%, #670626 48%, #2a0a1c 100%); }
body[data-tab="agenda"]   { --accent: #7cc4d6; background: radial-gradient(130% 90% at 82% 100%, rgba(76,157,176,0.38), rgba(76,157,176,0) 60%), linear-gradient(165deg, #07242e 0%, #0d3a4a 48%, #0a2833 100%); }
body[data-tab="progress"] { --accent: #c69fd5; background: radial-gradient(130% 90% at 82% 100%, rgba(198,159,213,0.34), rgba(198,159,213,0) 60%), linear-gradient(165deg, #1d1030 0%, #3a2354 48%, #241437 100%); }
body[data-tab="build"]    { --accent: #f08a54; background: radial-gradient(130% 90% at 82% 100%, rgba(232,93,37,0.38), rgba(232,93,37,0) 60%), linear-gradient(165deg, #2a0e08 0%, #6b2412 48%, #33100a 100%); }
body[data-tab="recovery"] { --accent: #8fc7a5; background: radial-gradient(130% 90% at 82% 100%, rgba(90,140,110,0.4), rgba(90,140,110,0) 62%), linear-gradient(165deg, #081b15 0%, #1d4034 48%, #0f2a21 100%); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
    color: var(--text);
    font-family: "Readex Pro", -apple-system, "Geeza Pro", sans-serif;
    background-attachment: fixed;
}

#root { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 20px 16px 120px; }

/* كروت أمامية معتمة ونضيفة، من غير شفافية ولا تدرج */
.glass {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

/* Header */
.hdr { padding: 6px 4px 16px; }
.hdr .hello { font-size: 15px; color: var(--dim); font-weight: 500; }
.hdr h1 { margin: 2px 0 4px; font-size: 34px; font-weight: 700; line-height: 1.15; color: #ffffff; }
.hdr .date { font-size: 13.5px; color: var(--faint); font-weight: 500; }

.sec-title { display: flex; align-items: center; gap: 8px; margin: 22px 4px 10px; font-size: 16px; font-weight: 700; }
.sec-title svg { flex: 0 0 auto; stroke: var(--accent); }
.sec-title .hint { margin-inline-start: auto; font-size: 11.5px; color: var(--faint); font-weight: 500; }

.card { padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.card p { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--dim); }

/* Countdown card */
.count { display: flex; align-items: center; gap: 14px; }
.count .days {
    flex: 0 0 auto; width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center;
    background: var(--blue); border: none; text-align: center; color: #ffffff;
}
.count .days b { display: block; font-size: 26px; line-height: 1; }
.count .days span { font-size: 10.5px; color: rgba(255,255,255,0.85); }
.count .info { flex: 1; min-width: 0; }
.count .info .t { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.count .info .s { font-size: 12px; color: var(--dim); }

/* Basics chips */
.basics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.basic {
    border: 1px solid var(--card-border); border-radius: 18px; padding: 10px 4px; text-align: center;
    background: var(--card-2); cursor: pointer; color: var(--dim); transition: 0.2s;
    font-family: inherit; font-size: 12.5px; font-weight: 600;
}
.basic svg { display: block; margin: 0 auto 5px; }
.basic.on { color: #06220f; background: var(--green); border-color: transparent; }
.basic.on svg { stroke: #06220f; }

/* Task rows */
.task { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 8px; }
.task .box {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 9px; border: 1.5px solid rgba(255,255,255,0.35);
    display: grid; place-items: center; transition: 0.2s;
}
.task.done .box { background: var(--green); border-color: transparent; }
.task .box svg { opacity: 0; transition: 0.15s; }
.task.done .box svg { opacity: 1; }
.task .t { flex: 1; font-size: 14.5px; font-weight: 600; }
.task.done .t { color: var(--faint); text-decoration: line-through; }
.tag { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: var(--wisteria); color: #241233; border: none; white-space: nowrap; }
.tag.exam { background: var(--red); color: #ffffff; }
.tag.amber { background: var(--amber); color: #33270a; }
.tag.blue { background: var(--blue); color: #ffffff; }
.task.dimmed { opacity: 0.35; }

/* Buttons */
.btn {
    display: block; width: 100%; padding: 14px; border: none; border-radius: 18px; cursor: pointer;
    font-family: inherit; font-size: 15px; font-weight: 700; color: #ffffff;
    background: var(--blue); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.btn.ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--card-border); box-shadow: none; }
.btn.small { width: auto; padding: 8px 16px; font-size: 13px; border-radius: 14px; }

/* Plan line */
.plan { border-inline-start: 3px solid var(--blue); padding-inline-start: 12px; }

/* Exam mode banner */
.exam-banner { background: #3a1d22; border-color: rgba(205, 92, 92, 0.5); }
.exam-banner h3 { color: #f0a0a0; }

/* Events */
.ev { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; }
.ev .d { flex: 0 0 auto; width: 52px; text-align: center; border-radius: 16px; padding: 8px 0; background: var(--card-2); border: 1px solid var(--card-border); }
.ev .d b { display: block; font-size: 19px; }
.ev .d span { font-size: 10px; color: var(--dim); }
.ev .i { flex: 1; min-width: 0; }
.ev .i .t { font-size: 14px; font-weight: 700; }
.ev .i .s { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.ev .left { font-size: 11px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Forms */
.f-row { display: flex; gap: 8px; margin-bottom: 8px; }
.f-row > * { min-width: 0; }
input, select, textarea {
    width: 100%; padding: 11px 13px; border-radius: 15px; border: 1px solid var(--card-border);
    background: var(--card-2); color: var(--text); font-family: inherit; font-size: 13.5px;
    outline: none; resize: vertical;
}
select option { background: #232029; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: rgba(124, 196, 214, 0.6); }
::placeholder { color: var(--faint); }
label.lbl { display: block; font-size: 12px; color: var(--dim); margin: 10px 2px 6px; font-weight: 600; }

/* Progress */
.rate { display: flex; align-items: center; gap: 16px; }
.ring { flex: 0 0 auto; width: 92px; height: 92px; }
.ring .num { font-size: 24px; font-weight: 700; fill: var(--text); }
.ring .cap { font-size: 8px; fill: var(--dim); }
.rate .side { flex: 1; }
.rate .side .big { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.rate .side .s { font-size: 12.5px; color: var(--dim); line-height: 1.8; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 110px; padding: 10px 6px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar .col { width: 100%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: var(--blue); min-height: 4px; }
.bar.low .col { background: var(--red); }
.bar.today .col { background: var(--wisteria); }
.bar span { font-size: 10px; color: var(--faint); }

.streak { display: flex; align-items: center; gap: 12px; }
.streak .fire { font-size: 30px; }
.streak .n { font-size: 22px; font-weight: 800; color: var(--amber); }
.streak .s { font-size: 12px; color: var(--dim); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 8px 14px; border-radius: 20px; border: 1px solid var(--card-border); cursor: pointer;
    background: var(--card-2); color: var(--dim); font-family: inherit; font-size: 12.5px; font-weight: 600; transition: 0.2s;
}
.chip.on { background: var(--blue); color: #ffffff; border-color: transparent; }

.esc { display: flex; flex-direction: column; gap: 0; }
.esc .step { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.esc .step::before { content: ""; position: absolute; inset-inline-start: 13px; top: 28px; bottom: 0; width: 2px; background: rgba(255,255,255,0.12); }
.esc .step:last-child { padding-bottom: 0; }
.esc .step:last-child::before { display: none; }
.esc .dot { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--card-2); border: 1px solid var(--card-border); z-index: 1; }
.esc .step.s2 .dot { background: var(--amber); color: #33270a; border-color: transparent; }
.esc .step.s3 .dot { background: var(--red); color: #ffffff; border-color: transparent; }
.esc .t { font-size: 13.5px; font-weight: 700; }
.esc .d { font-size: 12px; color: var(--dim); line-height: 1.7; margin-top: 2px; }

/* Lessons */
.lesson-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 20px; margin-bottom: 10px; }
.lesson-kind.build { background: var(--blue); color: #ffffff; border: none; }
.lesson-kind.rec { background: var(--pink); color: #3a1420; border: none; }
.lesson-body { font-size: 13.5px; line-height: 1.9; color: var(--dim); }
.lesson-body b { color: var(--text); }

.q-card textarea { min-height: 76px; }
.saved-note { font-size: 11px; color: #6fdc93; margin-top: 6px; opacity: 0; transition: 0.3s; }
.saved-note.show { opacity: 1; }

/* Rewards */
.reward { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; }
.reward .ic { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--amber); color: #33270a; border: none; font-size: 18px; }
.reward .t { flex: 1; font-size: 14px; font-weight: 600; }
.reward .p { font-size: 11.5px; color: var(--faint); }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 6, 18, 0.78); display: grid; place-items: center; padding: 24px; }
.modal { width: 100%; max-width: 340px; padding: 26px 20px; text-align: center; }
.modal .halo { width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; background: var(--blue); }
.modal h2 { margin: 0 0 6px; font-size: 21px; }
.modal p { font-size: 13.5px; color: var(--dim); line-height: 1.8; margin: 0 0 16px; }

/* Tab bar */
.tabbar {
    position: fixed; bottom: 14px; inset-inline: 0; margin: 0 auto; max-width: 480px; width: calc(100% - 28px);
    display: flex; z-index: 50; padding: 8px; border-radius: 24px;
    background: rgba(18, 15, 24, 0.94);
    border: 1px solid var(--card-border);
}
.tab {
    flex: 1; border: none; background: none; cursor: pointer; color: var(--faint); font-family: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 5px; border-radius: 17px; transition: 0.2s;
}
.tab span { font-size: 10.5px; font-weight: 700; }
.tab.on { color: var(--text); background: var(--card-2); }
.tab.on svg { stroke: var(--accent); }

.note { font-size: 11.5px; color: var(--faint); line-height: 1.8; padding: 0 4px; }
.divider { height: 1px; background: rgba(255,255,255,0.09); margin: 14px 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 46px; height: 27px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.knob { position: absolute; inset: 0; border-radius: 30px; background: var(--card-2); border: 1px solid var(--card-border); transition: 0.25s; cursor: pointer; }
.knob::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: 0.25s; }
.switch input:checked + .knob { background: var(--green); border-color: transparent; }
.switch input:checked + .knob::after { transform: translateX(-19px); }
[dir="rtl"] .switch input:checked + .knob::after { transform: translateX(-19px); }
