:root {
  --court: #123d2b;
  --court-deep: #09271b;
  --court-light: #1f6648;
  --lime: #d8ff3e;
  --lime-soft: #efffb0;
  --clay: #d06a38;
  --cream: #e4e9e4;
  --paper: #edf1ed;
  --ink: #14231c;
  --muted: #647168;
  --line: rgba(20, 35, 28, 0.11);
  --shadow: 0 20px 60px rgba(7, 38, 25, 0.13);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(216, 255, 62, 0.18), transparent 24rem),
    linear-gradient(180deg, #dce5dc 0, #e7ebe6 28rem, #e7ebe6 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.36;
  pointer-events: none;
  background-image: linear-gradient(rgba(18, 61, 43, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 61, 43, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(28px, 6vw, 64px);
  margin-bottom: 38px;
  border-radius: var(--radius-xl);
  color: white;
  background:
    linear-gradient(115deg, rgba(7, 39, 27, 0.98), rgba(18, 76, 51, 0.92)),
    var(--court);
  box-shadow: 0 28px 80px rgba(7, 38, 25, 0.28);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 22px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-bottom: 0;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  width: 54%;
  height: 140%;
  right: -13%;
  top: -38%;
  z-index: -1;
  border: 2px solid rgba(216, 255, 62, 0.18);
  border-radius: 50%;
  transform: rotate(-18deg);
}

.hero-copy {
  max-width: 680px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 9px;
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--lime);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 6px rgba(216, 255, 62, 0.12);
  animation: pulse 2s infinite;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.hero h1 span {
  display: inline-block;
  margin: 0 0.06em;
  color: var(--lime);
  font-size: 0.32em;
  font-style: italic;
  letter-spacing: -0.03em;
  transform: translateY(-0.4em);
}

.hero-text {
  max-width: 580px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.65;
}

.hero-mark {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.tennis-ball {
  width: clamp(76px, 10vw, 112px);
  aspect-ratio: 1;
  position: relative;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: inset -18px -15px 25px rgba(70, 100, 0, 0.22), 0 18px 38px rgba(0, 0, 0, 0.24);
  animation: float 4s ease-in-out infinite;
}

.tennis-ball::before,
.tennis-ball::after {
  content: "";
  position: absolute;
  width: 62%;
  height: 88%;
  top: 6%;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}

.tennis-ball::before {
  left: -24%;
}

.tennis-ball::after {
  right: -24%;
}

.section-heading,
.card-heading,
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin: 0 4px 16px;
}

.section-kicker {
  color: var(--clay);
}

.section-heading h2,
.card h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  letter-spacing: -0.04em;
}

.section-icon,
.step-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.section-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--lime-soft);
}

.step-badge {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--court);
  font-size: 0.76rem;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card,
.card {
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(237, 242, 238, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 25px;
  border-radius: var(--radius-lg);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.55s both;
}

.stat-card:nth-child(2) {
  animation-delay: 0.08s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 65px rgba(7, 38, 25, 0.18);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--lime);
}

.stat-card::after {
  content: "MATCH";
  position: absolute;
  right: 18px;
  top: 20px;
  color: rgba(18, 61, 43, 0.13);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.player-name {
  color: var(--court);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.stat-line {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.mini-stat {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #e4ebe5;
}

.mini-stat strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.32rem);
  line-height: 1.2;
  text-overflow: ellipsis;
}

.mini-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
}

.card {
  padding: clamp(20px, 4vw, 30px);
  margin-bottom: 24px;
  border-radius: var(--radius-xl);
}

.card-heading,
.table-head {
  margin-bottom: 24px;
}

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

input,
select {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: 0;
  color: var(--ink);
  background: #e7ece8;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder {
  color: #879087;
}

input:hover,
select:hover {
  background: white;
}

input:focus,
select:focus {
  border-color: var(--court-light);
  background: white;
  box-shadow: 0 0 0 4px rgba(31, 102, 72, 0.11);
}

select {
  cursor: pointer;
}

#matchSets {
  color: var(--court);
  border-color: rgba(31, 102, 72, 0.3);
  background: rgba(216, 255, 62, 0.22);
  font-weight: 850;
}

.third-set-input {
  border-color: rgba(208, 106, 56, 0.35);
  background: rgba(208, 106, 56, 0.07);
  animation: reveal 0.22s ease both;
}

[hidden] {
  display: none !important;
}

.wide {
  grid-column: 1 / -1;
}

button {
  min-height: 52px;
  margin-top: 16px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  color: var(--court-deep);
  background: var(--lime);
  box-shadow: 0 12px 30px rgba(142, 176, 12, 0.2);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(0.97);
  box-shadow: 0 16px 36px rgba(142, 176, 12, 0.28);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  background: var(--paper);
}

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

th {
  color: var(--muted);
  background: #dfe6df;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(216, 255, 62, 0.09);
}

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

.match-score {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.surface-badge {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--court);
  background: #e8f3eb;
  font-size: 0.72rem;
  font-weight: 800;
}

.surface-antuka {
  color: #8b3d1f;
  background: #fae2d4;
}

.surface-tráva {
  color: #285c34;
  background: #dff3d7;
}

@keyframes pulse {
  50% { opacity: 0.55; transform: scale(0.86); }
}

@keyframes float {
  50% { transform: translateY(-10px) rotate(6deg); }
}

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

@keyframes reveal {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .hero {
    min-height: 300px;
  }

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

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

@media (max-width: 640px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding: 10px 0 38px;
  }

  .hero {
    min-height: 285px;
    align-items: flex-end;
    padding: 27px 22px;
    margin-bottom: 30px;
    border-radius: 0 0 26px 26px;
  }

  .hero::before {
    inset: 12px;
  }

  .hero h1 {
    font-size: clamp(3.25rem, 18vw, 5.1rem);
  }

  .hero h1 span {
    display: block;
    width: fit-content;
    margin: 0.3em 0 0.08em;
    transform: none;
  }

  .hero-text {
    margin-top: 18px;
    font-size: 0.92rem;
  }

  .hero-mark {
    display: none;
  }

  .section-heading {
    margin-inline: 4px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 20px;
  }

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

  .mini-stat:nth-child(4),
  .mini-stat:nth-child(5) {
    grid-column: span 1;
  }

  .card {
    padding: 20px 14px;
    border-radius: 22px;
  }

  .card-heading,
  .table-head {
    padding-inline: 5px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  #matchSets,
  #date,
  #surface,
  .wide {
    grid-column: 1 / -1;
  }

  input,
  select {
    min-height: 54px;
    padding-inline: 12px;
    font-size: 16px;
  }

  button {
    width: 100%;
    min-height: 56px;
    margin-top: 14px;
  }

  .history-card {
    padding-inline: 10px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  tbody {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 8px 25px rgba(7, 38, 25, 0.07);
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
    text-align: right;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
  }

  td:nth-child(1),
  td:nth-child(2),
  td:nth-child(3),
  td:nth-child(4),
  td:nth-child(9) {
    grid-column: 1 / -1;
  }

  td:nth-child(9) {
    border-bottom: 0;
  }

  .match-score {
    color: var(--court);
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-button {
  color: var(--court);
  background: transparent;
  border: 1px solid rgba(18, 61, 43, 0.24);
  box-shadow: none;
}

.secondary-button:hover {
  background: rgba(18, 61, 43, 0.07);
  box-shadow: none;
}

.edit-match {
  min-height: 36px;
  margin: 0;
  padding: 0 14px;
  color: var(--court);
  background: rgba(216, 255, 62, 0.45);
  border: 1px solid rgba(18, 61, 43, 0.12);
  box-shadow: none;
  font-size: 0.76rem;
}

.edit-match:hover {
  box-shadow: 0 7px 18px rgba(18, 61, 43, 0.12);
}

.form-card.is-editing {
  outline: 3px solid rgba(216, 255, 62, 0.75);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-actions button {
    margin-top: 4px;
  }

  td:nth-child(10) {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .edit-match {
    width: auto;
    min-height: 40px;
    margin: 0;
  }
}