:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #172126;
  --muted: #60707a;
  --line: #d9e1e5;
  --teal: #0d665f;
  --teal-dark: #084842;
  --coral: #d94d5c;
  --amber: #e2a72e;
  --blue: #315f9f;
  --shadow: 0 18px 45px rgba(16, 35, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(13, 102, 95, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(217, 77, 92, 0.09), transparent 34%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.loading-panel,
.error-panel,
.login-layout,
.table-panel,
.match-row,
.summary-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.loading-panel,
.error-panel {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 6px solid rgba(13, 102, 95, 0.16);
  border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 6px 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.session-box span {
  font-weight: 800;
}

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

.tabs button,
.filters button,
.ghost-button,
.refresh-button,
.primary-button,
.save-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
}

.tabs button.active,
.filters button.active,
.primary-button,
.save-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.refresh-button {
  margin-left: auto;
  border-color: rgba(49, 95, 159, 0.28);
  color: var(--blue);
}

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

.login-layout {
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  gap: 34px;
  padding: 34px;
  overflow: hidden;
}

.login-copy {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px;
  color: #ffffff;
  background:
    linear-gradient(160deg, rgba(8, 72, 66, 0.95), rgba(49, 95, 159, 0.78)),
    radial-gradient(circle at 78% 20%, rgba(226, 167, 46, 0.92), transparent 26%);
  border-radius: 8px;
}

.login-copy .eyebrow {
  color: #ffd66b;
}

.login-panel {
  display: grid;
  gap: 12px;
}

.login-panel label {
  font-weight: 800;
  color: var(--muted);
}

.login-panel input,
.login-panel select,
.prediction-form input,
.prediction-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.form-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
}

.summary-strip div {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #f9fbfc);
}

.summary-strip strong {
  font-size: 1.8rem;
  line-height: 1;
}

.summary-strip span {
  color: var(--muted);
  font-weight: 700;
}

.day-heading {
  margin: 24px 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.match-row {
  display: grid;
  grid-template-columns: 220px minmax(260px, 1fr) minmax(360px, 460px) 116px;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 16px;
}

.match-row.locked {
  box-shadow: none;
}

.match-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.match-number {
  width: fit-content;
  color: #ffffff;
  background: var(--coral);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
}

.match-main {
  min-width: 0;
}

.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.teams strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.teams span {
  color: var(--amber);
  font-weight: 900;
  text-align: center;
}

.match-main p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.prediction-form {
  display: grid;
  grid-template-columns: 64px 14px 64px minmax(118px, 1fr) 84px;
  align-items: center;
  gap: 8px;
}

.prediction-form input {
  width: 64px;
  padding: 0 8px;
  text-align: center;
  font-weight: 900;
}

.prediction-form select {
  min-width: 0;
}

.score-separator {
  text-align: center;
  font-weight: 900;
  color: var(--muted);
}

.match-status {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.match-status strong {
  min-width: 58px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--teal-dark);
  text-align: center;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.current-player td {
  background: rgba(13, 102, 95, 0.07);
}

.empty-state {
  margin: 0;
  padding: 28px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #ffffff;
  background: var(--teal-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 10;
  font-weight: 800;
}

.toast.error {
  background: #9f2432;
}

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

  .login-copy {
    min-height: 260px;
  }

  .match-row {
    grid-template-columns: 1fr;
  }

  .match-status {
    justify-items: start;
  }

  .prediction-form {
    grid-template-columns: 64px 14px 64px minmax(120px, 1fr) 84px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 14px;
  }

  .topbar,
  .session-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .session-box {
    width: 100%;
  }

  .refresh-button {
    margin-left: 0;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .login-layout {
    padding: 16px;
  }

  .prediction-form {
    grid-template-columns: 54px 12px 54px;
  }

  .prediction-form input {
    width: 54px;
  }

  .prediction-form select,
  .prediction-form button {
    grid-column: 1 / -1;
    width: 100%;
  }
}
