:root {
  --bg:         #0a0a0a;
  --bg-soft:    #141010;
  --bg-card:    #1a1313;
  --bg-elev:    #241717;
  --border:     #3a1a1a;
  --border-hi:  #5c2424;
  --text:       #f5ede8;
  --text-dim:   #9b8580;
  --red:        #d62828;
  --red-bright: #ff2a2a;
  --red-glow:   rgba(214,40,40,.4);
  --gold:       #e5b948;
  --green:      #22c55e;
  --live:       #ff2a2a;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow:     0 16px 48px rgba(0,0,0,.7);
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display:'Anton', 'Inter', sans-serif;
  --font-script:'Special Elite', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100vw; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 500px at 15% -5%, rgba(214,40,40,.18), transparent 55%),
    radial-gradient(1000px 480px at 90% 5%, rgba(214,40,40,.10), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(229,185,72,.06), transparent 70%);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 20px; }
.accent { color: var(--red); }
.muted { color: var(--text-dim); }
.svg-defs { display: none; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 0 rgba(214,40,40,.3);
  padding-top: env(safe-area-inset-top, 0px);
}
.header-inner {
  display: flex; align-items: center; gap: 24px;
  height: 68px;
  padding-left: max(20px, env(safe-area-inset-left, 20px));
  padding-right: max(20px, env(safe-area-inset-right, 20px));
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; flex: 0 0 auto; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 18px var(--red-glow), inset 0 0 0 2px rgba(255,255,255,.12);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: 1.5px; line-height: 1;
}
.brand-text .accent { color: var(--red); }

.main-nav { display: flex; gap: 6px; margin-left: auto; }
.nav-link {
  padding: 8px 16px; border-radius: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .8px;
  color: var(--text-dim); transition: .15s;
  text-transform: uppercase;
}
.nav-link:hover { color: var(--text); background: var(--bg-elev); }
.nav-link.active {
  color: var(--red);
  background: rgba(214,40,40,.14);
  box-shadow: inset 0 -2px 0 var(--red);
}

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.search-wrap input {
  width: 240px; padding: 9px 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-size: 13.5px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214,40,40,.22); }
.search-wrap input::placeholder { color: var(--text-dim); }

.btn-ghost {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 17px; transition: .15s;
}
.btn-ghost:hover { background: var(--bg-elev); border-color: var(--red); color: var(--red); }

.hero {
  position: relative;
  padding: 56px 0 38px;
  text-align: center;
  overflow: hidden;
}
.hero-mask {
  position: absolute;
  top: -60px; right: -60px;
  width: 380px; height: 380px;
  color: var(--red);
  opacity: .14;
  pointer-events: none;
  transform: rotate(-8deg);
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(214,40,40,.18);
  border: 1px solid rgba(214,40,40,.6);
  color: var(--red-bright);
  font-family: var(--font-script);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  animation: pulse 1.8s infinite;
  position: relative;
  z-index: 1;
}
.hero-kicker svg { color: var(--gold); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214,40,40,.5); }
  50%      { box-shadow: 0 0 0 8px rgba(214,40,40,0); }
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 7.5vw, 92px);
  letter-spacing: 3px;
  line-height: .92;
  margin: 0 0 12px;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 rgba(214,40,40,.35), 8px 8px 32px rgba(214,40,40,.4);
  position: relative;
  z-index: 1;
}
.hero h1 .accent { color: var(--red); }
.hero-sub { color: var(--text-dim); margin: 0 0 36px; font-size: 15px; letter-spacing: .3px; position: relative; z-index: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 900px; margin: 0 auto; position: relative; z-index: 1; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 4px;
  transition: .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--red);
  opacity: .8;
}
.stat-card:hover { border-color: var(--border-hi); box-shadow: 0 0 0 1px rgba(214,40,40,.35), 0 8px 24px rgba(0,0,0,.5); }
.stat-num {
  font-family: var(--font-display);
  font-size: 42px; letter-spacing: 2px; line-height: 1;
}
.stat-num.live { color: var(--live); text-shadow: 0 0 16px rgba(255,42,42,.6); }
.stat-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--text-dim); font-weight: 600;
}

.filters-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding-top: 24px; padding-bottom: 10px;
}
.tabs {
  display: flex; gap: 4px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px; padding: 4px;
}
.tab {
  padding: 8px 20px; border-radius: 7px; border: 0;
  background: transparent; color: var(--text-dim);
  font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
  transition: .15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 16px var(--red-glow);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.chip {
  padding: 7px 16px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  text-transform: capitalize; letter-spacing: .3px;
  transition: .15s; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--red); }
.chip.active {
  background: rgba(214,40,40,.16);
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}

.main-content { padding: 20px 20px 40px; min-height: 40vh; }
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 18px;
  width: 100%;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  position: relative;
}
.event-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--red);
  opacity: 0;
  transition: opacity .2s;
  z-index: 3;
}
.event-card:hover {
  transform: translateY(-4px);
  border-color: var(--red);
  box-shadow: var(--shadow), 0 0 0 1px rgba(214,40,40,.5), 0 0 40px rgba(214,40,40,.18);
}
.event-card:hover::before { opacity: 1; }

.card-thumb {
  position: relative; aspect-ratio: 16 / 9;
  background: var(--bg-elev); overflow: hidden;
}
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.event-card:hover .card-thumb img { transform: scale(1.06); }
.card-thumb .thumb-fallback {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 46px; opacity: .3;
  background: radial-gradient(circle at 50% 40%, #2a1515, var(--bg-elev));
}
.card-thumb::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,10,.1) 40%, rgba(10,10,10,.85) 100%);
  pointer-events: none;
}

.badge {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  backdrop-filter: blur(6px); z-index: 2;
}
.badge.live     { background: var(--red); color: #fff; animation: pulse 1.8s infinite; }
.badge.upcoming { background: rgba(229,185,72,.92); color: #1a0f00; }
.badge.finished { background: rgba(60,55,50,.9); color: #ddd; }

.badge-score {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 11px; border-radius: 4px;
  font-family: var(--font-display);
  font-size: 16px; letter-spacing: 1px;
  background: rgba(10,10,10,.9);
  border: 1px solid rgba(214,40,40,.6);
  color: #fff;
  backdrop-filter: blur(6px); z-index: 2;
}

.teams-flag-row {
  position: absolute;
  bottom: 8px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  z-index: 2;
  pointer-events: none;
}
.team-flag {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.15);
}
.vs-pill {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 1px;
  color: #fff;
  padding: 3px 10px;
  background: rgba(10,10,10,.82);
  border-radius: 4px;
  border: 1px solid rgba(214,40,40,.5);
  backdrop-filter: blur(6px);
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.card-league {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--red); font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card-title {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: 1px;
  line-height: 1.1;
  text-transform: uppercase;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 50px;
  color: var(--text);
}

.card-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 11.5px; color: var(--text-dim); margin-top: auto;
  letter-spacing: .3px;
}
.card-meta span { display: inline-flex; align-items: center; gap: 4px; }

.btn-watch {
  margin-top: 4px;
  padding: 11px 16px; border: 0; border-radius: var(--radius-sm);
  background: var(--red);
  color: #fff; font-weight: 900; font-size: 12.5px; letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--font-display);
  transition: filter .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 16px var(--red-glow);
}
.btn-watch:hover { filter: brightness(1.15); box-shadow: 0 6px 24px rgba(214,40,40,.55); }
.btn-watch:active { transform: scale(.97); }
.btn-watch[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }

.status-message {
  padding: 44px 20px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--border); border-radius: var(--radius);
  margin-bottom: 20px; font-size: 14px;
}

.disclaimer-strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: rgba(214,40,40,.05);
}
.disclaimer-text {
  margin: 0; padding: 14px 20px; text-align: center;
  font-size: 12px; line-height: 1.6; color: var(--text-dim);
}
.disclaimer-text strong { color: var(--red); font-weight: 700; }

/* ========= MODAL ========= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3,3,3,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal-panel {
  position: relative; z-index: 1;
  width: min(1050px, 100%);
  max-height: 92vh;
  background: var(--bg-soft);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.9), 0 0 60px rgba(214,40,40,.25);
  animation: pop .2s ease-out;
  display: flex; flex-direction: column;
}
@supports (height: 1dvh) {
  .modal-panel { max-height: 92dvh; }
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(214,40,40,.10), transparent);
}
.modal-title-wrap { min-width: 0; }
.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px; letter-spacing: 1.2px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.modal-meta { margin: 4px 0 0; font-size: 12px; color: var(--text-dim); letter-spacing: .3px; }
.btn-close {
  width: 36px; height: 36px; border-radius: 8px; flex: 0 0 auto;
  background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); font-size: 15px;
}
.btn-close:hover { border-color: var(--red); color: var(--red); }

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  flex: 0 0 auto;
  overflow: hidden;
}

.player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ========= SERVER OVERLAY ========= */
.server-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.server-overlay > * { pointer-events: auto; }

.server-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(10,10,10,.88);
  border: 1px solid rgba(214,40,40,.65);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 14px rgba(0,0,0,.6);
  cursor: pointer;
  transition: .15s;
}
.server-toggle:hover { border-color: var(--red); background: rgba(30,20,20,.95); }
.server-toggle svg { width: 15px; height: 15px; flex: 0 0 auto; }
.server-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0;
}

.server-menu {
  display: none;
  flex-direction: column;
  gap: 3px;
  min-width: 260px;
  max-width: 360px;
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  background: rgba(10,10,10,.97);
  border: 1px solid rgba(214,40,40,.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,.8), 0 0 0 1px rgba(214,40,40,.2);
  -webkit-overflow-scrolling: touch;
}
.server-overlay.open .server-menu { display: flex; }

.server-menu-label {
  padding: 4px 8px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.server-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  transition: .12s;
  cursor: pointer;
  min-height: 52px;
}
.server-btn:hover {
  background: rgba(214,40,40,.14);
  border-color: rgba(214,40,40,.4);
}
.server-btn.active {
  background: rgba(214,40,40,.24);
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.server-logo {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.12);
}

.server-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.server-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.server-desc {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: .3px;
}
.server-btn.active .server-desc { color: var(--red); }

.server-q {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .8px;
  padding: 3px 6px;
  border-radius: 3px;
  background: rgba(34,197,94,.2);
  color: var(--green);
  text-transform: uppercase;
}
.server-q.sd { background: rgba(120,120,120,.22); color: #a8a8a8; }
.server-q.auto { background: rgba(214,40,40,.22); color: var(--red); }

.player-fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(10,10,10,.96);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}
.player-fallback[hidden] { display: none; }
.player-fallback p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
}
.fallback-btn {
  padding: 11px 22px;
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  box-shadow: 0 4px 16px var(--red-glow);
  transition: filter .15s, transform .1s;
  cursor: pointer;
}
.fallback-btn:hover { filter: brightness(1.15); }
.fallback-btn:active { transform: scale(.97); }

.server-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  background: rgba(214,40,40,.05);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: .3px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(34,197,94,.6);
  flex: 0 0 auto;
  animation: statusPulse 2s infinite;
}
.status-dot.err { background: var(--red); box-shadow: 0 0 8px rgba(214,40,40,.6); animation: none; }
@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}
.status-text { font-weight: 600; color: var(--text); }
.status-quality {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(34,197,94,.15);
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.modal-foot {
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  background: var(--bg-soft);
}
.notice { margin: 0; font-size: 12px; color: var(--text-dim); }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner {
  display: flex; flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  gap: 6px;
  padding: 22px 20px;
  padding-left: max(20px, env(safe-area-inset-left, 20px));
  padding-right: max(20px, env(safe-area-inset-right, 20px));
  padding-bottom: max(22px, env(safe-area-inset-bottom, 22px));
  font-size: 13px; color: var(--text-dim);
}
.footer-inner a { color: var(--red); font-weight: 600; }
@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ========= RESPONSIVE ========= */
@media (max-width: 980px) {
  .main-nav { display: none; }
  .search-wrap input { width: 180px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-mask { width: 260px; height: 260px; top: -40px; right: -40px; }
}

@media (max-width: 620px) {
  .header-inner { gap: 12px; }
  .brand-text { display: none; }
  .search-wrap input { width: 140px; font-size: 13px; }
  .hero { padding: 34px 0 22px; }
  .hero-mask { width: 180px; height: 180px; top: -30px; right: -30px; opacity: .10; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 32px; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: center; }
  .event-grid { grid-template-columns: 1fr; }
  .card-title { font-size: 20px; min-height: 46px; }
  .disclaimer-text { font-size: 11px; padding: 12px 16px; }

  .modal { padding: 0; align-items: stretch; }
  .modal-panel {
    border-radius: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-title { font-size: 20px; }
  .player-wrap { aspect-ratio: 16 / 9; flex: 0 0 auto; }
  .modal-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }

  .server-overlay {
    top: 8px;
    right: 8px;
    left: auto;
    max-width: calc(100% - 16px);
  }
  .server-toggle {
    height: 42px;
    padding: 0 14px;
    font-size: 13px;
    gap: 8px;
  }
  .server-toggle svg { width: 17px; height: 17px; }
  .server-count {
    min-width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .server-menu {
    min-width: 260px;
    max-width: calc(100vw - 32px);
    max-height: 55vh;
    max-height: 55dvh;
    padding: 8px;
    border-radius: 14px;
  }
  .server-btn {
    padding: 12px 14px;
    min-height: 58px;
    font-size: 14px;
    gap: 12px;
  }
  .server-logo {
    width: 36px;
    height: 36px;
    font-size: 15px;
    border-radius: 8px;
  }
  .server-name { font-size: 14px; }
  .server-desc { font-size: 11px; }
  .server-q { font-size: 10px; padding: 3px 7px; }

  .server-status { padding: 10px 14px; font-size: 11.5px; }
  .status-quality { font-size: 9.5px; }
}

@media (max-width: 420px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    row-gap: 8px;
  }
  .brand { order: 1; }
  .header-actions { order: 2; margin-left: auto; }
  .search-wrap { flex: 1 1 100%; order: 3; }
  .search-wrap input { width: 100%; min-width: 0; }
  .main-nav { display: none; }
  .server-menu { min-width: 220px; }
}

@media (max-width: 480px) {
  .event-grid { grid-template-columns: 1fr; }
}

@media (max-height: 640px) {
  .modal-panel { overflow-y: auto; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .modal-panel {
    max-height: 100vh;
    max-height: 100dvh;
  }
  .modal-head { padding: 8px 14px; }
  .modal-title { font-size: 18px; }
  .modal-meta { display: none; }
  .player-wrap {
    aspect-ratio: auto;
    height: calc(100vh - 130px);
    height: calc(100dvh - 130px);
    min-height: 240px;
  }
  .server-menu { max-height: 60vh; max-height: 60dvh; }
  .modal-foot { display: none; }
  .btn-close { width: 32px; height: 32px; }
  .server-status { padding: 8px 14px; }
}