:root {
  color-scheme: light;
  --paper: #f7f7ef;
  --ink: #20392e;
  --muted: #52665b;
  --green: #294b3a;
  --line: #dce4d7;
  --lime: #e1f79e;
  --white: #fffefa;
  --heading: 'Bricolage Grotesque', 'Arial Rounded MT Bold', Arial, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.5 var(--body); }
h1, h2, h3, p, ul, dl { margin: 0; }
h1, h2, h3, .brand { font-family: var(--heading); }
button, textarea, input { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #48814f; outline-offset: 3px; }
.shell { width: min(1140px, calc(100% - 64px)); margin-inline: auto; }
.site-head { border-bottom: 1px solid var(--line); }
.head-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-size: 1.38rem; font-weight: 800; letter-spacing: -.055em; }
.brand-mark { display: block; width: 34px; height: 34px; background: url('/icon.svg') center / contain; }
.nav { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.nav a { padding: 6px 11px; border-radius: 8px; color: var(--muted); font-weight: 650; font-size: .86rem; text-decoration: none; white-space: nowrap; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); background: #e8eedf; }
.hero { min-height: 287px; display: grid; grid-template-columns: 1fr minmax(140px, 28%); align-items: center; gap: 28px; padding: 34px 42px; margin-block: 24px 22px; background: #e8efdd; border: 1px solid #dce6d4; border-radius: 22px; overflow: hidden; }
.hero h1 { max-width: 740px; font-size: clamp(2.45rem, 5.25vw, 4.5rem); line-height: .99; font-weight: 850; letter-spacing: -.075em; text-wrap: balance; }
.hero h1 em { color: #42694c; font-style: normal; }
.hero p { max-width: 510px; margin-top: 16px; color: #3e5647; font-size: 1.06rem; }
.hero-court { width: min(94%, 254px); aspect-ratio: 1.65; position: relative; justify-self: center; background: #335b43; border: 6px solid #d5e3c4; border-radius: 13px; transform: rotate(-13deg); box-shadow: 8px 11px 0 #b8cfae; }
.court-lines, .court-net { position: absolute; inset: 12%; border: 2px solid #c7e298; border-radius: 1px; }
.court-net { inset: 12% 50%; border-width: 0 0 0 2px; }
.court-lines::before { content: ''; position: absolute; inset: 25% 18%; border: 1px solid #c7e298; }
.court-lines::after { content: ''; position: absolute; inset: 50% 18%; border-top: 1px solid #c7e298; }
.court-ball { position: absolute; width: 13px; aspect-ratio: 1; border-radius: 50%; background: #e4ff87; left: 64%; top: 27%; box-shadow: -2px 3px 0 #203f2e; }
.workspace { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); align-items: start; gap: 20px; }
.panel { min-width: 0; padding: 24px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
h2 { font-size: 1.43rem; line-height: 1.2; letter-spacing: -.045em; }
.setup h2 { margin-bottom: 18px; }
form { display: grid; gap: 16px; }
.mode { min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span, .mode legend { margin-bottom: 6px; font-size: .86rem; font-weight: 720; }
.mode-options { display: flex; gap: 4px; padding: 4px; background: #edf0e8; border-radius: 10px; }
.mode-options label { position: relative; flex: 1 1 0; display: grid; cursor: pointer; }
.mode-options input { position: absolute; opacity: 0; }
.mode-options span { display: grid; place-items: center; min-height: 36px; padding: 4px; text-align: center; border-radius: 7px; font-size: .81rem; font-weight: 700; color: var(--muted); }
.mode-options input:checked + span { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px #20392e23; }
.mode-options input:focus-visible + span { outline: 3px solid #48814f; outline-offset: -2px; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field input, textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid #d2dcce; border-radius: 8px; background: #fcfdf8; }
.field input { height: 42px; }
textarea { resize: vertical; }
small { margin-top: 5px; color: var(--muted); font-size: .76rem; }
.fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 11px; }
.field[for="start"] { grid-column: span 2; }
.button { min-height: 43px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; font-size: .87rem; font-weight: 780; }
.button:disabled { opacity: .55; cursor: default; }
.button-primary { width: 100%; justify-content: space-between; background: var(--lime); border-color: #d4e994; }
.button-primary:hover { background: #d5f086; }
.button-primary span { font-size: 1.1rem; }
.button-copy { background: #edf4e6; border-color: #dce8d4; text-align: center; }
.button-copy:not(:disabled):hover { background: #e1eed9; }
.copy-icon { flex: 0 0 12px; height: 13px; position: relative; border: 1.5px solid currentColor; border-radius: 2px; }
.copy-icon::before { content: ''; position: absolute; width: 8px; height: 9px; top: -4px; left: -4px; border-top: 1.5px solid currentColor; border-left: 1.5px solid currentColor; border-radius: 2px; }
.results { scroll-margin-top: 16px; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.results-head p { margin-top: 4px; color: var(--muted); font-size: .84rem; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.summary div { display: flex; flex-direction: column; padding: 8px 11px; background: #f0f3ea; border-radius: 8px; }
.summary dt { color: var(--muted); font-size: .77rem; }
.summary dd { margin: 0; font-size: 1.12rem; font-weight: 780; }
.rounds { display: grid; gap: 9px; max-height: 480px; overflow-y: auto; scrollbar-color: #9daf98 transparent; }
.round { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; }
.round-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 5px; }
.round-head h3 { font-size: .93rem; }
.round-head > span { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.matches { list-style: none; padding: 0; }
.match { display: grid; grid-template-columns: 44px 1fr auto 1fr; align-items: center; column-gap: 8px; padding-block: 4px; font-size: .86rem; }
.court, .versus, .rest { color: var(--muted); font-size: .76rem; }
.side, .rest, #counts li { overflow-wrap: anywhere; }
.rest { padding-top: 4px; border-top: 1px solid #edf0e8; }
.rest span { margin-right: 6px; font-weight: 700; }
details { margin-top: 14px; color: var(--muted); font-size: .86rem; }
details summary { font-weight: 650; }
#counts { padding-top: 6px; padding-left: 22px; }
.notice { margin: 0 0 10px; padding: 8px 10px; border-radius: 7px; color: #344e35; background: #eff3e5; font-size: .85rem; }
#form-error { margin: 0; color: #7b321d; background: #faeee6; }
.copy-text { margin-bottom: 10px; }
.guide { margin-block: 34px 42px; padding: 20px 0; border-top: 1px solid var(--line); }
.guide p { max-width: 720px; margin-top: 8px; color: var(--muted); }
.examples { margin-top: 14px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.examples a { display: inline-block; padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; font-weight: 660; text-decoration: none; }
.examples a:hover { background: #e8eedf; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 800px) {
  .shell { width: min(100% - 32px, 650px); }
  .head-inner { align-items: flex-start; justify-content: center; flex-direction: column; gap: 7px; padding-block: 10px; }
  .nav { gap: 2px; }
  .nav a { padding-inline: 7px; }
  .hero { min-height: 0; padding: 26px 24px; margin-top: 15px; }
  .workspace { grid-template-columns: 1fr; gap: 14px; }
  .rounds { max-height: none; }
}
@media (max-width: 490px) {
  .hero { grid-template-columns: 1fr; padding: 22px 16px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.65rem); text-wrap: initial; }
  .hero p { font-size: .93rem; margin-top: 10px; }
  .hero-court { display: none; }
  .panel { padding: 15px; }
  .results-head { align-items: flex-start; flex-direction: column; }
  .button-copy { width: 100%; }
  .summary div { padding-inline: 8px; }
  .match { grid-template-columns: 38px minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 5px; }
}
