:root {
  --bg: var(--tg-theme-secondary-bg-color, #0f0f0f);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #212121));
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #aaaaaa);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --button: var(--tg-theme-button-color, #5288c1);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --header: var(--tg-theme-section-header-text-color, #8d8e93);
  --subtitle: var(--tg-theme-subtitle-text-color, #aaaaaa);
  --danger: var(--tg-theme-destructive-text-color, #ec3942);
  --bar: var(--tg-theme-bottom-bar-bg-color, #212121);
  --line: var(--tg-theme-section-separator-color, rgba(255, 255, 255, 0.08));
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, p, ul, ol { margin: 0; }
b, strong { font-weight: 600; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + var(--safe-t)) 16px 8px;
  background: var(--bg);
}
.top-lead { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-mark {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.top-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mine-pick, .ai-pick {
  border: 0;
  border-radius: 10px;
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
}
.mine-pick { background: var(--section); color: var(--text); }
.mine-pick.on, .ai-pick { background: var(--button); color: var(--button-text); }
.mark { display: none; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.nav-back {
  appearance: none;
  border: 0;
  border-radius: 10px;
  min-height: 32px;
  padding: 0 10px;
  background: var(--section);
  color: var(--link);
  font-size: 15px;
  font-weight: 500;
}

main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px calc(72px + var(--safe-b));
}
body.desk main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.card, .note, .status, .admin {
  background: var(--section);
  border-radius: 12px;
  padding: 14px 14px 12px;
  margin: 0;
}
.lead, .line, .note p, .card .line {
  color: var(--subtitle);
  font-size: 14px;
  line-height: 1.4;
}
.kicker, label {
  display: block;
  margin: 0 0 6px;
  color: var(--header);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.card > * + *, .note > * + *, .admin > * + * { margin-top: 10px; }
.card .kicker, .note .kicker { margin-top: 0; }

.look {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin: 0;
  padding: 2px;
  background: var(--section);
  border-radius: 12px;
}
.look button {
  border: 0;
  background: transparent;
  color: var(--hint);
  border-radius: 10px;
  min-height: 34px;
  font-size: 14px;
  font-weight: 600;
}
.look button.on { background: var(--button); color: var(--button-text); }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(54px + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--bar);
  border-top: 1px solid var(--line);
}
.tabs-glass {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: 54px;
  background: transparent;
}
.tabs-indicator { display: none; }
.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 4px 2px 2px;
  color: var(--hint);
}
.tabs svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabs span {
  max-width: 100%;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs button.on { color: var(--button); }
body.desk .tabs { display: none; }

.row { display: flex; gap: 10px; align-items: center; }
.avatar, .letter {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
}
.letter { background: var(--button); color: var(--button-text); }
.name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.price { margin-top: 8px; font-size: 17px; font-weight: 600; color: var(--link); }
.place {
  font-size: 17px;
  font-weight: 700;
  min-width: 22px;
  color: var(--link);
  font-variant-numeric: tabular-nums;
}
.muted { color: var(--hint); }

.path {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.path li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.path b { font-weight: 600; }

.actions, .help { display: flex; flex-wrap: wrap; gap: 8px; }
.prices { display: flex; flex-direction: column; gap: 8px; }
.btn, .ghost, .choice {
  appearance: none;
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
}
.btn { background: var(--button); color: var(--button-text); }
.ghost, .choice { background: var(--bg); color: var(--text); }
.btn.block, .ghost.block, .choice { width: 100%; }
.actions .btn, .actions .ghost { flex: 1; min-width: 120px; width: auto; }
.choice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}
.choice.on { background: var(--button); color: var(--button-text); }

.field, select, textarea {
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  color: var(--text);
  border: 0;
  border-radius: 10px;
  padding: 12px;
  outline: none;
}
textarea { resize: vertical; }
label input[type="checkbox"] { accent-color: var(--button); margin-right: 8px; }
.err { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.ok { color: var(--link); min-height: 1.2em; font-size: 13px; }
.countries, .facts { margin: 2px 0 0; padding: 0; list-style: none; }
.countries li, .facts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.chat { display: flex; flex-direction: column; gap: 8px; min-height: 180px; }
.bubble {
  max-width: 86%;
  border-radius: 16px;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
}
.bubble.me {
  align-self: flex-end;
  background: var(--button);
  color: var(--button-text);
}
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 4px;
  background: var(--bg);
  border-radius: 12px;
}
.composer textarea { flex: 1; margin: 0; background: transparent; border: 0; padding: 8px; }
.composer .btn { flex: 0 0 auto; width: auto; }
.center { display: grid; justify-items: center; }
.qr {
  width: 168px;
  height: 168px;
  margin-top: 4px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}
.url {
  word-break: break-all;
  font-size: 14px;
  line-height: 1.35;
  color: var(--link);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
}
.meter {
  height: 3px;
  background: var(--bg);
  border-radius: 99px;
  overflow: hidden;
}
.meter span { display: block; height: 100%; background: var(--button); }
.home-title {
  margin: 8px 4px 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-meta {
  margin: -4px 4px 0;
  color: var(--hint);
  font-size: 13px;
}
.stories {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 2px 2px;
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }
.story {
  width: 72px;
  flex: 0 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}
.story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 2px;
  background: var(--button);
  display: grid;
  place-items: center;
}
.story-ring .letter,
.story-ring .avatar {
  width: 56px;
  height: 56px;
  border: 2px solid var(--bg);
}
.story-name {
  max-width: 72px;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}
.price-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.price-pair .price { margin-top: 0; }
.limit { font-weight: 600; }
.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 44px;
  font-weight: 700;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.name .tick, h3.name { display: inline-flex; align-items: center; gap: 4px; }
.tick { width: 16px; height: 16px; color: var(--button); fill: currentColor; flex: 0 0 16px; }
.catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.shop-card {
  background: var(--section);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.shop-card .name { margin: 8px 0 0; font-size: 15px; }
.shop-card .line, .shop-card .price { margin-top: 6px; }
.shop-card .price { font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tags span {
  font-size: 11px;
  color: var(--hint);
  background: var(--bg);
  border-radius: 8px;
  padding: 3px 6px;
}
.more {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
  min-height: 36px;
}
.faq details { padding: 10px 0; border-top: 1px solid var(--line); }
.faq details:first-of-type { border-top: 0; padding-top: 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin-top: 6px; }
.story-view {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(20px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: var(--section);
}
.shop-entry {
  display: block;
  width: 100%;
  text-align: left;
  color: inherit;
}
body.sheet-open { overflow: hidden; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  width: 100%;
  height: 66vh;
  height: 66dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  transform: translateY(110%);
  transition: transform 0.24s ease;
}
.sheet-backdrop.is-open .sheet { transform: translateY(0); }
.sheet-grip {
  position: relative;
  flex: none;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.sheet-grip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: var(--hint);
  transform: translateX(-50%);
}
.sheet-body {
  overflow: auto;
  padding: 4px 16px calc(16px + var(--safe-b));
}
.tap { cursor: pointer; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }
