* { box-sizing: border-box; }
:root { font: 100% system-ui, sans-serif; color-scheme: dark; background: #101c2b; color: #eef6ff; }
body { margin: 0; }
main { max-width: 57rem; margin: auto; padding: clamp(.75rem, 4vw, 2rem); }
header, footer, nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
header { justify-content: space-between; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 5vw, 2.5rem); }
h2 { font-size: 1.2rem; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid #50667e; border-radius: .65rem; min-height: 2.75rem; padding: .45rem .7rem; background: #263b52; color: inherit; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid #f6cb67; outline-offset: 2px; }
.primary, [aria-current=true], .shot { background: #75e2d4; border-color: transparent; color: #102933; font-weight: 750; }
#status { color: #bdd0e1; margin: .5rem 0; }
#teams { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: clamp(.4rem, 2vw, 1rem); margin-block: 1rem; }
.team, .summary { background: #192b3e; border: 1px solid #364e67; border-radius: .9rem; padding: clamp(.5rem, 2.4vw, 1rem); }
.team { display: grid; align-content: start; gap: .55rem; overflow-wrap: anywhere; }
.score { font-size: clamp(2.5rem, 9vw, 4rem); font-weight: 800; line-height: 1; }
.shot { min-height: 4rem; font-size: 1.1rem; }
.meta { color: #bdd0e1; }
#stats { display: grid; gap: 1rem; margin-top: .8rem; }
.scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .55rem .45rem; border-bottom: 1px solid #364e67; }
dialog { width: min(26rem, calc(100% - 2rem)); background: #192b3e; color: inherit; border: 1px solid #50667e; border-radius: .9rem; padding: 1rem; }
dialog::backdrop { background: #07111dcc; }
form, label { display: grid; gap: .6rem; }
form { gap: .9rem; }
input, textarea { width: 100%; border: 1px solid #50667e; border-radius: .45rem; padding: .65rem; background: #101c2b; color: inherit; }
textarea { margin-top: .75rem; min-height: 10rem; }
footer { justify-content: flex-end; }

#view { display: inline-flex; flex-wrap: nowrap; gap: .15rem; margin: 0 0 .45rem; padding: .125rem; border-radius: .6rem; background: #192b3e; }
#view button { min-height: 2rem; padding: .15rem .65rem; border: 0; border-radius: .45rem; background: transparent; font-size: .875rem; touch-action: manipulation; }
#view button[aria-pressed=true] { background: #75e2d4; color: #102933; font-weight: 750; }
#teams.single-team { grid-template-columns: minmax(0, 1fr); }

summary { cursor: pointer; min-height: 2.75rem; padding-block: .5rem; font-size: 1.15rem; font-weight: 700; }
#copy { margin-top: .8rem; }
.corrections { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .35rem; }
.corrections button { padding-inline: .2rem; }
@media (max-width: 480px) {
  main { padding: max(.7rem, env(safe-area-inset-top)) max(.65rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(.65rem, env(safe-area-inset-left)); }
  #status { font-size: .875rem; }
  #teams { margin-block: .7rem; }
  .team h2 { font-size: 1.05rem; }
  .team button { touch-action: manipulation; min-height: 2.85rem; }
  .team .shot { min-height: 4.5rem; font-size: 1.25rem; }
  .single-team .team .shot { min-height: 5.5rem; font-size: 1.45rem; }
  .team .meta, .corrections button { font-size: .875rem; }
}

.save-rate { font-variant-numeric: tabular-nums; }
.save-rate p { white-space: nowrap; font-size: clamp(.72rem, 3.1vw, .875rem); }

#side-panel:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .65rem; }
#side-target { overflow-wrap: anywhere; }
#switch-side { flex-shrink: 0; }
#view { max-width: 100%; }
@media (max-width: 360px) { #view button { padding-inline: .45rem; } }

#periods[hidden], #teams[hidden], #summary-toggle[hidden] { display: none; }
#view button { padding-inline: clamp(.3rem, 1.5vw, .65rem); white-space: nowrap; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: .25rem; margin-bottom: .45rem; }
.topbar #view { min-width: 0; margin: 0; overflow-x: auto; }
#new { flex: none; min-height: 2.25rem; padding: .15rem .5rem; border: 0; background: #f6cb67; color: #261d0a; font-size: .875rem; font-weight: 750; white-space: nowrap; }
@media (max-width: 400px) {
  .topbar #view { gap: 0; }
  .topbar #view button, #new { padding-inline: .35rem; }
}

.page-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; color: #bdd0e1; font-size: .875rem; }
.page-tools label { display: flex; align-items: center; gap: .45rem; }
.page-tools select, #install { min-height: 2.5rem; padding: .25rem .45rem; color: inherit; background: transparent; border: 0; font: inherit; }
#install { text-decoration: underline; }
#install-help ol { padding-left: 1.4rem; }
#install-help li { margin-block: .6rem; }

.app-description { margin-top: .65rem; color: #bdd0e1; font-size: .875rem; }
