/* AFL Видео: тот же вид, что у AFL Фото (цвета, кнопки, шапка), плюс карточки голов, плееры, очередь */
:root {
  --bg: #0e1014;
  --surface: #161920;
  --surface-2: #1d2129;
  --surface-3: #252a34;
  --border: #2b313c;
  --text: #eceef2;
  --muted: #9aa3b2;
  --faint: #6b7483;
  --accent: #ff6a1a;
  --accent-ink: #1a0d05;
  --keep: #34c779;
  --reject: #f0524f;
  --warn: #f5a524;
  --info: #5aa9ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.bad { color: var(--reject); }
.good { color: var(--keep); }
.warn-text { color: var(--warn); }
.link { color: var(--info); cursor: pointer; }
.link:hover { text-decoration: underline; }
.linkbtn { background: none; border: 0; padding: 0; margin-left: 6px; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: var(--text); }

/* ---------- кнопки, поля, чипы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff7d38; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: rgba(240, 82, 79, .14); border-color: rgba(240, 82, 79, .55); color: var(--reject); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn-icon { width: 40px; padding: 0; }

.input {
  height: 42px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--faint); }
select.input { appearance: auto; padding-right: 8px; }
.input.sm { height: 36px; border-radius: 8px; padding: 0 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--muted); white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.chip-keep { color: var(--keep); border-color: rgba(52, 199, 121, .35); background: rgba(52, 199, 121, .08); }
.chip-reject { color: var(--reject); border-color: rgba(240, 82, 79, .35); background: rgba(240, 82, 79, .08); }
.chip-warn { color: var(--warn); border-color: rgba(245, 165, 36, .35); background: rgba(245, 165, 36, .08); }
.chip-live { color: var(--accent); border-color: rgba(255, 106, 26, .4); background: rgba(255, 106, 26, .1); }
.chip-info { color: var(--info); border-color: rgba(90, 169, 255, .35); background: rgba(90, 169, 255, .08); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip-live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  height: 60px; padding: 0 24px; background: rgba(14, 16, 20, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; flex: none; }
.brand-mark {
  display: inline-grid; place-items: center; height: 30px; padding: 0 8px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; letter-spacing: .5px;
}
.brand-text { font-size: 17px; }
.nav { display: flex; gap: 4px; min-width: 0; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.is-active { color: var(--text); background: var(--surface-2); }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); flex: none; }
#logout .ico { display: none; }
.upload-mini {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 999px; flex: none;
  background: rgba(255, 106, 26, .12); color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer;
}
.upload-mini .bar { width: 90px; height: 4px; }

.app { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- вход ---------- */
.login-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.login {
  width: min(400px, 100%); padding: 32px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.login .brand { margin-bottom: 24px; }
.login h1 { font-size: 22px; margin: 0 0 6px; }
.login p { margin: 0 0 22px; color: var(--muted); }
.login label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login .btn { width: 100%; margin-top: 22px; height: 44px; }
.form-error { color: var(--reject); font-size: 14px; margin-top: 12px; min-height: 20px; }

/* ---------- список матчей ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.3px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.week { display: flex; align-items: center; gap: 8px; }
.week-label { min-width: 170px; text-align: center; font-weight: 700; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar .input { max-width: 360px; }
.toolbar form { display: flex; gap: 8px; flex: 1 1 320px; max-width: 460px; }
.day { margin-bottom: 34px; }
.day-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.day-head h2 { margin: 0; font-size: 20px; }
.stadium { margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stadium-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.stadium-head h3 { margin: 0; font-size: 15px; }
.stadium-head .count { margin-left: auto; color: var(--muted); font-size: 13px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); margin: 0 -1px -1px 0; }
.game {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); transition: background .12s;
}
.game:hover { background: var(--surface-2); }
.game-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.game-teams { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; min-width: 0; }
.game-teams .team { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-teams .goals { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.game-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.game-meta .champ { color: var(--faint); font-size: 12px; margin-right: 4px; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); }
.warnbox { background: rgba(245, 165, 36, .08); border-color: rgba(245, 165, 36, .35); }
.errbox { background: rgba(240, 82, 79, .08); border-color: rgba(240, 82, 79, .35); }

/* ---------- матч ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.back:hover { color: var(--text); }
.match-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.match-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0; font-size: 26px; letter-spacing: -.3px; }
.match-title .team { display: inline-flex; align-items: center; gap: 10px; }
.match-title img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: rgba(255, 255, 255, .04); }
.match-title .score { color: var(--accent); font-variant-numeric: tabular-nums; }
.match-title .score.faint { color: var(--faint); }
.match-sub { color: var(--muted); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 22px; }
.panel-title { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-title .right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s; }
.bar.is-indet > i { width: 30% !important; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

.job { display: grid; gap: 10px; }
.job-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-top .stage { font-weight: 700; }
.job-top .right { margin-left: auto; display: flex; gap: 8px; }
.job-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.job-steps .chip.is-done { color: var(--keep); }
.job-steps .chip.is-now { color: var(--accent); border-color: rgba(255, 106, 26, .5); }

/* карточки голов */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-top: 14px; }
.goal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.goal-card.is-now { border-color: rgba(255, 106, 26, .6); }
.goal-card.is-outdated { border-color: rgba(245, 165, 36, .5); }
.goal-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; }
.goal-score { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; min-width: 58px; }
.goal-who { min-width: 0; flex: 1; }
.goal-who .scorer { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-who .assist, .goal-who .meta { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-status { flex: none; }
.video-box { position: relative; background: #000; aspect-ratio: 16 / 9; display: grid; place-items: center; overflow: hidden; }
.video-box.v { aspect-ratio: 9 / 16; max-width: 300px; margin: 0 auto; }
.video-box.empty { aspect-ratio: auto; min-height: 110px; flex: 1; background: #0a0b0e; }
/* плеер всегда в рамке 16:9: вертикальный ролик внутри с полями, страница не прыгает при смене формата */
.video-box video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.video-box .ph { color: var(--faint); font-size: 13px; padding: 16px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.goal-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px 12px; margin-top: auto; }
.goal-foot .grow { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg button, .seg label { border: 0; background: none; padding: 4px 10px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.is-on, .seg label.is-on { background: var(--surface-3); color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.why { margin: 0 16px 12px; padding: 10px 12px; border-radius: 8px; background: rgba(240, 82, 79, .08); color: #ffb4b2; font-size: 13px; }
.why.warn { background: rgba(245, 165, 36, .08); color: var(--warn); }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30; min-width: 240px; padding: 6px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); display: grid;
}
.menu-list button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list button small { display: block; color: var(--faint); font-size: 12px; }
.menu-list .danger { color: var(--reject); }

.reel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.reel-grid figure { margin: 0; }
.reel-grid figcaption { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13px; }

.hidden-list { display: grid; gap: 8px; }
.hidden-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.protocol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.protocol li { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.protocol .m { color: var(--faint); min-width: 44px; font-variant-numeric: tabular-nums; }

/* формы */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-size: 13px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; min-height: 36px; align-items: center; }
.checks label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checks input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }

/* своё видео */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center;
  min-height: 170px; border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; transition: border-color .15s, background .15s;
}
.drop.is-over { border-color: var(--accent); background: rgba(255, 106, 26, .06); }
.drop h3 { margin: 0; font-size: 18px; }
.drop p { margin: 0; color: var(--muted); }
.file-card { display: grid; gap: 10px; padding: 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.file-card .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-card .name { font-weight: 700; word-break: break-all; }
.marks { display: grid; gap: 8px; }
.mark-row { display: grid; grid-template-columns: 34px 110px 170px 1fr 40px; gap: 8px; align-items: center; }
.mark-row .num { color: var(--faint); font-weight: 700; text-align: center; }
.video-list { display: grid; gap: 10px; }
.video-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.video-row:hover { background: var(--surface-2); }
.video-row h3 { margin: 0 0 4px; font-size: 16px; }
.video-row .right { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* очередь и настройки */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table td .bar { margin-top: 6px; min-width: 120px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.user-form { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr 1fr auto; gap: 8px; margin-top: 14px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 22px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
pre.log { max-height: 60vh; overflow: auto; background: #07080a; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* окно поверх страницы */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 8, .78); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal-card.wide { width: min(860px, 100%); }
.modal-card h3 { margin: 0 0 6px; font-size: 19px; }
.modal-card .lead { color: var(--muted); margin: 0 0 16px; }
.price { font-size: 28px; font-weight: 800; color: var(--warn); margin: 6px 0 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: min(560px, calc(100% - 32px));
}
.toast.is-error { border-color: rgba(240, 82, 79, .5); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; }

@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand-text, .user span { display: none; }
  .nav { overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 9px; font-size: 14px; }
  .upload-mini .bar { display: none; }
  .app { padding: 20px 16px 60px; }
  .games, .goal-grid, .reel-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 24px; }
  .match-title { font-size: 21px; gap: 10px; }
  .match-title img { width: 32px; height: 32px; }
  .user-form { grid-template-columns: 1fr; }
  .mark-row { grid-template-columns: 26px 1fr 1fr 40px; }
  .mark-row .scorer { grid-column: 2 / 4; }
  .week-label { min-width: 0; }
  .toolbar .input, .toolbar form { max-width: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 640px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody { display: block; }
  .table.stack tr { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table.stack td { display: block; padding: 0; border: 0; }
  .table.stack td:first-child { flex: 1 1 100%; }
}
@media (max-width: 520px) {
  .topbar .brand { display: none; }
  #logout { width: 34px; padding: 0; }
  #logout .lbl { display: none; }
  #logout .ico { display: block; }
  .nav a { padding: 7px 8px; font-size: 13.5px; }
}
@media (max-width: 420px) {
  .panel { padding: 16px; }
}
