:root {
  --bg: #031540;
  --bg2: #0a318f;
  --panel: #244388;
  --panel2: #1b326b;
  --ink: #ffffff;
  --muted: #aab8d2;
  --line: rgba(255,255,255,.1);
  --gold: #ffd032;
  --green: #51e1be;
  --red: #ff8c9a;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 75% 5%, rgba(25, 77, 180, .9), transparent 42%),
    linear-gradient(120deg, #071022 0%, var(--bg) 38%, var(--bg2) 100%);
}

a { color: inherit; }

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 28px auto;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(9, 30, 84, .86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-icon, .admin-badge span {
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  color: #0b2666;
  font-size: 36px;
  font-weight: 800;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffe989, #ffb412);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.5rem, 6vw, 4.9rem); line-height: .92; letter-spacing: 0; }
.brand p, .panel p, .metric p, .player-name span, small, time { color: var(--muted); }
.brand p { margin-top: 8px; font-size: 1.15rem; }
.title-spark {
  display: inline-flex;
  margin-left: 6px;
  color: var(--gold);
  vertical-align: -2px;
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.08);
  text-decoration: none;
}

.admin-badge span { width: 54px; font-size: 28px; border-radius: 50%; }
.admin-badge strong { display: block; }

.tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.tabs a, .action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  padding: 13px 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #dbe5fb;
  font-weight: 600;
}
.tab-form {
  margin: 0;
}
.tab-form button {
  min-height: auto;
  padding: 13px 24px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #dbe5fb;
  font-weight: 600;
}
.tabs a:first-child, .action-link {
  background: var(--gold);
  color: #071a46;
}

.hidden { display: none !important; }

.notice {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(81, 225, 190, .18);
}
.notice.error { background: rgba(255, 140, 154, .18); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .68fr);
  gap: 28px;
  margin-top: 38px;
}
.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-top: 38px;
  align-items: start;
}

.main-column, .side-column { display: grid; gap: 28px; align-content: start; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }

.metric, .panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(62, 88, 145, .86), rgba(28, 61, 141, .84));
  box-shadow: 0 22px 56px rgba(0, 0, 0, .2);
}

.metric { min-height: 196px; padding: 24px; }
.metric-icon, .plus {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  margin-bottom: 20px;
  border-radius: 16px;
  background: rgba(255, 208, 50, .18);
  color: #ffe26d;
  font-size: 28px;
}
.metric-icon .icon, .plus .icon { width: 28px; height: 28px; }
.metric small { display: block; margin-bottom: 12px; }
.metric strong { display: block; font-size: 2rem; line-height: 1; }
.metric p { margin-top: 12px; line-height: 1.45; }

.panel { overflow: hidden; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 26px;
}
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.view-switch {
  display: flex;
  padding: 5px;
  border-radius: 999px;
  background: rgba(9, 30, 84, .38);
}
.view-switch button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: transparent;
  color: #dbe5fb;
  font-size: .95rem;
  font-weight: 800;
}
.view-switch button.active {
  background: var(--gold);
  color: #071a46;
}
.panel h2 { font-size: 1.6rem; line-height: 1.1; }
.panel h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  color: var(--gold);
}
.panel h3 { font-size: 1rem; }
.panel p { margin-top: 6px; line-height: 1.35; }

.standings { display: grid; }
.standing-row {
  display: grid;
  grid-template-columns: 58px 58px minmax(150px, 1.3fr) repeat(3, minmax(70px, .45fr)) minmax(130px, .8fr);
  gap: 16px;
  align-items: center;
  padding: 22px 26px;
  border-top: 1px solid var(--line);
}
.rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 52px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  color: #d5def2;
  font-weight: 800;
}
.rank .icon {
  width: 17px;
  height: 17px;
  color: #ffe26d;
}
.avatar {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--player);
  color: #09205c;
  font-weight: 800;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.28);
}
.avatar img, .player-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-name strong, .standing-row strong { display: block; font-size: 1.15rem; }
.standing-row small { display: block; margin-bottom: 4px; text-transform: uppercase; font-size: .72rem; }
.standing-row div:not(.rank):not(.avatar):not(.player-name):not(.form-dots) strong { color: #ffdf55; }
.form-dots { display: flex; gap: 8px; justify-content: flex-end; }
.form-dots span {
  display: grid;
  place-items: center;
  width: 30px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  font-size: .75rem;
  font-weight: 800;
}
.form-dots .s { background: var(--green); color: #06234d; }
.form-dots .u { background: #f8d75e; color: #06234d; }
.form-dots .n { background: #16336f; }

.form-panel { background: linear-gradient(145deg, rgba(67, 96, 158, .95), rgba(31, 68, 153, .94)); }
.plus { margin: 0; background: rgba(0,0,0,.18); color: var(--gold); }
.round-form { display: grid; gap: 14px; padding: 0 26px 26px; }
.password-form {
  max-width: 640px;
}
.admin-round-form {
  align-content: start;
  padding: 18px;
  border-radius: 20px;
  background: rgba(9, 30, 84, .34);
}
label { display: grid; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; }
input, select {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: rgba(9, 30, 84, .6);
  color: white;
  font: inherit;
}
input[type="color"] {
  padding: 8px;
  min-height: 52px;
}
input[type="file"] {
  padding: 14px 16px;
}
select option { color: #0b1f51; }
.team-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(7, 25, 72, .28);
}
button {
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--gold);
  color: #071a46;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.view-switch button {
  min-height: 42px;
  border-radius: 999px;
  background: transparent;
  color: #dbe5fb;
  font-size: .95rem;
}
.view-switch button.active {
  background: var(--gold);
  color: #071a46;
}

.game-list { display: grid; gap: 14px; padding: 0 26px 26px; }
.game-list article {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(9, 30, 84, .52);
}
.score-line { display: grid; gap: 4px; margin-top: 4px; }

.admin-games-grid {
  display: grid;
  grid-template-columns: minmax(320px, .58fr) minmax(0, 1.42fr);
  gap: 22px;
  padding: 0 26px 26px;
}
.admin-games-list {
  display: grid;
  gap: 16px;
  padding: 0 26px 26px;
}
.subhead {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.subhead h3 { font-size: 1.25rem; }
.icon-action {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.09);
  color: #dbe5fb;
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.icon-action.primary {
  background: var(--gold);
  color: #071a46;
}
.icon-action.danger {
  background: rgba(255, 140, 154, .18);
  color: #ffd6dc;
  font-size: 1.6rem;
}
.icon-action .icon {
  width: 20px;
  height: 20px;
}
.game-edit-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(9, 30, 84, .34);
}
.game-edit-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.game-edit-head small { color: var(--muted); }
.game-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.game-edit-grid > .team-card {
  padding: 14px;
}
.game-edit-card button,
.admin-round-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.game-form-teams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.form-actions button,
.form-actions .ghost-button {
  flex: 1;
}
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.09);
  color: #dbe5fb;
  text-decoration: none;
  font-weight: 800;
}
.games-table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  background: rgba(9, 30, 84, .34);
}
.games-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}
.games-table th,
.games-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.games-table th {
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
}
.games-table tr:last-child td {
  border-bottom: 0;
}
.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.table-actions form {
  margin: 0;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #dbe5fb;
  text-decoration: none;
  font-weight: 800;
}
.pagination a.active {
  background: var(--gold);
  color: #071a46;
}
.pagination span {
  opacity: .45;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 0 26px 26px;
}
.player-grid article {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(9, 30, 84, .34);
}
.player-card-photo {
  display: grid;
  place-items: center;
  width: min(100%, 180px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--player), rgba(255,255,255,.08));
  color: #09205c;
  font-size: 2rem;
  font-weight: 800;
}
.player-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-grid article > strong {
  margin-top: 4px;
  font-size: 1.25rem;
}
.player-grid b { color: #ffdf55; }

.admin-player-list {
  display: grid;
  gap: 18px;
  padding: 0 26px 26px;
}
.player-edit-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(9, 30, 84, .34);
}
.player-photo {
  width: 92px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255,255,255,.08);
}
.player-photo .avatar {
  width: 100%;
  height: 100%;
  border-radius: 22px;
  font-size: 1.4rem;
}
.player-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.player-edit-card button {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.player-edit-card button .icon {
  width: 20px;
  height: 20px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 26px 26px;
}
.gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
}

@media (max-width: 1120px) {
  .layout, .admin-layout { grid-template-columns: 1fr; }
  .admin-games-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 18px, 640px); margin: 10px auto; }
  .topbar { grid-template-columns: 1fr; padding: 18px; border-radius: 22px; }
  .brand { align-items: flex-start; }
  .brand-icon { width: 58px; border-radius: 15px; }
  h1 { font-size: 2.45rem; }
  .brand p { font-size: .95rem; }
  .admin-badge { justify-self: start; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tabs a { white-space: nowrap; padding: 11px 18px; }
  .layout { margin-top: 20px; gap: 20px; }
  .admin-layout { margin-top: 20px; gap: 20px; }
  .metric-grid, .player-grid { grid-template-columns: 1fr; }
  .metric { min-height: auto; }
  .panel-head { padding: 20px; flex-direction: column; }
  .panel-actions { justify-content: flex-start; width: 100%; }
  .view-switch, .action-link { width: 100%; }
  .view-switch button { flex: 1; }
  .action-link { text-align: center; }
  .standing-row {
    grid-template-columns: 46px 50px minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
  }
  .standing-row div:not(.rank):not(.avatar):not(.player-name):not(.form-dots) {
    grid-column: span 1;
  }
  .form-dots { grid-column: 1 / -1; justify-content: flex-start; }
  .round-form, .game-list, .gallery, .player-grid { padding: 0 18px 18px; }
  .admin-games-grid { padding: 0 18px 18px; }
  .admin-games-list { padding: 0 18px 18px; }
  .admin-round-form { padding: 18px; }
  .game-form-teams { grid-template-columns: 1fr; }
  .game-edit-grid { grid-template-columns: 1fr; }
  .subhead { align-items: start; flex-direction: column; }
  .admin-player-list { padding: 0 18px 18px; }
  .player-edit-card { grid-template-columns: 1fr; }
  .player-edit-fields { grid-template-columns: 1fr; }
  .player-edit-card button { grid-column: 1; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
