:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #edf4f5;
  --surface-strong: #e2eff0;
  --text: #152d38;
  --muted: #58707b;
  --primary: #123c52;
  --primary-2: #1e6674;
  --accent: #2c8a91;
  --line: #d5e1e4;
  --danger: #9c2f38;
  --warning: #8a5d0a;
  --success: #246a50;
  --focus: #0b6da7;
  --shadow: 0 6px 22px rgba(17, 58, 75, .08);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --content: 1180px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans CJK SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary-2); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }

.skip-link { position: fixed; z-index: 9999; left: 12px; top: -80px; padding: 10px 14px; border-radius: 8px; background: #fff; color: var(--text); box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 75%, white); outline-offset: 3px; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-mark { width: 58px; height: 58px; border-radius: 18px; background: linear-gradient(145deg, var(--primary), var(--accent)); box-shadow: var(--shadow); position: relative; }
.boot-mark::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 13px; height: 13px; border: solid #d8f4f1; border-width: 3px 0; border-radius: 50%; transform: skewY(-7deg); }
.static-message { margin: 10vh auto; padding: 24px; max-width: 640px; }

.app-shell { min-height: 100vh; padding-bottom: calc(24px + var(--safe-bottom)); }
.top-stack { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.96); }
.site-header { position: relative; z-index: 1; background: rgba(255,255,255,.93); border-bottom: 1px solid rgba(213,225,228,.92); backdrop-filter: blur(14px); }
.top-stack.without-install .site-header { padding-top: var(--safe-top); }
.install-banner { min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: calc(8px + var(--safe-top)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); color: #fff; background: linear-gradient(112deg, #123c52 0%, #1d6673 100%); border-bottom: 1px solid rgba(255,255,255,.16); box-shadow: 0 3px 14px rgba(18,60,82,.12); }
.install-banner-copy { flex: 1 1 auto; max-width: 760px; min-width: 0; line-height: 1.32; }
.install-banner-copy strong { display: block; font-size: 14px; font-weight: 680; }
.install-banner-button { min-height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 15px; border: 1px solid rgba(255,255,255,.46); border-radius: 12px; background: #fff; color: var(--primary); font-weight: 750; cursor: pointer; box-shadow: 0 3px 12px rgba(0,0,0,.11); }
.install-banner-button:hover { background: #eef8f7; }
.install-banner-button svg { width: 20px; height: 20px; }

.header-inner { max-width: var(--content); min-height: 64px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.brand-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 7px; border: 0; border-radius: 12px; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.brand-button:hover { background: var(--surface-soft); }
.brand-symbol { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(145deg, var(--primary), var(--accent)); color: #fff; flex: 0 0 auto; }
.brand-symbol svg { width: 23px; height: 23px; }
.brand-copy { display: grid; line-height: 1.08; }
.brand-copy strong { font-size: 16px; letter-spacing: .01em; }
.brand-copy span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.icon-button, .text-button { min-width: 44px; min-height: 44px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.icon-button svg { width: 22px; height: 22px; }
.icon-button:hover, .text-button:hover { background: var(--surface-soft); }
.text-button { display: none; padding: 0 11px; font-weight: 650; }
.language-group { display: flex; padding: 3px; border-radius: 12px; background: var(--surface-soft); }
.language-group button { min-height: 38px; min-width: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 650; }
.language-group button[aria-pressed="true"] { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(18,60,82,.1); }

.network-banner { min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 16px; font-size: 13px; background: #fff5d9; color: #624500; border-bottom: 1px solid #eadcae; }
.network-dot { width: 8px; height: 8px; border-radius: 50%; background: #b27a0b; }

.page { max-width: var(--content); margin: 0 auto; padding: 22px 16px 54px; }
.page.narrow { max-width: 860px; }
.page-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.page-header-copy { min-width: 0; }
.page-header h1 { margin: 0; font-size: clamp(24px, 5vw, 34px); line-height: 1.14; letter-spacing: -.02em; }
.page-header p { margin: 7px 0 0; color: var(--muted); }
.back-button { flex: 0 0 auto; margin-left: -8px; }

.hero-compact { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); gap: 18px; align-items: stretch; margin-bottom: 22px; }
.welcome-panel { border-radius: var(--radius-lg); padding: clamp(20px, 5vw, 34px); color: #fff; background: linear-gradient(125deg, #123c52 0%, #1f6d78 100%); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.welcome-panel::after { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%; right: -78px; top: -91px; border: 34px solid rgba(198,238,236,.12); }
.welcome-panel h1 { position: relative; z-index: 1; margin: 0; max-width: 680px; font-size: clamp(27px, 5vw, 44px); line-height: 1.08; letter-spacing: -.03em; }
.welcome-panel p { position: relative; z-index: 1; max-width: 680px; margin: 12px 0 0; color: #d4ecee; font-size: clamp(15px, 2.5vw, 18px); }
.catalog-status { display: grid; gap: 12px; padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.status-row { display: flex; align-items: center; gap: 12px; }
.status-icon { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; color: var(--primary-2); background: var(--surface-soft); border-radius: 12px; }
.status-icon svg { width: 22px; height: 22px; }
.status-row strong { display: block; font-size: 14px; }
.status-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.search-panel { position: relative; z-index: 3; margin-bottom: 24px; }
.search-form { display: flex; gap: 10px; align-items: stretch; }
.search-field { position: relative; flex: 1 1 auto; }
.search-field svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 21px; height: 21px; color: var(--muted); pointer-events: none; }
.search-input { width: 100%; min-height: 54px; padding: 10px 48px 10px 47px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: 0 4px 18px rgba(18,60,82,.055); }
.search-input::placeholder { color: #78909a; }
.search-input:focus { border-color: var(--accent); outline: 3px solid rgba(44,138,145,.17); }
.clear-search { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); min-width: 40px; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.search-submit { min-height: 54px; min-width: 64px; padding: 0 20px; border: 0; border-radius: 15px; background: var(--primary); color: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.search-submit:hover { background: #174d65; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 25px 0 13px; }
.section-head h2 { margin: 0; font-size: clamp(21px, 3vw, 26px); letter-spacing: -.015em; }
.section-head span, .section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.category-tile { min-height: 118px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; box-shadow: 0 3px 14px rgba(18,60,82,.04); }
.category-tile:hover { border-color: #a8c7cc; transform: translateY(-1px); box-shadow: var(--shadow); }
.category-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-soft); color: var(--primary-2); }
.category-icon svg { width: 24px; height: 24px; }
.category-tile strong { display: block; font-size: 16px; line-height: 1.24; }
.category-tile small { display: block; margin-top: 5px; color: var(--muted); }

.subcategory-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.chip { min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: #9ebfc5; }
.chip[aria-pressed="true"] { color: #fff; background: var(--primary); border-color: var(--primary); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filter-field { display: flex; align-items: center; gap: 9px; }
.filter-field label { font-size: 14px; color: var(--muted); }
.price-input { width: 132px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.secondary-button, .primary-button { min-height: 44px; border-radius: 11px; padding: 9px 15px; font-weight: 650; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--text); }
.primary-button { border: 1px solid var(--primary); background: var(--primary); color: #fff; }
.secondary-button:hover { background: var(--surface-soft); }
.primary-button:hover { background: #174d65; }

.listing-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.listing-card { min-height: 164px; display: grid; grid-template-columns: 150px minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); box-shadow: 0 3px 14px rgba(18,60,82,.045); }
.listing-card:hover { border-color: #a6c6ca; box-shadow: var(--shadow); transform: translateY(-1px); }
.listing-thumb { width: 100%; height: 100%; min-height: 164px; object-fit: cover; background: var(--surface-soft); }
.listing-card-body { min-width: 0; padding: 14px 15px; display: flex; flex-direction: column; }
.listing-meta { color: var(--primary-2); font-size: 12px; font-weight: 650; line-height: 1.35; }
.listing-card h3 { margin: 6px 0 6px; font-size: 17px; line-height: 1.27; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-summary { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-price { margin-top: auto; padding-top: 10px; color: var(--primary); font-weight: 750; font-size: 15px; }
.fallback-badge { display: inline-flex; align-items: center; margin-left: 6px; padding: 2px 6px; border-radius: 99px; background: #fff2cf; color: #6c4e08; font-size: 10px; font-weight: 700; vertical-align: middle; }

.empty-state, .error-state { padding: 34px 20px; text-align: center; border: 1px dashed #adc4ca; border-radius: var(--radius); background: rgba(255,255,255,.7); }
.empty-state-icon { width: 54px; height: 54px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 17px; background: var(--surface-soft); color: var(--primary-2); }
.empty-state-icon svg { width: 29px; height: 29px; }
.empty-state h2, .error-state h2 { margin: 0; font-size: 21px; }
.empty-state p, .error-state p { margin: 8px auto 0; max-width: 520px; color: var(--muted); }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr); gap: 20px; align-items: start; }
.detail-main, .detail-aside { min-width: 0; }
.detail-cover { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius-lg); background: var(--surface-soft); border: 1px solid var(--line); }
.detail-copy { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.detail-kicker { color: var(--primary-2); font-size: 13px; font-weight: 700; }
.detail-copy h1 { margin: 7px 0 8px; font-size: clamp(27px, 5vw, 40px); line-height: 1.12; letter-spacing: -.025em; }
.detail-price { margin: 8px 0 0; color: var(--primary); font-weight: 780; font-size: 21px; }
.detail-description { margin: 16px 0 0; color: #304d59; font-size: 16px; line-height: 1.62; white-space: pre-line; }
.info-card { margin-bottom: 14px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.info-card h2 { margin: 0 0 11px; font-size: 18px; }
.address-line { display: flex; gap: 10px; color: #304d59; }
.address-line svg { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; color: var(--primary-2); }
.contact-list { display: grid; gap: 8px; }
.contact-link { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; }
.contact-link:hover { background: var(--surface-soft); border-color: #a8c7cc; }
.contact-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--surface-soft); color: var(--primary-2); }
.contact-icon svg { width: 19px; height: 19px; }
.contact-copy { min-width: 0; }
.contact-copy small { display: block; color: var(--muted); text-transform: none; }
.contact-copy strong { display: block; overflow-wrap: anywhere; }
.no-contacts { margin: 0; color: var(--muted); }
.content-block { margin-top: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.content-block h2 { margin: 0 0 9px; font-size: 19px; }
.content-block p { margin: 0; white-space: pre-line; color: #304d59; }
.content-block ul { margin: 0; padding-left: 21px; }
.content-block li + li { margin-top: 7px; }
.content-kv { display: grid; gap: 8px; margin: 0; }
.content-kv-row { display: grid; grid-template-columns: minmax(90px,.38fr) minmax(0,1fr); gap: 12px; padding-bottom: 8px; border-bottom: 1px solid #edf2f3; }
.content-kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.content-kv dt { color: var(--muted); }
.content-kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

.about-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.about-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.about-card h2 { margin: 0 0 10px; font-size: 18px; }
.about-card dl { margin: 0; display: grid; gap: 8px; }
.about-card dl > div { display: flex; justify-content: space-between; gap: 12px; }
.about-card dt { color: var(--muted); }
.about-card dd { margin: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.about-card p { margin: 0; color: #304d59; }
.about-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.toast-stack { position: fixed; z-index: 100; left: 50%; bottom: calc(18px + var(--safe-bottom)); width: min(94vw, 560px); transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border-radius: 13px; color: #fff; background: #173f51; box-shadow: 0 12px 34px rgba(15,50,65,.28); pointer-events: auto; }
.toast.success { background: #246a50; }
.toast.warning { background: #76500b; }
.toast.error { background: #87333a; }
.toast button { margin-left: auto; min-width: 36px; min-height: 36px; border: 0; border-radius: 9px; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; }

.loading-line { height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 220% 100%; animation: loading 1.2s linear infinite; }
@keyframes loading { to { background-position: -220% 0; } }

.footer { max-width: var(--content); margin: 20px auto 0; padding: 22px 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.footer a { color: var(--muted); }

@media (max-width: 900px) {
  .hero-compact { grid-template-columns: 1fr; }
  .catalog-status { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .category-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .listing-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
  .detail-aside .info-card { margin: 0; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .header-inner { min-height: 60px; padding-inline: 11px; }
  .brand-copy span { display: none; }
  .language-group { display: none; }
  .text-button { display: inline-flex; }
  .page { padding: 16px 12px 42px; }
  .hero-compact { margin-bottom: 17px; }
  .welcome-panel { border-radius: 17px; padding: 22px 19px; }
  .catalog-status { grid-template-columns: 1fr 1fr; padding: 15px; gap: 10px; }
  .status-row { gap: 8px; }
  .status-icon { width: 35px; height: 35px; }
  .search-form { gap: 7px; }
  .search-submit { padding-inline: 14px; }
  .category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .category-tile { min-height: 112px; padding: 14px; }
  .listing-card { grid-template-columns: 108px minmax(0,1fr); min-height: 145px; }
  .listing-thumb { min-height: 145px; }
  .listing-card-body { padding: 12px; }
  .listing-summary { -webkit-line-clamp: 2; }
  .detail-copy { padding: 17px; }
  .detail-aside { grid-template-columns: 1fr; }
  .content-block { padding: 16px; }
  .content-kv-row { grid-template-columns: 1fr; gap: 2px; }
  .about-grid { grid-template-columns: 1fr; }
  .filter-bar { align-items: stretch; }
  .filter-field { width: 100%; justify-content: space-between; }
  .price-input { flex: 1; max-width: 180px; }
}

@media (max-width: 640px) {
  .install-banner { min-height: 54px; gap: 9px; padding: calc(6px + var(--safe-top)) max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px)); }
  .install-banner-copy strong { font-size: 12.5px; line-height: 1.25; }
  .install-banner-button { min-height: 42px; padding: 7px 11px; font-size: 14px; }
}

@media (max-width: 390px) {
  .brand-copy strong { font-size: 14px; }
  .text-button { padding-inline: 8px; min-width: 40px; }
  .category-tile strong { font-size: 15px; }
  .listing-card { grid-template-columns: 92px minmax(0,1fr); }
  .listing-thumb { min-height: 151px; }
}

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

@media print {
  .top-stack, .network-banner, .toast-stack, .footer, .back-button { display: none !important; }
  body, .app-shell, .page { background: #fff; }
  .page { max-width: none; padding: 0; }
  .detail-layout { display: block; }
  .detail-aside { margin-top: 14px; }
}

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; align-items: end; justify-items: center; padding: 16px; background: rgba(8,31,43,.46); backdrop-filter: blur(3px); }
.language-dialog, .install-help-dialog { width: min(100%, 520px); padding: 17px; border-radius: 20px 20px 14px 14px; background: #fff; box-shadow: 0 22px 70px rgba(8,31,43,.28); }
.install-help-dialog p { margin: 14px 0 18px; color: #304d59; line-height: 1.55; }
.install-help-dialog .primary-button { width: 100%; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head h2 { margin: 0; font-size: 21px; }
.language-options { display: grid; gap: 8px; margin-top: 12px; }
.language-options button { min-height: 54px; display: grid; grid-template-columns: 55px 1fr 26px; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--text); cursor: pointer; text-align: left; }
.language-options button:hover { background: var(--surface-soft); }
.language-options button.selected { border-color: var(--accent); background: #eef8f7; }
.language-options button strong { color: var(--primary); }
.language-options button span { color: var(--muted); }
.language-options button svg { width: 21px; height: 21px; color: var(--success); }
.filter-note { flex: 1 1 250px; color: var(--muted); font-size: 13px; }
.outbox-meta { margin-top: 10px !important; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted) !important; font-size: 13px; }
.about-links a.secondary-button { display: inline-flex; align-items: center; text-decoration: none; }
.primary-button:disabled { opacity: .58; cursor: wait; }
