:root {
  --bg: #f3f7f5;
  --ink: #11242f;
  --muted: #4f6a79;
  --line: #d9e4e9;
  --card: #ffffff;
  --brand: #0f6c99;
  --brand-2: #ffaf1a;
  --good: #0d9c72;
  --warn: #cd7e00;
  --danger: #d74949;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, #eef5f9 0%, #f9fbf8 45%, #ebf5f0 100%);
}

.mesh {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 15% 10%, rgba(72, 173, 223, 0.24), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(255, 181, 79, 0.2), transparent 35%),
    radial-gradient(circle at 20% 85%, rgba(16, 156, 113, 0.18), transparent 35%);
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 14px 30px rgba(11, 58, 87, 0.08);
  animation: rise 360ms ease both;
}

@keyframes rise {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  background:
    linear-gradient(120deg, rgba(13, 74, 112, 0.95), rgba(17, 110, 163, 0.9)),
    linear-gradient(30deg, rgba(255, 176, 34, 0.16), transparent 50%);
  color: #f4fbff;
  border: 0;
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -80px;
  top: -90px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 190, 77, 0.75), transparent 66%);
}

.topbar .muted {
  color: rgba(229, 245, 255, 0.92);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ccecff;
  font-weight: 700;
  font-size: 0.75rem;
}

h1 {
  margin: 0.2rem 0;
  font-size: clamp(1.4rem, 4vw, 2.5rem);
}

h2 {
  margin: 0 0 0.65rem;
}

h3 {
  margin: 0 0 0.5rem;
}

label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
}

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

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.52rem 0.8rem;
  background: linear-gradient(100deg, var(--brand), #2683b4);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: #eaf2f7;
  color: var(--ink);
}

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

.controls {
  display: flex;
  gap: 0.6rem;
  align-items: end;
  position: relative;
  z-index: 1;
}

.hero-mark {
  min-width: 220px;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(214, 239, 255, 0.42);
  backdrop-filter: blur(4px);
  position: relative;
  z-index: 1;
}

.hero-mark strong {
  font-size: 1.05rem;
}

.hero-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 0.35rem;
}

.dot-a { background: #44e2a8; }
.dot-b { background: #ffd16e; }
.dot-c { background: #8ed5ff; }
}

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

.motd pre {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.35;
  background: #f8fbfd;
  border: 1px dashed var(--line);
  padding: 0.85rem;
  border-radius: 10px;
}

#snapshot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

#snapshot .pill {
  background: #eff6fa;
  border: 1px solid var(--line);
  color: #27465a;
}

canvas {
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(180deg, #f5f9fc 0%, #ffffff 100%);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

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

.game-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0.7rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.team-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.team-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #d7e5ef;
  background: #fff;
  object-fit: cover;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill.open {
  background: #e8fbf3;
  color: #0f8a67;
}

.pill.closed {
  background: #fff4e8;
  color: #b36600;
}

.score-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.tipoff {
  margin: 0.2rem 0 0.6rem;
  color: var(--muted);
}

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

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

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

th {
  color: var(--muted);
}

tr:hover td {
  background: #f8fbff;
}

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

.admin form {
  display: grid;
  gap: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  background: #fcfeff;
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
  }

  .controls {
    width: 100%;
  }

  .controls label,
  .controls select,
  .controls button {
    flex: 1;
  }
}
