:root {
  color-scheme: light;
  --paper: #f7ead0;
  --surface: #fff8eb;
  --ink: #122126;
  --muted: #6d6254;
  --line: #dec9a4;
  --accent: #f47a20;
  --accent-strong: #c65316;
  --danger: #a62929;
  --gold: #ffb23f;
  --road: #152227;
  --shadow: 0 18px 45px rgba(18, 33, 38, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(247, 122, 32, 0.18), rgba(247, 234, 208, 0.96) 28rem),
    linear-gradient(90deg, rgba(18, 33, 38, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 72px 72px, auto;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--road);
  color: white;
  min-height: 44px;
  padding: 0.75rem 1rem;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: #000;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0.75rem 0.85rem;
}

input:focus,
button:focus-visible {
  outline: 3px solid rgba(244, 122, 32, 0.28);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 850;
  text-transform: uppercase;
}

.brand img {
  width: 3.1rem;
  height: 3.1rem;
  border: 2px solid var(--road);
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  background: white;
}

.text-button,
.secondary-button {
  background: transparent;
  color: var(--road);
  border: 1px solid var(--line);
}

.text-button:hover,
.secondary-button:hover {
  background: rgba(244, 122, 32, 0.12);
}

main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.summary {
  display: grid;
  gap: 1.2rem;
  padding: clamp(1.4rem, 5vw, 3.5rem) 0 clamp(1.5rem, 4vw, 3rem);
}

.summary-copy {
  align-self: center;
}

.hero-logo {
  width: min(16rem, 64vw);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  justify-self: start;
  filter: drop-shadow(0 18px 30px rgba(18, 33, 38, 0.14));
}

.intro {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.9rem, 11vw, 6.4rem);
}

h2 {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
}

.totals {
  display: grid;
  gap: 0.8rem;
}

.totals div {
  display: grid;
  gap: 0.2rem;
  padding: 1rem;
  border: 2px solid var(--road);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--road);
}

.totals span,
.amount-label,
.section-heading p,
.status {
  color: var(--muted);
}

.totals strong {
  font-size: clamp(2rem, 9vw, 4.6rem);
  line-height: 1;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}

.section-heading p {
  margin: 0;
  text-align: right;
  font-size: 0.9rem;
}

.leaderboard-section,
.admin-panel {
  padding: 1.5rem 0;
}

.leaderboard {
  display: grid;
  gap: 0.65rem;
}

.leaderboard-row,
.admin-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: center;
  background: rgba(255, 248, 235, 0.92);
  border: 1px solid rgba(18, 33, 38, 0.18);
  border-radius: 8px;
  padding: 0.85rem;
  box-shadow: var(--shadow);
}

.rank {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--road);
  color: white;
  font-weight: 850;
}

.team-main {
  display: grid;
  gap: 0.55rem;
}

.team-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  font-weight: 850;
}

.team-amounts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.amount {
  display: grid;
  gap: 0.1rem;
}

.amount strong {
  font-size: 1.25rem;
}

.amount.primary strong {
  color: var(--accent-strong);
}

.admin-panel {
  border-top: 1px solid var(--line);
}

.login-form,
.team-form {
  display: grid;
  gap: 0.9rem;
  max-width: 680px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.team-form {
  grid-template-columns: 1fr;
  padding: 1rem 0 1.25rem;
}

.team-form label,
.login-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 700;
}

.form-actions,
.row-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.admin-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

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

.row-actions button {
  flex: 1 1 8rem;
}

.delete-button {
  background: var(--danger);
}

.delete-button:hover {
  background: #7c1f1f;
}

.status {
  min-height: 1.5rem;
}

.empty {
  margin: 0;
  padding: 1.25rem 0;
  color: var(--muted);
}

@media (min-width: 700px) {
  .summary {
    grid-template-columns: minmax(0, 1.1fr) minmax(13rem, 0.45fr) minmax(20rem, 0.75fr);
    align-items: center;
  }

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

  .leaderboard-row {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 1rem 1.1rem;
  }

  .team-main {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.8fr);
    align-items: center;
  }

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

  .team-form {
    grid-template-columns: minmax(12rem, 1.2fr) minmax(9rem, 0.8fr) minmax(9rem, 0.8fr) auto;
    align-items: end;
    max-width: none;
  }

  .form-actions {
    min-width: 10rem;
  }

  .admin-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}
