:root {
  color-scheme: light;
  font: 100%/1.5 system-ui, sans-serif;
  --blue: #003399;
  --navy: #102449;
  --muted: #435679;
  --line: #c9d6ec;
  color: var(--navy);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.masthead { color: #fff; background: var(--blue); border-bottom: 4px solid #fcdf58; }
.mast-inner, main, .footer { width: min(100% - 2rem, 68rem); margin-inline: auto; }
.mast-inner { min-height: 4.25rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.mast-inner a { color: #fff; text-underline-offset: .25em; }
.brand { font-weight: 850; text-decoration: none; font-size: 1.15rem; }
.brand span { font-weight: 500; margin-inline-start: .4em; }
main { margin-block: clamp(1.5rem, 7vw, 5rem); flex: 1; }
.footer { padding-block: 1.25rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: .55rem 1.15rem; }
.footer a { color: var(--blue); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 6vw, 4.8rem); line-height: 1.02; letter-spacing: -.05em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.2rem, 3vw, 1.65rem); line-height: 1.2; }
p { margin-block: .6rem; }
.start-layout { display: grid; grid-template-columns: 1.22fr 1fr; min-height: 24rem; }
.intro {
  position: relative; overflow: hidden; min-height: 20rem;
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--line);
  border-inline-end: 0; border-radius: 1.4rem 0 0 1.4rem;
  padding: clamp(1.5rem, 5vw, 3.25rem);
}
.intro h1, .intro p { position: relative; z-index: 1; }
.intro p { max-width: 24rem; }
.event-kicker {
  margin: 0 0 .65rem;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.target {
  position: absolute; width: clamp(10rem, 27vw, 22rem); aspect-ratio: 1;
  bottom: -34%; right: -9%; background: #00339926;
  mask: url("/gear.svg") center / contain no-repeat;
}
.panel { background: white; border: 1px solid var(--line); padding: clamp(1.1rem, 4vw, 2.75rem); border-radius: 1.4rem; box-shadow: 0 .6rem 2rem #10244910; }
.start-panel { display: grid; align-content: center; border-radius: 0 1.4rem 1.4rem 0; }
.game, .admin { max-width: 50rem; margin-inline: auto; }
.game h1, .admin h1 { font-size: clamp(1.8rem, 5vw, 3rem); }
form { display: grid; gap: .65rem; margin-top: 1.25rem; }
label { font-weight: 700; }
input, select, button, .button {
  font: inherit; border-radius: .6rem; min-height: 3rem; padding: .6rem .9rem;
  border: 1px solid var(--line);
}
input, select { background: #f9fbff; color: var(--navy); width: 100%; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .3em;
  background: var(--blue); color: white; font-weight: 750; cursor: pointer; text-decoration: none;
  border-color: var(--blue);
}
button:hover, .button:hover { background: #082367; }
.secondary { background: #edf3ff; border-color: var(--line); color: var(--blue); }
.secondary:hover { background: #dce8ff; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[tabindex="-1"]:focus-visible { outline: none; }
.muted { color: var(--muted); font-size: .94rem; }
.ring-grid, .hit-grid { display: grid; gap: .75rem; margin-block: 1.25rem; }
.ring-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ring-choice {
  flex-direction: column; min-height: 8.7rem;
  color: var(--blue); background: #fff; border-color: var(--line);
}
.ring-choice:hover { background: #edf3ff; border-color: var(--blue); }
.ring-choice strong { font-size: 1.75rem; }
.ring-dot { display: block; background: var(--blue); mask: url("/gear.svg") center / contain no-repeat; aspect-ratio: 1; }
.ring-dot.large { width: 3rem; }
.ring-dot.middle { width: 2.45rem; }
.ring-dot.small { width: 1.9rem; }
.game-strip { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
#throw-counter { font-weight: 750; }
.factor { padding: .35rem .7rem; border-radius: .4rem; background: #fcdf58; font-weight: 850; }
.points-block { text-align: center; display: grid; padding: .8rem; background: #edf3ff; border-radius: .9rem; }
.points-block strong { font-size: clamp(3rem, 12vw, 6rem); line-height: 1.05; color: var(--blue); font-variant-numeric: tabular-nums; }
.points-block span { font-weight: 650; }
.hit-grid { grid-template-columns: 1fr 1fr; }
.hit-grid button { min-height: 4.25rem; }
.hit-grid strong { font-size: 1.4rem; }
.throws { padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; }
.throws li { padding: .25rem .55rem; background: #edf3ff; border-radius: .35rem; font-size: .9rem; }
.bottom-actions { margin-top: 1.25rem; }
.notice { padding: .75rem .9rem; background: #fff2b7; border-radius: .5rem; color: #4a3400; }
.error { background: #ffe4e4; color: #761b1b; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.ranking-lists { display: grid; grid-template-columns: 1.15fr 1fr; gap: 1rem; align-items: start; }
.score-list ol { list-style: none; padding: 0; margin-bottom: 0; }
.score-list li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; align-items: center; gap: .55rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.score-list .rank { font-weight: 850; color: var(--blue); }
.score-name { overflow-wrap: anywhere; }
.score-name small { display: block; color: var(--muted); }
@media (max-width: 42rem) {
  .start-layout, .ranking-lists { grid-template-columns: 1fr; }
  .intro { min-height: 11rem; border-radius: 1rem 1rem 0 0; border-inline-end: 1px solid var(--line); border-bottom: 0; }
  .start-panel { border-radius: 0 0 1rem 1rem; }
  .target { bottom: -60%; right: -2%; }
  .ring-grid { gap: .4rem; }
  .ring-choice { min-height: 7rem; padding-inline: .3rem; font-size: .9rem; }
}
.admin-results { margin-top: 2rem; }
.admin-results ol { list-style: none; padding: 0; }
.admin-results li {
  border-top: 1px solid var(--line); padding-block: .7rem;
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.admin-results li div { min-width: 0; overflow-wrap: anywhere; }
.admin-results small { display: block; color: var(--muted); }
.danger { background: #fff1f1; color: #861b2a; border-color: #e7b4bd; }
.danger:hover { background: #ffe2e6; }

.event-label { color: var(--blue); font-weight: 750; }
.event-filter { display: grid; gap: .35rem; max-width: 24rem; margin-bottom: 1rem; }

.ranking-filters, .mode-links { display: flex; flex-wrap: wrap; gap: .75rem 1.15rem; }
.mode-links { margin-block: .8rem 1rem; }
.mode-links a, .info-links a { color: var(--blue); text-underline-offset: .2em; }
.result-card { max-width: 46rem; margin-bottom: 1.15rem; }
.result-card h2 { font-size: clamp(1.45rem, 3.5vw, 2.15rem); overflow-wrap: anywhere; }
#result-detail { color: var(--muted); overflow-wrap: anywhere; }
.result-points { font-size: clamp(2.2rem, 8vw, 4rem); line-height: 1; font-weight: 850; color: var(--blue); }
#copy-status:empty { display: none; }
.display-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.1rem; align-items: start; }
.display-mode main, .stand-mode main { width: min(100% - 2rem, 88rem); margin-block: clamp(1rem, 4vw, 3rem); }
.display-mode .score-list li { font-size: clamp(1.05rem, 3vw, 1.8rem); padding-block: .45rem; }
.display-mode .score-list li small { font-size: .66em; }
.display-mode .footer, .stand-mode .footer { display: none; }
.latest { background: var(--blue); color: #fff; }
.latest p { font-size: clamp(1.35rem, 4vw, 2.3rem); overflow-wrap: anywhere; }
.latest strong { font-size: clamp(2rem, 5vw, 4rem); color: #fcdf58; }
.stand-mode .game { max-width: 68rem; }
.stand-mode .hit-grid button { min-height: clamp(4.5rem, 16vh, 8rem); font-size: 1.45rem; }
.stand-mode .hit-grid strong { font-size: 2rem; }
.info-page section { margin-top: 1.5rem; }
.info-links { padding-inline-start: 1.25rem; }
.info-links li { margin-block: .45rem; }
@media (max-width: 42rem) {
  .display-grid { grid-template-columns: 1fr; }
  .latest { grid-row: 1; }
  .ring-choice small { font-size: .75rem; }
}

#admin-shortcuts { margin-top: 1.25rem; }
.mode-links .button { color: #fff; }
.mode-links .secondary { color: var(--blue); }
.display-overview { color: var(--muted); }
.join-card {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem;
  padding: clamp(.85rem, 3vw, 1.4rem); border: 1px solid var(--line); border-radius: 1rem;
  background: #edf3ff;
}
.join-card img { width: clamp(7rem, 15vw, 10.75rem); height: auto; display: block; }
.join-card a { color: var(--blue); }
.display-side, .display-secondary { display: grid; gap: 1rem; align-content: start; }
.display-secondary { grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); margin-top: 1rem; }
@media (max-width: 42rem) {
  .display-side { grid-row: 1; }
  .latest { grid-row: auto; }
}

.ranking-switch { border: 0; margin: 0; padding: 0; min-width: 0; }
.ranking-switch legend { font-weight: 750; margin-bottom: .35rem; }
.ranking-switch div { display: flex; flex-wrap: wrap; gap: .3rem; }
.ranking-switch label {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  min-height: 2.75rem; padding: .35rem .65rem; border: 1px solid var(--line); border-radius: .5rem;
}
.ranking-switch label:has(input:checked) { color: var(--blue); background: #edf3ff; border-color: var(--blue); }
.ranking-switch input { min-height: auto; width: auto; padding: 0; margin: 0; accent-color: var(--blue); }
#ranking-join { margin-top: 1.5rem; }

.ranking-column { min-width: 0; }
.ranking-switch { margin-bottom: .65rem; }
.ranking-switch .slider {
  position: relative; isolation: isolate; display: grid; gap: 0;
  grid-template-columns: repeat(var(--switch-count), minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: .7rem; background: #edf3ff;
}
.ranking-switch.two { --switch-count: 2; }
.ranking-switch.three { --switch-count: 3; }
.slider::before {
  content: ""; z-index: -1; position: absolute;
  inset: .15rem auto .15rem .15rem;
  width: calc(100% / var(--switch-count) - .3rem);
  border-radius: .5rem; background: var(--blue);
  transform: translateX(var(--shift, 0));
  transition: transform .18s ease;
}
.slider:has(label:nth-child(2) input:checked) { --shift: calc(100% + .3rem); }
.slider:has(label:nth-child(3) input:checked) { --shift: calc(200% + .6rem); }
.slider label {
  justify-content: center; position: relative; text-align: center;
  font-size: .9rem; border: 0; padding-inline: .2rem;
}
.slider label:has(input:checked) { color: #fff; background: transparent; }
.slider label:has(input:focus-visible) { outline: 2px solid #1460c7; outline-offset: -2px; }
.slider input { position: absolute; width: 1px; height: 1px; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .slider::before { transition: none; } }

#group-list-setting {
  width: 100%; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: .6rem;
  resize: vertical; font: inherit; color: var(--navy); background: #f9fbff;
}
.qr-page main { display: grid; place-items: center; align-content: center; gap: .75rem; min-height: calc(100svh - 3rem); text-align: center; }
.qr-page h1 { font-size: clamp(1.7rem, 5vw, 3.2rem); }
.qr-page img { width: clamp(11rem, min(70vw, 55vh), 26rem); height: auto; display: block; }
.qr-page p { margin: 0; }

.fairplay { color: var(--muted); font-size: .92rem; }
#throw-fairplay { margin: .85rem 0 0; }
#throw-fairplay + .hit-grid { margin-top: .55rem; }

.checkbox-option { display: flex; align-items: center; gap: .55rem; min-height: 2rem; }
.checkbox-option input { width: auto; min-height: auto; margin: 0; accent-color: var(--blue); }
