:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #10172a;
  --panel: rgba(16, 23, 42, 0.88);
  --panel-strong: rgba(17, 24, 39, 0.96);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.32);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --primary: #7c3aed;
  --primary-2: #a855f7;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.24), transparent 34rem),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.13), transparent 28rem),
    var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.45rem;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--line);
  color: #d8b4fe;
}

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

h1 {
  margin: 0 0 8px;
  font-size: clamp(2.15rem, 4vw, 3.2rem);
  letter-spacing: -0.065em;
  line-height: 0.94;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
}

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

.small {
  font-size: 0.84rem;
}


/* Explicitly hide auth/dashboard sections even when component classes define display:grid/flex.
   Without this rule, .login-screen { display: grid; } overrides the browser default [hidden] style. */
[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1800px, 100%);
  height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.sidebar,
.content-area {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.brand-card,
.panel,
.stat-row,
.content-top {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.72), rgba(15, 23, 42, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-card,
.panel,
.content-top {
  padding: 16px;
}

.brand-card .muted {
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #c4b5fd;
  font-size: 0.72rem;
  font-weight: 900;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 14px;
}

.compact-stack {
  display: grid;
}

.config-grid,
.manual-form {
  display: grid;
  gap: 10px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  outline: none;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

input:focus,
textarea:focus {
  border-color: rgba(168, 85, 247, 0.72);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.14);
  background: rgba(15, 23, 42, 0.95);
}

.btn,
.chip,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(30, 41, 59, 0.72);
  color: var(--text);
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 850;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.btn:hover,
.chip:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(51, 65, 85, 0.78);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn.primary,
.chip.active {
  border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(127, 29, 29, 0.48);
}

.btn.full {
  width: 100%;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 1.35rem;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.ok,
.badge.ok {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(20, 83, 45, 0.36);
}

.status-pill.warn,
.badge.warn {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(120, 53, 15, 0.36);
}

.status-pill.error,
.badge.error {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(127, 29, 29, 0.36);
}

.auto-refresh-pill {
  width: 100%;
  justify-content: center;
}

.sidebar-stats {
  display: grid;
  gap: 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 12px;
  box-shadow: none;
  background: rgba(15, 23, 42, 0.34);
}

.stat-row span,
.stat-row small {
  color: var(--muted);
}

.stat-row span {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-row strong {
  grid-row: span 2;
  font-size: 1.55rem;
  letter-spacing: -0.055em;
}

.stat-row small {
  font-size: 0.78rem;
}

.stat-row.accent {
  border-color: rgba(168, 85, 247, 0.36);
  background: linear-gradient(180deg, rgba(88, 28, 135, 0.42), rgba(15, 23, 42, 0.52));
}

.sidebar-actions-panel {
  display: grid;
  gap: 10px;
}

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

.content-top {
  padding: 8px;
}

.tabs-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 8px;
}

.tab-button {
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  border-color: var(--line);
  background: rgba(30, 41, 59, 0.55);
  color: var(--text);
}

.tab-button.active {
  border-color: rgba(168, 85, 247, 0.45);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.94), rgba(168, 85, 247, 0.94));
  color: white;
  box-shadow: 0 12px 36px rgba(124, 58, 237, 0.18);
}

.tab-button span,
.tab-button small {
  display: block;
}

.tab-button span {
  font-weight: 900;
  letter-spacing: -0.02em;
}

.tab-button small {
  margin-top: 1px;
  color: currentColor;
  opacity: 0.72;
  font-size: 0.75rem;
  font-weight: 750;
}

.tabs-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

.tab-panel[hidden] {
  display: none !important;
}

.tab-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  animation: tabFade 0.16s ease;
}

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

.main-panel,
.favorites-panel {
  height: 100%;
  min-height: 0;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.players-controls {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.view-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(15, 23, 42, 0.48);
}

.chip {
  padding: 8px 10px;
  font-size: 0.86rem;
}

.quick-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(15, 23, 42, 0.34);
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 17px;
}

.players-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.players-table th,
.players-table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.players-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.97);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.players-table tbody tr {
  background: rgba(15, 23, 42, 0.12);
}

.players-table tbody tr:hover {
  background: rgba(124, 58, 237, 0.12);
}

.players-table tr.is-favorite {
  background: rgba(88, 28, 135, 0.22);
}

.id-pill {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.34);
  color: #ddd6fe;
  background: rgba(88, 28, 135, 0.22);
  font-weight: 900;
}

.name-main {
  font-weight: 850;
}

.name-sub {
  display: block;
  color: var(--muted-2);
  margin-top: 2px;
  font-size: 0.78rem;
}

.empty-cell,
.empty-card {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.favorites-panel {
  padding: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.players-heading {
  align-items: center;
}

.favorites-management-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.favorites-controls,
.favorites-results-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(15, 23, 42, 0.28);
  padding: 12px;
  min-height: 0;
}

.favorites-results-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.favorites-results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.favorites-results-header h3,
.favorites-results-header p {
  margin-bottom: 0;
}

.manual-form,
.bulk-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(15, 23, 42, 0.34);
}

.bulk-box summary {
  cursor: pointer;
  font-weight: 850;
}

.bulk-box textarea {
  margin: 12px 0;
}

.favorites-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  overflow: auto;
  padding-right: 2px;
}

.favorite-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.42);
}

.favorite-card.online {
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(20, 83, 45, 0.14);
}

.favorite-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.favorite-card strong {
  display: block;
  letter-spacing: -0.02em;
}


.favorite-card,
.favorite-card-header,
.favorite-card-header > div {
  min-width: 0;
}

.favorite-card-header > div {
  max-width: 100%;
}

.favorite-card strong,
.term-list,
.name-main,
.name-sub {
  overflow-wrap: anywhere;
}

.favorite-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.term-list {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.card-actions .btn,
.players-table .btn {
  padding: 7px 10px;
  border-radius: 11px;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: min(460px, calc(100% - 44px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
}

.toast.ok {
  border-color: rgba(34, 197, 94, 0.4);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: min(880px, calc(100vw - 28px));
}

.modal-card .field {
  margin-bottom: 12px;
}

.spacer {
  flex: 1;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.matches-list {
  display: grid;
  gap: 10px;
}

.match-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.38);
}

.help-card ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text);
}

.help-card li {
  margin-bottom: 10px;
}


@media (max-width: 1380px) {
  .favorites-management-grid {
    grid-template-columns: 1fr;
  }

  .favorites-controls {
    order: 2;
  }

  .favorites-results-card {
    order: 1;
    min-height: 420px;
  }
}

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

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .sidebar {
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  }

  .brand-card,
  .sidebar-actions-panel {
    grid-column: 1 / -1;
  }

  .content-area {
    overflow: visible;
  }

  .tabs-shell,
  .tab-panel,
  .main-panel,
  .favorites-panel {
    min-height: 620px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 10px;
  }

  .sidebar,
  .favorites-management-grid,
  .players-controls,
  .quick-add-grid {
    grid-template-columns: 1fr;
  }

  .tabs-bar {
    grid-template-columns: 1fr;
  }

  .sidebar-buttons,
  .view-switch {
    width: 100%;
  }

  .sidebar-buttons,
  .view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .section-heading,
  .players-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .players-table {
    min-width: 680px;
  }

  .modal-actions {
    flex-wrap: wrap;
  }
}

.account-panel {
  display: grid;
  gap: 10px;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(15, 23, 42, 0.72);
}

.account-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-text strong,
.account-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.28), transparent 34rem),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 28rem),
    rgba(5, 10, 24, 0.96);
}

.login-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.86), rgba(15, 23, 42, 0.96));
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card h1 {
  margin-bottom: 12px;
}

.login-card .muted {
  line-height: 1.55;
}

.login-btn {
  display: inline-flex;
  margin: 16px auto 10px;
  min-width: 240px;
  justify-content: center;
  text-decoration: none;
}

.access-mode-box {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.46);
}

.access-mode-box p {
  margin: 0;
}

.access-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.access-list {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 3px;
}

.access-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.48);
}

.access-entry-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.access-entry-main strong {
  font-size: 0.95rem;
  word-break: break-all;
}

.access-entry-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn.slim {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
}

.login-btn[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .access-add-grid {
    grid-template-columns: 1fr;
  }

  .access-entry {
    grid-template-columns: 1fr;
  }

  .access-entry-meta {
    justify-content: space-between;
  }
}


/* Patch 2026-07-03: hide server address panel on VPS layout and center account buttons. */
.config-panel {
  display: none !important;
}

.account-panel .btn.full,
.account-panel a.btn.full {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

/* Legacy import is intentionally hidden in the production panel. */
#importLegacyFavoritesBtn {
  display: none !important;
}
