/* Shared structure for vorstaz apps. Each app sets the tokens in :root. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 100%; }
html.ts-l { font-size: 115%; }
html.ts-xl { font-size: 132%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font), system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--fs, 1rem);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
a { color: var(--link, var(--accent)); }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 12px; }
.top h1 { font-size: 1.25rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { font-size: 1.05rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: end; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: var(--radius-btn, 10px);
  border: 1.5px solid var(--line-strong, var(--line)); background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); padding-inline: 8px; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); flex: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }

:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }

/* forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .9rem; font-weight: 600; }
.field small { color: var(--muted); }
input[type=text], input[type=number], input[type=tel], input[type=date], input[type=time], input[type=month], input[type=url], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line-strong, var(--line)); background: var(--field, var(--surface));
}
textarea { min-height: 80px; resize: vertical; }
input.invalid { border-color: var(--bad); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong, var(--line)); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .95rem; }
.seg input:checked + label { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.seg input:focus-visible + label { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }

/* list rows */
.list { display: grid; border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); min-height: 60px; }
.item.tap { cursor: pointer; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: .875rem; }

.empty { padding: 28px 16px; text-align: center; border: 1.5px dashed var(--line-strong, var(--line)); border-radius: 14px; color: var(--muted); }
.empty p { margin-bottom: 14px; }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  background: var(--tabs-bg, var(--surface)); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs nav { display: flex; width: 100%; max-width: 560px; }
.tabs button {
  flex: 1; min-height: 60px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; gap: 2px; padding: 8px 4px; color: var(--muted); font-size: .78rem; font-weight: 600;
}
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-current=page] { color: var(--accent-strong, var(--accent)); }

/* sheets */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink);
}
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 18px; } }
dialog.sheet::backdrop { background: rgba(20, 24, 32, .45); }
.sheet form { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 6px 18px; }
.sheet-head h2 { flex: 1; font-size: 1.15rem; }
.sheet-body { padding: 6px 18px 12px; overflow-y: auto; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.sheet-msg { margin: 4px 0 10px; line-height: 1.55; }

#toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); text-align: center;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .95rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.install-btn { display: none; }
.can-install .install-btn { display: inline-flex; }
.standalone .install-btn, .standalone .install-tip { display: none !important; }

.foot-note { margin-top: 32px; font-size: .8rem; color: var(--muted); text-align: center; }
.foot-note a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- skip link, top tools, language ---------- */
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 200; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 8px; }
.tool-btn { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 700; font-size: .78rem; cursor: pointer; flex: none; }
.tool-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-item { display: flex; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--line-strong, var(--line)); color: var(--ink); text-decoration: none; font-weight: 600; }
.lang-item[aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lang-offer { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 6px 12px; background: var(--ink); color: var(--bg); font-size: .95rem; }
.lang-offer a { color: inherit; font-weight: 700; }
.lang-offer button { border: 0; background: none; color: inherit; font-size: 1.4rem; width: 40px; height: 40px; cursor: pointer; }
.switch { gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { width: 24px; height: 24px; accent-color: var(--accent); }

/* ---------- about section and footer links (static HTML, written at build time) ---------- */
#about { margin: 28px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }
#about summary { cursor: pointer; font-weight: 700; padding: 12px 0; min-height: 44px; }
#about h2 { font-size: 1.05rem; margin: 18px 0 8px; }
#about h3 { font-size: 1rem; margin: 14px 0 4px; }
#about p, #about li { color: var(--muted); line-height: 1.6; max-width: 68ch; }
#about ul { padding-inline-start: 20px; margin: 0; }
#about .lede { color: var(--ink); }
.page-links { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin: 22px 0 8px; font-size: .85rem; }
.page-links a { color: var(--muted); }

/* ---------- high contrast ---------- */
html.hc { --bg: #FFFFFF; --surface: #FFFFFF; --field: #FFFFFF; --ink: #000000; --muted: #1F1F1F; --line: #000000; --line-strong: #000000; }
html.hc body { background: #fff; }
html.hc a { text-decoration: underline; }
html.hc .btn, html.hc input, html.hc select, html.hc textarea, html.hc .seg label { border-width: 2px; }
html.hc :focus-visible { outline: 4px solid #000; outline-offset: 2px; box-shadow: 0 0 0 7px #FFD400; }

/* ---------- right-to-left (Arabic, Urdu) ---------- */
[dir=rtl] .back svg, [dir=rtl] .back { transform: scaleX(-1); }
[dir=rtl] .monthbar .icon-btn, [dir=rtl] .datebar .icon-btn { transform: scaleX(-1); }
[dir=rtl] #toast { direction: rtl; }

.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon-btn:disabled { opacity: .3; cursor: default; }
main:focus { outline: none; }
.site-foot { margin-top: 18px; text-align: center; font-size: .85rem; color: var(--muted); }
.site-foot p { margin: 0 0 6px; }
.lang-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .9rem; }
.lang-links a { color: var(--muted); }
/* static pages: accessibility, AI and bot pages */
.page h1 { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 12px; }
.page h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.page p, .page li { line-height: 1.65; max-width: 68ch; }
.page ul { padding-inline-start: 22px; }
.page li { margin-bottom: 6px; }
.page code { font-size: .9em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 1px 5px; border-radius: 4px; }
.page .back-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
