:root {
  --bg: var(--tg-theme-secondary-bg-color, #f4f5f7);
  --card: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #17191d);
  --muted: var(--tg-theme-hint-color, #7a8089);
  --link: var(--tg-theme-link-color, #2457d6);
  --line: rgba(127,127,127,.18);
  --soft: rgba(127,127,127,.08);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }

.app {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 18px 14px calc(52px + env(safe-area-inset-bottom));
}

.hero {
  padding: 8px 4px 14px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -.45px;
  font-weight: 780;
}

.hero p {
  margin: 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.48;
}

.search-wrap {
  margin: 3px 0 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.search-icon {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
}

.search-box input::placeholder { color: var(--muted); }

.search-count {
  min-height: 16px;
  padding: 4px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

/* Compact section menu */
.section-menu {
  position: relative;
  margin: 0 0 10px;
}

.section-menu > summary {
  list-style: none;
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.section-menu > summary::-webkit-details-marker { display: none; }

.section-menu > summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.section-menu[open] > summary::after {
  transform: rotate(180deg);
}

.section-menu-list {
  margin-top: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.section-menu-item {
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
}

.section-menu-item:last-child { border-bottom: 0; }
.section-menu-item:active { background: var(--soft); }

.section {
  margin-bottom: 19px;
  scroll-margin-top: 10px;
}

.section-head {
  padding: 13px 4px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: -.1px;
}

.schemes {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--card);
  box-shadow: 0 1px 1px rgba(0,0,0,.02);
}

.scheme + .scheme {
  border-top: 1px solid var(--line);
}

.scheme summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 15px 15px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
}

.scheme summary::-webkit-details-marker { display: none; }

.scheme[open] > summary {
  background: var(--soft);
}

.scheme-title {
  min-width: 0;
}

.chevron {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  transition: transform .15s ease;
}

.scheme[open] .chevron {
  transform: rotate(180deg);
}

.scheme-body {
  padding: 2px 16px 17px;
}

.field {
  padding-top: 13px;
}

.label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .62px;
}

.value {
  font-size: 14px;
  line-height: 1.55;
}

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

.source {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--link) 20%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--link) 7%, var(--card));
  color: var(--link);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.source:active { transform: scale(.98); }

.empty {
  display: none;
  margin: 22px 0;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.state, .denied {
  margin-top: 24vh;
  padding: 22px;
  text-align: center;
  line-height: 1.5;
  color: var(--muted);
}

.denied strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
}

@media (min-width: 700px) {
  .app { padding-top: 26px; }
  .hero h1 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chevron, .source { transition: none; }
}
