:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f3f5;
  --text: #151922;
  --muted: #697386;
  --line: #e4e7ec;
  --strong: #111827;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --radius: 18px;
  --shadow: 0 16px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 44px);
  background: rgba(246, 247, 249, 0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(228, 231, 236, 0.85);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand img {
  width: 36px;
  height: 36px;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
}

.auth-hero {
  display: flex;
  align-items: center;
  padding: 56px clamp(24px, 6vw, 84px);
  background: #111827;
  color: #ffffff;
}

.auth-hero h1 {
  max-width: 600px;
  margin: 24px 0 16px;
  font-size: clamp(42px, 6vw, 74px);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.auth-hero p {
  max-width: 520px;
  margin: 0;
  color: #d1d5db;
  font-size: 18px;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  padding: 32px;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  background: var(--surface-soft);
  border-radius: 14px;
  margin-bottom: 22px;
}

.auth-tabs button,
.tab-button {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.auth-tabs button.is-active,
.tab-button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 16px;
  font-size: 23px;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 10px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

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

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.04);
  padding: 20px;
}

.card.tight {
  padding: 14px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card strong {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -0.05em;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 13px;
  padding: 12px 13px;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 11px 15px;
  background: var(--strong);
  color: #ffffff;
  text-decoration: none;
  font-weight: 750;
  line-height: 1;
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn.small {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.btn:disabled,
input:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

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

.pool-list {
  display: grid;
  gap: 12px;
}

.pool-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.pool-item:hover {
  border-color: #cbd5e1;
}

.pool-item p,
.match-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 22px 0 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td.number,
th.number {
  text-align: right;
}

.rank-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #111827;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
}

.match-list {
  display: grid;
  gap: 14px;
}

.match-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 18px;
  padding: 18px;
}

.match-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.match-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.score-inputs {
  display: grid;
  grid-template-columns: 86px auto 86px auto;
  gap: 10px;
  align-items: end;
  max-width: 420px;
}

.score-sep {
  align-self: center;
  color: var(--muted);
  font-weight: 800;
  padding-top: 20px;
}

.guess-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.guess-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 14px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
}

.center-state {
  min-height: 60vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--strong);
  animation: spin 800ms linear infinite;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 14px;
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 860px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 36vh;
  }

  .grid.two,
  .grid.three,
  .form-row {
    grid-template-columns: 1fr;
  }

  .page-head,
  .match-head,
  .pool-item {
    flex-direction: column;
    align-items: stretch;
  }

  .score-inputs {
    grid-template-columns: 1fr auto 1fr;
  }

  .score-inputs .btn {
    grid-column: 1 / -1;
  }

  .userbar span {
    display: none;
  }
}

.btn.danger {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(180, 35, 24, 0.22);
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #ffffff;
}

.admin-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-item-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.edit-panel {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.edit-panel summary {
  width: fit-content;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
  margin-bottom: 12px;
}

.score-inline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.score-inline span {
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 860px) {
  .admin-item-head {
    flex-direction: column;
    align-items: stretch;
  }
}
