:root {
  --brand: #FFC800;
  --t1: #28303F;
  --t2: #77849D;
  --t3: #A5AEC0;
  --bg: #F0F3F5;
  --card: #FFFFFF;
  --active: #202632;
  --border: #E2E6ED;
  --err: #F84A00;
  --ok: #00A55E;
  --r-card: 32px;
  --r-pill: 100px;
  --r-xl: 24px;
  --r-lg: 16px;
  --edge: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

/* Без этого правила элементы с одновременно class="field"/"card" (display: flex) и
   атрибутом hidden остаются видимыми -- у автора-стиля display:flex тот же приоритет,
   что и у встроенного правила [hidden]{display:none}, и он побеждает как более поздний.
   Это ломало, например, поле «Свой город»: оно показывалось всегда, а не только при
   выборе «Другой». !important гарантирует, что hidden всегда побеждает. */
[hidden] { display: none !important; }

body {
  font-family: "Beeline Sans", "BeelineSans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--t1);
  font-size: 16px;
  line-height: 20px;
  text-transform: lowercase;
  padding: var(--edge) var(--edge) 64px;
}
input { text-transform: none; }

.wrap { max-width: 1080px; margin: 0 auto; }

.cap { font-size: 13px; line-height: 16px; color: var(--t2); }
.md { font-size: 17px; line-height: 24px; }
.mut { color: var(--t2); }
.mut3 { color: var(--t3); }

/* ---------- hero / head ---------- */
.head {
  background: var(--active);
  color: #fff;
  border-radius: var(--r-card);
  padding: 40px 36px;
}
.tag {
  display: inline-block;
  background: var(--brand);
  color: var(--t1);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 13px;
  line-height: 16px;
  font-weight: 600;
}
.hero {
  font-size: 44px;
  line-height: 50px;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-top: 18px;
  text-transform: lowercase;
}
.lead {
  color: #A5AEC0;
  margin-top: 14px;
  max-width: 640px;
}
.accent { color: var(--brand); }
.hero-sm { font-size: 34px; line-height: 40px; }

/* ---------- top nav (tabs across pages) ---------- */
.top-nav { margin-top: 18px; }
.top-nav .chip { text-decoration: none; display: inline-block; }

/* ---------- info page (community links) ---------- */
.info-list { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.info-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  text-decoration: none;
  color: var(--t1);
  transition: 0.15s;
}
.info-link:hover { box-shadow: 0 4px 18px rgba(32, 38, 50, 0.1); }
.info-link .n { font-size: 17px; font-weight: 600; }
.info-link .cap { margin-top: 3px; }
.info-link .arrow { color: var(--t3); font-size: 20px; }

/* ---------- info page: communities by city ---------- */
.section-title { font-size: 20px; font-weight: 700; margin-top: 32px; }
.section-lead { margin-top: 4px; }
.city-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.city-card {
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.city-card .n { font-size: 17px; font-weight: 600; }
.city-contact, .city-ambassadors a { color: var(--t1); text-decoration: none; }
.city-contact:hover, .city-ambassadors a:hover { text-decoration: underline; }
.city-ambassadors { line-height: 1.6; }
.city-meta { font-size: 13px; color: var(--t2); }
.city-card-link { font-size: 13px; font-weight: 600; color: var(--t2); text-decoration: none; margin-top: 4px; }
.city-card-link:hover { color: var(--t1); text-decoration: underline; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

/* ---------- requests page (game wishlist / voting) ---------- */
.whoami-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 16px 22px;
  margin-top: 20px;
}
.whoami-banner .filter-label { margin: 0; }

.select-input {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  background: var(--card);
  color: var(--t1);
  cursor: pointer;
}
.select-input:focus { outline: none; border-color: var(--brand); }

/* the "table" is a CSS grid on the outer container; both the head row and every data row
   use display:contents so their cells become direct grid items and line up into columns --
   this keeps markup simple (one wrapper per row) while still getting real column alignment */
.requests-table {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(200px, 1.8fr) minmax(180px, 1.6fr) 84px auto;
  column-gap: 18px;
  margin-top: 20px;
  align-items: stretch;
  background: var(--card);
  border-radius: var(--r-xl);
  padding: 6px 24px;
}
.requests-head { display: contents; }
.requests-head > div {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t2);
  font-weight: 600;
  padding-top: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.requests-row { display: contents; }
.req-cell { padding: 18px 0; border-bottom: 1px solid var(--border); }
.requests-row:last-child .req-cell { border-bottom: none; }
.req-cell-label { display: none; }
.req-game { font-size: 15px; font-weight: 600; }
.req-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.req-office, .req-host {
  font-size: 12px;
  background: var(--bg);
  color: var(--t2);
  border-radius: var(--r-pill);
  padding: 5px 11px;
  line-height: 1.4;
}
.req-chips-empty { font-size: 13px; color: var(--t3); }
.req-bga {
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-pill);
  padding: 5px 11px;
  display: inline-block;
}
.req-bga.is-yes { background: #E8F7EE; color: var(--ok); }
.req-bga.is-no { color: var(--t3); font-weight: 400; }
.req-cell-vote { text-align: right; }

@media (max-width: 760px) {
  .requests-head { display: none; }
  .requests-table { display: flex; flex-direction: column; gap: 12px; background: transparent; padding: 0; margin-top: 20px; }
  .requests-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    background: var(--card);
    border-radius: var(--r-xl);
    padding: 18px 20px;
  }
  .req-cell { padding: 0; border-bottom: none; }
  .req-cell-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--t3);
    font-weight: 600;
    margin-bottom: 4px;
  }
  .req-cell-vote { text-align: left; margin-top: 4px; }
  .req-cell-vote .vote-btn { width: 100%; justify-content: center; }
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--t1);
  border-radius: var(--r-pill);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}
.vote-btn:hover { border-color: var(--t3); }
.vote-btn.active { background: var(--brand); border-color: var(--brand); color: var(--t1); }
.vote-count { font-variant-numeric: tabular-nums; }

/* ---------- organizer page ---------- */
.wrap-narrow { max-width: 640px; }
.back-link { margin: 16px 0 20px; }
.form-card { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.field-wide { grid-column: 1 / -1; }
.result-card { margin-top: 20px; }
.result-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.post-text {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--t1);
  resize: vertical;
  margin: 14px 0;
}
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions .btn-primary,
.result-actions .btn-ghost { width: auto; flex: 1; text-align: center; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- attached games on an event (organizer form) ---------- */
.event-games-wrap { display: flex; flex-direction: column; gap: 14px; }
.event-game-block {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  position: relative;
}
.event-game-block .form-grid { gap: 12px 14px; }
.event-game-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  color: var(--t2);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.event-game-remove:hover { color: var(--err); }
.event-game-index { font-size: 12px; font-weight: 600; color: var(--t2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }

/* ---------- attached games display on an event card (index.html) ---------- */
.card-event-games { display: flex; flex-direction: column; gap: 8px; }
.card-event-game { font-size: 13px; color: var(--t1); }
.card-event-game .n { font-weight: 600; }
.card-event-game .card-tags { margin-top: 4px; }

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 16px;
}
.card-s { background: var(--card); border-radius: var(--r-xl); padding: 20px; }
.card-s .n { font-size: 34px; line-height: 38px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.card-s .cap.mut { margin-top: 4px; }

/* ---------- sticky filter bar ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-start;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 18px 0 16px;
  margin-top: 8px;
  border-bottom: 1px solid var(--border);
}
.filter-block { display: flex; flex-direction: column; gap: 8px; }
.filter-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t2);
  font-weight: 600;
}
.pillrow { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--t1);
  border-radius: var(--r-pill);
  padding: 9px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}
.chip:hover { border-color: var(--t3); }
.chip.active { background: var(--brand); border-color: var(--brand); color: var(--t1); font-weight: 600; }

.btn-ghost {
  border: 1px solid var(--active);
  background: transparent;
  color: var(--active);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { background: var(--active); color: var(--brand); }
.btn-ghost.active { background: var(--active); color: var(--brand); }

.note {
  border-radius: var(--r-lg);
  background: #FFF6D6;
  color: #6b5300;
  padding: 16px 18px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------- cards ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--t2);
  padding: 60px 20px;
  font-size: 15px;
}

.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.is-cancelled { opacity: 0.6; }
.card.is-past { opacity: 0.55; }
.card.is-highlighted { box-shadow: 0 0 0 3px var(--brand); transition: box-shadow 0.3s ease; }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-date {
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-size: 13px;
  line-height: 16px;
  color: var(--t2);
  white-space: nowrap;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.badge-open { background: #E3F7ED; color: var(--ok); }
.badge-full { background: var(--bg); color: var(--t2); }
.badge-cancelled { background: #FFE8DC; color: var(--err); }
.badge-past { background: var(--border); color: var(--t2); }
.badge-planned { background: #FFF1DB; color: #B36B00; }

.card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--r-lg);
  background: var(--bg);
}

.card-game { font-size: 22px; line-height: 27px; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { font-size: 13px; color: var(--t2); display: flex; flex-direction: column; gap: 3px; }
.card-meta b { color: var(--t1); font-weight: 500; }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 12px;
  background: var(--bg);
  color: var(--t2);
  border-radius: var(--r-pill);
  padding: 4px 11px;
}

.card-participants { font-size: 13px; color: var(--t1); }
.card-participants b { font-weight: 600; }
.card-participants .names { color: var(--t2); }
.hoverable-email { border-bottom: 1px dotted var(--t3); cursor: help; }

.card-interest { font-size: 12px; color: var(--t2); }

.card-reserved {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--t2);
}
.stepper-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--t1);
  font-size: 16px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.stepper-btn:hover { border-color: var(--t3); }
.stepper-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.past-toggle-wrap { text-align: center; margin-top: 20px; }

.card-links { display: flex; gap: 12px; flex-wrap: wrap; }
.card-link { font-size: 12px; font-weight: 600; color: var(--t2); text-decoration: none; }
.card-link:hover { color: var(--t1); text-decoration: underline; }

.card-actions { margin-top: auto; padding-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.card-actions .btn-ghost { width: 100%; text-align: center; box-sizing: border-box; }

.btn-primary {
  width: 100%;
  background: var(--active);
  color: var(--brand);
  border: none;
  border-radius: var(--r-pill);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}
.btn-primary:hover { background: #2c3444; }
.btn-primary:disabled { background: var(--bg); color: var(--t3); cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  background: #fff;
  color: var(--err);
  border: 1px solid var(--err);
  border-radius: var(--r-pill);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-secondary:hover { background: #FFF3EE; }

/* ---------- footer ---------- */
.footer-note { text-align: center; margin-top: 44px; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 38, 50, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: var(--r-xl);
  padding: 28px;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: 0 24px 60px rgba(32, 38, 50, 0.25);
}
.modal h3 { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: var(--t1); }
.modal-hint { color: var(--t2); font-size: 13px; margin: 0 0 18px; line-height: 1.4; }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  border: none; background: none; font-size: 22px; cursor: pointer; color: var(--t2);
  line-height: 1;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--t1); }
.field input,
.field select {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  background: var(--bg);
  color: var(--t1);
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--brand); background: #fff; }
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 400;
  background: var(--bg);
  color: var(--t1);
  resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--brand); background: #fff; }
.field-hint { font-size: 12px; font-weight: 400; color: var(--t2); line-height: 1.4; }
.modal-error { color: var(--err); font-size: 13px; margin: 10px 0 0; }

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--t1);
  cursor: pointer;
}
.field-checkbox input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.field-warning {
  font-size: 12px;
  color: #B36B00;
  background: #FFF1DB;
  border-radius: var(--r-lg);
  padding: 10px 12px;
  line-height: 1.4;
  margin: -6px 0 14px;
}
@media (max-width: 640px) {
  .hero { font-size: 32px; line-height: 38px; }
  .head { padding: 28px 22px; }
  .stats-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
