/* ==========================================================================
   F1 HUB — стили. Тёмная «карбоновая» тема, красный акцент, курсивные
   заголовки в духе гоночной типографики.
   ========================================================================== */

:root {
  --red: #e10600;
  --red-dark: #b00500;
  --bg: #0f0f14;
  --bg-2: #15151e;
  --card: #1c1c26;
  --card-hi: #23232f;
  --line: #2c2c3a;
  --text: #f2f2f5;
  --muted: #9b9bab;
  --green: #2ee06a;
  --yellow: #ffcd3c;
  --blue: #4aa8ff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: 'Titillium Web', 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать собственные display у компонентов. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(1000px 500px at 80% -10%, rgba(225, 6, 0, .18), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .015) 0 2px, transparent 2px 8px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ============================ ШАПКА ============================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 15, 20, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.logo__mark {
  width: 34px;
  height: 22px;
  background:
    repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 7px 7px;
  border-radius: 3px;
  transform: skewX(-12deg);
  box-shadow: 0 0 0 2px var(--red);
}

.logo__text {
  font-size: 24px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -.5px;
}
.logo__text em { color: var(--red); font-style: italic; }

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav__item {
  background: none;
  border: 0;
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav__item:hover { color: var(--text); background: var(--card); }
.nav__item.is-active {
  color: #fff;
  background: var(--red);
}
.nav__item--dev { margin-left: auto; color: #b9b9c8; border: 1px solid var(--line); }
.nav__item--dev.is-active { background: #3a3a4d; border-color: #4d4d63; }

.season {
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.user { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.user__name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.user__name em {
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.user__btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.user__btn:hover { border-color: var(--red); color: #fff; }

.form-error {
  color: #ff8b85;
  font-size: 13px;
  font-weight: 600;
  margin: 10px 0 0;
}

.row-card--new { border-style: dashed; margin-bottom: 18px; }

.user-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.modal__box--narrow { width: min(420px, 100%); }
.modal__box--narrow .field { margin-bottom: 12px; }

.burger {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
}

/* ============================ КАРКАС ============================ */

.main {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px 60px;
  flex: 1;
}

.view { display: none; animation: fade .25s ease; }
.view.is-active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 34px 0 18px;
}

.section-title {
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  margin: 0;
  letter-spacing: -.5px;
}
.section-title em { color: var(--red); font-style: italic; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.chip:hover { color: var(--text); border-color: #444458; }
.chip.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.chip--link { color: var(--yellow); border-color: #4a4426; }
.chip--link:hover { color: var(--yellow); border-color: var(--yellow); }

.suggest-link { color: var(--blue); word-break: break-all; }

.search {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  min-width: 260px;
  outline: none;
}
.search:focus { border-color: var(--red); }

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ============================ ГЕРОЙ / БЛИЖАЙШАЯ ГОНКА ============ */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 32px;
  background: linear-gradient(120deg, #23000a 0%, #15151e 55%, #15151e 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -40px;
  width: 320px;
  height: 320px;
  background: repeating-conic-gradient(rgba(255,255,255,.06) 0 25%, transparent 0 50%) 0 0 / 22px 22px;
  transform: rotate(12deg);
  pointer-events: none;
}

.hero__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--red);
}

.hero__title {
  font-size: 40px;
  font-weight: 900;
  font-style: italic;
  margin: 8px 0 4px;
  text-transform: uppercase;
  line-height: 1.05;
}

.hero__flag {
  font-size: 18px;
  height: 32px;
  min-width: 46px;
  vertical-align: 4px;
  font-style: normal;
  background: rgba(0, 0, 0, .35);
}

.hero__sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }

.countdown { display: flex; gap: 12px; flex-wrap: wrap; }

.cd-cell {
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 82px;
  text-align: center;
}
.cd-cell b {
  display: block;
  font-size: 30px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.cd-cell span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

/* ============================ КАЛЕНДАРЬ ============================ */

.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.race {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.race:hover { transform: translateY(-3px); border-color: #45455a; }
.race::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--red);
}
.race--done::before { background: #4a4a5c; }
.race--next::before { background: linear-gradient(var(--yellow), var(--red)); }

.race__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.race__round {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}
/* Windows не рисует флаговые эмодзи и показывает код страны («BH»).
   Поэтому флаг всегда лежит в «шильдике»: и картинка, и код смотрятся уместно. */
.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 7px;
  border-radius: 5px;
  background: #2a2a37;
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1;
}

.race__flag { font-size: 16px; }

.race__name {
  font-size: 19px;
  font-weight: 700;
  font-style: italic;
  margin: 0 0 4px;
  text-transform: uppercase;
}
.race__circuit { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.race__meta {
  display: flex;
  gap: 18px;
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.race__meta div span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
.race__meta div b { font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge--live { background: var(--red); color: #fff; }
.badge--next { background: var(--yellow); color: #201a00; }
.badge--done { background: #33333f; color: var(--muted); }

.race__winner {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.race__winner b { color: var(--text); }

/* ============================ ТАБЛИЦА ============================ */

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.podium__card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.podium__card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, var(--red));
}
.podium__pos {
  font-size: 46px;
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  color: rgba(255, 255, 255, .12);
  position: absolute;
  right: 14px;
  top: 8px;
}
.podium__name { font-size: 18px; font-weight: 700; font-style: italic; text-transform: uppercase; }
.podium__team { color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.podium__pts { font-size: 26px; font-weight: 900; }
.podium__pts small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

.table { width: 100%; border-collapse: collapse; min-width: 620px; }

.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(44, 44, 58, .6);
  font-size: 15px;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--card-hi); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-pos { width: 64px; }

.pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #2a2a37;
  font-weight: 900;
  font-size: 14px;
}
.pos--1 { background: linear-gradient(135deg, #ffd85e, #c99700); color: #241c00; }
.pos--2 { background: linear-gradient(135deg, #e3e3ec, #9a9aa8); color: #1c1c22; }
.pos--3 { background: linear-gradient(135deg, #e0a06a, #a0632e); color: #231202; }

.driver-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.team-dot { width: 4px; height: 20px; border-radius: 2px; display: inline-block; }
.pts { font-weight: 900; font-size: 16px; }

.constructors { display: grid; gap: 10px; }

.constructor {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}
.constructor__bar {
  height: 8px;
  border-radius: 4px;
  background: #2a2a37;
  overflow: hidden;
  margin-top: 6px;
}
.constructor__fill { height: 100%; border-radius: 4px; }
.constructor__name { font-weight: 700; }
.constructor__pts { font-weight: 900; font-size: 18px; }
.constructor__pos { font-weight: 900; color: var(--muted); font-style: italic; }

/* ============================ ПИЛОТЫ ============================ */

.driver-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.driver {
  position: relative;
  background: linear-gradient(160deg, var(--card-hi), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.driver:hover { transform: translateY(-3px); border-color: var(--accent, #45455a); }
.driver::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--accent, var(--red));
}
.driver__num {
  position: absolute;
  right: 12px;
  top: 4px;
  font-size: 58px;
  font-weight: 900;
  font-style: italic;
  color: rgba(255, 255, 255, .08);
  line-height: 1;
}
.driver__flag { font-size: 15px; }
.driver__name {
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  margin: 8px 0 2px;
  line-height: 1.1;
}
.driver__team { font-size: 13px; font-weight: 700; color: var(--accent, var(--muted)); }
.driver__country { color: var(--muted); font-size: 12px; margin-top: 2px; }

.driver__stats {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.driver__stats div span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.driver__stats div b { font-size: 17px; font-weight: 900; }

/* ============================ ПОГОДА ============================ */

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.wcard {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px;
  background: var(--card);
  position: relative;
  overflow: hidden;
}
.wcard--sunny  { background: linear-gradient(150deg, #3a2a05, var(--card) 65%); }
.wcard--partly { background: linear-gradient(150deg, #2a2b35, var(--card) 65%); }
.wcard--cloudy { background: linear-gradient(150deg, #23262e, var(--card) 65%); }
.wcard--rain   { background: linear-gradient(150deg, #12263a, var(--card) 65%); }
.wcard--storm  { background: linear-gradient(150deg, #2a1030, var(--card) 65%); }

.wcard__top { display: flex; align-items: flex-start; justify-content: space-between; }
.wcard__loc { font-size: 19px; font-weight: 700; font-style: italic; text-transform: uppercase; margin: 0; }
.wcard__date { color: var(--muted); font-size: 13px; }
.wcard__icon { font-size: 44px; line-height: 1; }

.wcard__temp {
  font-size: 46px;
  font-weight: 900;
  margin: 12px 0 2px;
  font-variant-numeric: tabular-nums;
}
.wcard__cond { color: var(--muted); font-size: 14px; font-weight: 600; }

.wcard__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.wcard__grid div span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.wcard__grid div b { font-size: 15px; font-weight: 800; }

.rainbar { height: 6px; border-radius: 3px; background: #2a2a37; margin-top: 14px; overflow: hidden; }
.rainbar__fill { height: 100%; background: linear-gradient(90deg, var(--blue), #7a5cff); }

/* ============================ НОВОСТИ ============================ */

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.news {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.news:hover { transform: translateY(-3px); border-color: #45455a; }
.news:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.news:hover .news__more { color: var(--red); }
.news:hover .news__cover img { transform: scale(1.04); }

.news__body { padding: 20px; }

.news__cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #101018;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.news__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}
.news__cover--empty {
  background:
    linear-gradient(140deg, #2a2a38, #15151e 70%),
    repeating-conic-gradient(rgba(255,255,255,.05) 0 25%, transparent 0 50%) 0 0 / 24px 24px;
}
.news__cover--empty span {
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .14);
  letter-spacing: 1px;
}
.news__cover--video { background: linear-gradient(140deg, #2b1030, #15151e 70%); }

.news__play {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding-left: 4px;
  box-shadow: 0 6px 20px rgba(225, 6, 0, .45);
}
.news__media-label {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
}

.news__more {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color .15s;
}

.news__top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.news__tag {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 3px 9px;
  border-radius: 4px;
}
.news__date { color: var(--muted); font-size: 12px; }
.news__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}
.news__text { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }

/* ============================ ПАНЕЛЬ РАЗРАБОТКИ ============== */

.dev-note {
  color: var(--muted);
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 20px;
}

.dev-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.save-state {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.save-state--saving { color: var(--yellow); border-color: #4a4426; }
.save-state--saved { color: var(--green); border-color: #26492f; }
.save-state--error { color: #ff8b85; border-color: #5a2a28; }

/* ============================ ЭКРАН ВХОДА ======================== */

/* Пока не вошли, сайта на странице нет вообще — только форма. */
body.is-locked .topbar,
body.is-locked .main,
body.is-locked .footer { display: none; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(900px 500px at 70% -10%, rgba(225, 6, 0, .25), transparent 60%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .02) 0 2px, transparent 2px 8px),
    var(--bg);
}

.gate__card {
  width: min(400px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: var(--shadow);
}

.gate__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.gate__title {
  font-size: 30px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.gate__hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 20px;
}

.gate__card .field { margin-bottom: 14px; }
.gate__card .field input { padding: 11px 12px; font-size: 15px; }

.gate__submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 6px;
}
.gate__cancel {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
}

.fatal {
  max-width: 560px;
  margin: 60px auto;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
}
.fatal h2 { margin: 0 0 10px; font-style: italic; text-transform: uppercase; }
.fatal p { color: var(--muted); line-height: 1.6; margin: 0 0 8px; }
.fatal code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
}

.btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
}
.btn:hover { background: var(--card-hi); border-color: #4a4a5e; }
.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn--danger { color: #ff8b85; border-color: #5a2a28; }
.btn--danger:hover { background: #3a1a18; }

.dev-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.dev-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.dev-tab:hover { color: var(--text); background: var(--card); }
.dev-tab.is-active { background: var(--card-hi); border-color: var(--line); color: #fff; }

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.editor-head h3 { margin: 0; font-size: 20px; font-style: italic; text-transform: uppercase; }
.editor-count { color: var(--muted); font-size: 13px; font-weight: 600; }

.rows { display: grid; gap: 12px; }

.row-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.row-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.row-card__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-card__tools { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  line-height: 1;
  color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: #4a4a5e; }
.icon-btn--del:hover { color: #ff8b85; border-color: #5a2a28; background: #3a1a18; }

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field--wide { grid-column: 1 / -1; }
.field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  font-weight: 700;
}
.field input, .field select, .field textarea {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.field input[readonly] { color: var(--muted); cursor: default; }
.field input[type="color"] { padding: 2px; height: 36px; cursor: pointer; }

.upload {
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 12px;
}
.upload__row { display: flex; gap: 8px; flex-wrap: wrap; }
.upload__btn { cursor: pointer; }
.upload__hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.upload__preview {
  max-width: 320px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}

.settings-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  max-width: 520px;
}
.settings-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.settings-stats div span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.settings-stats div b { font-size: 22px; font-weight: 900; }

/* ============================ ТОСТ / МОДАЛКА ================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 24px);
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 80;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { border-left-color: var(--red); color: #ff9b95; max-width: min(520px, 92vw); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
  /* Длинная статья выше экрана — прокручиваем само окно, а не страницу. */
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal.is-open { display: flex; }

.modal__box {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  width: min(680px, 100%);
  box-shadow: var(--shadow);
}
.modal__title { margin: 0 0 6px; font-size: 22px; font-style: italic; text-transform: uppercase; }
.modal__hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.modal__area {
  width: 100%;
  min-height: 260px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 13px;
  outline: none;
  resize: vertical;
}
.modal__area:focus { border-color: var(--red); }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---- полная версия новости ---- */

.modal--article { align-items: flex-start; padding: 0; }

.article {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(820px, 100%);
  margin: 40px auto;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fade .2s ease;
}

/* Кнопка закрытия живёт поверх окна, а не внутри статьи:
   иначе на длинном тексте она уезжает вместе с прокруткой. */
.article__close {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 95;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(15, 15, 20, .8);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
}
.article__close:hover { background: var(--red); border-color: var(--red); }

/* Единый формат медиа: кадр 16:9 и на телефоне, и на компьютере —
   меняется только его ширина, пропорции остаются теми же. */
.article__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  line-height: 0;
  overflow: hidden;
}
.article__media img,
.article__media video,
.article__media iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.article__media img { object-fit: cover; }
/* Видео вписываем целиком: обрезать чужой кадр хуже, чем поля по краям. */
.article__media video { object-fit: contain; }

.article__content { padding: 26px 30px 32px; }

.article__title {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.2;
  margin: 10px 0 14px;
}
.article__lead {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  border-left: 3px solid var(--red);
  padding-left: 14px;
  margin: 0 0 20px;
}
.article__content p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
  margin: 0 0 14px;
}

/* ============================ ПОДВАЛ ============================ */

.footer {
  border-top: 1px solid var(--line);
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ============================ АДАПТИВ ============================ */

/* Имя вошедшего занимает место в шапке — на средней ширине убираем
   значок сезона, иначе кнопка «Разработка» обрезается. */
@media (max-width: 1150px) {
  .season { display: none; }
}

@media (max-width: 900px) {
  .podium { grid-template-columns: 1fr; }
  .user__name { display: none; }
}

@media (max-width: 760px) {
  .topbar__inner { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .burger { display: block; }
  .season { display: none; }
  .nav {
    order: 3;
    /* flex: 1 из базового правила обнуляет flex-basis, поэтому ширину
       задаём именно здесь — иначе меню встаёт в строку с логотипом. */
    flex: 1 0 100%;
    display: none;
    flex-direction: column;
    padding-bottom: 8px;
  }
  .nav.is-open { display: flex; }
  .nav__item { text-align: left; }
  .nav__item--dev { margin-left: 0; }
  .main { padding: 18px 16px 44px; }
  .hero { padding: 22px; }
  .hero__title { font-size: 28px; }
  /* Четыре ячейки отсчёта должны помещаться в одну строку на телефоне. */
  .countdown { gap: 8px; }
  .cd-cell { min-width: 0; flex: 1; padding: 10px 6px; }
  .cd-cell b { font-size: 24px; }
  .cd-cell span { font-size: 10px; letter-spacing: .4px; }
  .section-title { font-size: 22px; }
  .search { min-width: 100%; }
  .article { margin: 0; border-radius: 0; min-height: 100%; }
  .article__content { padding: 20px 18px 28px; }
  .article__title { font-size: 23px; }
  .article__lead { font-size: 15px; }
}
