:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #64706b;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --line: #d9ded7;
  --line-strong: #b9c5be;
  --court: #1f7a5c;
  --court-dark: #145440;
  --clay: #c9633f;
  --sky: #2f80a7;
  --gold: #d6a62f;
  --danger: #b93d44;
  --success: #247650;
  --shadow: 0 18px 55px rgba(28, 38, 33, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(31, 122, 92, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(47, 128, 167, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  transition:
    transform 170ms ease,
    box-shadow 170ms ease,
    background 170ms ease,
    border-color 170ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 32, 28, 0.14);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line-strong);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
  padding: 0 10px;
}

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

button.success {
  background: var(--success);
  border-color: var(--success);
}

a {
  color: var(--sky);
}

.app-shell {
  min-height: 100vh;
}

.loading-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--muted);
}

.court-mark,
.court-asset {
  position: relative;
  overflow: hidden;
  background: var(--court);
  border: 3px solid #f5f7f1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.court-mark {
  width: 96px;
  aspect-ratio: 1.5;
  border-radius: 8px;
}

.court-mark::before,
.court-mark::after,
.court-asset::before,
.court-asset::after {
  content: "";
  position: absolute;
  background: #f5f7f1;
}

.court-mark::before,
.court-asset::before {
  inset: 50% 0 auto;
  height: 3px;
}

.court-mark::after,
.court-asset::after {
  inset: 0 auto 0 50%;
  width: 3px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid rgba(23, 32, 28, 0.12);
  background: rgba(247, 244, 238, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.brand p,
.mini-copy,
.muted {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--clay);
}

.status-pill.online::before {
  background: var(--success);
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 24px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 48px) 48px;
}

.auth-gate {
  display: grid;
  min-height: calc(100vh - 75px);
  place-items: center;
  padding: 24px clamp(16px, 4vw, 42px);
}

.auth-stage {
  display: grid;
  width: min(440px, 100%);
  gap: 16px;
}

.auth-stage h2 {
  margin: 4px 0 6px;
  font-size: 2rem;
  line-height: 1;
}

.auth-mark {
  width: 120px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.main {
  display: grid;
  gap: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
}

.panel {
  border: 1px solid rgba(23, 32, 28, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.panel:hover {
  border-color: rgba(23, 32, 28, 0.18);
  box-shadow: 0 22px 60px rgba(28, 38, 33, 0.16);
}

.panel.pad {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2,
.panel-header h3,
.panel-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.panel-body {
  padding: 20px 22px 22px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 1.45rem;
  line-height: 1;
}

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

.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(23, 32, 28, 0.16);
}

.player-card h2,
.player-card h3,
.player-card p {
  min-width: 0;
  margin: 0;
}

.player-card h2,
.player-card h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.court-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(190px, 0.55fr);
  gap: 24px;
  align-items: stretch;
  min-height: 242px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(20, 84, 64, 0.96), rgba(31, 122, 92, 0.94)),
    var(--court-dark);
  color: #fff;
}

.court-panel .mini-copy {
  color: rgba(255, 255, 255, 0.74);
}

.court-panel h2 {
  margin: 8px 0 8px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.court-panel p {
  max-width: 62ch;
}

.court-asset {
  min-height: 190px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 19%, rgba(255, 255, 255, 0.85) 19% 20%, transparent 20% 80%, rgba(255, 255, 255, 0.85) 80% 81%, transparent 81%),
    linear-gradient(0deg, transparent 18%, rgba(255, 255, 255, 0.85) 18% 19.5%, transparent 19.5% 80.5%, rgba(255, 255, 255, 0.85) 80.5% 82%, transparent 82%),
    var(--court);
}

.court-asset .ball {
  position: absolute;
  top: 28%;
  left: 62%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d7f25c;
  box-shadow: 0 0 0 5px rgba(215, 242, 92, 0.16);
}

.config-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.14);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  border: 1px solid rgba(47, 128, 167, 0.25);
  border-radius: 8px;
  background: rgba(47, 128, 167, 0.08);
  padding: 10px 12px;
  color: #1e5e79;
}

.notice.error {
  border-color: rgba(185, 61, 68, 0.3);
  background: rgba(185, 61, 68, 0.08);
  color: var(--danger);
}

.leaderboard,
.match-list,
.highlight-list,
.people-list {
  display: grid;
  gap: 14px;
}

.leaderboard-row,
.person-row,
.match-card,
.highlight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.leaderboard-row,
.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.leaderboard-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: #f1eee7;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.rating {
  font-weight: 900;
  color: var(--court-dark);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.tag {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  background: #f1eee7;
  color: var(--muted);
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tag.live {
  background: rgba(36, 118, 80, 0.12);
  color: var(--success);
}

.tag.warn {
  background: rgba(214, 166, 47, 0.16);
  color: #816017;
}

.tag.bad {
  background: rgba(185, 61, 68, 0.12);
  color: var(--danger);
}

.match-card,
.highlight-card {
  padding: 18px;
}

.match-card header,
.highlight-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.match-card h3,
.highlight-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.match-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 22px 0;
}

.tab {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
  gap: 24px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.score-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.score-chip {
  border-radius: 7px;
  background: #17201c;
  color: #fff;
  padding: 7px 9px;
  font-weight: 800;
}

.pulse-line {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 0 12px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
}

.panel-kicker {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1eee7;
  padding: 4px;
}

.segment {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.segment:hover {
  box-shadow: none;
}

.segment.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 16px rgba(23, 32, 28, 0.12);
}

.google-button {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.google-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
}

.divider-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.divider-label::before,
.divider-label::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.friends-list,
.mini-section {
  display: grid;
  gap: 14px;
}

.mini-section > strong {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.friend-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.friend-row.request {
  border-color: rgba(214, 166, 47, 0.35);
  background: rgba(214, 166, 47, 0.08);
}

.tiny-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.tiny-player strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 900;
}

.highlight-media {
  display: grid;
  min-height: 150px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #e7ebe4;
}

.highlight-media video {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #111;
}

.highlight-placeholder {
  position: relative;
  display: grid;
  min-height: 180px;
  place-items: center;
  background:
    linear-gradient(90deg, transparent 18%, rgba(255, 255, 255, 0.8) 18% 19.5%, transparent 19.5% 80.5%, rgba(255, 255, 255, 0.8) 80.5% 82%, transparent 82%),
    linear-gradient(0deg, transparent 28%, rgba(255, 255, 255, 0.8) 28% 30%, transparent 30% 70%, rgba(255, 255, 255, 0.8) 70% 72%, transparent 72%),
    var(--court-dark);
  color: #fff;
  font-weight: 800;
}

.auth-stack {
  display: grid;
  gap: 16px;
}

.demo-switch {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.compact-copy {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .layout,
  .hero-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .side {
    order: 2;
  }
}

@media (max-width: 760px) {
  .topbar,
  .top-actions,
  .court-panel,
  .match-card header,
  .highlight-card header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .scoreboard,
  .config-grid,
  .form-grid,
  .form-grid.three,
  .court-panel,
  .match-meta {
    grid-template-columns: 1fr;
  }

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

  .leaderboard-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .court-panel h2 {
    font-size: 1.6rem;
  }
}
