/* Турниры ШСК «Феникс» — стиль сайта и админки: чёрный фон, огненно-оранжевый акцент эмблемы. */

:root {
  --bg: #111111;
  --bg-deep: #0B0B0B;
  --card: #1B1B1B;
  --card-2: #222222;
  --field: #151515;
  --line: #2E2E2E;
  --line-soft: #262626;
  --accent: #F6A623;
  --accent-2: #FF6B1A;
  --text: #F5F2ED;
  --muted: #B7B1A9;
  --danger: #FF6B6B;
  --ok: #7BD389;
  --fire: linear-gradient(135deg, #F6A623 0%, #FF6B1A 100%);
  --radius: 14px;
  --t: 180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: 10px 14px; background: var(--accent); color: #111; border-radius: 8px;
  transition: top var(--t);
}
.skip-link:focus { top: 12px; }

/* ---------- Шапка ---------- */

.site-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 16px;
  background: rgba(17, 17, 17, .96);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); transition: opacity var(--t); }
.brand:hover { opacity: .85; text-decoration: none; }
.brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: contain; flex: none; }
.brand-text strong { display: block; font-size: 15px; font-weight: 800; letter-spacing: .16em; line-height: 1.1; text-transform: uppercase; }
.brand-text small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }

.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a, .nav button {
  flex: none; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: background var(--t), color var(--t);
}
.nav a:hover, .nav button:hover { background: var(--card); color: var(--text); text-decoration: none; }
.nav [aria-current="page"] { background: var(--fire); color: #111; }

.account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }

/* ---------- Основа страниц ---------- */

.main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 22px 16px 60px; }
.main:focus { outline: none; }
.site-foot { padding: 22px 16px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; text-align: center; }

.page-head { display: grid; gap: 6px; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: 14px; }
.page-head .back { font-size: 14px; font-weight: 700; }

.section-title { font-size: 19px; font-weight: 800; margin: 26px 0 12px; }
.muted { color: var(--muted); font-size: 13px; }
.lead { color: var(--muted); }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.panel h2 { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.grid.three { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 18px; border: 1px solid transparent; border-radius: 10px;
  background: var(--card-2); color: var(--text);
  font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: transform var(--t), filter var(--t), background var(--t), border-color var(--t), color var(--t);
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--fire); color: #111; box-shadow: 0 10px 28px -12px rgba(246, 166, 35, .7); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: #4a4a4a; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: transparent; border-color: #6b3434; color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-small { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Переключатели и таблицы ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
  min-height: 36px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tab:hover { color: var(--text); border-color: #555; }
.tab[aria-selected="true"] { background: var(--fire); border-color: transparent; color: #111; }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px;
  background: var(--field); border: 1px solid var(--line); border-radius: 12px;
}
.seg-btn {
  min-height: 38px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
  transition: background var(--t), color var(--t);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] { background: var(--fire); color: #111; }

.table-wrap { overflow-x: auto; }
.standings { width: 100%; border-collapse: collapse; font-size: 14px; }
.standings th, .standings td { padding: 10px 8px; text-align: center; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.standings th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.standings td.team, .standings th.team { text-align: left; }
.standings td.points { font-weight: 800; color: var(--accent); }
.standings tbody tr:hover td { background: rgba(255, 255, 255, .02); }

.group-title { font-size: 15px; font-weight: 800; color: var(--accent); margin-bottom: 8px; }

/* Отступы и вспомогательные классы (inline-стили запрещены политикой CSP) */
.mt { margin-top: 16px; }
.mt-sm { margin-top: 12px; }
.mb-sm { margin-bottom: 8px; }
.narrow { max-width: 320px; margin-bottom: 14px; }
.game-head { margin-bottom: 16px; }
.game-edit { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.code-box { word-break: break-all; padding: 8px 10px; }
.stat-value { font-size: 22px; font-weight: 800; margin-top: 4px; }

/* ---------- Логотипы и игры ---------- */

.logo {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none;
  display: inline-grid; place-items: center; background: var(--fire); color: #111; font-weight: 800; font-size: 14px;
  vertical-align: middle;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.logo.sm { width: 26px; height: 26px; font-size: 12px; }
.logo.lg { width: 64px; height: 64px; font-size: 22px; }
.team-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.team-name:hover { color: var(--accent); text-decoration: none; }

.list { display: grid; gap: 8px; }
.game-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); transition: border-color var(--t), transform var(--t);
}
.game-row:hover { border-color: #555; text-decoration: none; transform: translateY(-1px); }
.game-row .center { display: grid; justify-items: center; gap: 2px; }
.game-row .side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.game-row .side.right { justify-content: flex-end; text-align: right; }
.game-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.game-row .meta { font-size: 12px; color: var(--muted); }
.score { font-size: 20px; font-weight: 800; min-width: 74px; text-align: center; }
.score.pending { color: var(--muted); font-size: 15px; font-weight: 700; }
@media (max-width: 560px) {
  .game-row { grid-template-columns: 1fr; text-align: center; }
  .game-row .side, .game-row .side.right { justify-content: center; text-align: center; }
}

.card-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
}
.card-link:hover { border-color: var(--accent); text-decoration: none; }

.hero {
  display: flex; align-items: center; gap: 18px; padding: 22px; margin-bottom: 22px;
  background: radial-gradient(circle at 100% 0%, rgba(246, 166, 35, .18), transparent 60%), var(--card);
  border: 1px solid var(--line); border-radius: 18px;
}
.hero img { width: 84px; height: 84px; border-radius: 50%; flex: none; }
.hero h1 { font-size: 24px; font-weight: 800; line-height: 1.2; }
.hero p { color: var(--muted); margin-top: 6px; }
@media (max-width: 560px) { .hero { flex-direction: column; text-align: center; } }

.facts { display: grid; gap: 12px; }
@media (min-width: 760px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 14px; }
.facts b { display: block; color: var(--accent); margin-bottom: 4px; }

.notice {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 10px;
  background: rgba(246, 166, 35, .12); border: 1px solid rgba(246, 166, 35, .35); font-size: 14px;
}
.form-error {
  margin-bottom: 14px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .4); color: #ffb3b3; font-size: 14px;
}
.empty { padding: 18px; border: 1px dashed #3a3a3a; border-radius: 12px; color: var(--muted); text-align: center; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.badge.on { background: rgba(123, 211, 137, .15); color: var(--ok); }
.badge.warn { background: rgba(246, 166, 35, .15); color: var(--accent); }
.badge.off { color: #9e9e9e; }

/* ---------- Формы ---------- */

.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid.three { grid-template-columns: 1fr 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 700; color: #e7e1d8; }
.field small { font-size: 12px; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }

.input, .field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea, input.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 10px 12px;
  background: var(--field); border: 1px solid #3a3a3a; border-radius: 10px; font-size: 15px; outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field textarea, textarea.input { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(246, 166, 35, .2); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field-error { font-size: 12px; color: #ff8a80; }
.field-error:empty { display: none; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }

/* ---------- Вход и модальное окно ---------- */

.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .7);
}
.modal-card {
  position: relative; width: 100%; max-width: 400px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 26px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 60px -30px rgba(246, 166, 35, .35);
}
.modal-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.modal-card > #modal-body > p { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 10px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; max-width: calc(100% - 32px);
  transform: translate(-50%, 140%); padding: 12px 16px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line); font-size: 14px;
  transition: transform 200ms ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 107, 107, .6); color: #ffb3b3; }
.toast.ok { border-color: rgba(123, 211, 137, .5); }

/* ---------- Фото ---------- */

.photos { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .photos { grid-template-columns: repeat(4, 1fr); } }
.photo { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card); }
.photo img { width: 100%; height: 150px; object-fit: cover; }
.photo .btn { position: absolute; right: 6px; bottom: 6px; }

.permit-link { font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
