/* Стиль: Сила ветра — электрик-синий, чёрный, капс, жирная типографика.
   Тема подхватывается из Telegram (body.dark). */
:root {
  --blue: #0047ff;
  --blue-dark: #003cd9;
  --link: #0047ff;
  --orange: #ff5700;
  --yellow: #ffcc01;
  --bg: #ffffff;
  --text: #121212;
  --surface: #f5f5f5;
  --bubble: #ffffff;
  --hint: #8a8a8a;
  --on-blue: #ffffff;
}

body.dark {
  --link: #5c85ff;
  --bg: #121212;
  --text: #ffffff;
  --surface: #1f1f1f;
  --bubble: #2b2b2b;
  --hint: #9a9a9a;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Golos Text", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 16px;
  padding-bottom: 90px;
  transition: background .2s, color .2s;
}

#app { max-width: 640px; margin: 0 auto; padding: 14px; }

.loading, .empty { text-align: center; color: var(--hint); padding: 48px 16px; font-weight: 600; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 2px 16px;
}
.topbar h1 {
  font-size: 30px; font-weight: 900; text-transform: uppercase;
  letter-spacing: -0.5px; line-height: 1;
}
.icon-btn {
  border: none; background: var(--surface); color: var(--text);
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 20px; cursor: pointer; flex-shrink: 0;
}

.btn {
  display: inline-block; border: none; border-radius: 8px;
  background: var(--blue); color: var(--on-blue);
  font-family: inherit; font-size: 15px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.3px;
  padding: 14px 20px; cursor: pointer; text-align: center;
  transition: background .15s;
}
.btn:active { background: var(--blue-dark); }
.btn.small { padding: 9px 14px; font-size: 13px; }
.btn.ghost { background: var(--surface); color: var(--text); }
.btn.danger { background: var(--orange); color: #fff; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; }

.card {
  background: var(--surface); border-radius: 12px;
  padding: 16px; margin-bottom: 10px; cursor: pointer;
  border-left: 5px solid var(--blue);
}
.card .title {
  font-weight: 800; font-size: 18px; margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: -0.2px;
}
.card .meta { color: var(--hint); font-size: 14px; margin-bottom: 8px; font-weight: 500; }
.card .row { display: flex; justify-content: space-between; align-items: center; }

.badge {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px;
  background: var(--bg); color: var(--text);
}
.badge.going { background: var(--blue); color: var(--on-blue); }

.detail .title {
  font-size: 26px; font-weight: 900; text-transform: uppercase;
  letter-spacing: -0.5px; line-height: 1.05; margin-bottom: 10px;
}
.detail .meta { color: var(--text); margin-bottom: 5px; font-weight: 600; font-size: 15px; }
.detail .desc { margin: 14px 0; white-space: pre-wrap; line-height: 1.45; }

.section-label {
  font-size: 13px; text-transform: uppercase; color: var(--link);
  margin: 22px 0 10px; letter-spacing: 1px; font-weight: 800;
}

.attendees { display: flex; flex-wrap: wrap; gap: 6px; }
.attendees .chip {
  background: var(--surface); border-radius: 20px; padding: 7px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; border: none;
  color: var(--text); font-family: inherit;
}

.rsvp-row { display: flex; gap: 8px; margin-top: 18px; }
.rsvp-row .btn { flex: 1; }

form label, .field-label {
  display: block; font-size: 12px; color: var(--text);
  margin: 16px 0 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}
form input, form textarea, form select {
  width: 100%; border: 2px solid transparent; border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 16px; padding: 13px; font-family: inherit; font-weight: 500;
  outline: none; appearance: none; -webkit-appearance: none;
}
form input:focus, form textarea:focus, form select:focus { border-color: var(--blue); }
form textarea { min-height: 70px; resize: vertical; }
form .hint { font-size: 13px; color: var(--hint); margin-top: 6px; font-weight: 500; }
.dt-row { display: flex; gap: 8px; }
.dt-row > div { flex: 1; }

.chat { margin-top: 8px; }
.chat-box {
  background: var(--surface); border-radius: 12px; padding: 12px;
  height: 40vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: 85%; }
.msg .who { font-size: 12px; color: var(--link); font-weight: 800; margin-bottom: 2px; }
.msg .bubble {
  background: var(--bubble); border-radius: 10px; padding: 9px 12px;
  font-size: 15px; word-break: break-word; line-height: 1.35;
}
.msg .at { font-size: 11px; color: var(--hint); margin-left: 8px; font-weight: 500; }
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--blue); color: var(--on-blue); }
.msg.mine .at { color: rgba(255,255,255,.7); }
.msg.mine .who { display: none; }

.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input {
  flex: 1; border: 2px solid var(--surface); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 16px; padding: 12px; font-family: inherit; outline: none;
}
.chat-input input:focus { border-color: var(--blue); }
.chat-locked {
  text-align: center; color: var(--text); padding: 22px;
  background: var(--surface); border-radius: 12px; font-weight: 600; font-size: 14px;
}

.back {
  color: var(--link); font-size: 13px; margin-bottom: 12px; display: inline-block;
  cursor: pointer; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}

.notice {
  background: var(--yellow); color: #121212; border-radius: 10px;
  padding: 12px 14px; font-size: 14px; margin-bottom: 14px; font-weight: 600;
}

.fab {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(0, 71, 255, .35);
  white-space: nowrap;
}

.topbar-btns { display: flex; gap: 8px; }

/* Переключатель аудитории и список людей */
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; border: 2px solid var(--surface); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 800;
  text-transform: uppercase; padding: 11px; cursor: pointer;
}
.seg-btn.active { border-color: var(--blue); color: var(--link); background: var(--bg); }
.pick-list {
  margin-top: 8px; background: var(--surface); border-radius: 10px;
  padding: 6px; max-height: 40vh; overflow-y: auto;
}
.pick {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px; border-radius: 8px; cursor: pointer;
  font-size: 15px; font-weight: 600;
}
.pick input { width: 18px; height: 18px; accent-color: var(--blue); flex-shrink: 0; }
.pick.self { opacity: .6; }

.card.past { border-left-color: var(--hint); opacity: .85; }
.badge.past-badge { background: var(--surface); color: var(--hint); }

/* Календарь */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cal-title { font-size: 18px; font-weight: 900; text-transform: uppercase; }
.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  text-align: center; font-size: 11px; font-weight: 800; text-transform: uppercase;
  color: var(--hint); margin-bottom: 4px;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 10px; font-size: 15px; font-weight: 600;
  background: var(--surface); position: relative;
}
.cal-day.blank { background: transparent; }
.cal-day.today { outline: 2px solid var(--blue); }
.cal-day.has-event, .cal-day.has-past { cursor: pointer; }
.cal-day .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hint);
  position: absolute; bottom: 6px;
}
.cal-day.has-event .dot { background: var(--blue); }
.cal-day.has-event { color: var(--link); font-weight: 800; }
.cal-day.selected { background: var(--blue); color: var(--on-blue); }
.cal-day.selected .dot { background: var(--on-blue); }

/* Голосование за дату */
.poll-opt {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 2px solid transparent;
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
}
.poll-opt.voted { border-color: var(--blue); }
.poll-opt .poll-when { flex: 1; }
.poll-opt .voters { font-size: 12px; color: var(--hint); margin-top: 3px; }
.votes-badge {
  font-size: 14px; font-weight: 800; color: var(--link);
  white-space: nowrap;
}

/* Сбор денег */
.fee-box {
  background: var(--surface); border-radius: 12px; padding: 14px;
}
.fee-req {
  font-weight: 700; font-size: 15px; margin-bottom: 10px;
  word-break: break-all;
}

/* Медиа-галерея */
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.media-item {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: 10px; background: var(--surface); cursor: pointer;
}
.media-item img, .media-item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-item .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none;
}
.media-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; cursor: pointer;
}

.lightbox { align-items: center; }
.lightbox-inner { max-width: 100%; padding: 10px; text-align: center; }
.lightbox-inner img, .lightbox-inner video {
  max-width: 100%; max-height: 78vh; border-radius: 12px;
}
.lightbox-meta { color: #fff; font-size: 13px; margin-top: 8px; font-weight: 600; }

/* Модалка профиля участника */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal {
  background: var(--bg); color: var(--text);
  border-radius: 16px 16px 0 0; padding: 20px; width: 100%; max-width: 640px;
}
.modal h2 {
  font-size: 20px; font-weight: 900; text-transform: uppercase; margin-bottom: 2px;
}
.modal .username { color: var(--hint); font-size: 14px; margin-bottom: 12px; font-weight: 500; }
.modal .prow { margin: 10px 0; }
.modal .prow .k {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  color: var(--link); letter-spacing: 0.5px; margin-bottom: 2px;
}
.modal .prow .v { font-size: 15px; line-height: 1.35; white-space: pre-wrap; }
.modal .prow .v.empty { color: var(--hint); }
.modal .btn { margin-top: 14px; }
