* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #0e3d22 0%, #0e3d22 180px, #eef3ee 180px, #eef3ee 100%);
  background-attachment: fixed;
  color: #1a2b1a;
  min-height: 100vh;
}
header {
  color: #fff;
  padding: 22px 16px 18px;
  text-align: center;
}
header h1 { margin: 0; font-size: 1.6rem; letter-spacing: .5px; }
.subtitle { margin: 4px 0 0; opacity: .8; font-size: .9rem; }
main {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(10, 40, 20, .10);
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }

.tabs {
  display: flex;
  background: #eef3ee;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 12px;
}
.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1rem;
  color: #4a5a4a;
  cursor: pointer;
}
.tab.active { background: #fff; color: #0e3d22; font-weight: bold; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

table.board { width: 100%; border-collapse: collapse; }
table.board td { padding: 12px 8px; border-bottom: 1px solid #eef0ee; font-size: 1rem; }
table.board tr:last-child td { border-bottom: none; }
.rank { width: 36px; font-size: 1.1rem; }
.wins { text-align: left; font-weight: 800; font-size: 1.15rem; color: #0e3d22; width: 60px; }
.wins small { font-weight: normal; color: #8a9a8a; font-size: .75rem; display: block; }
tr.first td { background: #f2f9ec; }
tr.first td:first-child { border-radius: 0 10px 10px 0; }
tr.first td:last-child { border-radius: 10px 0 0 10px; }

.muted { color: #777; font-size: .9rem; text-align: center; }
label { display: block; margin-bottom: 12px; font-size: .95rem; font-weight: 600; }
input[type="date"], select, input[type="text"] {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  font-size: 1rem;
  border: 1.5px solid #d5ddd5;
  border-radius: 10px;
  background: #fbfdfb;
}
.pairs { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.pair { flex: 1; }
.pair h3 { margin: 0 0 6px; font-size: .9rem; color: #4a5a4a; text-align: center; }
.pair select { margin-bottom: 8px; }
.pair2 {
  border: 1.5px dashed #b9c8b9;
  border-radius: 10px;
  padding: 12px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  background: #fbfdfb;
}
.pair2 span { display: block; text-align: center; }
.vs { font-weight: 800; color: #b9c8b9; font-size: .85rem; }
#winner-q { text-align: center; margin: 0 0 10px; font-weight: 600; }
.winner-btns { display: flex; flex-direction: column; gap: 10px; }
.winner-btn {
  padding: 16px 10px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid #1d6b3a;
  border-radius: 12px;
  background: #fff;
  color: #1d6b3a;
  cursor: pointer;
}
.winner-btn:active { background: #1d6b3a; color: #fff; }

button#save-names {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  background: #1d6b3a;
  color: #fff;
  cursor: pointer;
  margin-top: 8px;
}
.link-btn {
  background: none; border: none; color: #1d6b3a;
  font-size: .85rem; cursor: pointer; text-decoration: underline;
}
ul#history { list-style: none; margin: 0; padding: 0; }
ul#history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f2f0;
  font-size: .95rem;
}
ul#history li:last-child { border-bottom: none; }
ul#history .date { color: #8a9a8a; font-size: .85rem; }
ul#history .win { font-weight: bold; color: #1d6b3a; }
ul#history .del {
  background: none; border: none; color: #c33;
  font-size: 1.1rem; cursor: pointer; padding: 4px 8px;
}
.error { color: #b00; font-size: .9rem; min-height: 1.2em; text-align: center; }
#name-inputs input { margin-bottom: 8px; }
