:root {
  --bg-a: #f8f4ea;
  --bg-b: #d7e8f3;
  --ink: #1e2b3a;
  --ink-soft: #42586e;
  --accent: #0f766e;
  --accent-2: #b45309;
  --card: #ffffffd9;
  --line: #a8bfd1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 10% 0%, #fff6dc 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 10%, #d9f2ef 0%, transparent 60%),
    linear-gradient(145deg, var(--bg-a), var(--bg-b));
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.auth-page {
  max-width: 700px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.02em;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.hero-copy {
  max-width: 80ch;
}

.hero p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  backdrop-filter: blur(6px);
}

.info-card {
  border-left: 5px solid var(--accent);
}

.info-card p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.info-card h3 {
  margin: 18px 0 6px;
  font-size: 1rem;
}

.info-steps {
  margin: 0 0 12px;
  padding-left: 24px;
}

.info-steps li {
  margin: 6px 0;
}

.info-card .help {
  margin-bottom: 0;
}

.auth-card {
  max-width: 560px;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
}

label {
  display: block;
  margin: 8px 0 4px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

input,
select,
button {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #8fa9bf;
  font: inherit;
}

button {
  margin-top: 10px;
  cursor: pointer;
  color: #fff;
  border: none;
  background: linear-gradient(120deg, var(--accent), #2563eb);
}

button:hover {
  filter: brightness(1.04);
}

button.secondary {
  background: linear-gradient(120deg, var(--accent-2), #ea580c);
}

button.is-selected {
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 2px #14532d;
  filter: saturate(1.2);
}

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

.logout-corner {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.link-row {
  margin-top: 12px;
}

.link-btn {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(120deg, #2563eb, #4f46e5);
}

.action-links {
  display: grid;
  gap: 10px;
}

.action-links .help {
  margin-bottom: 2px;
}

.action-links-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.action-links .link-btn {
  width: 100%;
  padding: 12px 18px;
  text-align: center;
}

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

.match-item,
.table-item {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
}

.table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-row-text {
  min-width: 0;
}

.table-row-btn {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.table-details {
  margin-top: 10px;
}

.prediction-summary {
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.match-toggle {
  margin-top: 0;
  text-align: left;
}

.match-dropdown {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.prediction-item {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffffcc;
}

.prediction-grid {
  display: grid;
  grid-template-columns:
    52px
    minmax(0, 1fr)
    minmax(0, 1fr)
    minmax(0, 1fr)
    90px
    140px
    minmax(120px, auto);
  column-gap: 16px;
  row-gap: 8px;
  align-items: center;
}

.prediction-header {
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.prediction-header .prediction-cell,
.prediction-header .prediction-result,
.prediction-header .prediction-points,
.prediction-header .prediction-choice,
.prediction-header .prediction-match-id {
  font-weight: 700;
  color: var(--ink-soft);
}

.prediction-match-id {
  font-weight: 700;
  color: var(--ink-soft);
}

.prediction-cell,
.prediction-choice {
  font-family: "Consolas", "Courier New", monospace;
  white-space: nowrap;
}

.prediction-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}

.prediction-cell.is-selected,
.prediction-choice.is-selected {
  color: var(--ink);
  font-weight: 700;
}

.prediction-draw {
  text-align: center;
}

.prediction-choice {
  text-align: right;
}

.prediction-result,
.prediction-points {
  font-family: "Consolas", "Courier New", monospace;
  color: var(--ink-soft);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .prediction-grid {
    grid-template-columns: 52px 1fr 1fr;
  }

  .admin-result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .prediction-result,
  .prediction-points,
  .prediction-choice {
    grid-column: 1 / -1;
    text-align: left;
  }
}

.match-title {
  font-weight: 700;
}

.actions {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

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

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

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

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ink);
}

.toggle-row input {
  width: auto;
}

.admin-result-grid {
  display: grid;
  grid-template-columns: 90px 90px minmax(180px, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
  align-items: end;
}

.admin-result-grid button {
  margin-top: 0;
}

.help {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.team-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.team-group-section {
  margin-top: 10px;
}

.team-group-section h4 {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.playoff-round {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
}

.playoff-round h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.playoff-round-explanation {
  margin: 0 0 12px;
  padding: 9px 11px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--ink);
  background: #ffffffb8;
  font-size: 0.95rem;
  line-height: 1.45;
}

.team-pick-btn {
  margin-top: 0;
}

.team-pick-btn.is-selected {
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 2px #14532d;
  filter: saturate(1.2);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .playoff-round {
    padding: 10px 8px;
  }

  .playoff-round-explanation {
    font-size: 0.92rem;
  }

  .team-pick-grid {
    grid-template-columns: 1fr;
  }
}
