:root {
  color-scheme: light;
  --tg-bg: #f3f7f5;
  --tg-text: #15221e;
  --tg-hint: #66746e;
  --tg-button: #075b49;
  --tg-button-text: #ffffff;
  --brand: #075b49;
  --brand-2: #08715a;
  --brand-dark: #043f34;
  --brand-soft: #e5f2ed;
  --gold: #b78a28;
  --bg: #f3f7f5;
  --surface: #ffffff;
  --ink: #15221e;
  --muted: #66746e;
  --line: #dce6e1;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(12, 50, 40, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #dce8e2; }
body { min-width: 320px; min-height: 100svh; margin: 0; color: var(--ink); background: radial-gradient(circle at 10% 0, rgba(7,91,73,.16), transparent 28%), linear-gradient(135deg, #eef5f1, #d9e5df); }
.telegram-webapp body { color: var(--tg-text); background: var(--tg-bg); }
.telegram-webapp .app-shell { background: var(--tg-bg); }
.telegram-webapp .action-button.primary { color: var(--tg-button-text); background: var(--tg-button); }
button, input, a { font: inherit; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(183, 138, 40, .45); outline-offset: 2px; }

.app-shell { width: min(100%, 480px); min-height: 100svh; margin: 0 auto; padding-bottom: calc(78px + env(safe-area-inset-bottom)); overflow-x: hidden; background: var(--bg); box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 25px 80px rgba(0,47,37,.18); }
.loading-screen, .error-screen { min-height: 100svh; display: grid; place-content: center; gap: 12px; padding: 28px; text-align: center; }
.spinner { width: 38px; height: 38px; margin: auto; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { color: #fff; padding: calc(18px + env(safe-area-inset-top)) 20px 30px; background: radial-gradient(circle at 15% 0, rgba(255,255,255,.18), transparent 33%), linear-gradient(145deg, #08795f, var(--brand-dark)); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 5px; color: rgba(255,255,255,.72); font-size: 12px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(25px, 7vw, 31px); line-height: 1.05; letter-spacing: -.03em; }
.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; flex: 0 0 50px; border: 1px solid rgba(255,255,255,.26); border-radius: 16px; background: rgba(255,255,255,.13); font-size: 25px; }

.search-wrap { position: sticky; top: 0; z-index: 8; margin: -18px 15px 14px; }
.search-box { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px; border: 1px solid rgba(220,230,225,.95); border-radius: 16px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); }
.search-box svg { width: 22px; height: 22px; color: var(--brand); flex: 0 0 22px; }
.search-box input { width: 100%; min-width: 0; padding: 15px 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-box input::placeholder { color: #89948f; }
.clear-search { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: var(--brand-soft); }

main { padding: 0 15px 24px; }
.hero-card { position: relative; overflow: hidden; padding: 19px; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #0d715a, #06463a); box-shadow: var(--shadow); }
.hero-card::after { content: ""; position: absolute; right: -45px; bottom: -60px; width: 150px; height: 150px; border: 28px solid rgba(255,255,255,.07); border-radius: 50%; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2 { margin: 0 0 8px; font-size: 22px; }
.hero-card p { max-width: 360px; margin: 0; color: rgba(255,255,255,.8); font-size: 14px; line-height: 1.55; }
.stats { display: flex; gap: 9px; margin-top: 16px; }
.stat { min-width: 78px; padding: 9px 11px; border: 1px solid rgba(255,255,255,.17); border-radius: 13px; background: rgba(255,255,255,.1); }
.stat strong { display: block; font-size: 19px; }
.stat span { color: rgba(255,255,255,.7); font-size: 11px; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 2px 11px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-head p, .result-count { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.text-button { padding: 6px; border: 0; color: var(--brand); background: transparent; font-size: 13px; font-weight: 750; }

.category-list { display: flex; gap: 9px; margin: 0 -15px; padding: 2px 15px 5px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.category-list::-webkit-scrollbar { display: none; }
.category-chip { min-width: 136px; max-width: 190px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 16px; text-align: left; scroll-snap-align: start; background: var(--surface); box-shadow: 0 4px 12px rgba(12,50,40,.04); }
.category-chip span { display: block; color: var(--brand); font-size: 19px; }
.category-chip strong { display: block; margin-top: 7px; font-size: 13px; line-height: 1.25; }
.category-chip small { display: block; margin-top: 4px; color: var(--muted); }
.category-chip.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.category-chip.active span, .category-chip.active small { color: rgba(255,255,255,.78); }

.card-list { display: grid; gap: 11px; }
.item-card { width: 100%; display: grid; grid-template-columns: 82px minmax(0, 1fr) 18px; align-items: center; gap: 13px; padding: 10px; border: 1px solid var(--line); border-radius: 17px; text-align: left; background: var(--surface); box-shadow: 0 5px 14px rgba(12,50,40,.04); }
.item-card:hover { transform: translateY(-1px); border-color: #bdd2c8; box-shadow: 0 9px 20px rgba(12,50,40,.08); }
.card-visual { width: 82px; height: 82px; display: grid; place-items: center; overflow: hidden; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #0f8065, #06443a); font-size: 27px; }
.card-visual.heritage { background: linear-gradient(145deg, #be9135, #70531a); }
.card-visual.mountain { background: linear-gradient(145deg, #43886d, #1d5547); }
.card-visual.canyon { background: linear-gradient(145deg, #b36e45, #714027); }
.card-visual img { width: 100%; height: 100%; object-fit: cover; }
.item-card h3 { margin: 0; font-size: 15px; line-height: 1.28; }
.item-card p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta-row { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 7px; color: var(--brand); font-size: 11px; font-weight: 700; }
.chevron { color: #91a09a; font-size: 24px; }

.guide-card { grid-template-columns: 58px minmax(0, 1fr) 18px; }
.avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: linear-gradient(145deg, var(--brand-2), var(--brand-dark)); font-weight: 850; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.badge { padding: 3px 7px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 750; }

.empty-state { padding: 38px 24px; border: 1px dashed #bdccc5; border-radius: 18px; text-align: center; background: rgba(255,255,255,.55); }
.empty-state span { font-size: 34px; }
.empty-state h3 { margin: 9px 0 5px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

.bottom-nav { position: fixed; z-index: 12; bottom: 0; left: 50%; width: min(100%, 480px); min-height: 68px; display: grid; grid-template-columns: repeat(3, 1fr); transform: translateX(-50%); padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); box-shadow: 0 -10px 30px rgba(12,50,40,.08); backdrop-filter: blur(12px); }
.nav-button { display: grid; place-items: center; gap: 2px; padding: 5px; border: 0; border-radius: 13px; color: #75827d; background: transparent; font-size: 11px; font-weight: 700; }
.nav-button svg { width: 22px; height: 22px; }
.nav-button.active { color: var(--brand); background: var(--brand-soft); }

.back-row { display: flex; align-items: center; gap: 8px; margin: 5px 0 14px; }
.back-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--brand); background: var(--surface); font-weight: 750; }
.detail-hero { overflow: hidden; border-radius: 21px; background: var(--surface); box-shadow: var(--shadow); }
.detail-image { height: 230px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #138169, #043f34); font-size: 62px; }
.detail-image img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { padding: 18px; }
.detail-title h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.16; }
.detail-title p { margin: 0; color: var(--muted); font-size: 13px; }
.info-grid { display: grid; gap: 10px; margin-top: 13px; }
.info-card { padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.info-card h3 { display: flex; gap: 8px; margin: 0 0 7px; color: var(--brand); font-size: 14px; }
.info-card p { margin: 0; color: #3b4944; font-size: 13px; line-height: 1.58; white-space: pre-line; }
.description { white-space: pre-line; }
.action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 13px 0; }
.action-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px; border: 1px solid var(--brand); border-radius: 13px; color: var(--brand); background: var(--surface); font-size: 13px; font-weight: 800; }
.action-button.primary { color: #fff; background: var(--brand); }
.action-button.disabled { pointer-events: none; opacity: .45; }
.guide-links { display: flex; flex-wrap: wrap; gap: 7px; }
.guide-link { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 12px; font-weight: 700; }
.notice { margin-top: 13px; padding: 12px 14px; border-radius: 13px; color: #6a541e; background: #fff7df; font-size: 12px; line-height: 1.45; }

@media (min-width: 760px) {
  .app-shell, .bottom-nav { width: min(100%, 980px); }
  .app-shell { min-height: 100vh; }
  .topbar { padding-inline: 30px; }
  main { padding-inline: 30px; }
  .search-wrap { margin-inline: 30px; }
  .category-list { margin-inline: -30px; padding-inline: 30px; }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 15px; align-items: start; }
  .detail-layout .info-grid { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
