/* The installed app and notifications (Features/Push): the bell of the header (.header-bell), the page /notifications
   (.pwa-page, «الإشعارات» .pwa-push, also on /admin/push/setup) and its link card on /me and /parent (.pwa-link), the
   timely prompt (.pwa-prompt), «نزّل التطبيق» (.pwa-install) on /me and the home page, and the page /app (.pwa-app). */

/* The «نزّل التطبيق» links (header, tab bar, footer, visitor home) go in the installed app. The attribute is set by
   js/elements.js for iPhone Safari's navigator.standalone. */
@media (display-mode: standalone) {
    :root [data-install-link] { display: none; }
}
:root[data-standalone] [data-install-link] { display: none; }

/* The bell: the same size as «التطبيق» next to it; the red dot while this browser does not get notifications. */
.header-bell-wrap { display: contents; }
.header-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 14px;
    color: var(--on-console);
}
.header-bell:hover { background: rgba(255, 255, 255, .08); }
.header-bell:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.header-bell-dot {
    position: absolute;
    inset-block-start: 9px;
    inset-inline-end: 9px;
    width: 11px;
    height: 11px;
    border: 2px solid var(--console);
    border-radius: 50%;
    background: var(--danger);
}
.header-bell-dot[hidden] { display: none; }
/* The number of new rows of the notifications list (Inbox), like a social app; it takes the place of the dot. */
.header-bell-count {
    position: absolute;
    inset-block-start: 4px;
    inset-inline-end: 2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--console);
    border-radius: 10px;
    background: var(--danger);
    color: var(--surface);
    font-size: .72rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}
.header-bell-count ~ .header-bell-dot { display: none; }
/* A phone with the HUD has no room for both: «التطبيق» stays in the tab bar under it. */
@media (max-width: 28.6875em) {
    .site-header:has(.hud):has(.header-bell) .header-install { display: none; }
}

.pwa-page { display: grid; gap: var(--space-4); max-width: 640px; margin-inline: auto; }
.pwa-page-title { display: flex; align-items: center; gap: 10px; margin: 0; }
.pwa-page > p { margin: 0; }
.pwa-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; justify-self: start; font-weight: 600; }
.pwa-back-arrow { transform: scaleX(-1); }

.pwa-push { scroll-margin-top: 12px; display: grid; gap: var(--space-3); }
.pwa-push h2 { margin: 0; }
.pwa-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); }
.pwa-state { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pwa-state-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; }
.pwa-alert { margin: 0; }
.pwa-device { display: grid; gap: var(--space-2); }
.pwa-device > div { display: grid; gap: var(--space-2); justify-items: start; }
.pwa-device > div > .btn-block { justify-self: stretch; }
.pwa-device p { margin: 0; }
.pwa-on { display: flex; align-items: center; gap: 8px; color: var(--success); font-weight: 600; }
.pwa-steps { margin: 0; padding-inline-start: 1.4em; display: grid; gap: 4px; }
.pwa-share { vertical-align: -3px; }

.pwa-kinds { margin: 0; display: grid; gap: var(--space-3); }
.pwa-kinds fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pwa-kinds fieldset + fieldset { border-top: 1px dashed var(--border); padding-top: var(--space-3); }
.pwa-kinds legend { padding: 0; margin-bottom: var(--space-1); font-family: var(--font-title); font-size: var(--fs-md); }
.pwa-kinds .btn[type="submit"] { width: auto; justify-self: start; }
.pwa-kinds .field.check { margin: 0; }
.pwa-kinds .hint { margin: 0; }

/* The link card of /me and /parent. */
.pwa-link { display: flex; align-items: center; gap: var(--space-3); }
.pwa-link-icon { flex: none; color: var(--primary); }
.pwa-link-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pwa-link-text .muted { font-size: var(--fs-sm); }

/* The timely prompt: a small row with ✕ in the top end corner, on the mission card and after a quiz result. */
.pwa-prompt { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); padding-inline-end: 52px; }
.pwa-prompt[hidden] { display: none; }
.pwa-prompt-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-edge); }
.pwa-prompt-text { flex: 1 1 180px; min-width: 0; display: grid; gap: 2px; }
.pwa-prompt-text[hidden] { display: none; }
.pwa-prompt-text .muted { font-size: var(--fs-sm); }
.pwa-prompt-text a { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; font-size: var(--fs-sm); font-weight: 600; }
.pwa-prompt-go { flex: none; }
.pwa-prompt-close { position: absolute; inset-block-start: 0; inset-inline-end: 0; min-width: 44px; min-height: 44px; padding: 0; color: var(--text-muted); }
.card.pwa-prompt { padding-inline-end: 56px; }
.card.pwa-prompt .pwa-prompt-close { inset-block-start: 6px; inset-inline-end: 6px; }
.mission-push { justify-self: stretch; border-top: 1px dashed var(--border); padding-top: var(--space-3); }
.mission-push .pwa-prompt-close { inset-block-start: calc(var(--space-3) - 6px); }


.pwa-install { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.pwa-install[hidden] { display: none; }
.pwa-install-icon { flex: none; }
.pwa-install-icon img { display: block; border-radius: var(--radius-sm); }
.pwa-install-text { flex: 1 1 140px; min-width: 0; display: grid; gap: 2px; }
.pwa-install-text .muted { font-size: var(--fs-sm); }
.pwa-install .btn-accent { flex: none; }
.pwa-install-more { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: var(--fs-sm); font-weight: 600; }
/* The home card: a small row, the ✕ in the top end corner (so it never takes a row of its own on a phone). */
.pwa-install-card { position: relative; padding-block: var(--space-3); padding-inline-end: 56px; }
.pwa-install-close { position: absolute; inset-block-start: 6px; inset-inline-end: 6px; min-width: 44px; min-height: 44px; padding: 0; color: var(--text-muted); }

.pwa-test { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.pwa-test h2, .pwa-test p { margin: 0; }
.pwa-test form { justify-self: start; }

/* /app: only this browser's way («ده جهازك») shows until «عندك جهاز تاني؟»; it comes first and stands out. */
.pwa-app { display: grid; gap: var(--space-4); max-width: 760px; margin-inline: auto; }
.pwa-app-hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.pwa-app-icon { flex: none; border-radius: var(--radius); box-shadow: var(--shadow-1); }
.pwa-app-hero-text { flex: 1 1 220px; min-width: 0; }
.pwa-app-hero h1 { margin: 0 0 var(--space-1); }
.pwa-app-hero p { margin: 0; }
.pwa-app-go { flex: 1 1 100%; }
.pwa-app > .alert { margin: 0; }
.pwa-app-ways { display: flex; flex-direction: column; gap: var(--space-3); }
.pwa-app-way { display: grid; gap: var(--space-2); }
.pwa-app-way h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; font-size: var(--fs-md); }
.pwa-app-way p { margin: 0; }
.pwa-app-way.is-yours { order: -1; border-color: var(--primary); box-shadow: var(--glow), var(--shadow-1); }
.pwa-app-way .share { margin-top: var(--space-1); }
.pwa-app.only-yours .pwa-app-way:not(.is-yours) { display: none; }
.pwa-app-way:focus { outline: none; }
.pwa-app-way.is-flash { animation: pwa-flash 0.6s ease-in-out 2; }
.pwa-app-more { justify-self: center; }
.pwa-app > .notice { margin: 0; }
@keyframes pwa-flash { 50% { transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) {
    .pwa-app-way.is-flash { animation: none; }
}

@media (max-width: 30em) {
    .pwa-install .btn-accent { flex: 1 1 100%; }
}
@media (min-width: 35em) {
    .pwa-app-go { flex: none; }
}

/* The notifications list of /notifications (Features/Push/Inbox): a row stands out with a dot until it is tapped. */
.inbox { display: grid; gap: var(--space-3); }
.inbox-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.inbox-head h2 { margin: 0; }
.inbox-head form { margin: 0; }
.inbox .hint { margin: 0; }
.inbox-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.inbox-item a {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}
.inbox-item a:hover { background: var(--surface-2); }
.inbox-item a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.inbox-unread a { background: var(--primary-soft); }
.inbox-unread a:hover { background: var(--primary-soft); filter: brightness(.97); }
.inbox-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--link);
}
.inbox-text { display: grid; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.inbox-text time { font-size: .85rem; }
.inbox-unread .inbox-text time { color: var(--link); font-weight: 600; }
.inbox-dot { flex: none; width: 10px; height: 10px; margin-block-start: 6px; border-radius: 50%; background: var(--link); }
