:root {
    --primary: #6d28d9;
    --accent: #ec4899;
    --bg: #f8f7fc;
    --surface: #fff;
    --text: #190d30;
    --muted: #6b5b87;
    --border: #e6dff5;
    --radius: 18px;
    --shadow: 0 8px 24px rgba(109, 40, 217, .12);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding-block-end: 72px;
    font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

a { color: var(--primary); }
img { max-width: 100%; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

/* header */
.top { background: var(--surface); border-block-end: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; gap: 12px; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 8px; margin-inline-end: auto; font-weight: 800; font-size: 20px; text-decoration: none; color: var(--primary); }
.brand img { border-radius: 10px; }

.langs { position: relative; font-size: 14px; }
.langs summary { cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; list-style: none; white-space: nowrap; }
.langs summary::-webkit-details-marker { display: none; }
.langs ul { position: absolute; inset-inline-end: 0; margin: 6px 0 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); min-width: 150px; }
.langs li a { display: block; padding: 6px 10px; border-radius: 10px; text-decoration: none; color: var(--text); }
.langs li a[aria-current] { background: var(--bg); font-weight: 700; }

/* buttons */
.btn { display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 700; text-decoration: none; border: 0; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.top .btn { display: none; }

.sticky-app {
    position: fixed; inset-inline: 16px; bottom: 12px; z-index: 20; text-align: center; text-decoration: none;
    padding: 12px; border-radius: 999px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 8px 24px rgba(109, 40, 217, .35);
}

/* hero and headings */
.hero { text-align: center; padding-block: 32px 8px; }
.hero h1 { margin: 0; font-size: 34px; color: var(--primary); }
.hero p { color: var(--muted); max-width: 560px; margin: 8px auto 16px; }

.section-title { font-size: 22px; margin-block: 28px 12px; }
.page-head h1 { margin: 8px 0 0; font-size: 26px; }
.page-head p { margin: 0 0 16px; color: var(--muted); }
.crumbs { margin-block-start: 14px; font-size: 14px; color: var(--muted); }
.crumbs a { text-decoration: none; }

/* category cards */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card {
    position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
    text-decoration: none; color: #fff; background: var(--primary); box-shadow: var(--shadow);
}
.cat-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cat-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(25, 13, 48, .75), transparent 60%); }
.cat-text { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.quote-mark { position: absolute; inset-inline-start: 0; inset-inline-end: 0; top: 8%; text-align: center; font-size: 84px; line-height: 1; opacity: .35; font-family: Georgia, serif; }
.cat-info { position: absolute; inset-inline: 10px; bottom: 8px; z-index: 1; display: flex; flex-direction: column; text-align: center; }
.cat-info strong { font-size: 17px; line-height: 1.3; }
.cat-info small { opacity: .85; font-size: 13px; }

/* items */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 0; }

.pics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pic-link { display: block; }
.pic img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: contain; background: #e9e3f5; }
.pic figcaption { padding: 10px 12px 12px; }

.phrase { margin: 0; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.tags { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.tags span { white-space: nowrap; }

.texts { display: grid; gap: 12px; }
.txt { padding: 22px 18px 10px; color: #fff; text-align: center; background: linear-gradient(135deg, #6d28d9, #b04bd6); }
.txt .phrase { font-size: 20px; line-height: 1.9; font-weight: 700; }
.tone-1 { background: linear-gradient(135deg, #9d2f8e, #ec4899); }
.tone-2 { background: linear-gradient(135deg, #1e3a8a, #6d28d9); }
.tone-3 { background: linear-gradient(135deg, #0f766e, #2b8fa8); }
.tone-4 { background: linear-gradient(135deg, #b4452b, #d9467a); }
.tone-5 { background: linear-gradient(135deg, #3b2d8f, #8b3fd0); }

.actions { display: flex; gap: 8px; justify-content: center; margin-block-start: 10px; }
.act { flex: 1; min-height: 44px; border: 1px solid var(--border); background: var(--surface); color: var(--primary); border-radius: 999px; font: inherit; font-weight: 700; cursor: pointer; }
.txt .act { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .4); color: #fff; }

/* pagination */
.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-block: 24px; }
.pager a, .pager span { min-width: 40px; padding: 8px 12px; text-align: center; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

.app-card { text-align: center; margin-block: 28px; padding: 24px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.app-card h2 { margin: 0; color: var(--primary); }
.app-card p { color: var(--muted); margin: 4px 0 14px; }

.foot { margin-block-start: 32px; padding-block: 20px; text-align: center; color: var(--muted); font-size: 14px; }

.toast { position: fixed; inset-inline: 0; bottom: 84px; margin-inline: auto; width: max-content; max-width: 90%; padding: 8px 18px; border-radius: 999px; background: #190d30; color: #fff; z-index: 30; }

@media (min-width: 600px) {
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
    .pics { grid-template-columns: repeat(3, 1fr); }
    .texts { grid-template-columns: repeat(2, 1fr); }
    .top .btn { display: inline-block; }
    .sticky-app { display: none; }
    body { padding-block-end: 0; }
}

@media (min-width: 900px) {
    .cat-grid { grid-template-columns: repeat(4, 1fr); }
    .pics { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
    .card, .cat-card { transition: transform .15s ease; }
    .cat-card:hover { transform: translateY(-2px); }
}
