:root {
  color-scheme: light;
  --bg: #eef2e8;
  --ink: #1f2430;
  --muted: #687282;
  --paper: rgba(255, 255, 255, 0.82);
  --line: rgba(31, 36, 48, 0.14);
  --green: #176b5f;
  --red: #d94855;
  --yellow: #edbd3c;
  --blue: #26367b;
  --shadow: 0 18px 44px rgba(31, 42, 54, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(23, 107, 95, 0.18), transparent 38%),
    linear-gradient(315deg, rgba(237, 189, 60, 0.28), transparent 46%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  gap: 16px;
  align-content: center;
  background: #eef2e8;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-ball {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 44%),
    linear-gradient(160deg, #e9463f 0 34%, #f4c744 34% 66%, #167c72 66% 100%);
  animation: pulse-tile 1.4s ease-in-out infinite;
  box-shadow: var(--shadow);
}

@keyframes pulse-tile {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px max(18px, env(safe-area-inset-right)) 28px max(18px, env(safe-area-inset-left));
}

.topbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  text-align: left;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 48%),
    linear-gradient(160deg, #e9463f 0 34%, #f4c744 34% 66%, #167c72 66% 100%);
  color: white;
  font-weight: 950;
  box-shadow: var(--shadow);
}

.brand strong,
.module-card strong,
.hero-panel h1,
.page-head h1 {
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.nav-tabs,
.account-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 24px rgba(31, 42, 54, 0.08);
}

.nav-tabs button,
.nav-tabs a,
.account-card button,
.account-card a,
.hero-actions button,
.primary-action {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  font-weight: 850;
}

.nav-tabs .is-active,
.account-card a,
.primary-action {
  background: var(--ink);
  color: white;
}

.account-card span {
  padding: 0 8px;
  font-weight: 850;
}

.account-card.guest span {
  color: var(--muted);
}

.notice {
  border: 1px solid rgba(237, 189, 60, 0.55);
  border-radius: 8px;
  background: rgba(255, 247, 211, 0.86);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 750;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.7fr);
  gap: 14px;
  margin-bottom: 14px;
}

.hero-panel,
.status-grid article,
.page-head,
.empty-panel,
.work-list article,
.match-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 280px;
  padding: 24px;
  display: grid;
  align-content: end;
  background:
    linear-gradient(140deg, rgba(22, 100, 93, 0.9), rgba(32, 36, 88, 0.86)),
    var(--paper);
  color: white;
}

.eyebrow {
  color: rgba(255, 255, 255, 0.74);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.hero-panel h1,
.page-head h1 {
  margin: 8px 0 8px;
  font-size: clamp(34px, 6vw, 66px);
  line-height: 0.95;
}

.hero-panel p,
.page-head p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero-actions button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: white;
}

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

.status-grid article {
  padding: 18px;
  display: grid;
  align-content: center;
}

.status-grid span,
.status-grid small,
.module-card small,
.match-card small,
.work-list span {
  color: var(--muted);
}

.status-grid strong {
  margin: 4px 0;
  font-size: 26px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.module-card {
  min-height: 160px;
  border-radius: 10px;
  padding: 16px;
  color: white;
  background: linear-gradient(135deg, var(--a), var(--b));
  box-shadow: var(--shadow);
  display: grid;
  align-content: space-between;
}

.module-card strong {
  display: block;
  font-size: 22px;
}

.module-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.78);
}

.module-card em {
  justify-self: start;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px 10px;
  font-style: normal;
  font-weight: 900;
}

.page-head {
  padding: 22px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #25326e, #176b5f);
  color: white;
}

.page-head h1 {
  font-size: clamp(34px, 5vw, 56px);
}

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

.match-card,
.work-list article,
.empty-panel {
  padding: 16px;
}

.match-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.teams-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 14px 0 6px;
  font-size: 22px;
}

.teams-line strong:last-child {
  text-align: right;
}

.teams-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.predict-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.predict-row button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 900;
}

.predict-row button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.predict-row .is-selected {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.stat-bars {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.stat-bars span {
  position: relative;
  min-height: 24px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(31, 36, 48, 0.08);
}

.stat-bars i {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(23, 107, 95, 0.28);
}

.stat-bars b {
  position: relative;
  display: block;
  padding: 4px 10px;
  font-size: 12px;
}

.work-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
}

.work-list strong {
  font-size: 20px;
}

.work-list span {
  grid-column: 1;
}

.work-list a {
  grid-row: 1 / 3;
  grid-column: 2;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  padding: 10px 12px;
  font-weight: 900;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .nav-tabs,
  .account-card {
    justify-self: stretch;
    overflow-x: auto;
  }

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

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

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

@media (max-width: 680px) {
  .app-shell {
    padding: 12px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  }

  .brand strong {
    font-size: 20px;
  }

  .hero-panel {
    min-height: 360px;
    padding: 18px;
  }

  .hero-panel h1,
  .page-head h1 {
    font-size: 38px;
  }

  .status-grid,
  .module-grid,
  .predict-row {
    grid-template-columns: 1fr;
  }

  .teams-line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .teams-line strong:last-child {
    text-align: left;
  }

  .work-list article {
    grid-template-columns: 1fr;
  }

  .work-list span,
  .work-list a {
    grid-column: 1;
    grid-row: auto;
  }
}
