/* =========================================================================
   أدوات سهلة — mobile-first, RTL, light/dark. No framework, ~20 KB.
   ========================================================================= */

:root {
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', system-ui, sans-serif;
  --bg: #f5f7fc;
  --surface: #ffffff;
  --surface-2: #eef2fa;
  --text: #0f1a33;
  --muted: #4a5675;
  --border: #d8e0ef;
  --primary: #0b1f4d;
  --primary-2: #1d3f9e;
  --accent: #0f766e;
  --accent-bright: #14b8c4;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --turq-soft: #e0f7f8;
  --focus: #7c3aed;
  --warn-bg: #fff7e6;
  --warn-border: #f5c46b;
  --warn-text: #6b4200;
  --ok: #15803d;
  --bad: #b91c1c;
  --hero-1: #0b1f4d;
  --hero-2: #3b1a7a;
  --shadow: 0 1px 2px rgba(15, 26, 51, .06), 0 6px 24px rgba(15, 26, 51, .06);
  --radius: 16px;
  --radius-sm: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070d1f; --surface: #0f1830; --surface-2: #16223f; --text: #e8edf9; --muted: #aab5d1; --border: #26355a;
    --primary: #dbe6ff; --primary-2: #8fb3ff; --accent: #5eead4; --accent-bright: #22d3ee; --violet: #c4b5fd; --violet-soft: #2a1f4d;
    --turq-soft: #0e2f3a; --focus: #c4b5fd; --warn-bg: #2d2210; --warn-border: #8a6420; --warn-text: #ffd89a; --ok: #4ade80; --bad: #f87171;
    --hero-1: #0a1640; --hero-2: #2a1260; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070d1f; --surface: #0f1830; --surface-2: #16223f; --text: #e8edf9; --muted: #aab5d1; --border: #26355a;
  --primary: #dbe6ff; --primary-2: #8fb3ff; --accent: #5eead4; --accent-bright: #22d3ee; --violet: #c4b5fd; --violet-soft: #2a1f4d;
  --turq-soft: #0e2f3a; --focus: #c4b5fd; --warn-bg: #2d2210; --warn-border: #8a6420; --warn-text: #ffd89a; --ok: #4ade80; --bad: #f87171;
  --hero-1: #0a1640; --hero-2: #2a1260; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 1.0625rem; line-height: 1.75; overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--primary-2); text-underline-offset: 3px; }
a:hover { color: var(--violet); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; color: var(--primary); }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); font-weight: 700; }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
p { margin: 0 0 1em; }
kbd { font-family: inherit; font-size: .85em; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 0 .4em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 100; background: var(--primary); color: var(--surface); padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 8px; color: #fff; background: #0b1f4d; }
.wrap { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 16px; }
.main { padding-block: 16px 48px; outline: none; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: .9rem; color: var(--muted); }
.center { text-align: center; }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.flip { transform: scaleX(-1); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); font-weight: 700; font-size: 1.3rem; }
.brand .logo { width: 38px; height: 38px; }
.header-actions { margin-inline-start: auto; display: flex; gap: 4px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-weight: 700; }
.icon-btn:hover { background: var(--surface-2); color: var(--violet); }
.ic-sun { display: none; }
:root[data-theme="dark"] .ic-sun { display: inline; } :root[data-theme="dark"] .ic-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ic-sun { display: inline; } :root:not([data-theme="light"]) .ic-moon { display: none; } }

.main-nav { display: none; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.main-nav a { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 500; white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current] { background: var(--surface-2); color: var(--violet); }
.main-nav.open { display: block; position: absolute; inset-inline: 0; top: 64px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 8px 16px 16px; }
.main-nav.open ul { flex-direction: column; }
.main-nav.open a { padding: 12px; font-size: 1.05rem; }
@media (min-width: 980px) {
  .main-nav { display: block; margin-inline-start: 16px; }
  .menu-btn { display: none; }
  .main-nav .ic { width: 1.1em; height: 1.1em; }
}

/* ---------------------------------------------------------------- breadcrumbs / heads */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 12px; padding: 0; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: '‹'; margin-inline-end: 4px; opacity: .6; }
.crumbs a { color: var(--muted); }
.page-head { margin-block: 8px 20px; }
.page-head .lead { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }
.page-head__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; margin-bottom: 8px; }
.page-head__icon .ic { width: 28px; height: 28px; }
.section { margin-block: 36px; }

/* category colours */
.cat-calculators { background: #e7edff; color: #1d3f9e; }
.cat-converters { background: var(--turq-soft); color: var(--accent); }
.cat-arabic { background: #fdf0e3; color: #9a4b00; }
.cat-calendar { background: #e9f8ee; color: #15703a; }
.cat-space { background: var(--violet-soft); color: var(--violet); }
:root[data-theme="dark"] .cat-calculators { background: #1a2a5a; color: #a9c1ff; }
:root[data-theme="dark"] .cat-arabic { background: #3a2610; color: #ffc98a; }
:root[data-theme="dark"] .cat-calendar { background: #11331f; color: #86efac; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cat-calculators { background: #1a2a5a; color: #a9c1ff; }
  :root:not([data-theme="light"]) .cat-arabic { background: #3a2610; color: #ffc98a; }
  :root:not([data-theme="light"]) .cat-calendar { background: #11331f; color: #86efac; }
}

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; margin: 0 -16px; padding: 40px 16px 28px; color: #fff; text-align: center;
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff9 50%, transparent 51%), radial-gradient(1px 1px at 78% 18%, #fffa 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 62% 72%, #fff8 50%, transparent 51%), radial-gradient(1px 1px at 30% 80%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 60%, #fff9 50%, transparent 51%), radial-gradient(circle at 85% 110%, #14b8c455, transparent 45%),
    linear-gradient(135deg, var(--hero-1), var(--hero-2));
}
@media (min-width: 720px) { .hero { margin: 0; border-radius: 24px; padding: 56px 32px 36px; } }
.hero h1 { color: #fff; margin-bottom: .3em; }
.hero__sub { font-size: 1.1rem; color: #dbe4ff; max-width: 60ch; margin: 0 auto 22px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 44px; border-radius: 999px; background: #ffffff1f; border: 1px solid #ffffff38; color: #fff; text-decoration: none; font-weight: 500; }
.chip:hover { background: #ffffff33; color: #fff; }

/* ---------------------------------------------------------------- cards */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.tool-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; min-height: 88px; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--accent-bright); color: var(--text); }
.tool-card__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; flex: none; }
.tool-card__icon .ic { width: 26px; height: 26px; }
.tool-card__body { display: flex; flex-direction: column; }
.tool-card__title { font-weight: 700; color: var(--primary); font-size: 1.05rem; }
.tool-card__desc { color: var(--muted); font-size: .95rem; line-height: 1.55; }
.cards--popular .tool-card { padding: 18px; }

.cat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.cat-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.cat-block h3 a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); }
.cat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.cat-block ul { list-style: none; margin: 0; padding: 0; }
.cat-block li a { display: block; padding: 6px 0; color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); }
.cat-block li:last-child a { border-bottom: 0; }
.cat-block li a:hover { color: var(--violet); }

.article-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.article-card { display: flex; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.article-card .ic { color: var(--violet); width: 28px; height: 28px; }
.article-card strong { display: block; color: var(--primary); }
.article-card span span { color: var(--muted); font-size: .93rem; line-height: 1.55; }
.article-card:hover { border-color: var(--violet); }

.space-promo { text-align: center; margin-block: 36px; padding: 32px 16px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 20% 0%, #14b8c440, transparent 50%), linear-gradient(135deg, #160b3a, #0b1f4d); }
.space-promo h2 { color: #fff; }
.space-promo p { color: #d7defa; }
.space-promo__art { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.space-promo__art svg { width: 44px; height: 44px; }
@media (min-width: 600px) { .space-promo__art svg { width: 64px; height: 64px; } }

.privacy-section { display: flex; gap: 16px; align-items: flex-start; background: var(--turq-soft); border-radius: var(--radius); padding: 20px; }
.privacy-section__icon .ic { width: 44px; height: 44px; color: var(--accent); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.checks li::before { content: '✓'; color: var(--accent); font-weight: 700; margin-inline-end: 8px; }

/* ---------------------------------------------------------------- forms & tool boxes */
.tool-box { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
@media (min-width: 720px) { .tool-box { padding: 24px; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field legend { font-weight: 500; color: var(--text); }
.field small { color: var(--muted); font-weight: 400; }
.field--full { grid-column: 1 / -1; }
.field--end { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 8px; }
.input {
  width: 100%; min-height: 50px; padding: 10px 14px; font: inherit; font-size: 1.1rem; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px; appearance: none; -webkit-appearance: none;
}
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: left 18px center, left 12px center; background-size: 6px 6px; background-repeat: no-repeat; padding-inline-end: 14px; padding-inline-start: 36px; }
[dir="rtl"] select.input { padding-inline: 14px 36px; }
.input:focus { border-color: var(--accent-bright); outline: 3px solid color-mix(in srgb, var(--accent-bright) 30%, transparent); outline-offset: 0; }
.input--lg { min-height: 58px; font-size: 1.3rem; font-weight: 500; }
input[type="date"].input, input[type="datetime-local"].input { direction: ltr; text-align: end; }
.textarea { min-height: 140px; resize: vertical; line-height: 1.8; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-bottom: 14px; }
.grid-3 { display: grid; gap: 10px; grid-template-columns: 1fr 1.6fr 1.2fr; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 8px 18px; border-radius: 12px; border: 1.5px solid transparent; background: var(--primary-2); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
:root[data-theme="dark"] .btn { color: #0b1430; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: #0b1430; } }
.btn:hover { filter: brightness(1.08); color: #fff; }
.btn--primary { background: linear-gradient(135deg, #0e8f99, #6d28d9); color: #fff !important; border: 0; box-shadow: 0 6px 18px rgba(109, 40, 217, .3); }
.btn--ghost { background: var(--surface-2); color: var(--text) !important; border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent-bright); color: var(--violet) !important; }
.btn--sm { min-height: 40px; padding: 6px 12px; font-size: .95rem; }
.btn--xl { min-height: 58px; padding: 12px 28px; font-size: 1.2rem; border-radius: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px; margin: 0; }
fieldset.segmented { display: flex; }
.segmented legend { padding: 0; margin-bottom: 6px; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 42px; padding: 4px 14px; border-radius: 9px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--violet); box-shadow: var(--shadow); font-weight: 700; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }
.check, .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.check input, .switch input { width: 22px; height: 22px; accent-color: var(--violet); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width: thin; }
.tab { flex: none; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
:root[data-theme="dark"] .tab[aria-selected="true"] { color: #0b1430; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-selected="true"] { color: #0b1430; } }

.result-box { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--turq-soft); border-inline-start: 5px solid var(--accent-bright); }
.result-box--accent { background: var(--violet-soft); border-inline-start-color: var(--violet); }
.result-main { font-size: clamp(1.25rem, 4vw, 1.7rem); font-weight: 500; line-height: 1.5; word-break: break-word; }
.result-main strong { color: var(--primary); font-weight: 700; }
.result-out:empty { display: none; }
.result-out .big { font-size: clamp(1.25rem, 4vw, 1.6rem); font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.result-out .rows { display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); margin: 0; }
.result-out .rows div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.result-out .rows dt { color: var(--muted); }
.result-out .rows dd { margin: 0; font-weight: 700; }
.result-out .msg { color: var(--muted); }
.result-out pre { white-space: pre-wrap; font: inherit; margin: 0; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.formula { color: var(--muted); margin: 8px 0 0; font-size: .98rem; }
.formula-box { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 16px; border-radius: 12px; font-weight: 500; text-align: center; overflow-x: auto; }
.hint { color: var(--muted); font-size: .92rem; margin: 12px 0 0; }
.notice { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.notice--warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); margin-top: 16px; }
.privacy-badge { display: flex; gap: 8px; align-items: flex-start; color: var(--accent); font-size: .95rem; font-weight: 500; margin-top: 14px; }
.form-msg { color: var(--bad); font-weight: 500; min-height: 1.5em; margin: 8px 0 0; }
.badge { display: inline-block; font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }

/* converter */
.conv-grid { display: grid; gap: 12px; grid-template-columns: 1fr; align-items: end; }
.swap-btn { justify-self: center; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); color: var(--violet); cursor: pointer; transition: transform .2s; }
.swap-btn .ic { transform: rotate(90deg); }
.swap-btn:hover { transform: rotate(180deg); border-color: var(--violet); }
@media (min-width: 760px) {
  .conv-grid { grid-template-columns: 1.1fr 1fr auto 1fr; }
  .swap-btn { margin-bottom: 2px; }
  .swap-btn .ic { transform: none; }
}
.quick { margin-top: 16px; }
.quick summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }

.table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; }
.table th { color: var(--muted); font-weight: 500; }
.table--compact td { padding: 6px 10px; }
.table--compact tr:nth-child(odd) { background: var(--surface-2); }

.examples { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); padding: 0; list-style: none; }
.examples li { background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; border-radius: 12px; font-weight: 500; }

/* multi-form pages */
.forms--multi { display: grid; gap: 16px; background: transparent; border: 0; box-shadow: none; padding: 0; }
@media (min-width: 900px) { .forms--multi { grid-template-columns: 1fr 1fr; } }
.forms--multi .tool-form { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }
.form-title { font-size: 1.15rem; }

/* ---------------------------------------------------------------- calculator */
.calc { max-width: 460px; margin-inline: auto; }
.calc--sci { max-width: 640px; }
.calc-display { background: #0b1430; color: #fff; border-radius: 16px; padding: 12px 16px; margin-bottom: 12px; text-align: right; }
.calc-top { display: flex; justify-content: space-between; align-items: center; min-height: 28px; }
.calc-expr { color: #9fb0d8; font-size: 1rem; min-height: 1.4em; overflow-wrap: anywhere; }
.calc-input { width: 100%; border: 0; background: transparent; color: #fff; font: inherit; font-size: clamp(2rem, 8vw, 2.6rem); font-weight: 500; text-align: right; padding: 0; caret-color: #22d3ee; }
.calc-input:focus { outline: none; }
.calc-preview { display: block; color: #5eead4; min-height: 1.5em; font-size: 1.1rem; }
.pill { border: 1px solid #ffffff40; background: transparent; color: #5eead4; border-radius: 999px; padding: 2px 12px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 32px; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.keys--sci { grid-template-columns: repeat(5, 1fr); margin-bottom: 8px; }
.key { min-height: 60px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.5rem; font-weight: 500; cursor: pointer; touch-action: manipulation; user-select: none; }
.key:active { transform: scale(.96); }
.key--op { background: var(--turq-soft); color: var(--accent); font-weight: 700; }
.key--fn { font-size: 1.05rem; min-height: 48px; background: var(--surface); }
.key--warn { background: #fde8e8; color: #b91c1c; font-weight: 700; }
:root[data-theme="dark"] .key--warn { background: #3b1414; color: #fca5a5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .key--warn { background: #3b1414; color: #fca5a5; } }
.key--eq { background: linear-gradient(135deg, #0e8f99, #6d28d9); color: #fff; border: 0; font-weight: 700; }
.calc-history { margin-top: 14px; }
.calc-history summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.calc-history ol { direction: ltr; text-align: right; padding-inline-start: 24px; color: var(--muted); }
.calc-history li { cursor: pointer; padding: 2px 0; }

/* ---------------------------------------------------------------- grades */
.grades-table { margin-block: 12px; }
.grades-row { display: grid; grid-template-columns: 1.6fr 1fr 0.8fr 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.grades-head { color: var(--muted); font-size: .9rem; font-weight: 500; }
.grades-row .input { min-height: 48px; font-size: 1.05rem; }

/* ---------------------------------------------------------------- keyboard */
.kb-toolbar { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-bottom: 12px; }
.kb-text { font-size: 1.5rem; min-height: 110px; background: var(--surface); margin-bottom: 10px; }
@media (min-width: 720px) { .kb-text { min-height: 170px; } }
.kb-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 4px; }
.kb-count { color: var(--muted); font-size: .95rem; margin-inline-start: auto; }
.kb-font { display: inline-flex; }
.kb-keys { direction: ltr; display: flex; flex-direction: column; gap: 6px; user-select: none; -webkit-user-select: none; background: var(--surface-2); padding: 8px; border-radius: 16px; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.kb-key { flex: 1 1 0; min-width: 0; max-width: 64px; min-height: 50px; padding: 0; border-radius: 10px; border: 1px solid var(--border); border-bottom-width: 3px; background: var(--surface); color: var(--text); font: inherit; font-size: clamp(1.05rem, 4.2vw, 1.5rem); cursor: pointer; touch-action: manipulation; }
.kb-key:active, .kb-key.is-pressed { background: var(--turq-soft); transform: translateY(1px); }
.kb-key--wide { flex-grow: 1.8; max-width: 120px; font-size: 1rem; }
.kb-key--space { flex-grow: 6; max-width: 420px; font-size: 1rem; }
.kb-key--mark { color: var(--violet); font-size: 1.7rem; }
.kb-key[aria-pressed="true"] { background: var(--violet-soft); color: var(--violet); }
.kb-row--marks .kb-key { background: var(--violet-soft); }
@media (max-width: 420px) { .kb-row { gap: 3px; } .kb-key { min-height: 46px; border-radius: 8px; } .kb-keys { padding: 6px 4px; } }

/* ---------------------------------------------------------------- hijri */
.today-box { background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; font-size: 1.05rem; }
.today-box strong { color: #5eead4; }
.panel { margin-bottom: 4px; }
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.cal-head h2 { margin: 0; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title { font-weight: 700; color: var(--violet); margin: 8px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: .78rem; color: var(--muted); padding: 4px 0; }
.cal-day { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; padding: 2px; line-height: 1.2; }
.cal-day .g { font-weight: 700; font-size: 1.05rem; }
.cal-day .h { font-size: .78rem; color: var(--accent); }
.cal-day .h.first { color: var(--violet); font-weight: 700; }
.cal-day.is-today { border: 2px solid var(--accent-bright); }
.cal-day.is-selected { background: var(--violet-soft); border-color: var(--violet); }
.cal-day.is-friday .g { color: var(--accent); }
.age-box .result-out { margin-top: 12px; }

/* ---------------------------------------------------------------- planets */
.space-form { margin-bottom: 20px; }
.space-form .btn--xl { width: 100%; margin-top: 16px; }
@media (min-width: 720px) { .space-form .btn--xl { width: auto; } }
.planet-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.planet-card { position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.planet-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 110px; background: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 60%, #fffc 50%, transparent 51%), radial-gradient(1px 1px at 85% 20%, #fff 50%, transparent 51%), linear-gradient(160deg, #0b1f4d, #2a1260); z-index: 0; }
.planet-card > * { position: relative; z-index: 1; }
.planet-card__art { display: flex; justify-content: center; margin: -4px 0 8px; }
.planet-card__name { margin: 4px 0 2px; font-size: 1.25rem; }
.planet-card__name span { font-size: .85rem; color: var(--muted); font-weight: 500; }
.planet-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.stat dt { font-size: .8rem; color: var(--muted); }
.stat dd { margin: 0; font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.stat--weight, .stat--age { background: var(--turq-soft); }
.stat--weight dd, .stat--age dd { font-size: 1.25rem; color: var(--accent); }
.planet-card__jump { font-size: .92rem; color: var(--violet); font-weight: 500; margin: 0 0 6px; }
.planet-card__jump:empty { display: none; }
.planet-card__fact { font-size: .97rem; margin-bottom: 8px; }
.planet-card__note { font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.planet-card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.planet-card__actions .btn { flex: 1; }
.planet-card.is-highlight { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.planet-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.planet-head .planet-art { flex: none; }
.planet-head > div { flex: 1 1 280px; }
.fact-box { background: var(--violet-soft); border-radius: 14px; padding: 14px 16px; font-size: 1.05rem; }
.body-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.body-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-weight: 500; }
.body-chip:hover { border-color: var(--violet); }

/* share dialog */
.share-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); border: 0; border-radius: 20px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.share-dialog::backdrop { background: rgba(5, 10, 30, .65); }
.share-dialog__inner { padding: 16px; }
.share-dialog__head { display: flex; justify-content: space-between; align-items: center; }
.share-dialog__head h2 { margin: 0; }
.share-canvas { width: 100%; height: auto; aspect-ratio: 1; border-radius: 14px; margin: 10px 0; background: #0b1f4d; }
.share-text { font-weight: 500; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share--wa { background: #128c4a; } .share--fb { background: #1f5fd1; } .share--x { background: #111; } .share--tg { background: #1b8ac9; }
.share-buttons .share--wa, .share-buttons .share--fb, .share-buttons .share--x, .share-buttons .share--tg { color: #fff !important; }

/* ---------------------------------------------------------------- time zones */
.clock-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.clock-grid li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.clock-grid strong { font-variant-numeric: tabular-nums; color: var(--primary); }

/* ---------------------------------------------------------------- prose / FAQ */
.prose { max-width: 78ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin-bottom: .4em; }
.prose .table { margin-block: 12px; }
.faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 8px; }
.faq__item summary { cursor: pointer; padding: 14px 16px; font-weight: 700; min-height: 48px; list-style-position: inside; }
.faq__a { padding: 0 16px 14px; color: var(--muted); }

/* ---------------------------------------------------------------- ads */
.ad-slot { display: grid; place-items: center; min-height: 100px; margin-block: 28px; border-radius: 14px; }
.ad-slot > span { color: var(--muted); font-size: .8rem; border: 1px dashed var(--border); border-radius: 12px; width: 100%; min-height: 100px; display: grid; place-items: center; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-block: 32px 24px; font-size: .95rem; }
.footer-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.footer-col h2 { font-size: 1rem; margin-bottom: 6px; }
.footer-col h2 a { color: var(--primary); text-decoration: none; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li a { display: inline-block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.footer-col li a:hover { color: var(--violet); }
.footer-bottom { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); }
.footer-links { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-links a { color: var(--text); }
.copy { margin: 0; }
.big-404 { font-size: 5rem; font-weight: 700; margin: 0; background: linear-gradient(135deg, #14b8c4, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* copy feedback */
[data-copied]::after { content: attr(data-copied); margin-inline-start: 6px; color: var(--ok); }

@media print {
  .site-header, .site-footer, .ad-slot, .kb-keys, .result-actions, .share-dialog { display: none !important; }
  body { background: #fff; color: #000; }
}
