/* Anar web — the Android app's design system (core/designsystem) in CSS: the same colors,
   type scale (Vazirmatn), radii, spacing and soft shadows, light and dark. */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --primary: #3354e6;
  --on-primary: #ffffff;
  --primary-container: #e9edff;
  --on-primary-container: #0f1f66;
  --secondary-container: #e9ecf0;
  --tertiary: #12a150;
  --tertiary-container: #ddf5e7;
  --on-tertiary-container: #103722;
  --error: #d92d20;
  --error-container: #fdecea;
  --on-error-container: #7a1a12;
  --bg: #f6f7f9;
  --on-bg: #12151b;
  --surface: #ffffff;
  --on-surface: #12151b;
  --on-surface-variant: #5e6573;
  --surface-lowest: #ffffff;
  --surface-low: #f0f2f5;
  --surface-container: #e9ecf0;
  --surface-high: #e2e6eb;
  --surface-highest: #d3d8df;
  --outline: #d3d8df;
  --outline-variant: #e9ecf0;
  --inverse-surface: #12151b;
  --inverse-on-surface: #fbfcfd;
  --inverse-primary: #93a8ff;
  --warning: #b54708;
  --warning-container: #fef0c7;
  --on-warning-container: #7a2e0e;
  --favorite: #f5a524;
  --skeleton: #e9ecf0;
  --skeleton-highlight: #f6f7f9;
  --logo-border: rgba(18, 21, 27, 0.08);
  --header-top: #e9edff;
  --scrim: rgba(0, 0, 0, 0.32);
  --shadow-color: 27, 42, 85;
  --card-border: transparent;

  --shadow-6: 0 1px 2px rgba(var(--shadow-color), 0.08), 0 3px 10px rgba(var(--shadow-color), 0.08);
  --shadow-8: 0 1px 3px rgba(var(--shadow-color), 0.08), 0 4px 14px rgba(var(--shadow-color), 0.1);
  --shadow-10: 0 1px 3px rgba(var(--shadow-color), 0.08), 0 5px 18px rgba(var(--shadow-color), 0.11);
  --shadow-12: 0 2px 4px rgba(var(--shadow-color), 0.07), 0 6px 22px rgba(var(--shadow-color), 0.12);
  --shadow-16: 0 2px 6px rgba(var(--shadow-color), 0.08), 0 8px 28px rgba(var(--shadow-color), 0.14);

  --gutter: 16px;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --readable: 720px;
  --bar: 60px;
  --rail: 80px;
  --fast: 150ms;
  --medium: 240ms;
  --slow: 360ms;
  --emphasized: cubic-bezier(0.2, 0, 0, 1);
  --standard: cubic-bezier(0.2, 0, 0.1, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #93a8ff;
    --on-primary: #0a1550;
    --primary-container: #213072;
    --on-primary-container: #dce3ff;
    --secondary-container: #252931;
    --tertiary: #4ade80;
    --tertiary-container: #103722;
    --on-tertiary-container: #ddf5e7;
    --error: #ff8a80;
    --error-container: #3d1512;
    --on-error-container: #fdecea;
    --bg: #0c0e12;
    --on-bg: #eceef2;
    --surface: #14171c;
    --on-surface: #eceef2;
    --on-surface-variant: #a3aab8;
    --surface-lowest: #0c0e12;
    --surface-low: #191c22;
    --surface-container: #1e2228;
    --surface-high: #252931;
    --surface-highest: #2e333c;
    --outline: #3b414c;
    --outline-variant: #2e333c;
    --inverse-surface: #eceef2;
    --inverse-on-surface: #14171c;
    --inverse-primary: #3354e6;
    --warning: #fdb022;
    --warning-container: #3a2606;
    --on-warning-container: #fef0c7;
    --favorite: #fdb022;
    --skeleton: #1e2228;
    --skeleton-highlight: #252931;
    --logo-border: rgba(236, 238, 242, 0.08);
    --header-top: #182147;
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow-6: none;
    --shadow-8: none;
    --shadow-10: none;
    --shadow-12: none;
    --shadow-16: none;
    --card-border: var(--outline-variant);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #93a8ff;
  --on-primary: #0a1550;
  --primary-container: #213072;
  --on-primary-container: #dce3ff;
  --secondary-container: #252931;
  --tertiary: #4ade80;
  --tertiary-container: #103722;
  --on-tertiary-container: #ddf5e7;
  --error: #ff8a80;
  --error-container: #3d1512;
  --on-error-container: #fdecea;
  --bg: #0c0e12;
  --on-bg: #eceef2;
  --surface: #14171c;
  --on-surface: #eceef2;
  --on-surface-variant: #a3aab8;
  --surface-lowest: #0c0e12;
  --surface-low: #191c22;
  --surface-container: #1e2228;
  --surface-high: #252931;
  --surface-highest: #2e333c;
  --outline: #3b414c;
  --outline-variant: #2e333c;
  --inverse-surface: #eceef2;
  --inverse-on-surface: #14171c;
  --inverse-primary: #3354e6;
  --warning: #fdb022;
  --warning-container: #3a2606;
  --on-warning-container: #fef0c7;
  --favorite: #fdb022;
  --skeleton: #1e2228;
  --skeleton-highlight: #252931;
  --logo-border: rgba(236, 238, 242, 0.08);
  --header-top: #182147;
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow-6: none;
  --shadow-8: none;
  --shadow-10: none;
  --shadow-12: none;
  --shadow-16: none;
  --card-border: var(--outline-variant);
}

/* --- base ---------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--on-bg);
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  line-height: 22px;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

[dir="rtl"] .mirror {
  transform: scaleX(-1);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* type scale */
.display-small { font-size: 28px; line-height: 40px; font-weight: 800; }
.headline-medium { font-size: 24px; line-height: 34px; font-weight: 800; }
.headline-small { font-size: 20px; line-height: 30px; font-weight: 700; }
.title-large { font-size: 18px; line-height: 28px; font-weight: 700; }
.title-medium { font-size: 15px; line-height: 24px; font-weight: 700; }
.title-small { font-size: 14px; line-height: 22px; font-weight: 600; }
.body-large { font-size: 15px; line-height: 24px; font-weight: 400; }
.body-medium { font-size: 14px; line-height: 22px; font-weight: 400; }
.body-small { font-size: 12px; line-height: 18px; font-weight: 400; }
.label-large { font-size: 13px; line-height: 20px; font-weight: 600; }
.label-medium { font-size: 12px; line-height: 18px; font-weight: 500; }
.label-small { font-size: 10px; line-height: 15px; font-weight: 600; }
.muted { color: var(--on-surface-variant); }

.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- shell --------------------------------------------------------------------------- */

#app {
  min-height: 100dvh;
}

.screen {
  min-height: 100dvh;
  padding-bottom: calc(var(--bar) + var(--safe-bottom));
}

.screen.no-bar {
  padding-bottom: var(--safe-bottom);
}

.readable {
  width: 100%;
  max-width: var(--readable);
  margin-inline: auto;
}

.nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  height: calc(var(--bar) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  box-shadow: var(--shadow-16);
  border-top: 1px solid var(--card-border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--on-surface-variant);
}

.nav-pill {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  transition: background var(--fast) var(--standard);
}

.nav-item[aria-current="page"] {
  color: var(--primary);
}

.nav-item[aria-current="page"] .nav-pill {
  background: var(--primary-container);
}

.nav-item .label-small {
  font-weight: 500;
}

.nav-item[aria-current="page"] .label-small {
  font-weight: 700;
}

.nav-badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10px;
  line-height: 16px;
  font-weight: 700;
  text-align: center;
}

/* side rail on wide or short windows (like the app: ≥600 wide or <480 tall) */
@media (min-width: 600px), (max-height: 479px) {
  .nav {
    inset-inline-start: 0;
    inset-inline-end: auto;
    top: 0;
    bottom: 0;
    width: var(--rail);
    height: auto;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: var(--safe-top) 0 var(--safe-bottom);
    border-top: 0;
    border-inline-end: 1px solid var(--card-border);
  }

  .nav-item {
    flex: none;
    height: 64px;
  }

  .screen,
  .screen.no-bar {
    padding-bottom: var(--safe-bottom);
    padding-inline-start: var(--rail);
  }

  .screen.full {
    padding-inline-start: 0;
  }

  .snackbar-host {
    bottom: calc(16px + var(--safe-bottom)) !important;
    padding-inline-start: var(--rail);
  }

  .offline-pill {
    bottom: calc(16px + var(--safe-bottom));
    inset-inline-start: calc(var(--rail) + 12px);
  }
}

/* --- top bar & section headers --------------------------------------------------------- */

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: calc(52px + var(--safe-top));
  padding: var(--safe-top) 4px 0;
  background: var(--bg);
}

.top-bar .title-large {
  flex: 1;
  min-width: 0;
  padding-inline-start: 12px;
}

.top-bar .icon-button + .title-large {
  padding-inline-start: 0;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: var(--on-surface);
  flex: none;
}

.icon-button:hover {
  background: color-mix(in srgb, var(--on-surface) 6%, transparent);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  gap: 8px;
}

.section-action {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding-inline: 8px;
  margin-inline-end: -8px;
  color: var(--primary);
}

.section-action .icon {
  width: 16px;
  height: 16px;
}

/* --- logos, tiles, rows ------------------------------------------------------------------ */

.logo {
  --size: 48px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  flex: none;
  overflow: hidden;
  border-radius: 28%;
  background: var(--surface-lowest);
  isolation: isolate;
}

.logo .monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: calc(var(--size) * 0.42);
  line-height: 1;
  opacity: 0;
}

/* The monogram stands in only when the logo is missing, failed, or slow (over 150 ms). */
.logo.mono .monogram {
  opacity: 1;
}

.logo.waiting .monogram {
  animation: appear 1ms linear 150ms forwards;
}

@keyframes appear {
  to { opacity: 1; }
}

.logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--fast) var(--standard);
}

.logo.loaded img {
  opacity: 1;
}

.logo.instant img {
  transition: none;
}

.logo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--logo-border);
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  flex: none;
}

.pill.accent {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.pill.success {
  background: var(--tertiary-container);
  color: var(--on-tertiary-container);
}

.pill.warning {
  background: var(--warning-container);
  color: var(--on-warning-container);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--columns, 5), minmax(0, 1fr));
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 2px 6px;
  border-radius: var(--radius-md);
  text-align: center;
  transition: transform var(--fast) var(--standard), background var(--fast);
  -webkit-touch-callout: none;
  user-select: none;
}

.tile:active {
  transform: scale(0.95);
}

.tile:hover {
  background: color-mix(in srgb, var(--on-surface) 4%, transparent);
}

.tile .name {
  width: 100%;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile .pill {
  margin-top: -4px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  -webkit-touch-callout: none;
  user-select: none;
}

.row:hover {
  background: color-mix(in srgb, var(--on-surface) 4%, transparent);
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-text {
  flex: 1;
  min-width: 0;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.row-title .title-small {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.star {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  color: var(--on-surface-variant);
  flex: none;
}

.star[aria-pressed="true"] {
  color: var(--favorite);
}

.star.pop .icon {
  animation: pop 320ms var(--emphasized);
}

@keyframes pop {
  from { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  to { transform: scale(1); }
}

/* --- home -------------------------------------------------------------------------------- */

.home-header {
  position: relative;
  padding: calc(12px + var(--safe-top)) var(--gutter) 16px;
  background: linear-gradient(to bottom, var(--header-top), var(--bg));
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 12px;
}

.app-mark {
  display: grid;
  place-items: center;
  width: var(--mark, 32px);
  height: var(--mark, 32px);
  border-radius: 28%;
  background: #c41e3a;
  color: #fbf6ee;
  flex: none;
}

.app-mark .brand-mark {
  width: 78%;
  height: 78%;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  padding-inline: 16px 4px;
  gap: 8px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-10);
  border: 1px solid var(--card-border);
  color: var(--on-surface-variant);
}

.search-field .icon {
  width: 18px;
  height: 18px;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--on-surface);
  font-size: 14px;
  unicode-bidi: plaintext;
  text-align: start;
}

.search-field input::placeholder {
  color: var(--on-surface-variant);
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-field:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

.home-body {
  padding: 0 var(--gutter) 20px;
}

.qa-card {
  margin-top: 4px;
  padding: 12px 8px 4px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-12);
  border: 1px solid var(--card-border);
}

.qa-card > .title-small {
  padding: 0 8px 8px;
}

.home-section {
  padding-top: 12px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--on-surface-variant);
}

.notice .icon {
  width: 18px;
  height: 18px;
}

.cat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 2px;
  border-radius: var(--radius-md);
  text-align: center;
}

.cat-tile:hover {
  background: color-mix(in srgb, var(--on-surface) 4%, transparent);
}

.cat-box {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.cat-box.all {
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

.cat-box .icon {
  width: 26px;
  height: 26px;
}

.glyph {
  width: var(--glyph, 28px);
  height: var(--glyph, 28px);
  background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

.cat-tile .label-medium {
  width: 100%;
  min-height: 36px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.h-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  padding: 4px var(--gutter) 12px;
  margin-inline: calc(-1 * var(--gutter));
  scrollbar-width: none;
}

.h-scroll::-webkit-scrollbar {
  display: none;
}

.h-scroll > * {
  scroll-snap-align: start;
  flex: none;
}

.banner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 288px;
  min-height: 128px;
  padding: 16px;
  border-radius: var(--radius-xl);
  color: var(--on-brand, #fff);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  overflow: hidden;
}

.banner-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.banner .logo-frame {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: #fff;
  flex: none;
}

.banner .body-small {
  opacity: 0.88;
}

.banner-open {
  align-self: flex-end;
  margin-top: auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--on-brand, #fff) 16%, transparent);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}

.compare-card {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  text-align: start;
}

.compare-members {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  margin-top: 8px;
}

.compare-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 4px 0;
  border-radius: var(--radius-md);
  text-align: center;
}

.compare-member:hover {
  background: color-mix(in srgb, var(--on-surface) 5%, transparent);
}

.compare-member .label-medium {
  width: 100%;
}

.compare-sep {
  display: grid;
  place-items: center;
  height: 48px;
  color: var(--outline);
}

.compare-sep .icon {
  width: 16px;
  height: 16px;
}

/* --- cards, buttons, status -------------------------------------------------------------- */

.card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-6);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  transition: transform var(--fast) var(--standard), background var(--fast), opacity var(--fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn.primary.destructive {
  background: var(--error);
  color: #fff;
}

.btn.secondary {
  border: 1px solid var(--outline);
  color: var(--on-surface);
}

.btn.ghost {
  min-height: 48px;
  padding-inline: 8px;
  color: var(--primary);
}

.btn.ghost.quiet {
  color: var(--on-surface-variant);
}

.btn.ghost.danger {
  color: var(--error);
}

.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.btn.block {
  width: 100%;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  flex: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
  text-align: center;
}

.halo {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 5.4%, transparent);
  color: var(--tint);
}

.halo::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 12%, transparent);
}

.halo .icon {
  position: relative;
  width: 36px;
  height: 36px;
}

.status .title-large {
  margin-top: 16px;
}

.status .body-medium {
  margin-top: 8px;
  color: var(--on-surface-variant);
}

.status .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.status .actions .btn.primary {
  min-width: 180px;
}

.skeleton {
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-highlight) 50%, var(--skeleton) 75%);
  background-size: 300% 100%;
  animation: shimmer 1100ms linear infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -200% 0; }
}

/* --- update / install banners -------------------------------------------------------------- */

.update-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 12px 12px 4px;
  border-radius: var(--radius-lg);
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.update-banner .head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.update-banner .head .icon {
  color: var(--primary);
  margin-top: 2px;
}

.update-banner .actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.update-banner .btn.ghost.quiet {
  color: var(--on-primary-container);
}

/* --- categories (two panes) ---------------------------------------------------------------- */

.panes {
  display: flex;
  align-items: stretch;
  min-height: calc(100dvh - 52px - var(--safe-top) - var(--bar) - var(--safe-bottom));
}

.cat-rail {
  position: sticky;
  top: calc(52px + var(--safe-top));
  align-self: flex-start;
  width: 92px;
  max-height: calc(100dvh - 52px - var(--safe-top) - var(--bar) - var(--safe-bottom));
  overflow-y: auto;
  flex: none;
  padding: 4px 0 16px;
  background: var(--surface-low);
  scrollbar-width: none;
}

@media (min-width: 600px), (max-height: 479px) {
  .panes {
    min-height: calc(100dvh - 52px - var(--safe-top) - var(--safe-bottom));
  }

  .cat-rail {
    max-height: calc(100dvh - 52px - var(--safe-top) - var(--safe-bottom));
  }
}

.cat-rail::-webkit-scrollbar {
  display: none;
}

.rail-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 6px 4px;
  text-align: center;
  color: var(--on-surface-variant);
}

.rail-item .rail-box {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--accent);
}

.rail-item .rail-box .icon {
  width: 20px;
  height: 20px;
}

.rail-item .label-medium {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-item[aria-selected="true"] {
  background: var(--bg);
  color: var(--on-surface);
}

.rail-item[aria-selected="true"] .label-medium {
  font-weight: 700;
}

.rail-item[aria-selected="true"] .rail-box {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.rail-item[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 3px;
  height: 32px;
  transform: translateY(-50%);
  border-start-end-radius: 3px;
  border-end-end-radius: 3px;
  background: var(--primary);
}

.pane {
  flex: 1;
  min-width: 0;
  padding: 4px 8px 16px 12px;
}

[dir="rtl"] .pane {
  padding: 4px 12px 16px 8px;
}

/* --- settings -------------------------------------------------------------------------------- */

.settings {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px var(--gutter) 24px;
}

.group-title {
  padding: 0 4px 6px;
  color: var(--on-surface-variant);
}

.group-footer {
  padding: 8px 4px 0;
  color: var(--on-surface-variant);
}

.setting {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  text-align: start;
}

button.setting:hover,
a.setting:hover {
  background: color-mix(in srgb, var(--on-surface) 4%, transparent);
}

.setting + .setting::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 12px 0;
  height: 1px;
  background: var(--outline-variant);
}

.setting.with-icon + .setting.with-icon::before {
  inset-inline-start: 50px;
}

.setting > .icon {
  color: var(--on-surface-variant);
}

.setting .text {
  flex: 1;
  min-width: 0;
}

.setting .chev {
  width: 18px;
  height: 18px;
  color: var(--on-surface-variant);
}

.setting.danger .body-medium,
.setting.danger > .icon {
  color: var(--error);
}

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 16px 12px;
  gap: 12px;
}

.summary .headline-small {
  unicode-bidi: isolate;
}

/* --- favorites --------------------------------------------------------------------------- */

.list-card {
  padding: 4px 8px;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 44px;
  color: var(--on-surface-variant);
  cursor: grab;
  touch-action: none;
  flex: none;
}

.row.dragging {
  position: relative;
  z-index: 5;
  background: var(--surface);
  box-shadow: var(--shadow-16);
  transition: none;
}

.row.shift {
  transition: transform var(--fast) var(--standard);
}

.time {
  color: var(--on-surface-variant);
  white-space: nowrap;
}

/* --- feedback ---------------------------------------------------------------------------- */

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  font-size: 13px;
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-color: transparent;
}

.chip .icon {
  width: 16px;
  height: 16px;
}

.textarea {
  width: 100%;
  min-height: 160px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline);
  background: var(--surface);
  resize: vertical;
  font-size: 15px;
  line-height: 24px;
  unicode-bidi: plaintext;
  text-align: start;
}

.textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: transparent;
}

.counter {
  text-align: end;
  color: var(--on-surface-variant);
}

.privacy-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--on-surface-variant);
}

.privacy-note .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

/* --- onboarding ---------------------------------------------------------------------------- */

.onboarding {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: calc(56px + var(--safe-top)) 20px 0;
}

.onboarding .points {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 40px;
}

.point {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.point-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-high);
  color: var(--on-surface);
  flex: none;
}

.onboarding .cta {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 24px 0 calc(16px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

/* --- overlays: sheets, dialogs, snackbars ---------------------------------------------------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  animation: fade-in var(--medium) var(--standard);
}

.scrim.closing {
  animation: fade-out var(--fast) var(--standard) forwards;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes fade-out {
  to { opacity: 0; }
}

.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 41;
  max-width: 560px;
  max-height: 85dvh;
  margin-inline: auto;
  overflow-y: auto;
  padding: 0 0 calc(12px + var(--safe-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface);
  animation: slide-up var(--medium) var(--emphasized);
  overscroll-behavior: contain;
}

.sheet:focus,
.dialog:focus {
  outline: none;
}

.sheet.closing {
  animation: slide-down var(--fast) var(--standard) forwards;
}

@keyframes slide-up {
  from { transform: translateY(100%); }
}

@keyframes slide-down {
  to { transform: translateY(100%); }
}

.handle {
  width: 36px;
  height: 4px;
  margin: 12px auto 8px;
  border-radius: 2px;
  background: var(--outline);
}

.sheet-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 20px 12px;
  border-bottom: 1px solid var(--outline-variant);
}

.sheet-action {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 8px 20px;
  text-align: start;
}

.sheet-action:hover {
  background: color-mix(in srgb, var(--on-surface) 5%, transparent);
}

.sheet-action .icon {
  color: var(--on-surface-variant);
}

.sheet-action.on .icon {
  color: var(--favorite);
}

.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.dialog {
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 24px 24px 12px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  pointer-events: auto;
  animation: pop-in var(--medium) var(--emphasized);
}

@keyframes pop-in {
  from { transform: scale(0.92); opacity: 0; }
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--primary);
}

.dialog-icon.destructive {
  background: var(--error-container);
  color: var(--error);
}

.dialog .body-medium {
  margin-top: 8px;
  color: var(--on-surface-variant);
  white-space: pre-line;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
}

.radio {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 4px 4px;
  text-align: start;
  border-radius: var(--radius-md);
}

.radio .dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--on-surface-variant);
  flex: none;
}

.radio[aria-checked="true"] .dot {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 10px var(--primary);
}

.snackbar-host {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--bar) + var(--safe-bottom) + 12px);
  z-index: 50;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}

.snackbar-host.no-bar {
  bottom: calc(16px + var(--safe-bottom));
}

.snackbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  min-height: 48px;
  padding: 6px 8px 6px 16px;
  border-radius: var(--radius-md);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  box-shadow: var(--shadow-12);
  pointer-events: auto;
  animation: pop-in var(--medium) var(--emphasized);
}

[dir="rtl"] .snackbar {
  padding: 6px 16px 6px 8px;
}

.snackbar .text {
  flex: 1;
}

.snackbar .btn.ghost {
  color: var(--inverse-primary);
  min-height: 40px;
}

/* Above the navigation bar, at the start side: never over the search field or a title. */
.offline-pill {
  position: fixed;
  bottom: calc(var(--bar) + var(--safe-bottom) + 12px);
  inset-inline-start: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--warning-container);
  color: var(--on-warning-container);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-8);
}

.offline-pill .icon {
  width: 16px;
  height: 16px;
}

.opening {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  animation: fade-in var(--fast) var(--standard);
}

.opening .logo {
  animation: pulse 900ms ease-in-out infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.55; }
}

.ptr {
  position: absolute;
  inset-inline: 0;
  top: calc(8px + var(--safe-top));
  z-index: 5;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.ptr .ptr-dot {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-8);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

body[data-bar="off"] .offline-pill {
  bottom: calc(16px + var(--safe-bottom));
  inset-inline-start: 12px;
}
