:root {
  --ink: #13231f;
  --felt: #123c32;
  --felt-deep: #0b2d26;
  --cream: #f4f0e6;
  --paper: #fffdf8;
  --orange: #ef6a35;
  --orange-dark: #c94d20;
  --muted: #73817c;
  --line: #dcd9cf;
  --success: #2f7d5c;
  --danger: #b64337;
  --shadow: 0 24px 80px rgba(9, 35, 29, 0.14);
}

* {
  box-sizing: border-box;
}
html {
  background: var(--cream);
  color: var(--ink);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}
body {
  margin: 0;
  min-height: 100vh;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.brand-panel {
  position: relative;
  overflow: hidden;
  background: var(--felt);
  color: var(--cream);
  padding: clamp(36px, 7vw, 100px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand-panel::after {
  content: '';
  position: absolute;
  width: 55vw;
  height: 55vw;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  right: -30vw;
  bottom: -26vw;
  box-shadow:
    0 0 0 90px rgba(255, 255, 255, 0.025),
    0 0 0 180px rgba(255, 255, 255, 0.018);
}
.brand-mark {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #101816;
  border: 4px solid var(--cream);
  display: grid;
  place-items: center;
  margin-bottom: 48px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.brand-mark span {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: white;
  color: #111;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.eyebrow,
.form-kicker,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 800;
}
.eyebrow {
  color: #9fbbb0;
}
.brand-panel h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.04em;
  margin: 12px 0 24px;
  max-width: 760px;
}
.brand-copy {
  color: #c9d7d1;
  font-size: 17px;
  line-height: 1.7;
  max-width: 560px;
}
.table-line {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 60px;
}
.table-line::before {
  content: '';
  width: 120px;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
}
.table-line i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
}
.table-line i:nth-child(2) {
  background: #f1cb4a;
}
.table-line i:nth-child(3) {
  background: #3477be;
}
.table-line i:nth-child(4) {
  background: #934d99;
}
.table-line i:nth-child(5) {
  background: #eee;
}
.auth-panel {
  background: var(--cream);
  display: grid;
  place-items: center;
  padding: 32px;
}
.auth-card {
  width: min(440px, 100%);
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin-bottom: 42px;
}
.auth-tab {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 16px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
}
.auth-tab.active {
  color: var(--ink);
  border-color: var(--orange);
}
.auth-form {
  display: grid;
  gap: 20px;
}
.auth-form h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 40px;
  margin: 5px 0 12px;
}
.form-kicker {
  color: var(--orange-dark);
  margin: 0;
}
label {
  display: grid;
  gap: 8px;
  color: #344740;
  font-size: 13px;
  font-weight: 700;
}
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  padding: 14px 15px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
input:focus,
select:focus {
  border-color: var(--felt);
  box-shadow: 0 0 0 3px rgba(18, 60, 50, 0.1);
}
.primary-button {
  border: 0;
  border-radius: 4px;
  background: var(--orange);
  color: white;
  padding: 16px 18px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 28px rgba(239, 106, 53, 0.24);
}
.primary-button:hover {
  background: var(--orange-dark);
}
.form-error {
  min-height: 20px;
  margin: -8px 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
}
.app-header {
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 230, 0.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.08em;
  font-size: 13px;
}
.logo-ball {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.desktop-nav {
  display: flex;
  gap: 10px;
}
.nav-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}
.nav-link.active,
.nav-link:hover {
  color: var(--ink);
  background: rgba(18, 60, 50, 0.08);
}
.profile-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
}
.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 50%;
}
.workspace {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 28px 100px;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 32px;
}
.page-heading h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(38px, 5vw, 60px);
  margin: 4px 0 0;
  letter-spacing: -0.03em;
}
.page-heading p {
  color: var(--muted);
  margin: 0;
}
.recent-heading {
  margin-top: 42px;
}
.recent-heading h1 {
  font-size: 34px;
}
.section-label {
  color: var(--orange-dark);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 20px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 12px 36px rgba(31, 55, 47, 0.055);
}
.new-match-panel {
  background: var(--felt);
  color: white;
  border: 0;
  position: relative;
  overflow: hidden;
}
.new-match-panel::after {
  content: '8';
  position: absolute;
  right: -16px;
  bottom: -80px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 240px;
  color: rgba(255, 255, 255, 0.035);
}
.new-match-panel h2,
.panel h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  margin: 6px 0 22px;
}
.match-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 150px auto;
  gap: 12px;
  align-items: end;
}
.match-form label {
  color: #d8e4df;
}
.match-form select {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.18);
}
.match-form option {
  color: var(--ink);
}
.match-form .primary-button {
  height: 48px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-card strong {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 44px;
}
.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-card.featured {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}
.stat-card.featured span {
  color: rgba(255, 255, 255, 0.75);
}
.match-list,
.player-list {
  display: grid;
  gap: 12px;
}
.match-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 20px;
}
.player-side {
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-side.right {
  justify-content: flex-end;
  text-align: right;
}
.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dfe9e4;
  color: var(--felt);
  font-weight: 800;
}
.score {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 34px;
  min-width: 84px;
  text-align: center;
}
.match-meta {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.status {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 99px;
  background: #e5eee9;
  color: var(--success);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.status.pending {
  background: #f7eadc;
  color: #a75a2f;
}
.status.completed {
  background: #e9e8e2;
  color: #68736e;
}
.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.small-button {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 800;
}
.small-button.accent {
  color: white;
  background: var(--orange);
  border-color: var(--orange);
}
.small-button.danger {
  color: var(--danger);
}
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty .empty-ball {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 800;
}
.player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.player-card-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.player-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.mobile-nav {
  display: none;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink);
  color: white;
  padding: 14px 18px;
  border-radius: 5px;
  box-shadow: var(--shadow);
  transform: translateY(120px);
  opacity: 0;
  transition: 0.25s;
  z-index: 50;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.error {
  background: var(--danger);
}
.loading {
  padding: 70px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .brand-panel {
    min-height: 42vh;
    padding: 40px 28px;
  }
  .brand-mark {
    margin-bottom: 22px;
  }
  .brand-panel h1 {
    font-size: 48px;
  }
  .brand-copy {
    font-size: 14px;
  }
  .table-line {
    display: none;
  }
  .auth-panel {
    padding: 42px 24px 60px;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .match-form {
    grid-template-columns: 1fr 120px;
  }
  .match-form .primary-button {
    grid-column: 1/-1;
  }
  .match-card {
    grid-template-columns: 1fr auto 1fr;
  }
  .match-card .actions {
    grid-column: 1/-1;
  }
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 640px) {
  .app-header {
    height: 64px;
    padding: 0 16px;
  }
  .desktop-nav {
    display: none;
  }
  .profile-menu #header-user {
    display: none;
  }
  .workspace {
    padding: 30px 16px 100px;
  }
  .page-heading {
    align-items: start;
    flex-direction: column;
  }
  .page-heading h1 {
    font-size: 42px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stats-grid .stat-card:first-child {
    grid-column: 1/-1;
  }
  .panel {
    padding: 19px;
  }
  .match-form {
    grid-template-columns: 1fr;
  }
  .match-form .primary-button {
    grid-column: auto;
  }
  .match-card {
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    padding: 16px 12px;
  }
  .player-side {
    flex-direction: column;
    text-align: center;
  }
  .player-side.right {
    flex-direction: column-reverse;
    text-align: center;
  }
  .score {
    font-size: 28px;
    min-width: 54px;
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 7px 8px max(7px, env(safe-area-inset-bottom));
  }
  .mobile-nav .nav-link {
    display: grid;
    gap: 2px;
    place-items: center;
    font-size: 10px;
  }
  .mobile-nav .nav-link span {
    font-size: 15px;
  }
}
