﻿:root {
  --bg: #eff2f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --line: #d9deea;
  --text: #101828;
  --muted: #5f6b85;
  --accent: #355cff;
  --accent-2: #0ea5a8;
  --danger: #b42318;
  --ok: #0f9d6e;
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 24px 50px rgba(15, 23, 42, 0.12);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --font-main: "Avenir Next", "Segoe UI Variable Display", "Trebuchet MS", "Gill Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-main);
  background:
    radial-gradient(1100px 650px at 6% -10%, rgba(53, 92, 255, 0.2), transparent 55%),
    radial-gradient(900px 620px at 104% 102%, rgba(14, 165, 168, 0.18), transparent 52%),
    linear-gradient(170deg, #f5f7fc 0%, #eef2f9 48%, #edf1f8 100%);
  letter-spacing: 0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

h2 {
  letter-spacing: -0.02em;
}

h3,
h4 {
  letter-spacing: -0.01em;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  color: #7b879f;
  margin: 0 0 9px;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  border-right: 1px solid rgba(140, 153, 180, 0.22);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 249, 255, 0.9));
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.menu,
.sidebar-actions,
.stacked-form {
  display: grid;
  gap: 9px;
}

.sidebar-actions {
  margin-top: auto;
}

.menu-btn,
.ghost-btn,
.primary-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.84);
  color: #1f2a44;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.menu-btn:hover,
.ghost-btn:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.menu-btn.active,
.primary-btn {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 74%, #ffffff));
  color: #fff;
  border-color: transparent;
}

.primary-btn {
  font-weight: 700;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.66);
}

.ghost-btn.danger {
  color: var(--danger);
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.content {
  padding: 24px;
}

.view {
  display: none;
  animation: viewEnter 260ms ease;
}

.view.active {
  display: block;
}

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

.hero,
.panel,
.metric,
.home-card {
  background: var(--surface);
  border: 1px solid rgba(143, 156, 183, 0.28);
  box-shadow: var(--shadow-soft);
}

.hero {
  padding: 26px;
  border-radius: var(--radius-xl);
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.hero h2 {
  font-size: 2.05rem;
  margin-bottom: 10px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric {
  border-radius: var(--radius-lg);
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.88));
}

.metric-label {
  display: block;
  color: #6c7790;
  margin-bottom: 8px;
  font-size: 0.88rem;
}

.metric-value {
  font-size: 1.65rem;
}

.cards {
  display: grid;
  gap: 14px;
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-card,
.panel {
  border-radius: 22px;
  padding: 18px;
}

.home-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-card-league {
  border-top: 6px solid #1f8f74;
}

.home-card-tournament {
  border-top: 6px solid #b45309;
}

.home-card-blind {
  border-top: 6px solid #4254d0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(143, 156, 183, 0.3);
  border-radius: 18px;
  padding: 12px 14px;
}

.mode-intro {
  border-radius: 20px;
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid rgba(143, 156, 183, 0.28);
  box-shadow: var(--shadow-soft);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(249, 252, 255, 0.84));
}

.mode-intro h3 {
  margin-bottom: 7px;
  font-size: 1.34rem;
}

.mode-league {
  border-left: 7px solid #1f8f74;
}

.mode-tournament {
  border-left: 7px solid #b45309;
}

.mode-blind {
  border-left: 7px solid #4254d0;
}

.split {
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 10px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #47536e;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d3dbee;
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 52%, #b9c8ff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.panel-sub {
  min-height: 500px;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #c8d2e8;
  border-radius: 18px;
  color: #5e6c89;
  background: rgba(255, 255, 255, 0.7);
}

.toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: end;
}

.inline-field {
  display: grid;
  gap: 5px;
}

.inline-field span {
  font-size: 0.78rem;
  color: #5d6b88;
}

.inline-field input {
  width: 92px;
}

.category-block,
.table-card,
.bracket-round,
.match-card,
.ticket,
.group-card {
  background: var(--surface-strong);
  border: 1px solid #d8e0f1;
  border-radius: var(--radius-lg);
  padding: 14px;
}

.category-block,
.table-card,
.group-card {
  margin-bottom: 12px;
}

#view-league .category-block {
  border-left: 5px solid rgba(31, 143, 116, 0.8);
}

#view-tournament .category-block {
  border-left: 5px solid rgba(180, 83, 9, 0.84);
}

#view-blind .category-block {
  border-left: 5px solid rgba(66, 84, 208, 0.84);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

th,
td {
  padding: 9px 7px;
  border-bottom: 1px solid #e4e9f5;
  text-align: left;
  white-space: nowrap;
}

th {
  color: #4b5873;
  font-weight: 700;
}

.bracket {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 11px;
}

.match-card {
  margin-bottom: 8px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.match-card:last-child {
  margin-bottom: 0;
}

.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
}

.match-pending {
  border-left: 4px solid #9a5808;
}

.match-in_play {
  border-left: 4px solid #1463d6;
}

.match-completed {
  border-left: 4px solid #127c58;
}

.match-head,
.match-actions,
.ticket-head,
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(14, 165, 168, 0.12);
  color: #0f6f76;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.warn {
  background: rgba(180, 83, 9, 0.14);
  color: #92400e;
}

.badge.danger {
  background: rgba(180, 35, 24, 0.12);
  color: #991b1b;
}

.scanner-box {
  border: 1px dashed #c8d2e8;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.ticket-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.score-box {
  min-height: 46px;
  border: 1px solid #d3dbee;
  border-radius: 10px;
}

.code-box {
  overflow: auto hidden;
  margin-top: 10px;
}

dialog {
  width: min(760px, calc(100vw - 32px));
  border: none;
  border-radius: 24px;
  padding: 0;
  background: transparent;
}

.dialog-form {
  background: #fff;
  border: 1px solid #d7deef;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.small-note {
  color: #607091;
  font-size: 0.85rem;
}

.live-tools {
  margin-bottom: 12px;
}

.group-teams {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.group-team-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  background: #f7f9ff;
  border: 1px solid #e4eaf8;
}

.group-team-meta {
  font-size: 0.82rem;
  color: #607091;
}

.toast-host {
  position: fixed;
  z-index: 9999;
  right: 14px;
  bottom: 14px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 20px));
  pointer-events: none;
}

.toast {
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  animation: toastIn 180ms ease;
}

.toast.info { background: #3659f6; }
.toast.ok { background: #127c58; }
.toast.warn { background: #9a5808; }
.toast.error { background: #b42318; }

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

#view-league .split > form,
#view-tournament .split > form,
#view-blind .split > form {
  position: sticky;
  top: 12px;
  align-self: start;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d5dff1;
  border-radius: 16px;
  padding: 12px;
}

#view-live .panel h3,
#view-ranking .panel h3 {
  border-bottom: 2px solid rgba(214, 224, 244, 0.94);
  padding-bottom: 8px;
}

body[data-mode="home"] {
  --accent: #355cff;
  --accent-2: #0ea5a8;
}

body[data-mode="league"] {
  --accent: #1f8f74;
  --accent-2: #0f6f76;
  background:
    radial-gradient(950px 620px at 8% -6%, rgba(31, 143, 116, 0.24), transparent 56%),
    radial-gradient(760px 560px at 102% 98%, rgba(15, 111, 118, 0.2), transparent 52%),
    linear-gradient(180deg, #edf8f4 0%, #e5f3ee 100%);
}

body[data-mode="tournament"] {
  --accent: #b45309;
  --accent-2: #8a3e10;
  background:
    radial-gradient(940px 620px at 8% -8%, rgba(180, 83, 9, 0.24), transparent 56%),
    radial-gradient(760px 560px at 102% 98%, rgba(138, 62, 16, 0.2), transparent 52%),
    linear-gradient(180deg, #fff4e9 0%, #f8e8d6 100%);
}

body[data-mode="blind"] {
  --accent: #4254d0;
  --accent-2: #2563eb;
  background:
    radial-gradient(960px 620px at 8% -8%, rgba(66, 84, 208, 0.24), transparent 56%),
    radial-gradient(760px 560px at 102% 98%, rgba(37, 99, 235, 0.2), transparent 52%),
    linear-gradient(180deg, #eef1ff 0%, #e4e9ff 100%);
}

body[data-mode="live"] {
  --accent: #374151;
  --accent-2: #0f766e;
  background:
    radial-gradient(980px 650px at 8% -8%, rgba(55, 65, 81, 0.22), transparent 56%),
    radial-gradient(760px 560px at 102% 98%, rgba(15, 118, 110, 0.2), transparent 52%),
    linear-gradient(180deg, #f3f5f8 0%, #e7ebf1 100%);
}

body[data-mode="ranking"] {
  --accent: #6d28d9;
  --accent-2: #1f8f74;
  background:
    radial-gradient(980px 650px at 8% -8%, rgba(109, 40, 217, 0.22), transparent 56%),
    radial-gradient(760px 560px at 102% 98%, rgba(31, 143, 116, 0.18), transparent 52%),
    linear-gradient(180deg, #f5f1ff 0%, #ece6ff 100%);
}

@media (max-width: 1220px) {
  .shell,
  .hero,
  .split,
  .cards.three,
  .cards.two,
  .grid.four,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(140, 153, 180, 0.22);
  }

  #view-league .split > form,
  #view-tournament .split > form,
  #view-blind .split > form {
    position: static;
  }
}
