:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #17332d;
  background: #f2f6f3;
}
* {
  box-sizing: border-box;
}
[hidden] { display: none !important; }
body {
  margin: 0;
}
header {
  background: #176b57;
  color: #fff;
  padding: calc(18px + env(safe-area-inset-top)) 20px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
h1 {
  margin: 4px 0;
  font-size: 28px;
}
.brand {
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 800;
}
header p {
  margin: 5px 0 0;
  opacity: 0.9;
}
.header-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 750;
  color: #176b57;
  background: #fff;
}
main {
  max-width: 820px;
  margin: auto;
  padding: 16px 16px 90px;
}
section,
details {
  margin: 0 0 16px;
}
.notice,
.court,
.standing,
.registration-card,
.roster-card,
details {
  background: #fff;
  border: 1px solid #d9e5e0;
  border-radius: 18px;
  padding: 16px;
}
.full-action { width: 100%; margin-top: 12px; }
.device-note { margin-top: 10px; }
.saved-registration { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:8px 10px; margin:0 0 8px; border:1px solid #d9e5e0; border-radius:12px; }
.saved-registration button { padding:7px 10px; background:#edf5f1; }
.roster-card h2 { margin-top:0; }
.roster-card h3 { margin:18px 0 8px; }
.roster-entry { padding:8px 10px; margin:6px 0; border-radius:10px; background:#edf5f1; }
.registration-card h2 {
  margin: 0 0 12px;
}
.registration-card form {
  display: grid;
  gap: 12px;
}
.registration-card label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}
.registration-card input {
  width: 100%;
  border: 1px solid #bfd2ca;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: #17332d;
  background: #fff;
}
.registration-card form button,
.danger-action {
  width: 100%;
  background: #176b57;
  color: #fff;
}
.secondary-action {
  border: 1px solid #bfd2ca;
  color: #176b57 !important;
  background: #fff !important;
}
.danger-action {
  margin-top: 12px;
  background: #9c3a35;
}
.form-note,
.form-message {
  line-height: 1.45;
}
.form-message {
  min-height: 22px;
  margin-top: 10px;
  font-weight: 700;
}
.registration-badge {
  border-radius: 999px;
  padding: 8px 12px;
  background: #dfeee8;
  font-weight: 800;
}
.notice.offline {
  background: #fff4d7;
  color: #6d5614;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.heading h2 {
  margin-right: 12px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.court h3 {
  margin: 0 0 12px;
}
.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  text-align: center;
}
.team {
  background: #edf5f1;
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
}
.score {
  font-size: 25px;
  font-weight: 900;
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  background: #dfeee8;
  border-radius: 999px;
  padding: 8px 12px;
}
.standing {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  margin: 8px 0;
}
.muted {
  color: #667d75;
  font-size: 13px;
}
.section-note {
  margin: -8px 0 12px;
}
details > .section-note {
  margin: 12px 0 22px;
  line-height: 1.5;
}
.mode-tag {
  display: inline-block;
  margin-left: 8px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #edf5f1;
  color: #176b57;
  font-size: 12px;
  font-weight: 750;
}
.completed {
  padding: 16px 0;
  border-bottom: 1px solid #e3ebe7;
  line-height: 1.55;
}
.completed:first-child {
  padding-top: 8px;
}
.completed:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}
.completed br {
  content: "";
  display: block;
  margin-bottom: 4px;
}
.qr-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 20px;
  background: rgba(8, 30, 24, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-mask[hidden] {
  display: none;
}
.qr-dialog {
  width: min(360px, 100%);
  padding: 20px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.24);
}
.qr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  text-align: left;
}
.qr-head h2 {
  margin: 0;
  font-size: 21px;
}
.qr-head button {
  padding: 2px 9px;
  background: #edf5f1;
  font-size: 26px;
  line-height: 1.2;
}
#qrCanvas {
  width: min(280px, 100%);
  height: auto;
  border: 10px solid #fff;
}
.qr-download {
  width: 100%;
  margin-top: 8px;
  background: #176b57;
  color: #fff;
}
footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #d9e5e0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
footer button {
  background: #176b57;
  color: #fff;
}
summary {
  font-weight: 800;
  cursor: pointer;
}
@media print {
  header button,
  footer {
    display: none;
  }
  body {
    background: #fff;
  }
  main {
    padding-bottom: 0;
  }
  .notice {
    display: none;
  }
}
.planned-round {
  background: #fff;
  border: 1px solid #d9e5e0;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
}
.planned-round h3 {
  margin: 0 0 12px;
}
.planned-court {
  background: #edf5f1;
  border-radius: 12px;
  padding: 12px;
  line-height: 1.5;
}
.planned-court small {
  color: #667d75;
}
@media (max-width: 600px) {
  header {
    padding: 14px 16px 16px;
    align-items: flex-start;
  }
  h1 {
    font-size: 24px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }
  .brand {
    font-size: 10px;
  }
  header p {
    font-size: 14px;
    line-height: 1.35;
  }
  header button {
    padding: 9px 10px;
    min-width: 68px;
    flex: none;
  }
  .header-actions {
    flex-direction: column-reverse;
  }
  main {
    padding: 12px 12px 82px;
  }
  h2 {
    font-size: 22px;
    margin: 18px 0 12px;
  }
  .notice,
  .court,
  .standing,
  details,
  .planned-round {
    border-radius: 14px;
    padding: 12px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .pill {
    padding: 7px 10px;
    font-size: 14px;
  }
  footer {
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  footer > span {
    font-size: 11px;
  }
  footer button {
    padding: 9px 10px;
    font-size: 13px;
  }
}
