:root {
	--bg: #0e0f12;
	--card: #16181d;
	--card-2: #15130f;
	--line: #23252b;
	--line-2: #262420;
	--gold: #c9a96e;
	--gold-2: #e3c58c;
	--gold-line: #4a3f2c;
	--gold-soft: #3a3226;
	--text: #f3eee4;
	--text-2: #b9b2a3;
	--muted: #8e8778;
	--coral: #e8a08a;
	--dim: #5b564c;
	color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
	font-family: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.5;
	min-height: 100vh;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 560px; margin: 0 auto; padding: 22px 16px 40px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: var(--text); background: none; border: 0; outline: none; }
.muted { color: var(--muted); font-size: 12px; }
.gold { color: var(--gold); }
.coral { color: var(--coral); }
svg { width: 1em; height: 1em; display: block; }

.top { display: flex; justify-content: space-between; align-items: flex-start; padding: 4px 4px 0; }
.top h1 { font-size: 23px; font-weight: 500; margin: 2px 0 0; }
.round { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-size: 18px; }
.round.spin svg { animation: spin 0.8s linear; }
@keyframes spin { to { transform: rotate(-360deg); } }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.num { font-size: 24px; font-weight: 500; }

.sec { display: flex; align-items: center; gap: 8px; margin: 24px 4px 10px; font-size: 13px; color: var(--text-2); }
.sec .line { flex: 1; height: 1px; background: var(--line-2); }
.sec .icon { font-size: 15px; }
.empty { color: var(--dim); font-size: 13px; padding: 6px 6px 2px; }

.card {
	display: flex; align-items: center; gap: 12px;
	background: var(--card); border: 1px solid var(--line); border-radius: 16px;
	padding: 13px 14px; margin-bottom: 8px;
	user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
	transition: opacity 0.3s, transform 0.3s;
}
.card.gone { opacity: 0; transform: translateX(-24px); }
.card.pressing { transform: scale(0.985); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.body { flex: 1; min-width: 0; }
.title { font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.open .title { white-space: normal; }
.meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.reason { display: none; color: var(--text-2); font-size: 12px; margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 6px; }
.card.open .reason { display: block; }
.deadline { color: var(--gold-2); }
.check { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--gold-line); color: var(--gold); display: grid; place-items: center; flex: none; font-size: 16px; }
.check:active { background: var(--gold-soft); }
.play { width: 32px; height: 32px; border-radius: 50%; background: #2a2419; color: var(--gold-2); display: grid; place-items: center; flex: none; font-size: 13px; }
.more { width: 100%; padding: 8px; color: var(--muted); font-size: 13px; }

.teach { background: var(--card-2); border: 1px solid var(--gold-soft); border-radius: 16px; padding: 13px 14px; margin-bottom: 8px; }
.teach .q { color: var(--text); margin: 6px 0 2px; }
.teach .said { color: var(--muted); font-size: 12px; margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; gap: 8px; }
.chip { font-size: 13px; padding: 6px 18px; border-radius: 999px; border: 1px solid var(--gold-line); color: var(--gold-2); }
.chip:active { background: var(--gold-soft); }

.rule { margin-top: 24px; display: flex; gap: 10px; align-items: center; border: 1px dashed var(--gold-soft); border-radius: 16px; padding: 10px 14px; }
.rule input { flex: 1; min-width: 0; font-size: 14px; }
.rule input::placeholder { color: var(--muted); }
.rule .icon { font-size: 16px; }
.send { color: var(--gold); font-size: 17px; padding: 4px; }
.hint { text-align: center; margin-top: 14px; }

.sheet-bg { position: fixed; inset: 0; background: rgb(0 0 0 / 0.55); }
.sheet {
	position: fixed; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
	background: #121317; border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
	padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
	display: flex; flex-direction: column; gap: 4px;
}
.sheet[hidden], .sheet-bg[hidden], .toast[hidden] { display: none; }
.sheet-title { color: var(--text-2); font-size: 13px; padding: 0 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet > button { display: flex; gap: 12px; align-items: center; padding: 13px 10px; border-radius: 12px; text-align: start; }
.sheet > button:active { background: var(--card); }
.sheet > button span { color: var(--gold); font-size: 17px; }
.sheet-row { display: flex; gap: 8px; align-items: center; padding: 10px; }
.sheet .cancel { justify-content: center; color: var(--muted); margin-top: 4px; }

.toast {
	position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
	background: #1d1a14; color: var(--gold-2); border: 1px solid var(--gold-soft); border-radius: 999px;
	padding: 9px 18px; font-size: 13px; white-space: nowrap;
}

/* Login page */
.login { max-width: 360px; margin: 0 auto; padding: 18vh 24px 40px; text-align: center; }
.login .mark { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 18px; display: block; }
.login h1 { font-size: 22px; font-weight: 500; margin: 0 0 4px; }
.login form { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.login input { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; text-align: center; font-size: 16px; }
.login input:focus { border-color: var(--gold-line); }
.login button { background: var(--gold); color: #1a150c; border-radius: 14px; padding: 13px; font-weight: 500; }
.login .err { color: var(--coral); font-size: 13px; min-height: 1.5em; }

/* Notifications panel */
.top-btns { display: flex; gap: 8px; }
.round.off { color: var(--dim); border-color: var(--line); }
.sheet-head { font-size: 16px; padding: 0 6px 8px; }
.setup { border-top: 1px solid var(--line-2); margin-top: 8px; padding: 12px 6px 4px; font-size: 14px; color: var(--text-2); }
.setup ol { margin: 8px 0; padding-inline-start: 20px; }
.setup li { margin-bottom: 4px; }
.setup b { color: var(--text); font-weight: 500; }
.topic { display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 8px 0; direction: ltr; }
.topic code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; color: var(--gold-2); }
