:root {
  --bg: #080b10;
  --bg2: #0e141c;
  --panel: #121a24;
  --panel2: #0e151d;
  --line: #233040;
  --text: #eaf1f8;
  --muted: #8aa0b4;
  --green: #18c964;
  --green-d: #0e9c4c;
  --live: #ff3b46;
  --up: #3da9fc;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1100px 520px at 50% -260px, #16263a 0%, transparent 70%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24,201,100,.10), transparent); position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo-badge { font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(24,201,100,.4)); }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .2px;
  background: linear-gradient(90deg, #fff, var(--green)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.tagline { color: var(--muted); font-size: 12.5px; }
.topbar.slim .back { color: var(--green); font-weight: 700; }
.brand.small { font-weight: 700; font-size: 16px; }
.topbar.slim { justify-content: space-between; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 22px 2px 14px; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .4px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-live { color: #fff; background: var(--live); }
.pill-ft { color: var(--muted); background: #1b2632; }
.pill-up { color: #cfe6ff; background: rgba(61,169,252,.16); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,.7); animation: pulse 1.5s infinite; }
.mc-meta { display: inline-flex; align-items: center; gap: 8px; }
.viewers { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sb-comp .viewers { margin-left: auto; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255,255,255,0); } }

/* ---------- crest / team / score ---------- */
.crest { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; overflow: hidden; background: #1b2632; flex: none; }
.crest img { width: 100%; height: 100%; object-fit: cover; }
.crest-fallback { color: #fff; font-weight: 800; letter-spacing: .5px; }
.team { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.team-name { font-weight: 700; font-size: 13.5px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team.big .team-name { font-size: 15px; }
.vs { color: var(--muted); font-weight: 800; font-size: 13px; padding: 0 6px; }
.score { font-weight: 800; font-size: 30px; letter-spacing: 1px; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.score-sep { color: var(--muted); font-weight: 700; }

/* ---------- hero (featured match) ---------- */
.hero { display: block; margin: 18px 0 6px; padding: 20px; border-radius: 18px; border: 1px solid var(--line);
  background: linear-gradient(160deg, #15202e, var(--panel2)); position: relative; overflow: hidden;
  transition: transform .15s, border-color .15s, box-shadow .15s; }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 200px at 50% -60px, rgba(24,201,100,.18), transparent 70%); pointer-events: none; }
.hero:hover { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 14px 40px rgba(0,0,0,.4); }
.hero.is-live { border-color: rgba(255,59,70,.4); }
.hero-top { display: flex; justify-content: space-between; align-items: center; position: relative; }
.hero-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 20px 0 18px; position: relative; }
.hero .score { font-size: 44px; }
.hero-cta-row { text-align: center; position: relative; }
.hero-cta { display: inline-block; background: var(--green); color: #03210f; font-weight: 800; padding: 11px 26px; border-radius: 999px; font-size: 14px; }
.hero:not(.is-live) .hero-cta { background: #1b2632; color: var(--text); }

/* ---------- match cards grid ---------- */
.matches { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.match-card { display: flex; flex-direction: column; background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--line); border-radius: 16px; padding: 15px; transition: transform .15s, border-color .15s, box-shadow .15s; }
.match-card:hover { transform: translateY(-3px); border-color: var(--green); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.match-card.is-live { border-color: rgba(255,59,70,.42); }
.mc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.competition { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.mc-foot { margin-top: 14px; text-align: center; font-weight: 700; font-size: 13px; color: var(--green); }
.match-card:not(.is-live) .mc-foot { color: var(--muted); }

/* ---------- watch page ---------- */
.scoreboard { background: linear-gradient(160deg, #15202e, var(--panel2)); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.sb-comp { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.sb-body { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 14px; }
.sb-body .score { font-size: 38px; }

.video-box { position: relative; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
video { width: 100%; display: block; aspect-ratio: 16/9; background: #000; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8,12,16,.86); }
.overlay-inner { text-align: center; }
.overlay-inner p { margin: 14px 0 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--green); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ---------- admin ---------- */
.admin .card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.admin h2 { margin: 0 0 12px; font-size: 15px; }
.admin .fld { display: block; margin: 10px 0; color: var(--muted); font-size: 12.5px; }
.admin input[type=text], .admin input[type=password], .admin input[type=number], .admin input[type=datetime-local], .admin select, .admin input:not([type]) {
  width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 14px; }
.me-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.me-stream { font-family: ui-monospace, monospace; color: var(--green); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.me-head .status { width: auto; margin: 0; }
.ind { width: 9px; height: 9px; border-radius: 50%; background: #44515f; }
.ind.on { background: var(--live); box-shadow: 0 0 0 0 rgba(255,59,70,.6); animation: pulse 1.5s infinite; }
.teams-edit { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; margin-top: 6px; }
.team-edit { display: flex; gap: 10px; align-items: flex-start; }
.team-edit-fields { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.team-edit-fields .row2 { display: flex; gap: 7px; }
.team-edit-fields .tscore { width: 62px; flex: none; text-align: center; }
.team-edit-fields .tlogo { flex: 1; color: var(--muted); font-size: 11px; min-width: 0; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
button { font: inherit; cursor: pointer; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line); background: #1b2632; color: var(--text); font-weight: 700; }
button.primary, #unlock { background: var(--green); border-color: var(--green-d); color: #03210f; }
button:hover { filter: brightness(1.08); }

/* ---------- public news ---------- */
.news { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.news-card { background: linear-gradient(180deg, var(--panel), var(--panel2)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.news-img { aspect-ratio: 16/9; background: #0a0d12; }
.news-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-text { padding: 14px; }
.news-text h3 { margin: 0 0 6px; font-size: 15.5px; }
.news-text p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }

/* ---------- admin: sections + controls ---------- */
.admin-sec-head { display: flex; justify-content: space-between; align-items: center; margin: 24px 2px 12px; }
.admin-sec-head h2 { margin: 0; font-size: 15px; }
.admin-sec-head button { padding: 8px 14px; }
.me-tools { display: flex; gap: 6px; }
.me-tools button { padding: 6px 11px; font-size: 14px; border-radius: 8px; line-height: 1; }
.me-tools button.danger { color: #ff9b9b; border-color: #5a2b2b; }
.match-edit.is-featured { border-color: var(--green); box-shadow: 0 0 0 1px rgba(24,201,100,.3) inset; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; resize: vertical; }
.news-edit-body { display: flex; gap: 12px; }
.news-edit-img { width: 110px; height: 76px; flex: none; border-radius: 8px; overflow: hidden; background: #0e151d; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.news-edit-img img { width: 100%; height: 100%; object-fit: cover; }
.news-edit-fields { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.news-edit-fields .nimg { color: var(--muted); font-size: 11px; }
.save-bar { position: sticky; bottom: 0; background: linear-gradient(0deg, var(--bg) 60%, transparent); padding: 14px 0; margin-top: 8px; }

/* ---------- news detail ---------- */
.news-card { display: block; color: inherit; transition: transform .15s, border-color .15s; }
.news-card:hover { transform: translateY(-2px); border-color: var(--green); }
.news-more { display: inline-block; margin-top: 8px; color: var(--green); font-weight: 700; font-size: 12.5px; }
.article { max-width: 760px; margin: 0 auto; }
.article-img { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 18px; }
.article-img img { width: 100%; display: block; }
.article h1 { font-size: 26px; margin: 0 0 14px; }
.article-body { color: #cdd9e5; font-size: 16px; line-height: 1.7; }
.article-back { margin-top: 26px; } .article-back a { color: var(--green); font-weight: 700; }

/* ---------- admin health dashboard ---------- */
.dash { margin-bottom: 18px; transition: opacity .2s; }
.dash.stale { opacity: .45; }
.dash-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.dash-card { background: linear-gradient(180deg, var(--panel), var(--panel2)); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.dash-card h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.big-num { font-size: 40px; font-weight: 800; line-height: 1; }
.kpi-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.kpi-list li { display: flex; justify-content: space-between; color: var(--muted); }
.kpi-list b { color: var(--text); }
.kpi-row { display: flex; justify-content: space-between; margin: 6px 0; font-size: 13px; color: var(--muted); }
.kpi-row b { color: var(--text); }
.meter { margin: 10px 0; }
.meter-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.bar { height: 8px; background: #0a0d12; border-radius: 999px; overflow: hidden; }
.bar-f { height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }
.bar-f.hot { background: var(--live); }
.svc { display: flex; align-items: center; gap: 9px; font-size: 13.5px; margin: 7px 0; }
.hdot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #44515f; }
.hdot.ok { background: var(--green); box-shadow: 0 0 8px rgba(24,201,100,.55); }
.hdot.bad { background: var(--live); }

/* ===================== PRO ADMIN ===================== */
.adminbody { background: radial-gradient(1000px 520px at 78% -220px, #14243a 0%, transparent 62%), linear-gradient(180deg, #0a0f16, #070a0e); }

/* login gate */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: 100%; max-width: 380px; text-align: center; padding: 34px 28px; border-radius: 20px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--panel2)); box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: fadeUp .5s both; }
.gate-logo { font-size: 46px; filter: drop-shadow(0 4px 14px rgba(24,201,100,.45)); }
.gate-card h1 { font-size: 22px; margin: 10px 0 20px; } .gate-card h1 span { color: var(--green); }
.gate-card input { margin-bottom: 12px; text-align: center; } .gate-card button { width: 100%; }

/* top bar + tabs */
.adm-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(24,201,100,.08), transparent); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); }
.adm-brand { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.adm-tag { color: var(--green); font-weight: 700; }
.adm-top-right { display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 8px; padding: 14px 20px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 1080px; margin: 0 auto; }
.tab { flex: none; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; transition: all .15s; }
.tab:hover { color: var(--text); border-color: var(--green); }
.tab.active { background: var(--green); border-color: var(--green); color: #03210f; }

/* panes */
.adm-main { max-width: 1080px; margin: 0 auto; padding: 18px 16px 96px; }
.pane { display: none; } .pane.active { display: block; animation: fadeUp .35s both; }
.pane-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 14px; }
.pane-head h2 { margin: 0; font-size: 18px; }

/* #app cards + inputs */
#app .card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
#app h2 { font-size: 15px; margin: 0 0 12px; }
#app .fld { display: block; margin: 10px 0; color: var(--muted); font-size: 12.5px; }
#app input[type=text], #app input[type=password], #app input[type=number], #app input[type=datetime-local], #app select, #app textarea, .gate-card input {
  width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; }
#app textarea { resize: vertical; }
#app input:focus, #app select:focus, #app textarea:focus, .gate-card input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(24,201,100,.15); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.ghost:hover { color: var(--text); border-color: var(--green); }
button.sm { padding: 8px 14px; font-size: 13px; }
code { background: var(--panel2); padding: 2px 6px; border-radius: 5px; }

/* KPI stat cards */
.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.stat { position: relative; overflow: hidden; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--panel2)); animation: fadeUp .45s both; transition: transform .15s, border-color .15s; }
.stat:hover { transform: translateY(-3px); border-color: var(--green); }
.stat-ico { font-size: 20px; }
.stat-n { font-size: 32px; font-weight: 800; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat.live .stat-n { color: var(--live); }
.stat.live::after { content: ""; position: absolute; top: 16px; right: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255,59,70,.6); animation: pulse 1.5s infinite; }

.dash-card { animation: fadeUp .45s both; }

/* audience bars + sparkline */
.abar { margin: 8px 0; }
.abar-h { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.abar-sep { height: 1px; background: var(--line); margin: 12px 0; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 92px; padding-top: 8px; }
.spark-b { flex: 1; background: linear-gradient(180deg, var(--green), var(--green-d)); border-radius: 5px 5px 0 0; min-height: 6px; opacity: .5; transition: height .5s; }
.spark-b.today { opacity: 1; }

.match-edit, .news-edit { animation: fadeUp .4s both; animation-delay: var(--d, 0ms); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.save-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 14px; justify-content: center; padding: 14px; background: linear-gradient(0deg, var(--bg) 65%, transparent); z-index: 15; }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .container { padding: 16px 12px 36px; }
  .hero { padding: 16px; }
  .hero-body { gap: 6px; }
  .hero .score { font-size: 34px; }
  .hero .crest { width: 64px !important; height: 64px !important; }
  .sb-body .crest { width: 58px !important; height: 58px !important; }
  .sb-body .score { font-size: 30px; }
  .team.big .team-name { font-size: 13px; }
  .teams-edit { grid-template-columns: 1fr; gap: 8px; }
  .teams-edit .vs { display: none; }
  .matches { gap: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .news-edit-body { flex-direction: column; }
  .news-edit-img { width: 100%; height: 130px; }
}
