@import url('https://fonts.googleapis.com/css2?family=Finlandica:wght@400;500;600;700;800;900&display=swap');

:root {
  color-scheme: dark;
  --bg: #212428;
  --panel: #2a2e33;
  --panel-soft: #30353b;
  --line: rgba(255, 255, 255, .1);
  --text: #fff;
  --muted: rgba(255, 255, 255, .66);
  --blue: #00bcff;
  --blue-dark: #008fd1;
  --danger: #ff5173;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 80% 0%, rgba(0, 188, 255, .16), transparent 30%), var(--bg);
  color: var(--text);
  font-family: Finlandica, Segoe UI, system-ui, sans-serif;
}
a { color: inherit; text-decoration: none; }
main, .persistent-stream { width: min(1480px, calc(100% - 40px)); margin: 0 auto; }
main { padding: 28px 0 56px; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 24px; justify-content: space-between;
  padding: 12px max(20px, calc((100vw - 1480px) / 2));
  background: rgba(33, 36, 40, .9); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px);
}
body[data-page="home"] .topbar,
body[data-page="shop"] .topbar,
body[data-page="messages"] .topbar,
body[data-page="tournaments"] .topbar {
  position: relative;
  top: auto;
  z-index: 5;
}
.brand, nav, .account, .card-actions, .row, .section-title { display: flex; align-items: center; gap: 14px; }
.brand img, .account img { width: 36px; height: 36px; object-fit: contain; }
.account img { border-radius: 50%; object-fit: cover; }
.brand span { font-size: 20px; font-weight: 900; letter-spacing: 0; }
.menu-toggle { display: none; }
nav { flex: 1; }
nav a, .account a { color: var(--muted); font-weight: 700; font-size: 14px; }
nav a:hover, .account a:hover { color: var(--blue); }
body[data-page="home"] nav a[data-nav="home"],
body[data-page="shop"] nav a[data-nav="shop"],
body[data-page="messages"] nav a[data-nav="messages"],
body[data-page="tournaments"] nav a[data-nav="tournaments"],
body[data-page="ranking"] nav a[data-nav="ranking"],
body[data-page="admin"] nav a[data-nav="admin"] { color: var(--blue); }
.mobile-logout-link { display: none; }
.account strong { color: var(--blue); }
.account span { color: var(--muted); }
.logout-link {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255, 81, 115, .12); border: 1px solid rgba(255, 81, 115, .35);
}
.logout-link svg { width: 20px; height: 20px; fill: var(--danger); }
.logout-link:hover { background: rgba(255, 81, 115, .22); border-color: var(--danger); }

.login-panel {
  width: min(460px, 100%);
  margin: 8vh auto;
  padding: 34px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}
.login-panel img { width: 92px; height: 92px; }
.login-benefits {
  display: grid; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; text-align: left;
}
.login-benefits li {
  position: relative; padding-left: 18px; color: #fff; font-weight: 700;
}
.login-benefits li::before {
  content: ""; position: absolute; left: 0; top: .65em; width: 7px; height: 7px;
  border-radius: 50%; background: var(--blue);
}
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1; letter-spacing: 0; }
h2 { font-size: 20px; }
p, small, .notice, .empty { color: var(--muted); }
.notice { padding: 12px; border: 1px solid rgba(0,188,255,.35); border-radius: 8px; margin-bottom: 16px; }
.button, button {
  border: 0; border-radius: 6px; padding: 10px 14px; cursor: pointer;
  color: #fff; background: var(--panel-soft); font-weight: 900;
}
.button.primary, button.primary { background: var(--blue); color: #04151d; }
.button.primary:hover, button.primary:hover { background: #40ccff; }
.twitch-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #9146ff; color: #fff; padding: 12px 18px;
}
.twitch-button:hover { background: #7f35ee; }
.twitch-button svg { width: 22px; height: 22px; fill: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
.danger { background: rgba(255,81,115,.16); color: var(--danger); }

.persistent-stream { display: none; padding-top: 24px; }
body[data-page="home"] .persistent-stream,
body[data-page="shop"] .persistent-stream,
body[data-page="messages"] .persistent-stream,
body[data-page="tournaments"] .persistent-stream,
body[data-page="ranking"] .persistent-stream { display: block; }
body[data-page="admin"] .persistent-stream,
body[data-page="login"] .persistent-stream { display: none; }
.stream-zone { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; gap: 18px; padding: 0 0 8px; }
.compact-latest { display: none; }
.stream-left { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; height: 680px; min-width: 0; }
.stream-player, .stream-chat { position: relative; background: #111418; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 680px; }
.stream-player { height: 100%; min-height: 0; }
.stream-player iframe, .stream-player [data-twitch-player], .stream-chat iframe { display: block; width: 100%; height: 100%; border: 0; }
.player-disabled {
  display: none; position: absolute; inset: 0; place-items: center; align-content: center; gap: 12px; padding: 24px;
  color: var(--muted); background: #111418; text-align: center; font-weight: 900;
}
.player-off-icon {
  width: clamp(60px, 10vw, 86px);
  height: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.player-disabled p { margin: 0; }
.stream-player.is-hidden [data-twitch-player] { display: none; }
.stream-player.is-hidden .player-disabled { display: grid; }
.stream-status {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 8px 12px;
  border-radius: 8px; background: #2a2e33; color: #fff; font-size: 14px; font-weight: 800;
}
.stream-status span { width: 10px; height: 10px; border-radius: 50%; background: #7f858c; flex: 0 0 10px; }
.stream-status.live span { background: #ff354f; }
.stream-status b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-controls {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
}
.stream-balance, .stream-toggle, .stream-viewers {
  justify-self: start; display: flex; align-items: center; gap: 8px;
  min-height: 44px;
  max-width: 100%; padding: 10px 14px; border-radius: 8px;
  background: #2a2e33;
  color: var(--muted); font-size: 15px; font-weight: 800;
}
.stream-balance b { color: #fff; font-size: 1em; line-height: inherit; }
.stream-viewers {
  margin-left: auto;
  color: var(--danger);
}
.stream-viewers svg {
  width: 17px; height: 17px; fill: currentColor; flex: 0 0 17px;
}
.stream-viewers b {
  color: var(--danger); font-size: 1em; line-height: inherit;
}
.stream-toggle {
  position: relative; cursor: pointer; user-select: none;
}
.info-tooltip {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 18px;
  width: 18px; height: 18px; border-radius: 50%;
  color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.78);
  font-size: 12px; line-height: 18px; font-weight: 900;
}
.info-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%);
  width: max-content; max-width: min(340px, calc(100vw - 36px));
  padding: 8px 10px; border-radius: 6px;
  color: #fff; background: #111418; border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
  font-size: 12px; line-height: 1.35; font-weight: 800; z-index: 4;
}
.info-tooltip:hover::before {
  content: "";
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%) rotate(45deg);
  width: 9px; height: 9px; background: #111418;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  z-index: 5;
}
.stream-toggle input {
  position: absolute; opacity: 0; pointer-events: none;
}
.stream-toggle i {
  position: relative; width: 42px; height: 24px; flex: 0 0 42px;
  border-radius: 999px; background: rgba(255,255,255,.15);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
  transition: background .2s ease, transform .16s ease;
}
.stream-toggle i::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  transition: transform .2s cubic-bezier(.2, .9, .2, 1.2);
}
.stream-toggle input:checked + i {
  background: var(--blue);
  animation: switchPulse .24s ease;
}
.stream-toggle input:checked + i::after {
  transform: translateX(18px);
}
@keyframes switchPulse {
  50% { transform: scale(1.08); }
}
[data-points] {
  display: inline-block;
  transition: color .18s ease, transform .18s ease, text-shadow .18s ease;
}
[data-points].points-up {
  color: #41d684 !important;
  animation: pointsUp .75s ease;
  text-shadow: 0 0 16px rgba(65, 214, 132, .45);
}
[data-points].points-down {
  color: var(--danger) !important;
  animation: pointsDown .75s ease;
  text-shadow: 0 0 16px rgba(255, 81, 115, .42);
}
@keyframes pointsUp {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-4px) scale(1.16); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes pointsDown {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(4px) scale(.92); }
  100% { transform: translateY(0) scale(1); }
}
.coin-stack {
  position: relative; display: inline-block; flex: 0 0 20px; width: 20px; height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, #7ce0ff, var(--blue) 45%, #0079b2);
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.22);
}
.coin-stack i {
  position: absolute;
  display: block;
}
.coin-stack i:nth-child(1) { display: none; }
.coin-stack i:nth-child(2) {
  inset: 0;
  display: grid;
  place-items: center;
}
.coin-stack i:nth-child(2)::before {
  content: "P";
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
  font-style: normal;
}
.coin-stack i:nth-child(3) {
  display: none;
}
.separator { color: rgba(255,255,255,.28); }
.eyebrow, .section-title span { color: var(--blue); font-weight: 900; text-transform: uppercase; font-size: 12px; }
.event-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.event-logo { width: 1em; height: 1em; object-fit: contain; flex: 0 0 1em; }
.event-link {
  display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 4px;
  color: var(--blue); background: rgba(0, 188, 255, .12); text-decoration: none;
}
.event-link svg { width: .95em; height: .95em; fill: currentColor; }
.event-link:hover { background: rgba(0, 188, 255, .22); }
.hero aside, .panel, .card, .match-card, .leaderboard-item {
  background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 8px;
}
.hero aside { padding: 22px; display: grid; gap: 4px; }
.hero aside strong { color: var(--blue); font-size: 48px; line-height: 1; }
.grid.two { display: grid; grid-template-columns: 1.5fr .8fr; gap: 22px; margin-top: 26px; }
.section-title { justify-content: space-between; margin: 10px 0 16px; }
.section-title h1, .section-title h2 { margin: 0; }
.match-list, .leaderboard, .cards { display: grid; gap: 14px; }
.match-card { padding: 16px; display: grid; gap: 14px; }
.match-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.versus { display: grid; grid-template-columns: minmax(0, 1fr) 62px minmax(0, 1fr); align-items: stretch; gap: 12px; }
.team-pick {
  display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 12px;
  width: 100%; min-height: 92px; padding: 10px; text-align: left;
  background: rgba(255, 255, 255, .025); border: 1px solid transparent; border-radius: 8px;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.team-pick:hover:not(:disabled) { background: rgba(0, 188, 255, .11); border-color: rgba(0, 188, 255, .42); transform: translateY(-1px); }
.team-pick.selected { background: rgba(0, 188, 255, .16); border-color: var(--blue); box-shadow: inset 0 0 0 1px rgba(0, 188, 255, .4); }
.team-pick.won { background: rgba(65, 214, 132, .17); border-color: #41d684; }
.team-pick.lost { background: rgba(255, 81, 115, .13); border-color: var(--danger); }
.team-pick:disabled { cursor: default; opacity: 1; }
.team-logo-box {
  display: flex; align-items: center; justify-content: center;
  width: 78px; height: 72px; min-width: 78px; max-width: 78px;
  padding: 6px;
  background: rgba(0, 0, 0, .18); border-radius: 8px; overflow: hidden;
}
.team-logo-box img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}
.team-copy { display: grid; gap: 3px; min-width: 0; }
.team-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

body.compact-view {
  overflow: hidden;
}
body.compact-view .topbar,
body.compact-view main,
body.compact-view .site-footer,
body.compact-view .mobile-chat-button {
  display: none !important;
}
body.compact-view .persistent-stream {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 8px;
}
body.compact-view .stream-zone {
  display: contents;
}
body.compact-view .stream-left {
  grid-column: 1;
  grid-row: 1;
  height: auto;
  min-height: 0;
  gap: 8px;
}
body.compact-view .stream-player,
body.compact-view .stream-chat {
  height: auto;
  min-height: 0;
}
body.compact-view .stream-chat {
  grid-column: 2;
  grid-row: 1 / 3;
}
  body.compact-view .stream-balance,
  body.compact-view .stream-toggle,
  body.compact-view .stream-viewers {
    min-height: 38px;
    padding: 8px 11px;
    font-size: 13px;
  }
body.compact-view .compact-latest {
  display: block;
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
}
body.compact-view .compact-match-card {
  padding: 10px;
  gap: 8px;
}
body.compact-view .compact-match-card .match-head {
  gap: 8px;
}
body.compact-view .compact-match-card .versus {
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 8px;
}
body.compact-view .compact-match-card .team-pick {
  min-height: 64px;
  grid-template-columns: 54px minmax(0, 1fr);
  padding: 7px;
  gap: 8px;
}
body.compact-view .compact-match-card .team-logo-box {
  width: 54px;
  height: 50px;
  min-width: 54px;
  max-width: 54px;
}
body.compact-view .compact-match-card .vote-share {
  height: 14px;
}
body.compact-view .compact-match-card .vote-share b {
  line-height: 14px;
  font-size: 11px;
}
body.compact-view .compact-match-card .supporters {
  margin-top: 2px;
}
body.compact-view .compact-match-card .supporters img,
body.compact-view .compact-match-card .supporter-fallback {
  width: 18px;
  height: 18px;
}
body.compact-view .vs {
  min-height: 64px;
}
body.compact-view[data-page="admin"],
body.compact-view[data-page="terms"] {
  overflow: auto;
}
body.compact-view[data-page="admin"] .topbar,
body.compact-view[data-page="terms"] .topbar {
  display: flex !important;
}
body.compact-view[data-page="admin"] main,
body.compact-view[data-page="terms"] main {
  display: block !important;
}
body.compact-view[data-page="admin"] .site-footer,
body.compact-view[data-page="terms"] .site-footer,
body.compact-view[data-page="privacy"] .site-footer,
body.compact-view[data-page="legal"] .site-footer {
  display: flex !important;
}
.leaderboard-item img, .avatar-placeholder { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: var(--panel); }
.tag { color: var(--blue); font-weight: 900; }
.vote-share {
  position: relative; display: block; width: min(180px, 100%); height: 18px;
  overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08);
}
.vote-share span {
  position: absolute; inset: 0 auto 0 0; background: rgba(0, 188, 255, .48);
}
.vote-share b {
  position: relative; z-index: 1; display: block; padding: 0 7px;
  color: #fff; font-size: 12px; line-height: 18px; font-weight: 900;
}
.vs { display: grid; place-items: center; color: var(--muted); font-weight: 900; min-height: 92px; }
.bet-result { width: max-content; padding: 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 900; }
.bet-result.won { color: #062113; background: #41d684; }
.bet-result.lost { color: #fff; background: var(--danger); }
.supporters { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.supporters img, .supporter-fallback {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25);
}
.supporters img { object-fit: cover; }
.supporter-fallback {
  display: inline-grid; place-items: center; background: rgba(0, 188, 255, .18);
  color: #fff; font-size: 11px; font-weight: 900;
}

.status { color: var(--muted); font-size: 13px; font-weight: 900; }
.leaderboard-item { padding: 12px; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; }
.predictor-count { margin-top: 10px; text-align: right; color: var(--muted); font-size: 13px; font-weight: 800; }
.ranking-page { width: 100%; max-width: none; margin: 0; }
.ranking-toolbar {
  display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 10px; align-items: start;
  margin-bottom: 14px;
}
.ranking-toolbar input { margin: 0; }
.ranking-filter {
  display: flex; gap: 0; flex-wrap: wrap; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.035);
}
.ranking-filter button {
  min-height: 40px; background: transparent; color: var(--muted);
  border: 0; border-radius: 0; border-right: 1px solid var(--line);
}
.ranking-filter button:last-child {
  border-right: 0;
}
.ranking-filter button.active {
  color: #fff; background: rgba(0, 188, 255, .18);
  box-shadow: inset 0 -2px 0 var(--blue);
}
.leaderboard-full { gap: 10px; }
.ranking-row { grid-template-columns: 56px 42px minmax(0, 1fr) auto; }
.ranking-row.ranking-me {
  border-color: rgba(0, 188, 255, .78);
  box-shadow: inset 0 0 0 1px rgba(0, 188, 255, .5), 0 0 24px rgba(0, 188, 255, .16);
  background: rgba(0, 188, 255, .11);
}
.rank-number { color: var(--blue); }
.ranking-user { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ranking-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caster-badge {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 999px;
  color: #fff; background: rgba(145, 70, 255, .22); border: 1px solid rgba(145, 70, 255, .55);
  cursor: help;
}
.caster-badge svg { width: 16px; height: 16px; fill: currentColor; }
.caster-badge:hover::after {
  content: "Commentateur";
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  padding: 7px 9px; border-radius: 6px; white-space: nowrap;
  color: #fff; background: #111418; border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0,0,0,.35); font-size: 12px; font-weight: 900; z-index: 4;
}
.caster-badge:hover::before {
  content: "";
  position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%) rotate(45deg);
  width: 9px; height: 9px; background: #111418;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  z-index: 5;
}
.ranking-pagination {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 14px;
}
.ranking-pagination button {
  display: grid; place-items: center; width: 42px; height: 38px; padding: 0;
  font-size: 24px; line-height: 1; color: #fff;
}
.ranking-pagination span { color: var(--muted); font-size: 13px; font-weight: 900; }
.shop-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { padding: 16px; }
.product > img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; background: var(--panel); margin-bottom: 12px; }
.card-actions { justify-content: space-between; margin-top: 18px; }

.tournaments-page { width: 100%; }
.tournament-agenda { display: grid; gap: 12px; }
.tournament-card {
  display: grid; grid-template-columns: 58px 70px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px; border-radius: 8px; border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
}
.tournament-date {
  display: grid; place-items: center; align-content: center;
  width: 58px; height: 58px; border-radius: 8px;
  color: #fff; background: var(--blue);
  text-align: center; text-decoration: none; line-height: 1;
}
.tournament-date strong { font-size: 28px; }
.tournament-date span { margin-top: 3px; font-size: 13px; font-weight: 900; text-transform: capitalize; }
.tournament-logo {
  display: flex; align-items: center; justify-content: center;
  width: 70px; height: 58px; padding: 6px; border-radius: 8px;
  background: rgba(0,0,0,.18); overflow: hidden;
}
.tournament-logo img { width: 100%; height: 100%; object-fit: contain; }
.tournament-copy { min-width: 0; }
.tournament-copy h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.tournament-copy span { color: var(--muted); font-weight: 800; }
.tournament-link { font-size: 20px; }

.messages { max-width: none; margin: 0; }
.messages-title { justify-content: flex-start; align-items: flex-start; }
.messages-title p { margin: 8px 0 0; }
.thread { display: grid; gap: 12px; margin-bottom: 18px; }
.bubble { width: 100%; max-width: none; padding: 12px 14px; border-radius: 8px; background: var(--panel); }
.bubble.user { justify-self: end; background: rgba(0,188,255,.15); border: 1px solid rgba(0,188,255,.25); }
.bubble p { margin-bottom: 6px; color: #fff; }
.reply { display: grid; gap: 10px; }

.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.admin-tabs a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border-radius: 8px; background: var(--panel); color: var(--muted); font-weight: 900;
}
.admin-tabs a.active, .admin-tabs a:hover { background: rgba(0, 188, 255, .14); color: var(--blue); }
.panel { padding: 16px; margin-bottom: 16px; }
.panel form, .panel { min-width: 0; }
.wide { width: 100%; overflow-x: auto; }
input, select, textarea {
  width: 100%; margin-bottom: 10px; padding: 11px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: #1b1e22; color: #fff;
}
textarea { resize: vertical; min-height: 88px; }
.row { justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.row span { min-width: 220px; }
.row form { display: flex; gap: 8px; align-items: center; margin: 0; }
.row select { margin: 0; min-width: 160px; }
.inline-form { display: grid; grid-template-columns: 220px 1fr auto; gap: 10px; align-items: start; }
.edit-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) 120px;
  gap: 10px;
  align-items: start;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.product-edit { grid-template-columns: repeat(3, minmax(140px, 1fr)) 110px 110px; }
.edit-row input, .edit-row select, .edit-row textarea { margin-bottom: 0; }
.mini-delete { margin: 8px 0 14px; }
.admin-list-panel { display: grid; gap: 10px; overflow: visible; }
.admin-list-head {
  display: grid; grid-template-columns: 1fr minmax(220px, 360px); gap: 12px; align-items: center;
}
.admin-list-head h2 { margin: 0; }
.admin-list-head input { margin: 0; }
.admin-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.admin-row-main { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.admin-row-main img {
  width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: rgba(0,0,0,.18); padding: 4px;
}
.admin-row-main strong { min-width: 180px; }
.admin-row-main p { flex-basis: 100%; margin: 0; color: var(--text); }
.badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px;
  background: rgba(0, 188, 255, .14); color: var(--blue); font-size: 12px; font-weight: 900;
}
.admin-row-winner {
  padding-left: 10px;
  border-left: 3px solid #41d684;
  background: rgba(65, 214, 132, .07);
}
.winner-badge {
  background: rgba(65, 214, 132, .18);
  color: #41d684;
}
.pending-badge {
  background: rgba(255,255,255,.08);
  color: var(--muted);
}
.admin-row details { min-width: 100px; position: static; }
.admin-row summary { cursor: pointer; color: var(--blue); font-weight: 900; }
.admin-row details[open] {
  grid-column: 1 / -1;
  order: 5;
  width: 100%;
  padding-top: 10px;
}
.admin-row details[open] summary { margin-bottom: 10px; }
.admin-row details[open] .edit-row {
  width: 100%;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .12);
}
.admin-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.admin-pagination span { color: var(--muted); font-weight: 800; }
.toast {
  position: fixed; right: 18px; bottom: 18px;
  display: inline-flex; align-items: center; gap: 9px;
  width: max-content; max-width: calc(100vw - 36px);
  transform: translateX(calc(100% + 28px)); opacity: 0;
  overflow: hidden;
  background: #111418; color: #fff; border: 1px solid var(--blue); border-radius: 8px; padding: 12px 14px 15px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, .38), 0 0 0 1px rgba(0, 188, 255, .12);
  transition: transform .28s ease, opacity .2s ease; pointer-events: none;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.leaving { transform: translateX(calc(100% + 28px)); opacity: 0; }
.toast::before {
  content: "i";
  display: inline-grid; place-items: center; flex: 0 0 18px;
  width: 18px; height: 18px; border-radius: 50%;
  color: #04151d; background: var(--blue);
  font-size: 12px; line-height: 1; font-weight: 900; font-style: italic;
}
.toast::after {
  content: "";
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0;
  background: var(--blue);
}
.toast.show::after { animation: toastProgress 3.2s linear forwards; }
.toast.success { background: #10261a; border-color: #41d684; color: #bdf5d1; }
.toast.success::before {
  color: #062113; background: #41d684;
}
.toast.success::after {
  background: #41d684;
}
@keyframes toastProgress {
  from { width: 0; opacity: .55; }
  to { width: 100%; opacity: .95; }
}
.modal-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 20px;
  background: rgba(7, 9, 12, .66);
  backdrop-filter: blur(8px) saturate(.75);
  opacity: 0; transition: opacity .18s ease;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #15191e;
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  transform: translateY(10px) scale(.98);
  transition: transform .18s ease;
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-box h2 { margin: 0 0 10px; }
.modal-box p { margin: 0; color: var(--muted); line-height: 1.55; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 20px;
}
body.modal-open { overflow: hidden; }
.site-footer {
  width: min(1480px, calc(100% - 40px)); margin: 20px auto 0; padding: 20px 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-footer > span { white-space: nowrap; }
.footer-links { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.footer-links a { color: var(--muted); font-weight: 900; }
.footer-links a:hover { color: var(--blue); }
.footer-links svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.legal { max-width: 980px; margin: 0 auto; }
.legal h1 { margin-top: 0; }
.legal h2 { margin: 24px 0 8px; }
.legal p { color: var(--muted); line-height: 1.6; }
.legal strong, .legal a { color: #fff; }
.legal-table-wrap { overflow-x: auto; margin: 14px 0; }
.legal-table {
  width: 100%; border-collapse: collapse; min-width: 720px;
  color: var(--muted); font-size: 14px;
}
.legal-table th, .legal-table td {
  padding: 12px; border: 1px solid var(--line); text-align: left; vertical-align: top;
}
.legal-table th { color: #fff; background: rgba(255,255,255,.06); }
.legal-table td:first-child { color: #fff; font-weight: 900; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.privacy-actions .danger { border: 1px solid rgba(255, 81, 115, .35); }
.export-note { font-size: 13px; }
.mobile-chat-button { display: none; }

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .brand span { display: none; }
  .menu-toggle {
    display: grid; gap: 4px; place-content: center;
    width: 40px; height: 40px; padding: 0; margin-left: auto;
    background: rgba(255,255,255,.06); border: 1px solid var(--line);
  }
  .menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 999px; background: #fff; }
  nav {
    order: 4; display: none; flex: 0 0 100%; width: 100%; flex-direction: column; align-items: stretch; gap: 4px;
    padding-top: 10px; border-top: 1px solid var(--line);
  }
  .mobile-logout-link { display: block; color: var(--danger); }
  body.menu-open nav { display: flex; }
  nav a { display: block; width: 100%; padding: 10px 0; }
  .account { order: 2; width: auto; margin-left: auto; justify-content: flex-end; }
  .account .logout-link { display: none; }
  .account strong { font-size: 16px; }
  .account span { font-size: 13px; }
  .menu-toggle { order: 3; margin-left: 0; }
  .persistent-stream {
    padding-top: 10px;
    padding-bottom: 8px;
  }
  .stream-zone, .hero, .grid.two, .admin-grid { grid-template-columns: 1fr; }
  .stream-left { height: auto; }
  .stream-player { height: auto; aspect-ratio: 16 / 9; }
  .stream-chat { display: none; }
  body.chat-open .stream-chat {
    display: block; position: fixed; right: 14px; bottom: 72px; z-index: 9;
    width: min(360px, calc(100vw - 28px)); height: 520px; border: 1px solid rgba(0,188,255,.35);
    box-shadow: 0 16px 50px rgba(0,0,0,.45);
  }
  .mobile-chat-button {
    display: block; position: fixed; right: 14px; bottom: 14px; z-index: 10;
    background: #9146ff; color: #fff;
    border-color: rgba(255,255,255,.18);
    transition: bottom .28s ease, transform .28s ease, background .2s ease;
  }
  body.toast-visible .mobile-chat-button { bottom: 76px; }
  body[data-page="admin"] .mobile-chat-button,
  body[data-page="login"] .mobile-chat-button,
  body[data-page="terms"] .mobile-chat-button,
  body[data-page="privacy"] .mobile-chat-button,
  body[data-page="legal"] .mobile-chat-button { display: none; }
  body.chat-open .mobile-chat-button { background: var(--danger); color: #fff; }
  body.chat-open .mobile-chat-button::before { content: "Fermer "; }
  .site-footer { flex-direction: column; align-items: flex-start; width: min(1480px, calc(100% - 32px)); }
  .site-footer > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .footer-links { flex-direction: row; flex-wrap: nowrap; align-items: center; width: auto; }
  .footer-links a { width: auto; flex: 0 0 auto; }
  .stream-status { align-items: center; }
  .stream-status b { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
  .stream-balance span { min-width: 0; overflow-wrap: anywhere; }
  .ranking-toolbar { grid-template-columns: 1fr; }
  .ranking-filter button, .ranking-toolbar .button { width: 100%; }
  .ranking-row { grid-template-columns: 46px 42px minmax(0, 1fr) auto; }
  .ranking-pagination { justify-content: stretch; }
  .ranking-pagination button { flex: 1; }
  .tournament-card { grid-template-columns: 52px 58px minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .tournament-date { width: 52px; height: 52px; }
  .tournament-date strong { font-size: 24px; }
  .tournament-date span { font-size: 12px; }
  .tournament-logo { width: 58px; height: 50px; }
  .tournament-copy h2 { font-size: 18px; }
  .stream-balance { flex-wrap: wrap; }
  .versus { grid-template-columns: 1fr; }
  .vs { min-height: 28px; }
  .match-head, .row, .inline-form, .edit-row, .product-edit, .admin-list-head, .admin-row { align-items: stretch; flex-direction: column; grid-template-columns: 1fr; }
  .admin-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .admin-row-main strong { min-width: 0; }
  .admin-pagination { justify-content: stretch; }
  .admin-pagination button { flex: 1; }
  .bubble { max-width: 92%; }
  body.compact-view .persistent-stream {
    display: block;
    width: min(1480px, calc(100% - 40px));
    height: auto;
    margin: 0 auto;
    padding-top: 10px;
    padding-bottom: 8px;
  }
  body.compact-view .stream-left {
    height: auto;
    min-height: auto;
    gap: 10px;
  }
  body.compact-view .stream-zone {
    display: grid;
    grid-template-columns: 1fr;
  }
  body.compact-view .stream-chat {
    display: none;
  }
  body.compact-view .stream-player {
    height: auto;
    aspect-ratio: 16 / 9;
  }
  body.compact-view .compact-latest {
    display: none;
  }
  body.compact-view .topbar {
    display: flex !important;
  }
  body.compact-view main {
    display: block !important;
  }
  body.compact-view .site-footer {
    display: flex !important;
  }
  body.compact-view {
    overflow: auto;
  }
  [data-compact-toggle] {
    display: none;
  }
  .stream-toggle:has([data-compact-toggle]) {
    display: none;
  }
}
