﻿:root {
  --ink: #23384f;
  --ink-soft: #50697f;
  --line: #9eb5c7;
  --panel: rgba(238, 244, 250, 0.9);
  --panel-strong: rgba(228, 236, 246, 0.95);
  --accent: #3b7fc3;
  --accent-dark: #255d93;
  --danger: #a24956;
  --ok: #2b8760;
  --ds-blue-0: #0c2238;
  --ds-blue-1: #123553;
  --ds-blue-2: #245d8d;
  --ds-red-0: #4f1f2a;
  --ds-red-1: #6c2a38;
  --ds-gold: #c7963a;
  --ds-ink: #eaf5ff;
  --match-menu-bg-top: #d8e6f1;
  --match-menu-bg-bottom: #c7d9e9;
  --match-menu-panel: #e7eff7;
  --match-menu-panel-strong: #dce7f2;
  --match-menu-border: #96aec2;
  --match-menu-text: #2f5477;
  --match-menu-text-strong: #214668;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #d8e1ea;
  overflow: hidden;
}

.bg-wall {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(236, 242, 248, 0.74), rgba(228, 236, 244, 0.74)),
    url("assets/images/wallaper.webp") center top / cover no-repeat;
}

.site {
  position: relative;
  z-index: 1;
  padding: 8px;
  height: 100vh;
  max-width: 1760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  min-height: 50px;
  border: 1px solid #88a5be;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #bdd2e4 0%, #aac2d8 48%, #9fb7cf 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 4px 12px rgba(30, 64, 96, 0.2);
  display: grid;
  grid-template-columns: minmax(210px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 6px;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: -100% -16% auto;
  height: 220%;
  pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0.34) 16%, rgba(255, 255, 255, 0) 44%);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: rgba(112, 140, 166, 0.64);
}

.brand-wrap {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 1;
}

.brand {
  font-size: 1.52rem;
  font-weight: 800;
  color: #2f6ea5;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 12px rgba(56, 124, 185, 0.22);
  line-height: 1;
}

.brand-sub {
  align-self: center;
  margin-bottom: 1px;
  padding: 2px 6px 1px;
  border: 1px solid #8ca8c1;
  border-radius: 999px;
  background: rgba(238, 246, 252, 0.76);
  font-size: 0.66rem;
  font-weight: 700;
  color: #4d6f8d;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-center {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: end;
}

.top-window-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.top-window-controls .btn.small {
  margin-top: 0;
  width: auto;
  min-width: 126px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.top-window-controls .btn.small:not(.is-active) {
  border-color: #a9bfd2;
  background: linear-gradient(#edf4fa, #d8e5f1);
  color: #5b768f;
}

.top-window-controls .btn.is-active {
  border-color: #4f7ea7;
  background: linear-gradient(#ffffff, #e4f0fb);
  color: #275274;
}

.topnav {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 4px;
}

.topnav-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin-top: 0;
  min-width: 92px;
  padding: 6px 13px 5px;
  border: 1px solid #8ea8bf;
  border-bottom-color: #7f9ab1;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(#f9fdff, #dae9f6);
  color: #4b6882;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transition:
    transform 0.15s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease;
}

.topnav-pill::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4a8eca, #2f6aa0);
  opacity: 0;
  transform: scaleX(0.55);
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.topnav-pill:hover {
  transform: translateY(-1px);
  border-color: #7094b5;
  color: #2f587b;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 3px 8px rgba(47, 84, 118, 0.16);
}

.topnav-pill:hover::after {
  opacity: 0.86;
  transform: scaleX(1);
}

.topnav-pill.is-active {
  transform: translateY(1px);
  border-color: #6f91b0;
  border-bottom-color: #edf5fc;
  color: #23547c;
  background: linear-gradient(#ffffff, #eaf3fb);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 8px rgba(39, 75, 108, 0.12);
}

.topnav-pill.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.top-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #8eaec8;
  background: #eff6fc;
  object-fit: cover;
}

.account-badge {
  max-width: 170px;
  padding: 5px 8px;
  border: 1px solid #8faec7;
  border-radius: 7px;
  background: linear-gradient(#f9fcff, #e7f0f8);
  font-size: 0.8rem;
  color: #3f627f;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

#chooseNameBtn {
  margin-top: 0;
  min-width: 98px;
  border-radius: 7px;
  font-weight: 700;
}

.layout {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 300px;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.left-col,
.main-col,
.right-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.left-col > .panel,
.right-col > .panel {
  flex: 0 0 auto;
}

.panel {
  border: 1px solid #9fb8cb;
  border-radius: 10px;
  background: rgba(240, 247, 252, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 7px 15px rgba(32, 67, 98, 0.12);
  padding: 9px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.left-col .panel,
.right-col .panel {
  animation: menuReveal 0.42s ease both;
}

.left-col .panel:nth-of-type(1),
.right-col .panel:nth-of-type(1) {
  animation-delay: 0.03s;
}

.left-col .panel:nth-of-type(2),
.right-col .panel:nth-of-type(2) {
  animation-delay: 0.08s;
}

.left-col .panel:nth-of-type(3),
.right-col .panel:nth-of-type(3) {
  animation-delay: 0.13s;
}

.left-col .panel:nth-of-type(4),
.right-col .panel:nth-of-type(4) {
  animation-delay: 0.18s;
}

.left-col .panel {
  border-color: #6e93b3;
  border-radius: 16px;
  background: linear-gradient(
    176deg,
    rgba(44, 117, 177, 0.94) 0%,
    rgba(35, 100, 154, 0.93) 52%,
    rgba(27, 77, 124, 0.92) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 20px rgba(18, 47, 75, 0.2);
}

.left-col .panel:hover {
  transform: translateY(-2px);
  border-color: #93b6d4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 14px 24px rgba(17, 45, 72, 0.26);
}

.left-col .panel h2,
.left-col .panel h3 {
  color: #eff8ff;
  text-shadow: 0 1px 0 rgba(12, 37, 59, 0.45);
}

.left-col .panel label,
.left-col .panel .muted,
.left-col .panel .player-meta,
.left-col .panel .picked-meta,
.left-col .panel .auth-status {
  color: #cee4f6;
}

.left-col .panel input:not([type="checkbox"]),
.left-col .panel select,
.left-col .panel button {
  border-color: #89acc8;
  color: #2c5375;
  background: linear-gradient(#fbfeff, #e5f1fb);
}

.left-col .panel input:not([type="checkbox"])::placeholder {
  color: #6f90ac;
}

.right-col .panel {
  border-radius: 12px;
  background: rgba(244, 249, 253, 0.92);
}

/* Coherence pass: simplify menu visuals outside match. */
body:not(.match-page-active) .topbar {
  border: 1px solid #90aec7;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(199, 216, 231, 0.96), rgba(182, 203, 221, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 6px 14px rgba(28, 61, 91, 0.16);
  padding: 9px 12px;
}

body:not(.match-page-active) .topbar::before,
body:not(.match-page-active) .topbar::after {
  display: none;
}

body:not(.match-page-active) .brand {
  font-size: 1.44rem;
  color: #2a5f8a;
  text-shadow: none;
}

body:not(.match-page-active) .brand-sub {
  margin-bottom: 0;
  padding: 2px 7px;
  border-color: #9ab8d0;
  background: rgba(238, 246, 252, 0.92);
  color: #45657f;
}

body:not(.match-page-active) .topnav-pill {
  min-width: 100px;
  border: 1px solid #8faec7;
  border-bottom-color: #8faec7;
  border-radius: 8px;
  padding: 7px 11px;
  background: linear-gradient(#f4f9fd, #e2edf7);
  color: #355b7d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

body:not(.match-page-active) .topnav-pill::after {
  display: none;
}

body:not(.match-page-active) .topnav-pill:hover {
  transform: none;
  border-color: #7d9fbd;
  color: #2c5477;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(36, 72, 104, 0.14);
}

body:not(.match-page-active) .topnav-pill.is-active {
  transform: none;
  border-color: #7a9dbb;
  color: #214c6f;
  background: linear-gradient(#ffffff, #eaf3fb);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 2px 6px rgba(37, 73, 106, 0.14);
}

body:not(.match-page-active) .top-window-controls .btn.small {
  min-width: 136px;
  border-radius: 8px;
}

body:not(.match-page-active) .account-badge {
  border-color: #9ab7cd;
  border-radius: 8px;
  background: linear-gradient(#f7fbff, #e8f1f8);
  color: #365a78;
}

body:not(.match-page-active) #chooseNameBtn {
  min-width: 108px;
}

body:not(.match-page-active) .layout {
  gap: 10px;
}

body:not(.match-page-active) .left-col,
body:not(.match-page-active) .main-col,
body:not(.match-page-active) .right-col {
  gap: 10px;
}

body:not(.match-page-active) .panel {
  border: 1px solid #a7bfd1;
  border-radius: 12px;
  background: rgba(239, 247, 252, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 8px 16px rgba(28, 61, 90, 0.12);
  padding: 10px;
}

body:not(.match-page-active) .left-col .panel,
body:not(.match-page-active) .right-col .panel {
  animation: none;
  border-radius: 12px;
}

body:not(.match-page-active) .left-col .panel {
  border-color: #9fb8cb;
  background: rgba(237, 246, 252, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 8px 16px rgba(28, 61, 90, 0.12);
}

body:not(.match-page-active) .left-col .panel:hover {
  transform: none;
  border-color: #8eacc3;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 18px rgba(28, 61, 90, 0.14);
}

body:not(.match-page-active) .left-col .panel h2,
body:not(.match-page-active) .left-col .panel h3 {
  color: #2a5b84;
  text-shadow: none;
}

body:not(.match-page-active) .left-col .panel label,
body:not(.match-page-active) .left-col .panel .muted,
body:not(.match-page-active) .left-col .panel .player-meta,
body:not(.match-page-active) .left-col .panel .picked-meta,
body:not(.match-page-active) .left-col .panel .auth-status {
  color: #4f6d86;
}

body:not(.match-page-active) .left-col .panel input:not([type="checkbox"]),
body:not(.match-page-active) .left-col .panel select,
body:not(.match-page-active) .left-col .panel button {
  border-color: #a5bfd1;
  color: #2f5272;
  background: linear-gradient(#fdfefe, #ebf4fb);
}

body:not(.match-page-active) .left-col .panel input:not([type="checkbox"])::placeholder {
  color: #7491ab;
}

body:not(.match-page-active) #teamBuilderPanel::before {
  display: none;
}

body:not(.match-page-active) #onlinePanel {
  background: rgba(236, 246, 252, 0.95);
  border-color: #9fb8cb;
}

body:not(.match-page-active) #onlinePanel #startBtn {
  min-height: 46px;
  border-radius: 10px;
  border-color: #6f9f43;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 4px 10px rgba(22, 53, 80, 0.22);
}

body:not(.match-page-active) #onlineDetails,
body:not(.match-page-active) .strategy-panel details {
  border-color: #c2d5e4;
  background: rgba(249, 252, 255, 0.98);
}

body:not(.match-page-active) #onlineDetails summary,
body:not(.match-page-active) .strategy-panel summary {
  color: #365e81;
}

body:not(.match-page-active) .left-col #onlineDetails label,
body:not(.match-page-active) .left-col #onlineDetails .muted,
body:not(.match-page-active) .left-col .strategy-panel details label,
body:not(.match-page-active) .left-col .strategy-panel details .muted {
  color: #4f6f89;
}

@keyframes menuReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .left-col .panel,
  .right-col .panel {
    animation: none !important;
  }

  .panel,
  .btn,
  .topnav-pill {
    transition: none !important;
  }
}

.panel-pulse {
  animation: panelPulse 0.56s ease;
}

@keyframes panelPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 101, 152, 0);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(46, 101, 152, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 101, 152, 0);
  }
}

h2,
h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  color: #2f5f8f;
}

label,
.muted,
.player-meta,
.picked-meta,
.auth-status {
  font-size: 0.84rem;
  color: var(--ink-soft);
}

input,
select,
button {
  width: 100%;
  margin-top: 5px;
  border: 1px solid #a3bbce;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 0.92rem;
  color: var(--ink);
  background: #f7fbff;
}

input::placeholder {
  color: #7b94aa;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #3a7cb5;
  outline-offset: 1px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn {
  border-color: #89aac6;
  border-radius: 9px;
  font-weight: 700;
  background: linear-gradient(#f8fcff, #d9e8f5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 2px 5px rgba(30, 62, 92, 0.14);
  transition:
    transform 0.14s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 8px rgba(26, 56, 85, 0.2);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  filter: saturate(0.94);
  box-shadow:
    inset 0 1px 2px rgba(20, 46, 69, 0.2),
    0 2px 4px rgba(24, 52, 78, 0.16);
}

.btn.primary {
  font-weight: 800;
  color: #fff;
  border-color: #366b9d;
  background: linear-gradient(#4a8ac8, #2c648f);
}

.btn.small {
  width: auto;
  padding: 5px 9px;
  font-size: 0.86rem;
  border-radius: 7px;
}

.btn.danger {
  color: #fff;
  border-color: #884250;
  background: linear-gradient(#c96f7e, #9c4f5d);
}

.row-actions {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.row-actions .btn {
  font-weight: 700;
}

.panel-inline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.panel-inline-head h3 {
  margin: 0;
}

#teamBuilderPanel {
  position: relative;
  overflow: hidden;
}

#teamBuilderPanel::before {
  content: "";
  position: absolute;
  inset: -28% auto auto -20%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(164, 208, 241, 0.2), rgba(164, 208, 241, 0));
  pointer-events: none;
}

#teamBuilderPanel > * {
  position: relative;
  z-index: 1;
}

#playerFilterPanel h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.emblem-inline {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 6px;
  align-items: center;
}

.emblem-preview {
  width: 42px;
  height: 42px;
  border: 1px solid #b8cad9;
  border-radius: 4px;
  object-fit: cover;
  background: #f2f7fc;
}

.online-matchbox {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(203, 224, 241, 0.6);
  display: grid;
  gap: 6px;
}

#onlinePanel {
  display: grid;
  gap: 6px;
  background: linear-gradient(
    166deg,
    rgba(29, 103, 162, 0.96) 0%,
    rgba(27, 87, 141, 0.95) 54%,
    rgba(20, 68, 111, 0.94) 100%
  );
  border-color: #5d85a8;
}

#onlinePanel #startBtn {
  margin-top: 1px;
  min-height: 50px;
  border-radius: 12px;
  border-color: #6a973a;
  color: #f6ffe6;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(#c6e07f, #7faf3f);
  text-shadow: 0 1px 0 rgba(59, 89, 22, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 6px 12px rgba(14, 40, 66, 0.32);
}

#onlinePanel #startBtn:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 8px 14px rgba(12, 36, 58, 0.36);
}

#onlinePanel > .btn {
  margin-top: 0;
}

#onlineDetails {
  border: 1px solid #90b2ce;
  border-radius: 10px;
  background: rgba(240, 248, 255, 0.92);
  padding: 6px;
}

#onlineDetails summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 0.84rem;
  font-weight: 700;
  color: #2f5d84;
}

#onlineDetails summary::before {
  content: "\25B8";
  font-size: 0.72rem;
  color: #49739a;
  transition: transform 0.16s ease;
}

#onlineDetails summary::-webkit-details-marker {
  display: none;
}

#onlineDetails[open] summary::before {
  transform: rotate(90deg);
}

#onlineDetails .online-matchbox {
  margin-top: 6px;
  padding-top: 0;
  border-top: 0;
}

.left-col #onlineDetails label,
.left-col #onlineDetails .muted,
.left-col .strategy-panel details label,
.left-col .strategy-panel details .muted {
  color: #3a6284;
}

.online-match-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.online-match-actions .btn {
  margin-top: 0;
}

.btn.ranked {
  color: #fff8e2;
  border-color: #876722;
  background: linear-gradient(#c2943f, #886628);
}

.online-join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.online-join-row input,
.online-join-row button {
  margin-top: 0;
}

.online-code {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: #315979;
}

.online-code strong {
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.08em;
}

.online-code .btn.small {
  margin-top: 0;
}

.strategy-panel {
  display: grid;
  gap: 6px;
}

.strategy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.strategy-head h2 {
  margin: 0;
}

.strategy-panel details {
  border: 1px solid #90b2ce;
  border-radius: 10px;
  background: rgba(240, 248, 255, 0.92);
  padding: 6px;
}

.strategy-panel summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: #2f5d84;
  list-style: none;
}

.strategy-panel summary::before {
  content: "\25B8";
  font-size: 0.72rem;
  color: #49739a;
  transition: transform 0.16s ease;
}

.strategy-panel summary::-webkit-details-marker {
  display: none;
}

.strategy-panel details[open] summary::before {
  transform: rotate(90deg);
}

.strategy-grid {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}

.strategy-grid > div {
  display: grid;
  gap: 4px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.check-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
  padding: 0;
}

.custom-formation {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.custom-formation .small-label {
  margin-top: 0;
  font-size: 0.72rem;
}

.custom-formation input {
  margin-top: 0;
  text-align: center;
}

#customFormationHint {
  grid-column: 1 / -1;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.picked-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 190px;
  overflow: auto;
}

.picked-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #d3dde7;
  padding: 5px 0;
}

.picked-remove {
  width: auto;
  margin: 0;
  padding: 2px 8px;
  border: 1px solid #b77683;
  background: #d9aab3;
}

.players-panel {
  min-height: 320px;
}

.players-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.team-visual-panel {
  padding-bottom: 10px;
}

.team-pitch-board {
  position: relative;
  min-height: clamp(360px, 52vh, 520px);
  border: 2px solid #d7e6d1;
  border-radius: 4px;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.07)),
    repeating-linear-gradient(
      to bottom,
      #3f9e3b 0px,
      #3f9e3b 56px,
      #379437 56px,
      #379437 112px
    );
  overflow: hidden;
}

.team-pitch-board::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent 8%, #e7f0df 8%, #e7f0df 9%, transparent 9%, transparent 91%, #e7f0df 91%, #e7f0df 92%, transparent 92%),
    linear-gradient(to bottom, transparent 49.5%, #e7f0df 49.5%, #e7f0df 50.5%, transparent 50.5%);
}

.team-pitch-board::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  border: 3px solid #e7f0df;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.team-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 84px;
  min-height: 82px;
  border: 2px solid #f0d861;
  border-radius: 6px;
  background: rgba(245, 251, 240, 0.92);
  text-align: center;
  padding: 3px 4px 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.slot-info-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid #6d8fae;
  border-radius: 999px;
  background: linear-gradient(#f9fcff, #dbe9f5);
  color: #29577f;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}

.slot-info-btn:hover {
  border-color: #4573a0;
  background: linear-gradient(#ffffff, #d0e5f8);
}

.slot-info-btn:focus-visible {
  outline: 2px solid rgba(58, 112, 164, 0.38);
  outline-offset: 1px;
}

.team-slot.filled {
  cursor: pointer;
}

.team-slot.empty {
  border-style: dashed;
  border-color: rgba(236, 240, 226, 0.8);
  background: rgba(248, 251, 245, 0.22);
}

.team-slot:hover,
.bench-card:hover {
  outline: 1px solid rgba(248, 253, 210, 0.8);
}

.team-slot.empty .slot-name {
  color: rgba(244, 250, 236, 0.9);
}

.team-slot > img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #c8d7c0;
  background: #f6f8f4;
}

.slot-role {
  margin-top: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #204d79;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.slot-element-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(34, 69, 103, 0.35);
  object-fit: cover;
  background: #eff5fa;
}

.slot-name {
  margin-top: 2px;
  font-size: 0.69rem;
  color: #425d77;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bench-head {
  margin-top: 8px;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.bench-head h3 {
  margin: 0;
  font-size: 1rem;
}

.bench-visual {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.bench-card {
  position: relative;
  border: 1px solid #c2d4e2;
  border-radius: 4px;
  background: #f7fbff;
  padding: 5px;
  text-align: center;
  min-height: 84px;
}

.bench-card.filled {
  cursor: pointer;
}

.bench-card.empty {
  border-style: dashed;
  background: #f4f7fa;
}

.bench-card > img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #c7d4e3;
  background: #eef4f9;
}

.bench-name-row {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bench-name {
  margin-top: 0;
  font-size: 0.72rem;
  color: #48637c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bench-element-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(42, 77, 111, 0.35);
  object-fit: cover;
  background: #f0f6fb;
}

.players-list {
  max-height: min(420px, 44vh);
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
  align-items: start;
}

.roster-panel {
  display: grid;
  gap: 6px;
}

.roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.roster-head h2 {
  margin: 0;
}

.roster-head .btn.small {
  margin-top: 0;
}

.roster-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.roster-chip {
  border: 1px solid #c3d4e3;
  border-radius: 8px;
  background: #f7fbff;
  padding: 6px 7px;
  display: grid;
  gap: 1px;
}

.roster-chip strong {
  font-size: 1.02rem;
  color: #2a5379;
  line-height: 1;
}

.roster-chip span {
  font-size: 0.74rem;
  color: #5b7892;
}

.roster-details {
  border-top: 1px solid #d0deea;
  padding-top: 6px;
}

.roster-split > div {
  min-width: 0;
}

.roster-split h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.ladder-panel {
  display: grid;
  gap: 7px;
  min-height: 0;
}

.ladder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ladder-head .btn.small {
  margin-top: 0;
}

.ladder-my-card {
  border: 1px solid #b6ccde;
  border-radius: 10px;
  background: linear-gradient(#fbfeff, #edf5fc);
  padding: 7px;
  color: #456784;
  font-size: 0.8rem;
  line-height: 1.25;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.ladder-my-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 700;
  color: #2a547a;
}

.ladder-my-title strong {
  font-size: 1.08rem;
  color: #214f79;
}

.ladder-my-meta {
  margin-top: 2px;
  color: #557691;
  font-size: 0.75rem;
}

.ladder-list {
  border: 1px solid #b9d0e2;
  border-radius: 10px;
  background: linear-gradient(#fbfeff, #f3f9ff);
  min-height: 220px;
  max-height: calc(100vh - 430px);
  overflow: auto;
}

.news-panel {
  padding-top: 10px;
}

.news-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.news-head h2 {
  margin: 0;
}

.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.news-item {
  border: 1px solid #c1d4e4;
  border-radius: 10px;
  background: rgba(249, 252, 255, 0.96);
  padding: 8px 9px;
  display: grid;
  gap: 4px;
}

.news-item time {
  font-size: 0.74rem;
  font-weight: 700;
  color: #3e6689;
  letter-spacing: 0.02em;
}

.news-item p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
  color: #355676;
}

.ladder-empty {
  padding: 10px;
  color: #5a7891;
  font-size: 0.82rem;
}

.ladder-entry {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid #dee8f1;
  transition: background 0.16s ease, transform 0.16s ease;
}

.ladder-entry:hover {
  background: rgba(74, 136, 196, 0.08);
  transform: translateX(2px);
}

.ladder-entry:last-child {
  border-bottom: 0;
}

.ladder-entry.me {
  background: rgba(59, 127, 195, 0.11);
}

.ladder-rank {
  font-weight: 800;
  color: #315a7d;
  font-size: 0.84rem;
  text-align: center;
}

.ladder-player {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ladder-avatar {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid #a7bfd5;
  object-fit: cover;
  background: #e9f1f8;
}

.ladder-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  color: #2f5577;
}

.ladder-player-text {
  min-width: 0;
}

.ladder-sub {
  font-size: 0.68rem;
  color: #6784a0;
}

.ladder-points {
  font-weight: 800;
  font-size: 0.86rem;
  color: #214f79;
}

.player-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #c3d3e1;
  border-radius: 4px;
  background: #f5f9fd;
  padding: 7px;
  cursor: grab;
}

.player-name-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  color: #2f5577;
}

.player-element-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(55, 92, 127, 0.32);
  object-fit: cover;
  background: #edf3fa;
}

.player-card:active {
  cursor: grabbing;
}

.player-actions {
  display: flex;
  gap: 5px;
}

.player-actions button {
  width: auto;
  margin: 0;
  padding: 4px 9px;
  font-size: 0.8rem;
}

.match-panel {
  background: var(--panel-strong);
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.match-viewport {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 4px 0;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-weight: 700;
  color: #355a7b;
}

.duel-hud-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

.duel-hud-center {
  font-size: 0.75rem;
  font-weight: 800;
  color: #315a7d;
  white-space: nowrap;
}

.duel-hud-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid #b7c9da;
  border-radius: 7px;
  background: rgba(247, 251, 255, 0.92);
  padding: 4px 6px;
  min-width: 0;
}

.duel-hud-card.team-red {
  border-color: #cfb3b3;
  background: rgba(255, 249, 249, 0.96);
}

.duel-hud-card-right {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.duel-hud-card-right .duel-hud-meta {
  text-align: right;
}

.duel-hud-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #7ea1bf;
  object-fit: cover;
  background: #e8f0f8;
}

.duel-hud-card.team-red .duel-hud-avatar {
  border-color: #bf8a8a;
}

.duel-hud-meta {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.duel-hud-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #234b70;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-hud-role {
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  color: #5c7d98;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-hud-resource-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 3px;
  align-items: center;
}

.duel-hud-resource-label {
  font-size: 0.5rem;
  font-weight: 700;
  color: #6c8aa2;
}

.duel-hud-meter {
  height: 4px;
  border-radius: 999px;
  background: rgba(19, 35, 52, 0.24);
  overflow: hidden;
}

.duel-hud-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: #2f9be6;
}

.duel-hud-meter.fp i {
  background: #41c46d;
}

.duel-hud-resource-value {
  font-size: 0.5rem;
  font-weight: 700;
  color: #4f6f8b;
  white-space: nowrap;
}

.duel-hud-adv {
  margin-top: 1px;
  font-size: 0.55rem;
  font-weight: 800;
  color: #315a7d;
  letter-spacing: 0.03em;
}

.hud-team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hud-team-right {
  justify-content: flex-end;
}

.hud-emblem {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid #aec4d7;
  background: #edf4fa;
  object-fit: cover;
}

.hud-team-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hud-team-meta span {
  font-size: 0.8rem;
  font-weight: 600;
  color: #4a6781;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.hud-team-meta strong {
  font-size: 1.22rem;
  line-height: 1;
  color: #254e74;
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 150px;
}

.hud-center #timeLabel {
  font-size: 1.05rem;
}

.hud-center #statusLabel {
  font-size: 0.8rem;
  color: #4a6781;
  font-weight: 600;
}

.match-exit-btn {
  margin-top: 4px;
}

#pitch {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #b4c7d8;
  border-radius: 4px;
  background: #0d6c3f;
}

body.match-page-active {
  overflow: hidden;
}

body.match-page-active .topbar,
body.match-page-active .left-col,
body.match-page-active .right-col,
body.match-page-active .site-footer,
body.match-page-active .team-visual-panel,
body.match-page-active .players-panel {
  display: none !important;
}

body.match-page-active .site {
  padding: 0;
}

body.match-page-active .layout {
  margin-top: 0;
  grid-template-columns: 1fr;
  gap: 0;
}

body.match-page-active .main-col {
  min-height: 100vh;
  gap: 0;
}

body.match-page-active .match-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  border: 0;
  border-radius: 0;
  padding: clamp(8px, 1.2vw, 14px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(6px, 1vh, 12px);
  background:
    linear-gradient(180deg, rgba(216, 230, 241, 0.93), rgba(199, 217, 233, 0.95)),
    url("assets/images/wallaper.webp") center top / cover no-repeat;
  font-family: Verdana, "Trebuchet MS", "Segoe UI", sans-serif;
}

body.match-page-active .hud {
  grid-template-columns: minmax(0, 1fr) minmax(210px, auto) minmax(0, 1fr);
  gap: clamp(8px, 1.2vw, 14px);
  align-items: stretch;
  margin-bottom: 0;
}

body.match-page-active .hud-team {
  min-height: clamp(52px, 7vh, 64px);
  padding: 4px clamp(7px, 1vw, 12px);
  border: 2px solid var(--match-menu-border);
  border-radius: 10px;
  background: var(--match-menu-panel);
}

body.match-page-active .hud-emblem {
  width: 30px;
  height: 30px;
  border: 2px solid #8ea9c0;
  background: #f4f8fc;
}

body.match-page-active .hud-team-right {
  border-color: var(--match-menu-border);
  background: var(--match-menu-panel);
}

body.match-page-active .hud-team-right .hud-emblem {
  border-color: #8ea9c0;
  background: #f4f8fc;
}

body.match-page-active .hud-team-meta span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--match-menu-text);
}

body.match-page-active .hud-team-meta strong {
  font-size: clamp(1.45rem, 2.7vw, 2rem);
  color: var(--match-menu-text-strong);
}

body.match-page-active .hud-team-right .hud-team-meta span {
  color: var(--match-menu-text);
}

body.match-page-active .hud-team-right .hud-team-meta strong {
  color: var(--match-menu-text-strong);
}

body.match-page-active .hud-center {
  min-width: clamp(180px, 25vw, 290px);
  gap: 4px;
}

body.match-page-active .hud-center #timeLabel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(124px, 14vw, 168px);
  padding: 3px 10px;
  margin-top: 0;
  border: 2px solid #5f7891;
  border-radius: 6px;
  background: #f2f7fc;
  color: #2a4f71;
  font-size: clamp(0.88rem, 1.8vw, 1.04rem);
  letter-spacing: 0.06em;
  font-weight: 700;
}

body.match-page-active .hud-center #statusLabel {
  font-size: 0.84rem;
  font-weight: 700;
  color: #3d6384;
  display: none;
}

body.match-page-active .match-exit-btn {
  margin-top: 2px;
  width: auto;
  border: 1px solid #93acc0;
  background: #e5eff8;
  color: #355a7a;
  align-self: center;
}

body.match-page-active .match-viewport {
  padding: 0;
  min-height: 0;
}

body.match-page-active #pitch {
  width: min(1180px, 100%);
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 3px solid #d9ead2;
  border-radius: 6px;
  background: #0d6c3f;
}

/* Keep duel infos inside the match column to avoid overlap with the pitch across PC sizes. */
body.match-page-active .duel-hud-strip {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  z-index: 24;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(8px, 1.2vw, 14px);
  pointer-events: none;
  width: min(1320px, 100%);
  justify-self: center;
}

body.match-page-active .duel-hud-center {
  display: none;
}

body.match-page-active .duel-hud-card {
  width: min(100%, 460px);
  min-width: 0;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 2px solid #8fa8bc;
  background: rgba(229, 239, 248, 0.97);
  box-shadow: none;
  justify-self: start;
}

body.match-page-active .duel-hud-card.duel-hud-card-right {
  justify-self: end;
}

body.match-page-active .duel-hud-card.team-red {
  border-color: #8fa8bc;
  background: rgba(229, 239, 248, 0.97);
}

body.match-page-active .duel-hud-avatar {
  width: 22px;
  height: 22px;
  border-width: 1px;
}

body.match-page-active .duel-hud-name {
  font-size: 0.64rem;
  color: #244b6d;
}

body.match-page-active .duel-hud-card.team-red .duel-hud-name {
  color: #244b6d;
}

body.match-page-active .duel-hud-role {
  font-size: 0.5rem;
  color: #5a7995;
}

body.match-page-active .duel-hud-card.team-red .duel-hud-role {
  color: #5a7995;
}

body.match-page-active .duel-hud-resource-label {
  color: #5d7d9a;
}

body.match-page-active .duel-hud-card.team-red .duel-hud-resource-label {
  color: #5d7d9a;
}

body.match-page-active .duel-hud-meter {
  background: rgba(26, 47, 69, 0.18);
}

body.match-page-active .duel-hud-meter i {
  background: #2f9be6;
}

body.match-page-active .duel-hud-meter.fp i {
  background: #3dcc73;
}

body.match-page-active .duel-hud-resource-value {
  font-size: 0.51rem;
  color: #365c7d;
}

body.match-page-active .duel-hud-card.team-red .duel-hud-resource-value {
  color: #365c7d;
}

body.match-page-active .duel-hud-adv {
  margin-top: 1px;
  font-size: 0.56rem;
  color: #557797;
}

body.match-page-active .duel-hud-card.team-red .duel-hud-adv {
  color: #557797;
}

.duel-cinematic-layer {
  position: absolute;
  inset: 0;
  z-index: 27;
  pointer-events: none;
  overflow: hidden;
}

.duel-cine-score {
  position: absolute;
  top: 88px;
  min-width: 88px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 2px solid rgba(151, 185, 213, 0.95);
  background: rgba(12, 38, 62, 0.84);
  color: #f6fbff;
  text-align: center;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.duel-cine-score-left {
  left: clamp(16px, 12vw, 200px);
}

.duel-cine-score-right {
  right: clamp(16px, 12vw, 200px);
}

.duel-cine-score.locked {
  border-color: #f7d675;
  color: #ffe894;
  animation: duel-score-lock 0.24s ease-out both;
}

@keyframes duel-score-lock {
  from {
    transform: scale(1.15);
    filter: brightness(1.22);
  }
  to {
    transform: scale(1);
    filter: brightness(1);
  }
}

.duel-cine-tech {
  position: absolute;
  top: 53%;
  max-width: 38%;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.1rem, 2.8vw, 2.2rem);
  font-style: italic;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff5b2;
  text-shadow:
    0 2px 0 #1b1b1b,
    0 0 14px rgba(255, 230, 120, 0.25);
  opacity: 0;
  transition:
    transform 170ms ease-out,
    opacity 140ms linear,
    filter 170ms ease-out;
}

.duel-cine-tech-left {
  left: 50%;
  text-align: right;
  transform: translate(-138%, -50%) scale(0.94);
}

.duel-cine-tech-right {
  left: 50%;
  text-align: left;
  transform: translate(38%, -50%) scale(0.94);
}

.duel-cinematic-layer.tech-shown .duel-cine-tech {
  opacity: 1;
}

.duel-cinematic-layer.impact .duel-cine-tech-left {
  transform: translate(-92%, -50%) scale(1.02);
}

.duel-cinematic-layer.impact .duel-cine-tech-right {
  transform: translate(-8%, -50%) scale(1.02);
}

.duel-cinematic-layer.winner-left .duel-cine-tech-left {
  transform: translate(-106%, -50%) scale(1.1);
}

.duel-cinematic-layer.winner-left .duel-cine-tech-right {
  transform: translate(56%, -50%) scale(0.86);
  opacity: 0.42;
  filter: saturate(0.6);
}

.duel-cinematic-layer.winner-right .duel-cine-tech-right {
  transform: translate(6%, -50%) scale(1.1);
}

.duel-cinematic-layer.winner-right .duel-cine-tech-left {
  transform: translate(-156%, -50%) scale(0.86);
  opacity: 0.42;
  filter: saturate(0.6);
}

.duel-cinematic-layer.winner-focus .duel-cine-tech {
  opacity: 0;
}

.duel-cinematic-layer.winner-focus .duel-cine-score {
  opacity: 0.22;
}

.duel-cine-clash {
  position: absolute;
  left: 50%;
  top: 53%;
  max-width: 66%;
  transform: translate(-50%, -50%) scale(0.82);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(1.2rem, 3.2vw, 2.6rem);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffeb87;
  text-shadow:
    0 2px 0 #121212,
    0 0 16px rgba(255, 217, 87, 0.34);
  opacity: 0;
  transition:
    opacity 120ms linear,
    transform 170ms ease-out;
}

.duel-cinematic-layer.winner-left .duel-cine-clash,
.duel-cinematic-layer.winner-right .duel-cine-clash {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.duel-cinematic-layer.winner-focus .duel-cine-clash {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
}

.setpiece-overlay,
.match-stats-overlay {
  position: absolute;
  inset: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 30, 44, 0.36);
}

.setpiece-overlay {
  pointer-events: none;
  align-items: flex-start;
  padding-top: clamp(10px, 2.4vh, 24px);
  background: transparent;
}

.match-stats-overlay {
  pointer-events: auto;
}

.setpiece-box,
.match-stats-box {
  pointer-events: auto;
  width: min(720px, calc(100vw - 26px));
  border: 2px solid #88a7c0;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef5fb, #dce9f4);
  color: #22425f;
  box-shadow: 0 16px 34px rgba(3, 14, 24, 0.28);
  padding: 14px 14px 12px;
}

.setpiece-box {
  width: min(620px, calc(100vw - 22px));
  background: rgba(238, 245, 251, 0.93);
  box-shadow: 0 10px 24px rgba(9, 24, 38, 0.22);
}

.tech-video-overlay {
  position: absolute;
  inset: 0;
  z-index: 33;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 30, 44, 0.58);
  pointer-events: auto;
}

.tech-video-box {
  width: min(860px, calc(100vw - 24px));
  border: 2px solid #88a7c0;
  border-radius: 12px;
  background: linear-gradient(180deg, #eef5fb, #dce9f4);
  color: #22425f;
  box-shadow: 0 16px 34px rgba(3, 14, 24, 0.32);
  padding: 12px;
}

.tech-video-head h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  color: #21445f;
}

.tech-video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid #93adc3;
  border-radius: 10px;
  background: #0d1f30;
}

.tech-video-ready {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 8px;
}

.tech-video-ready span {
  border: 1px solid #a4bfd4;
  border-radius: 8px;
  background: rgba(243, 248, 253, 0.92);
  font-size: 0.84rem;
  font-weight: 700;
  color: #3c6487;
  padding: 6px 8px;
  text-align: center;
}

.setpiece-head,
.match-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.setpiece-head h3,
.match-stats-head h3 {
  margin: 0;
  font-size: 1.08rem;
  color: #21445f;
}

#setPieceTimer,
#matchStatsTimer {
  min-width: 62px;
  text-align: center;
  border: 1px solid #7d9ab3;
  border-radius: 6px;
  background: #f6fbff;
  color: #315a7d;
  font-weight: 700;
  padding: 4px 8px;
}

.setpiece-ready,
.match-stats-ready {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.setpiece-ready span,
.match-stats-ready span {
  border: 1px solid #a4bfd4;
  border-radius: 8px;
  background: rgba(243, 248, 253, 0.92);
  font-size: 0.84rem;
  font-weight: 700;
  color: #3c6487;
  padding: 6px 8px;
  text-align: center;
}

.match-stats-table {
  display: grid;
  gap: 7px;
  margin: 8px 0;
}

.match-stats-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) minmax(110px, auto) minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #afc6da;
  border-radius: 8px;
  background: rgba(246, 251, 255, 0.95);
  padding: 7px 9px;
}

.match-stats-row span {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #3c6687;
}

.match-stats-row strong {
  font-size: 0.96rem;
  color: #214866;
}

.match-stats-row strong:first-child {
  text-align: left;
}

.match-stats-row strong:last-child {
  text-align: right;
}

#setPieceReadyBtn,
#matchStatsContinueBtn,
#techVideoSkipBtn {
  margin-top: 4px;
  width: min(240px, 100%);
}

.match-stats-overlay.final #matchStatsTimer,
.match-stats-overlay.final .match-stats-ready {
  display: none;
}

body.match-page-active .duel-overlay .duel-box h3,
body.match-page-active .duel-overlay .duel-subtitle,
body.match-page-active .duel-overlay .duel-actors,
body.match-page-active .duel-overlay .duel-help {
  display: none;
}

body.match-page-active .duel-overlay .duel-box {
  width: min(900px, calc(100vw - 14px));
  border: 2px solid #8ea8be;
  border-radius: 10px;
  background: var(--match-menu-panel);
  padding: 5px 7px 7px;
}

body.match-page-active #duelText {
  margin: 0 0 5px;
  font-size: 0.86rem;
  color: #2f5678;
  font-weight: 700;
  text-align: center;
}

body.match-page-active .duel-actions button {
  min-height: 38px;
  border: 2px solid #86a6c4;
  border-radius: 8px;
  background: linear-gradient(#f8fcff, #dbe8f4);
  color: #35597a;
  font-weight: 700;
  box-shadow: none;
  font-size: 0.8rem;
}

body.match-page-active .duel-actions button:hover {
  border-color: #7398bf;
  background: linear-gradient(#ffffff, #d5e5f3);
}

body.match-page-active .duel-actions button:active {
  background: linear-gradient(#d7e6f3, #f7fbff);
  color: #35597a;
}

body.match-page-active .duel-actions button[data-choice="tech"] {
  border-color: #7a9cbc;
  background: linear-gradient(#eef6fc, #d4e5f3);
  color: #2f5678;
}

body.match-page-active .duel-key {
  border-color: rgba(142, 170, 196, 0.8);
  background: rgba(233, 242, 250, 0.78);
  color: #315474;
}

body.match-page-active .duel-cine-score {
  top: clamp(108px, 17vh, 176px);
}

/* Wider desktops: keep the same non-overlap layout, only upscale details. */
@media (min-width: 1320px) and (min-height: 700px) {
  body.match-page-active .duel-hud-strip {
    width: min(1460px, 100%);
    gap: clamp(12px, 1.6vw, 24px);
    display: grid;
  }

  body.match-page-active .duel-hud-card {
    position: relative;
    width: min(100%, 500px);
    min-height: 48px;
    padding: 6px 8px;
    border-radius: 10px;
    box-shadow: none;
  }

  body.match-page-active #duelHudLeft {
    left: auto;
    top: auto;
    transform: none;
  }

  body.match-page-active #duelHudRight {
    right: auto;
    top: auto;
    transform: none;
  }

  body.match-page-active .duel-hud-avatar {
    width: 30px;
    height: 30px;
  }

  body.match-page-active .duel-hud-name {
    font-size: 0.7rem;
  }

  body.match-page-active .duel-hud-role {
    font-size: 0.53rem;
  }

  body.match-page-active .duel-hud-resource-value {
    font-size: 0.58rem;
  }

  body.match-page-active .duel-hud-adv {
    font-size: 0.62rem;
  }
}

@media (max-width: 980px) {
  .duel-cine-score {
    top: 66px;
    min-width: 70px;
    padding: 3px 6px;
    font-size: 1rem;
  }

  .duel-cine-tech {
    top: 56%;
    max-width: 42%;
    font-size: clamp(0.96rem, 4.2vw, 1.6rem);
  }

  .duel-cine-clash {
    top: 56%;
    max-width: 74%;
    font-size: clamp(1.04rem, 4.8vw, 1.85rem);
  }

  .setpiece-box,
  .match-stats-box {
    width: min(680px, calc(100vw - 16px));
    padding: 10px 10px 9px;
  }

  .setpiece-box {
    width: min(560px, calc(100vw - 14px));
  }

  .setpiece-head h3,
  .match-stats-head h3 {
    font-size: 0.96rem;
  }

  .setpiece-ready span,
  .match-stats-ready span,
  .match-stats-row span,
  .match-stats-row strong {
    font-size: 0.75rem;
  }

  .tech-video-box {
    width: min(700px, calc(100vw - 16px));
    padding: 10px;
  }

  .tech-video-head h3 {
    font-size: 0.96rem;
  }

  .tech-video-ready span {
    font-size: 0.75rem;
  }
}

.site-footer {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#d8e6f1, #c7d9e9);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.footer-copy {
  font-size: 0.82rem;
  font-weight: 700;
  color: #476581;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 6px;
}

.social-btn {
  width: auto;
  margin-top: 0;
  text-decoration: none;
  border: 1px solid #abc0d2;
  border-radius: 999px;
  background: linear-gradient(#f8fcff, #dbe8f4);
  color: #2f5577;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
}

.social-btn img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

.duel-overlay,
.auth-overlay,
.picker-overlay,
.player-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 49, 70, 0.44);
}

.auth-overlay,
.picker-overlay,
.player-info-overlay {
  background: rgba(18, 37, 55, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.duel-overlay {
  inset: auto 0 0;
  z-index: 38;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: transparent;
}

.duel-overlay .duel-box {
  pointer-events: auto;
}

.duel-overlay.hidden,
.auth-overlay.hidden,
.picker-overlay.hidden,
.player-info-overlay.hidden {
  display: none;
}

.auth-overlay:not(.hidden) .auth-box,
.picker-overlay:not(.hidden) .picker-box,
.player-info-overlay:not(.hidden) .player-info-box,
.asset-overlay:not(.hidden) .asset-box {
  animation: popupIn 0.17s ease-out;
}

@keyframes popupIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.duel-box,
.auth-box,
.picker-box,
.player-info-box {
  width: min(420px, calc(100vw - 22px));
  border: 1px solid #a8bfd2;
  border-radius: 4px;
  background: #eff5fb;
  padding: 10px;
}

.auth-box,
.picker-box,
.player-info-box,
.asset-box {
  border: 1px solid #b4c9da;
  border-radius: 12px;
  background: linear-gradient(#f6fbff, #ebf3fa);
  box-shadow:
    0 14px 30px rgba(14, 33, 51, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  padding: 12px;
}

.player-info-box {
  width: min(720px, calc(100vw - 22px));
  max-height: min(86vh, 760px);
  overflow: auto;
}

.player-info-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.player-info-head h3 {
  margin: 0;
}

.player-info-main {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.player-info-avatar {
  width: 86px;
  height: 86px;
  border: 1px solid #b7cadb;
  border-radius: 8px;
  object-fit: cover;
  background: #f1f7fc;
}

.player-info-main-text {
  display: grid;
  gap: 5px;
}

.player-info-main-text p {
  margin: 0;
}

#playerInfoMeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.player-info-meta-badge {
  min-height: 22px;
  border: 1px solid #b8cede;
  border-radius: 999px;
  background: #f8fcff;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  color: #355676;
  line-height: 1;
}

.player-info-meta-role-icon,
.player-info-meta-element-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 16px;
}

.player-info-meta-element-icon {
  border-radius: 50%;
  border: 1px solid rgba(39, 72, 103, 0.3);
  background: #edf5fc;
}

.player-info-description {
  font-size: 0.87rem;
  color: #365472;
  line-height: 1.35;
  padding: 6px 7px;
  border: 1px solid #cadae8;
  border-radius: 8px;
  background: rgba(248, 252, 255, 0.9);
}

.player-info-stats {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  padding: 7px;
  border: 1px solid #c7d9e8;
  border-radius: 10px;
  background: rgba(248, 252, 255, 0.9);
}

.player-info-stat {
  border: 1px solid #c2d4e3;
  border-radius: 6px;
  background: #f9fcff;
  padding: 5px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.player-info-stat-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.player-info-stat-label {
  font-size: 0.7rem;
  color: #496984;
  letter-spacing: 0.03em;
}

.player-info-stat-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex: 0 0 14px;
}

.player-info-stat-icon-tp {
  width: 15px;
  height: 15px;
  flex-basis: 15px;
}

.player-info-stat strong {
  font-size: 0.9rem;
  color: #173a5a;
}

.player-info-tech-wrap {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #ceddec;
}

.player-info-tech-wrap h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #315f89;
}

.player-info-tech-list {
  display: grid;
  gap: 6px;
  max-height: min(40vh, 320px);
  overflow: auto;
  padding: 7px;
  border: 1px solid #c7d9e8;
  border-radius: 10px;
  background: rgba(248, 252, 255, 0.92);
}

.player-info-tech-item {
  border: 1px solid #bed1e3;
  border-radius: 6px;
  background: #f7fbff;
  padding: 5px 7px;
}

.player-info-tech-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: #214f79;
  font-weight: 700;
}

.player-info-tech-type-icon,
.player-info-tech-element-icon,
.player-info-tp-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex: 0 0 15px;
}

.player-info-tech-element-icon {
  border-radius: 50%;
  border: 1px solid rgba(39, 72, 103, 0.35);
  background: #edf5fc;
}

.player-info-tech-tag {
  font-size: 0.68rem;
  color: #3d6384;
  border: 1px solid #b7cce0;
  border-radius: 999px;
  padding: 0 5px;
  line-height: 1.45;
}

.player-info-tech-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 0.76rem;
  color: #527190;
}

.player-info-tech-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #bdd2e5;
  border-radius: 999px;
  background: #eef6ff;
  padding: 1px 6px 1px 5px;
  line-height: 1;
}

.player-info-tech-cost strong {
  font-size: 0.78rem;
  color: #1f476a;
}

.auth-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.profile-inline {
  margin: 6px 0 8px;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 7px;
  align-items: center;
}

.profile-preview {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid #b9ccdc;
  object-fit: cover;
  background: #f1f6fb;
}

.code-block {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #cbdae8;
}

.auth-status {
  min-height: 18px;
  margin: 8px 0;
}

.auth-status.ok {
  color: var(--ok);
}

.auth-status.err {
  color: var(--danger);
}

.duel-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}

.duel-box {
  width: min(760px, calc(100vw - 16px));
  border: 1px solid #2f5f8f;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(13, 38, 66, 0.88), rgba(13, 29, 54, 0.92)),
    #102948;
  color: #e8f3ff;
  box-shadow:
    0 6px 16px rgba(4, 18, 33, 0.3),
    inset 0 0 0 1px rgba(110, 160, 207, 0.25);
  padding: 6px 8px 7px;
}

.duel-box h3 {
  color: #f4f8ff;
  font-size: 0.9rem;
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.duel-subtitle {
  margin: 0 0 2px;
  font-size: 0.64rem;
  color: #9bc3eb;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#duelText {
  margin: 0 0 5px;
  font-size: 0.8rem;
  color: #d8e9fb;
  font-weight: 700;
  min-height: 1.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-actors {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  margin: 0 0 5px;
}

.duel-actors-vs {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #bbd6f1;
  opacity: 0.82;
}

.duel-actor-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  background: rgba(16, 42, 70, 0.76);
  border: 1px solid rgba(99, 144, 188, 0.45);
  border-radius: 7px;
  padding: 4px 5px;
  min-width: 0;
}

.duel-actor-card-right {
  direction: rtl;
}

.duel-actor-card-right .duel-actor-main {
  direction: ltr;
}

.duel-actor-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #5f8fbe;
  object-fit: cover;
  background: #0e2d4a;
}

.duel-actor-avatar.team-red {
  border-color: #c56b6b;
}

.duel-actor-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.duel-actor-name {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: #e9f4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-actor-role {
  font-size: 0.59rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #90b9df;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.duel-actor-role.has-element-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(154, 190, 224, 0.38);
  background-image: var(--duel-element-icon);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.duel-actor-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  font-size: 0.57rem;
  color: #a5c4e2;
}

.duel-actor-row strong {
  font-size: 0.56rem;
  color: #d6e9fc;
}

.duel-actor-meter {
  height: 5px;
  border-radius: 999px;
  background: rgba(10, 21, 36, 0.8);
  overflow: hidden;
}

.duel-actor-meter i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.duel-actor-meter.fp i {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.duel-actions button {
  margin-top: 0;
  min-height: 40px;
  border: 1px solid #4d78a8;
  border-radius: 6px;
  background: linear-gradient(#245286, #183f69);
  color: #f3f8ff;
  font-weight: 700;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.15;
  padding: 4px 9px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  text-align: center;
  overflow-wrap: anywhere;
}

.duel-actions button:disabled {
  cursor: not-allowed;
}

.duel-actions button[data-choice="left"],
.duel-actions button[data-choice="right"] {
  min-width: 0;
}

.duel-actions button[data-choice="tech"] {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  min-height: 40px;
  padding: 0;
  justify-self: center;
  font-size: 0.67rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  border-color: #9f7e2f;
  background: linear-gradient(#9a7330, #705325);
  color: #fff8e6;
}

.duel-choice-label {
  min-width: 0;
}

.duel-choice-icon {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(227, 239, 252, 0.45);
  object-fit: cover;
  background: rgba(8, 23, 40, 0.72);
}

.duel-choice-lock {
  width: 12px;
  height: 12px;
  object-fit: contain;
  opacity: 0.95;
}

.duel-choice-disabled {
  opacity: 0.56;
}

.duel-choice-locked {
  border-color: #8c6a34 !important;
}

.duel-key {
  min-width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(215, 231, 248, 0.6);
  background: rgba(14, 35, 58, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  line-height: 1;
}

.duel-help {
  margin: 4px 0 0;
  color: #9fc1e6;
  font-size: 0.64rem;
  text-align: center;
  opacity: 0.82;
}

/* Compact duel dock on shorter screens so it does not hide too much pitch area. */
@media (max-height: 940px) {
  body.match-page-active .duel-overlay {
    padding: 0 8px calc(4px + env(safe-area-inset-bottom, 0px));
  }

  body.match-page-active .duel-box {
    width: min(720px, calc(100vw - 14px));
    padding: 4px 6px 5px;
  }

  body.match-page-active .duel-box h3,
  body.match-page-active .duel-subtitle,
  body.match-page-active .duel-help,
  body.match-page-active .duel-actors {
    display: none;
  }

  body.match-page-active #duelText {
    margin: 0 0 4px;
    font-size: 0.8rem;
    min-height: 1em;
  }

  body.match-page-active .duel-actions {
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    gap: 4px;
  }

  body.match-page-active .duel-actions button {
    min-height: 32px;
    padding: 2px 6px;
    font-size: 0.72rem;
    line-height: 1.05;
  }

  body.match-page-active .duel-actions button[data-choice="tech"] {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    min-height: 32px;
    padding: 0;
    font-size: 0.62rem;
  }
}

.picker-box {
  width: min(720px, calc(100vw - 20px));
  max-height: calc(100vh - 26px);
  overflow: auto;
}

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

#pickerSlotLabel {
  margin: 0 0 6px;
  padding: 5px 8px;
  border: 1px solid #c4d7e7;
  border-radius: 9px;
  background: linear-gradient(#f8fcff, #edf5fb);
  color: #365c7e;
  font-weight: 700;
}

.picker-filters {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
  border: 1px solid #c7d9e8;
  border-radius: 10px;
  background: rgba(247, 252, 255, 0.95);
}

#pickerResultsMeta {
  margin: 8px 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 9px;
  border: 1px solid #c1d5e5;
  border-radius: 999px;
  background: linear-gradient(#f8fcff, #edf6fd);
  color: #3c6687;
  font-size: 0.79rem;
  font-weight: 700;
}

.picker-results {
  margin-top: 6px;
  border: 1px solid #c5d8e7;
  border-radius: 10px;
  background: #f9fcff;
  max-height: 380px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  padding: 8px;
  align-items: start;
}

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 1px solid #c9d9e7;
  border-radius: 8px;
  background: #ffffff;
  padding: 7px;
  transition:
    transform 0.14s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.picker-item:hover {
  transform: translateY(-1px);
  border-color: #aac4d9;
  box-shadow: 0 5px 10px rgba(36, 69, 98, 0.14);
}

.picker-item img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #c6d5e2;
  background: #f0f5f9;
}

.picker-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #2f4f6c;
}

.picker-meta {
  font-size: 0.73rem;
  color: #54708a;
  line-height: 1.2;
  min-height: 40px;
}

.picker-item button {
  width: 100%;
  margin-top: auto;
}

.picker-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.asset-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 37, 55, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.asset-overlay.hidden {
  display: none;
}

.asset-box {
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100vh - 26px);
  overflow: auto;
  border: 1px solid #b4c9da;
  border-radius: 12px;
  background: linear-gradient(#f6fbff, #ebf3fa);
  box-shadow:
    0 14px 30px rgba(14, 33, 51, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  padding: 12px;
}

.asset-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.auth-head,
.picker-head,
.player-info-head,
.asset-head {
  position: sticky;
  top: -12px;
  z-index: 3;
  margin: -12px -12px 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #cbdae8;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(#f9fdff, #ecf4fb);
}

.auth-head h3,
.picker-head h3,
.player-info-head h3,
.asset-head h3 {
  margin: 0;
}

.auth-head .btn.small,
.picker-head .btn.small,
.player-info-head .btn.small,
.asset-head .btn.small {
  margin-top: 0;
  width: 32px;
  min-width: 32px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border-color: #9fb8cc;
  background: linear-gradient(#ffffff, #e8f1f8);
  color: #3a5f80;
  font-size: 0.9rem;
  font-weight: 800;
}

.asset-grid {
  margin-top: 6px;
  border: 1px solid #c5d8e7;
  border-radius: 10px;
  background: #f9fcff;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  padding: 8px;
  max-height: 420px;
  overflow: auto;
}

.asset-tile {
  margin-top: 0;
  width: 100%;
  border: 2px solid #c8d8e6;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.asset-tile.selected {
  border-color: #4d89be;
  background: #e7f3ff;
}

.asset-tile img {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 4px;
}

.asset-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-height: 820px) and (min-width: 961px) {
  body.match-page-active .match-panel {
    gap: 6px;
    padding: 8px 10px;
  }

  body.match-page-active .hud-team {
    min-height: 46px;
    padding: 3px 7px;
  }

  body.match-page-active .hud-team-meta span {
    font-size: 0.64rem;
  }

  body.match-page-active .hud-team-meta strong {
    font-size: 1.35rem;
  }

  body.match-page-active .hud-center {
    gap: 2px;
  }

  body.match-page-active .hud-center #timeLabel {
    font-size: 0.84rem;
    min-width: 122px;
    padding: 2px 7px;
  }

  body.match-page-active .duel-hud-card {
    min-height: 30px;
    padding: 2px 6px;
  }

  body.match-page-active .duel-hud-avatar {
    width: 18px;
    height: 18px;
  }

  body.match-page-active .duel-hud-name {
    font-size: 0.56rem;
  }

  body.match-page-active .duel-hud-role {
    font-size: 0.44rem;
  }

  body.match-page-active .duel-hud-resource-label,
  body.match-page-active .duel-hud-resource-value {
    font-size: 0.44rem;
  }

  body.match-page-active .duel-hud-adv {
    font-size: 0.48rem;
  }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .right-col {
    grid-column: 1 / -1;
    max-height: 290px;
    overflow: auto;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .site {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    border-radius: 8px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .top-center {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
  }

  .top-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .topnav {
    gap: 4px;
    flex-wrap: wrap;
  }

  .topnav-pill {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    border-bottom-color: #8ea8bf;
    padding: 7px 8px;
  }

  .topnav-pill.is-active {
    border-bottom-color: #6f91b0;
  }

  .top-window-controls {
    width: 100%;
    justify-content: stretch;
  }

  .top-window-controls .btn.small {
    flex: 1;
    min-width: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
    flex: initial;
  }

  .left-col,
  .main-col,
  .right-col {
    overflow: visible;
    min-height: auto;
    padding-right: 0;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .players-list {
    max-height: 300px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  }

  body.match-page-active .match-panel {
    padding: 6px 6px 8px;
  }

  body.match-page-active .hud {
    grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
    gap: 6px;
    margin-bottom: 2px;
  }

  body.match-page-active .hud-team {
    min-height: 46px;
    padding: 3px 5px;
    border-width: 1px;
    border-radius: 8px;
  }

  body.match-page-active .hud-team-right {
    border-color: #9fb5c8;
    background: var(--match-menu-panel-strong);
  }

  body.match-page-active .hud-emblem {
    width: 23px;
    height: 23px;
    border-width: 1px;
  }

  .duel-hud-strip {
    gap: 6px;
    margin-bottom: 4px;
  }

  .duel-hud-center {
    font-size: 0.67rem;
  }

  .duel-hud-card {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 34px;
    gap: 4px;
    padding: 3px 4px;
  }

  .duel-hud-card-right {
    grid-template-columns: minmax(0, 1fr) 28px;
  }

  .duel-hud-avatar {
    width: 28px;
    height: 28px;
  }

  .duel-hud-name {
    font-size: 0.64rem;
  }

  .duel-hud-resource-value {
    font-size: 0.53rem;
  }

  body.match-page-active .duel-hud-strip {
    left: auto;
    right: auto;
    top: auto;
    margin: 0;
    gap: 5px;
    width: 100%;
  }

  body.match-page-active .duel-hud-card {
    width: clamp(124px, 40vw, 188px);
    min-height: 24px;
    padding: 1px 4px;
    border-radius: 8px;
    border-width: 1px;
  }

  body.match-page-active .duel-hud-avatar {
    width: 17px;
    height: 17px;
  }

  body.match-page-active .duel-hud-name {
    font-size: 0.56rem;
  }

  body.match-page-active .duel-hud-role {
    font-size: 0.44rem;
  }

  body.match-page-active .duel-hud-resource-row {
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 2px;
  }

  body.match-page-active .duel-hud-resource-label {
    font-size: 0.43rem;
  }

  body.match-page-active .duel-hud-resource-value {
    font-size: 0.47rem;
  }

  body.match-page-active .duel-hud-adv {
    font-size: 0.48rem;
  }

  body.match-page-active .hud-team-meta strong {
    font-size: 1.45rem;
  }

  body.match-page-active .hud-team-meta span {
    font-size: 0.62rem;
  }

  body.match-page-active .hud-center #timeLabel {
    min-width: 114px;
    font-size: 0.84rem;
    padding: 2px 7px;
  }

  body.match-page-active .hud-center #statusLabel {
    font-size: 0.64rem;
  }

  body.match-page-active .match-exit-btn {
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .picker-filters {
    grid-template-columns: 1fr 1fr;
  }

  .picker-item {
    gap: 4px;
  }

  .picker-item button {
    width: 100%;
  }

  .player-info-box {
    width: min(680px, calc(100vw - 10px));
    padding: 8px;
  }

  .player-info-main {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
  }

  .player-info-avatar {
    width: 70px;
    height: 70px;
  }

  .player-info-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-info-tech-list {
    max-height: 34vh;
  }

  .team-pitch-board {
    min-height: 360px;
  }

  .team-slot {
    width: 72px;
    min-height: 74px;
  }

  .duel-overlay {
    padding: 0 6px 6px;
  }

  .duel-box {
    width: min(680px, calc(100vw - 10px));
    padding: 5px 6px 6px;
  }

  .duel-actors {
    gap: 4px;
    margin-bottom: 4px;
  }

  .duel-actor-card {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 4px;
    padding: 3px 4px;
  }

  .duel-actor-avatar {
    width: 30px;
    height: 30px;
  }

  .duel-actor-name {
    font-size: 0.64rem;
  }

  .duel-actor-role {
    font-size: 0.53rem;
  }

  .duel-actor-row {
    grid-template-columns: 15px minmax(0, 1fr) auto;
    gap: 3px;
    font-size: 0.52rem;
  }

  .duel-actor-row strong {
    font-size: 0.5rem;
  }

  #duelText {
    font-size: 0.73rem;
    margin-bottom: 4px;
  }

  .duel-actions {
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    gap: 4px;
  }

  .duel-actions button {
    min-height: 34px;
    font-size: 0.68rem;
    padding: 3px 6px;
  }

  .duel-actions button[data-choice="tech"] {
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    min-height: 34px;
    padding: 0;
    font-size: 0.62rem;
  }

  .duel-help {
    display: none;
  }

  .team-slot img {
    width: 44px;
    height: 44px;
  }

  .site-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-social {
    justify-content: space-between;
  }

  .social-btn {
    flex: 1;
    justify-content: center;
  }
}

body.ladder-hidden .right-col {
  display: none;
}

body.ladder-hidden .layout {
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
}

body.left-hidden .left-col {
  display: none;
}

body.left-hidden .layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
}

body.left-hidden .main-col {
  grid-column: 1;
}

body.left-hidden .right-col {
  grid-column: 2;
}

body.left-hidden.ladder-hidden .layout {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 960px) {
  body.left-hidden .layout,
  body.ladder-hidden .layout {
    grid-template-columns: 1fr;
  }
}
