:root {
  --bg: #0b0d12;
  --bg-soft: #10141b;
  --panel: #171b24;
  --panel-soft: #1d2330;
  --border: #2a3140;
  --text: #f3f4f6;
  --muted: #98a2b3;
  --accent: #6d5dfc;
  --accent-hover: #5d4ef1;
  --success: #19c37d;
  --warning: #f5a524;
  --danger: #ef4444;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --container: 760px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0a0c11 0%, #11151d 100%);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

input[type="submit"],
input[type="button"],
button,
.button-link,
.asp-button,
.asp-linkbutton {
  cursor: pointer;
}

.app {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 14px 36px;
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #9187ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.screen {
  display: grid;
  gap: 16px;
}

.screen-title h1,
.screen-title h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
}

.screen-title p {
  color: var(--muted);
  font-size: 14px;
}

.panel {
  background: rgba(22, 27, 36, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-head h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.panel-head p {
  color: var(--muted);
  font-size: 13px;
}

.panel-body {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.hero {
  padding: 22px 20px;
  background: radial-gradient(circle at top right, rgba(109, 93, 252, 0.2), transparent 38%), rgba(22, 27, 36, 0.98);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.hero h1,
.hero h2 {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}

.hero p {
  color: var(--muted);
  font-size: 14px;
}

.badge-row,
.actions,
.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  color: #dce2ec;
  font-size: 12px;
}

.badge.success {
  background: rgba(25, 195, 125, 0.12);
  border-color: rgba(25, 195, 125, 0.25);
  color: #bff3da;
}

.badge.warning {
  background: rgba(245, 165, 36, 0.12);
  border-color: rgba(245, 165, 36, 0.25);
  color: #ffd998;
}

.badge.info {
  background: rgba(109, 93, 252, 0.12);
  border-color: rgba(109, 93, 252, 0.25);
  color: #d8d2ff;
}

.btn,
.asp-button,
.asp-linkbutton,
.actions input[type="submit"],
.actions input[type="button"] {
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  min-height: 48px;
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
}

.btn:hover,
.asp-button:hover,
.asp-linkbutton:hover,
.actions input[type="submit"]:hover,
.actions input[type="button"]:hover {
  transform: translateY(-1px);
}

.btn-primary,
.asp-button.btn-primary,
.asp-linkbutton.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.asp-button.btn-primary:hover,
.asp-linkbutton.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary,
.asp-button.btn-secondary,
.asp-linkbutton.btn-secondary {
  background: var(--panel-soft);
  color: #fff;
  border: 1px solid var(--border);
}

.btn-success,
.asp-button.btn-success,
.asp-linkbutton.btn-success {
  background: rgba(25, 195, 125, 0.12);
  color: #bff3da;
  border: 1px solid rgba(25, 195, 125, 0.22);
}

.btn-danger,
.asp-button.btn-danger,
.asp-linkbutton.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ffcaca;
  border: 1px solid rgba(239, 68, 68, 0.22);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(109, 93, 252, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

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

.list-item {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.list-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.pill,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  color: #dce2ec;
  white-space: nowrap;
  text-decoration: none;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.field label {
  font-size: 14px;
  font-weight: 600;
  color: #dce2ec;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: #11151d;
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  outline: none;
  transition: 0.2s ease;
}

.field textarea {
  min-height: 160px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(109, 93, 252, 0.7);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

.helper {
  font-size: 12px;
  color: var(--muted);
}

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

.pairing-card {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.pairing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.table-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(109, 93, 252, 0.12);
  border: 1px solid rgba(109, 93, 252, 0.24);
  color: #ddd8ff;
  font-size: 12px;
  font-weight: 700;
}

.pairing-status {
  font-size: 12px;
  color: var(--muted);
}

.players-stack {
  display: grid;
  gap: 10px;
}

.player-choice {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #11151d;
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
}

.player-choice.active,
.player-choice:hover {
  border-color: rgba(109, 93, 252, 0.34);
  background: rgba(109, 93, 252, 0.12);
}

.player-choice.draw.active,
.player-choice.draw:hover {
  border-color: rgba(245, 165, 36, 0.28);
  background: rgba(245, 165, 36, 0.12);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.result-btn {
  border: 1px solid var(--border);
  background: #11151d;
  color: #fff;
  border-radius: 12px;
  padding: 11px 10px;
  transition: 0.2s ease;
  min-height: 44px;
  text-align: center;
  text-decoration: none;
}

.result-btn.active,
.result-btn:hover {
  border-color: rgba(109, 93, 252, 0.32);
  background: rgba(109, 93, 252, 0.12);
}

.separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.summary-card {
  border: 1px solid rgba(245, 165, 36, 0.24);
  background: rgba(245, 165, 36, 0.08);
  border-radius: 16px;
  padding: 14px;
  color: #ffd998;
  font-size: 13px;
  margin-block: 16px;
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(13, 16, 22, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.message {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 13px;
}

.message.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ffcaca;
  margin-top:16px;
}

.message.success {
  background: rgba(25, 195, 125, 0.1);
  border-color: rgba(25, 195, 125, 0.25);
  color: #c9f7e1;
}

.link-inline {
  color: #d8d2ff;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app {
    padding: 24px 18px 42px;
  }

  .topbar {
    padding-top: 10px;
  }

  .field-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .sticky-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
