/* ДОСУГ·КИНО — тема «вечерний сеанс»
   Палитра: тёплый уголь зала, свет проекторной лампы, кассовый красный.
   Шрифты: Oswald (афишный дисплей) · Golos Text (UI) · JetBrains Mono (табло). */

:root {
  --bg: #141110;          /* тёплый уголь */
  --bg-raise: #1d1917;    /* поверхность карточек */
  --bg-soft: #262019;     /* ховеры, вложенные блоки */
  --line: #302a25;
  --line-soft: #262119;
  --ink: #ede6da;         /* свет проектора */
  --ink-dim: #a89e90;
  --ink-faint: #6f675c;
  --lamp: #efb54a;        /* лампа — главный акцент */
  --lamp-soft: rgba(239, 181, 74, .14);
  --lamp-glow: rgba(239, 181, 74, .35);
  --ticket-red: #c9504a;  /* кассовый — редкие бейджи и ошибки */
  --ok: #7fb069;
  --radius: 10px;
  --font-ui: "Golos Text", system-ui, sans-serif;
  --font-display: "Oswald", var(--font-ui);
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 4px; }

/* ---------- верхняя панель ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; flex-direction: column; gap: 1px; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: .06em;
}
.brand-mark i { color: var(--lamp); font-style: normal; }
.brand-sub { font-size: 11.5px; color: var(--ink-faint); letter-spacing: .04em; }

.views { display: flex; gap: 4px; background: var(--bg-raise); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.view-btn { padding: 6px 18px; border-radius: 999px; color: var(--ink-dim); font-weight: 500; }
.view-btn.active { background: var(--lamp); color: #241a08; }
.view-btn:not(.active):hover { color: var(--ink); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.update-status { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.update-status.running { color: var(--lamp); }

.ghost-btn {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-dim);
  transition: border-color .15s, color .15s;
}
.ghost-btn:hover { border-color: var(--lamp); color: var(--ink); }

/* ---------- дата-лента «билеты» ---------- */

.datebar-wrap { padding: 14px 22px 0; overflow-x: auto; scrollbar-width: none; }
.datebar-wrap::-webkit-scrollbar { display: none; }
.datebar { display: flex; gap: 10px; min-width: max-content; }

.date-ticket {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 86px;
  padding: 9px 14px 8px 18px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color .15s, background .15s;
}
/* перфорация отрывного билета */
.date-ticket::before {
  content: "";
  position: absolute;
  left: 7px; top: 6px; bottom: 6px;
  border-left: 1.5px dashed var(--line);
}
.date-ticket .dow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.date-ticket .dom { font-family: var(--font-mono); font-weight: 700; font-size: 17px; line-height: 1.1; }
.date-ticket .cnt { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); }
.date-ticket:hover { border-color: var(--ink-faint); }
.date-ticket.active {
  background: var(--lamp-soft);
  border-color: var(--lamp);
}
.date-ticket.active::before { border-color: var(--lamp-glow); }
.date-ticket.active .dow, .date-ticket.active .cnt { color: var(--lamp); }
.date-ticket.weekend .dow { color: var(--ticket-red); }
.date-ticket.active.weekend .dow { color: var(--lamp); }

/* ---------- фильтры и подборки ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 22px 0;
}

.search, .select {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 12px;
  font: inherit;
}
.search { flex: 1 1 240px; min-width: 200px; }
.search::placeholder { color: var(--ink-faint); }
.select { max-width: 210px; }
.search:focus, .select:focus { border-color: var(--lamp); outline: none; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 4px; }
.preset {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 13.5px;
  transition: all .15s;
}
.preset:hover { border-color: var(--lamp); color: var(--ink); }
.preset.active {
  background: var(--lamp-soft);
  border-color: var(--lamp);
  color: var(--lamp);
}

/* ---------- афиша ---------- */

main { padding: 6px 22px 90px; }

.feed-summary {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  padding: 10px 2px 4px;
}
.feed-summary b { color: var(--ink-dim); font-weight: 500; }

.feed { display: flex; flex-direction: column; gap: 14px; }

.movie-card {
  display: flex;
  gap: 18px;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  animation: card-in .25s ease both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .movie-card { animation: none; }
}

.poster-col { position: relative; flex: 0 0 92px; }
.poster {
  width: 92px; height: 138px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg-soft);
  display: block;
}
.poster.noimg { display: grid; place-items: center; color: var(--ink-faint); font-size: 28px; }
.age-badge {
  position: absolute; top: 6px; right: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 700;
  background: rgba(0,0,0,.72);
  padding: 2px 5px;
  border-radius: 4px;
}

.movie-main { flex: 1; min-width: 0; }
.movie-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: .015em;
  line-height: 1.2;
}
.movie-meta { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.movie-stats { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); margin-top: 5px; }
.movie-stats .lamp { color: var(--lamp); }

.cinema-groups { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.cinema-group { border-top: 1px solid var(--line-soft); padding-top: 9px; }
.cinema-name { font-weight: 600; font-size: 13.5px; }
.cinema-name .metro { color: var(--ink-dim); font-weight: 400; }
.cinema-name .metro::before { content: "Ⓜ "; color: var(--ticket-red); font-size: 11px; }

.sessions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }

/* чип сеанса — «табло» */
.session-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
  padding: 5px 9px 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.session-chip .t { font-family: var(--font-mono); font-weight: 700; font-size: 14.5px; letter-spacing: .02em; }
.session-chip .p { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dim); }
.session-chip .f { font-family: var(--font-mono); font-size: 9px; color: var(--lamp); letter-spacing: .06em; }
.session-chip:hover {
  border-color: var(--lamp);
  box-shadow: 0 0 14px var(--lamp-glow);
  transform: translateY(-1px);
}

.more-cinemas { margin-top: 10px; font-size: 13px; }

.empty {
  text-align: center;
  color: var(--ink-dim);
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty b { display: block; font-family: var(--font-display); font-size: 19px; margin-bottom: 6px; color: var(--ink); }

.loading {
  text-align: center;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 60px 0;
}
.loading::after { content: "▮"; color: var(--lamp); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- кинотеатры + карта ---------- */

.cinemas-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  height: calc(100vh - 250px);
  min-height: 480px;
  margin-top: 12px;
}

.cinema-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }

.cinema-card {
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .15s;
  text-align: left;
}
.cinema-card:hover, .cinema-card.active { border-color: var(--lamp); }
.cinema-card h3 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 16.5px; }
.cinema-card .addr { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.cinema-card .row { display: flex; gap: 14px; margin-top: 7px; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.cinema-card .row .lamp { color: var(--lamp); }
.cinema-card .metro { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; }
.cinema-card .metro::before { content: "Ⓜ "; color: var(--ticket-red); font-size: 11px; }

.cinema-sessions { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 9px; }
.cs-movie { margin-bottom: 8px; }
.cs-movie .t { font-weight: 600; font-size: 13px; }

.map { border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--bg-soft); }
/* тёмная тема для Яндекс.Карт: инвертируем только слой тайлов, метки не трогаем */
.map [class*="ground-pane"] {
  filter: invert(0.93) hue-rotate(185deg) saturate(0.4) brightness(0.92) contrast(0.95);
}
/* балун в цветах приложения */
.map [class*="balloon__layout"],
.map [class*="balloon__content"] {
  background: var(--bg-raise) !important;
  color: var(--ink) !important;
  font-family: var(--font-ui) !important;
}
.map [class*="balloon__content"] a { color: var(--lamp) !important; }
.map [class*="balloon__tail"]::after { background: var(--bg-raise) !important; }
.map [class*="balloon__close-button"] { filter: invert(1); opacity: .7; }

/* ---------- чат ---------- */

.chat-fab {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 1000;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  background: var(--lamp);
  color: #241a08;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), 0 0 24px var(--lamp-glow);
  transition: transform .12s;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab-icon { font-size: 15px; }

.chat-panel {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 1001;
  width: min(430px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 60px));
  display: flex;
  flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0,0,0,.6);
  overflow: hidden;
}

.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg-raise));
}
.chat-title { font-family: var(--font-display); font-weight: 500; font-size: 17px; }
.chat-sub { font-size: 11.5px; color: var(--ink-faint); }

.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.chat-empty { color: var(--ink-dim); font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 8px 2px; }
.chat-hint {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 6px 11px;
  color: var(--lamp);
  font-size: 13px;
  text-align: left;
}
.chat-hint:hover { border-color: var(--lamp); }

.msg { max-width: 92%; padding: 9px 13px; border-radius: 12px; font-size: 14px; overflow-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--lamp-soft); border: 1px solid rgba(239,181,74,.3); }
.msg.assistant { align-self: flex-start; background: var(--bg-soft); border: 1px solid var(--line-soft); }
.msg.assistant.streaming::after { content: "▮"; color: var(--lamp); animation: blink 1s steps(2) infinite; }
.msg.assistant p { margin: 0 0 8px; } .msg.assistant p:last-child { margin: 0; }
.msg.assistant ul { margin: 4px 0; padding-left: 18px; }
.msg.assistant li { margin: 3px 0; }
.msg.assistant code { font-family: var(--font-mono); font-size: 12.5px; color: var(--lamp); }
.msg.assistant strong { color: var(--lamp); font-weight: 600; }
.msg.assistant a { color: var(--lamp); text-decoration-color: var(--lamp-glow); }
.msg.assistant a:hover { text-decoration-color: var(--lamp); }
.msg.error { align-self: center; color: var(--ticket-red); font-size: 13px; text-align: center; }

.tool-note {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.tool-note::before { content: "⌕ "; color: var(--lamp); }

.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-soft); }
.chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  color: var(--ink);
  font: inherit;
}
.chat-input:focus { border-color: var(--lamp); outline: none; }
.chat-send {
  width: 44px;
  background: var(--lamp);
  color: #241a08;
  border-radius: 10px;
  font-size: 15px;
}
.chat-send:disabled { opacity: .45; cursor: default; }

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  .cinemas-layout { grid-template-columns: 1fr; height: auto; }
  .map { height: 380px; }
  .cinema-list { max-height: 420px; }
}

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 14px 8px; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .datebar-wrap, .controls, .presets { padding-left: 14px; padding-right: 14px; }
  main { padding: 6px 14px 90px; }
  .movie-card { gap: 12px; padding: 12px; }
  .poster-col { flex-basis: 72px; }
  .poster { width: 72px; height: 108px; }
  .movie-title { font-size: 18px; }
  .chat-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100vh - 40px); }
}
