:root {
  --bg: #0b0c0e;
  --surface: #15171a;
  --surface-2: #202226;
  --surface-3: #282a2f;
  --text: #f4f2ed;
  --muted: #999ba2;
  --line: rgba(255, 255, 255, 0.09);
  --brand: #e85d3f;
  --brand-dark: #b63d29;
  --success: #91c990;
  --nav-height: 72px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #08090a;
  color: var(--text);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #08090a; }

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow-x: clip;
  overflow-y: visible;
  background: var(--bg);
}

.view-stack { min-height: 100dvh; }

.view {
  display: none;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.view.is-active { display: block; }

.topbar,
.page-header {
  padding-left: 18px;
  padding-right: 18px;
}

.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.brand strong { color: #f20d23; font-weight: 650; }

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button svg,
.button svg,
.nav-item svg,
.search-field svg,
.local-avatar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero {
  position: relative;
  margin: 0 14px;
  min-height: 430px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-2);
}

.image-placeholder {
  display: grid;
  place-items: center;
  color: #73767d;
  background: var(--surface-2);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-align: center;
}

.hero-image { position: absolute; inset: 0; }

.hero-gradient {
  position: absolute;
  inset: 25% 0 0;
  background: linear-gradient(transparent, rgba(11, 12, 14, 0.7) 42%, rgba(11, 12, 14, 0.98));
  pointer-events: none;
}

.hero-copy {
  position: absolute;
  z-index: 1;
  left: 18px;
  right: 18px;
  bottom: 18px;
}

.eyebrow,
.free-label {
  color: #e9c1b6;
  font-size: 11px;
  letter-spacing: 0.65px;
  font-weight: 600;
}

.hero h1 {
  max-width: 330px;
  margin: 7px 0 0;
  font-size: 27px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.75px;
}

.hero-actions,
.detail-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 16px;
}

.button {
  min-height: 43px;
  border: 0;
  border-radius: 7px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.button-primary { background: var(--text); color: #111214; }
.button-secondary { background: rgba(36, 38, 43, 0.94); color: var(--text); }

.content-section { padding: 26px 14px 0; }
.section-last { padding-bottom: 18px; }

.section-heading,
.catalog-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 12px;
}

.section-heading h2,
.catalog-summary strong {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.25px;
}

.section-heading button {
  flex: none;
  border: 0;
  padding: 6px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.poster-row,
.channel-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 31%);
  gap: 9px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.poster-row::-webkit-scrollbar,
.channel-row::-webkit-scrollbar,
.type-tabs::-webkit-scrollbar,
.category-chips::-webkit-scrollbar { display: none; }

@media (hover: hover) and (pointer: fine) {
  .poster-row,
  .channel-row,
  .finish-poster-row,
  .curated-row { cursor: grab; }

  .is-dragging {
    cursor: grabbing !important;
    scroll-snap-type: none !important;
    user-select: none;
  }
}

.catalog-card,
.row-card,
.channel-card,
.rank-item {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.row-card,
.channel-card { scroll-snap-align: start; }

.poster-image {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-2);
}

.hero-image img,
.poster-image img,
.rank-image img,
.channel-image img,
.detail-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.poster-placeholder,
.channel-placeholder,
.rank-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: #70737a;
  font-size: 11px;
  letter-spacing: 0.4px;
}

.card-title {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed #4a4d55;
  background:
    radial-gradient(circle at 50% 38%, rgba(225, 83, 70, 0.14), transparent 38%),
    var(--surface-2);
  color: var(--muted);
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.more-card:hover .more-visual,
.more-card:focus-visible .more-visual {
  border-color: var(--brand);
  color: var(--text);
  background:
    radial-gradient(circle at 50% 38%, rgba(225, 83, 70, 0.22), transparent 42%),
    var(--surface-2);
}

.more-plus {
  font-size: 30px;
  line-height: 1;
  font-weight: 300;
}

.more-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .25px;
}

.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.22);
}

.progress-track span { display: block; width: 46%; height: 100%; background: var(--brand); }

.ranking-list { display: grid; gap: 9px; }

.rank-item {
  min-height: 74px;
  display: grid;
  grid-template-columns: 28px 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.rank-number { color: var(--brand); font-size: 23px; font-weight: 600; text-align: center; }
.rank-image { width: 58px; height: 74px; overflow: hidden; border-radius: 6px; }
.rank-title { overflow: hidden; font-size: 13px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.rank-free { color: var(--success); font-size: 10px; font-weight: 600; }

.channel-row { grid-auto-columns: 43%; }
.channel-image { height: 82px; overflow: hidden; border-radius: 7px; background: var(--surface-2); }

.page-header { padding-top: 28px; padding-bottom: 18px; }
.page-header h1 { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 600; letter-spacing: -0.75px; }
.page-header p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.search-field {
  min-height: 46px;
  margin: 0 14px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

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

.search-field input::placeholder { color: var(--muted); opacity: 1; }

.type-tabs,
.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 14px 0;
  scrollbar-width: none;
}

.filter-button {
  flex: none;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: transparent;
  color: #d1cfc9;
  cursor: pointer;
  font-size: 13px;
}

.filter-button.is-active { border-color: var(--text); background: var(--text); color: #111214; }
.category-chips { padding-top: 9px; }
.category-chips .filter-button { min-height: 32px; font-size: 12px; }

.catalog-summary { margin: 22px 14px 12px; }
.catalog-summary span { color: var(--muted); font-size: 12px; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 9px;
  padding: 0 14px 24px;
}

.catalog-empty {
  grid-column: 1 / -1;
  padding: 54px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.offer-card {
  margin: 0 14px;
  border-radius: 11px;
  padding: 20px;
  background: #28221f;
}

.offer-main { min-height: 190px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; }
.offer-card h2 { margin: 8px 0 0; font-size: 23px; font-weight: 600; letter-spacing: -0.5px; }
.offer-card p { margin: 8px 0 0; color: #cbc5bf; font-size: 13px; line-height: 1.5; }
.offer-card .button { margin-top: 18px; }

.benefit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 12px 14px 0; }
.benefit-card { min-height: 135px; padding: 16px; border-radius: 9px; background: var(--surface); }
.benefit-icon { color: var(--brand); font-size: 15px; font-weight: 700; }
.benefit-card h3 { margin: 22px 0 0; font-size: 14px; font-weight: 600; }
.benefit-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.local-profile {
  margin: 0 14px 22px;
  padding: 16px;
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 10px;
  background: var(--surface);
}

.local-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--muted); }
.local-profile strong, .local-profile small { display: block; }
.local-profile strong { font-size: 14px; font-weight: 600; }
.local-profile small { margin-top: 4px; color: var(--muted); font-size: 12px; }

.settings-list { padding: 0 18px; }
.settings-list button {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}
.settings-list small { color: var(--muted); font-size: 12px; }

.settings-list .gift-settings-row {
  min-height: 78px;
  border-bottom: 0;
}

.gift-settings-copy {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gift-settings-copy strong,
.gift-settings-copy em {
  display: block;
}

.gift-settings-copy strong {
  color: var(--text);
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
}

.gift-settings-copy em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.gift-settings-icon {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(232, 93, 63, 0.42);
  border-radius: 12px;
  background: rgba(232, 93, 63, 0.12);
  font-size: 23px;
}

.gift-fab {
  position: fixed;
  z-index: 40;
  right: max(14px, calc((100vw - 430px) / 2 + 14px));
  bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
  min-width: 62px;
  min-height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 7px 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: linear-gradient(145deg, #f06a49, #b83d29);
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(232, 93, 63, 0.12);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.gift-fab-icon {
  display: block;
  font-size: 27px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}

.gift-fab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

body.activity-modal-open .gift-fab {
  opacity: 0;
  pointer-events: none;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 0;
  width: min(100%, 430px);
  min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 7px 6px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(11, 12, 14, 0.97);
  backdrop-filter: blur(14px);
}

.nav-item {
  min-height: 52px;
  border: 0;
  padding: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: #777981;
  cursor: pointer;
  font-size: 10px;
}

.nav-item svg { width: 19px; height: 19px; }
.nav-item.is-active { color: var(--text); }

.search-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  width: min(100%, 430px);
  margin: 0 auto;
  display: none;
  overflow-y: auto;
  background: var(--bg);
}

.search-overlay.is-open { display: block; }
.search-overlay-header { position: sticky; top: 0; z-index: 1; min-height: 72px; padding: 10px 10px 10px 4px; display: flex; align-items: center; background: rgba(11,12,14,.97); }
.overlay-field { flex: 1; margin: 0; }
.search-results { display: grid; gap: 0; padding: 4px 18px 28px; }

.search-result {
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}
.search-result::after { content: "›"; color: var(--muted); font-size: 21px; }

.detail-sheet { position: fixed; z-index: 60; inset: 0; display: none; align-items: flex-end; justify-content: center; }
.detail-sheet.is-open { display: flex; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.74); }
.sheet-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  background: var(--bg);
  box-shadow: 0 -20px 60px rgba(0,0,0,.45);
}
.sheet-close { position: absolute; z-index: 2; right: 12px; top: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(11,12,14,.78); color: var(--text); cursor: pointer; font-size: 24px; }
.detail-image { height: 360px; }
.detail-content { padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); }
.detail-content h2 { margin: 7px 0 0; font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -0.6px; }
.detail-actions { grid-template-columns: 1fr auto; }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(var(--nav-height) + 14px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  transform: translate(-50%, 8px);
  border-radius: 7px;
  background: var(--text);
  color: #111214;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  white-space: nowrap;
  font-size: 12px;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 560px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100dvh - 44px); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 22px 70px rgba(0,0,0,.45); }
  .view { min-height: calc(100dvh - 44px); }
  .bottom-nav { bottom: 22px; border-radius: 0 0 28px 28px; }
}
