﻿: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;
}

* {
  box-sizing: border-box;
}

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

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

.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;
}

.topbar {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: linear-gradient(#d8e6f1, #c7d9e9);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
}

.brand {
  font-size: 2rem;
  font-weight: 700;
  color: #2f6598;
}

.topnav {
  display: flex;
  gap: 8px;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 6px 10px;
  border: 1px solid #b4c8da;
  border-radius: 4px;
  background: linear-gradient(#f8fbfe, #dfeaf4);
  color: #35597a;
  text-decoration: none;
  font-size: 0.9rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.account-badge {
  max-width: 180px;
  padding: 5px 9px;
  border: 1px solid #b5c8d9;
  border-radius: 12px;
  background: #eef4fa;
  font-size: 0.84rem;
  color: #43617d;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.layout {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 250px;
  gap: 8px;
}

.left-col,
.main-col,
.right-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  padding: 9px;
}

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 #acc1d3;
  border-radius: 4px;
  padding: 7px 9px;
  font-size: 0.92rem;
  color: var(--ink);
  background: #f6fafe;
}

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

button {
  cursor: pointer;
}

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

.btn {
  background: linear-gradient(#f8fcff, #dbe8f4);
}

.btn.primary {
  color: #fff;
  border-color: #3c73aa;
  background: linear-gradient(var(--accent), var(--accent-dark));
}

.btn.small {
  width: auto;
  padding: 5px 10px;
  font-size: 0.86rem;
}

.btn.danger {
  color: #fff;
  border-color: #8d3f4c;
  background: linear-gradient(#c16978, #9a4b58);
}

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

.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;
}

#saveBuildBtn {
  margin-top: 6px;
}

.online-matchbox {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #c8d7e5;
  display: grid;
  gap: 6px;
}

.online-matchbox h3 {
  margin: 0;
  font-size: 0.98rem;
}

.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: #365977;
}

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

.online-code .btn.small {
  margin-top: 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: 240px;
  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: 460px;
  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: 92px;
  min-height: 98px;
  border: 2px solid #f0d861;
  border-radius: 6px;
  background: rgba(245, 251, 240, 0.92);
  text-align: center;
  padding: 4px 4px 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.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: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #c8d7c0;
  background: #f6f8f4;
}

.slot-role {
  margin-top: 3px;
  font-size: 0.66rem;
  font-weight: 700;
  color: #204d79;
  letter-spacing: 0.03em;
}

.slot-name {
  margin-top: 3px;
  font-size: 0.74rem;
  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 {
  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 {
  margin-top: 3px;
  font-size: 0.72rem;
  color: #48637c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.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-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);
}

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

.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;
}

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

.news-item {
  border: 1px solid #c8d7e4;
  border-radius: 4px;
  background: #f6faff;
  padding: 6px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: #4c667e;
}

.news-item:last-child {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

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

.duel-overlay {
  pointer-events: none;
}

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

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

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

.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: repeat(3, 1fr);
  gap: 6px;
}

.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;
  margin-bottom: 4px;
}

.picker-filters {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

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

.picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 1px solid #c4d5e4;
  border-radius: 4px;
  background: #ffffff;
  padding: 6px;
}

.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(27, 49, 70, 0.44);
}

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

.asset-box {
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100vh - 26px);
  overflow: auto;
  border: 1px solid #a8bfd2;
  border-radius: 4px;
  background: #eff5fb;
  padding: 10px;
}

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

.asset-grid {
  margin-top: 6px;
  border: 1px solid #c9d9e7;
  border-radius: 4px;
  background: #f7fbff;
  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: 6px;
  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-width: 1280px) {
  .layout {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .right-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr;
  }

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

  .topnav {
    flex-wrap: wrap;
  }

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

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

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

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

  .picker-item {
    gap: 4px;
  }

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

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

  .team-slot {
    width: 78px;
    min-height: 88px;
  }

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