:root {
  color-scheme: dark;
  --page: #101818;
  --panel: #162221;
  --inset: #11201e;
  --muted-panel: #1b2c29;
  --text: #eef8f4;
  --muted: #a3bcb6;
  --line: #354b46;
  --brand: #00c19e;
  --accent-text: #63e6cd;
  --blue: #73dfff;
  --gold: #ffd07b;
  --orange: #ffad70;
  --red: #ff97b1;
  --action: #021c18;
  --shade: #0009;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f6f9f7;
  --panel: #ffffff;
  --inset: #edf5f1;
  --muted-panel: #e3efea;
  --text: #152b25;
  --muted: #48635a;
  --line: #bdcec8;
  --accent-text: #00604f;
  --blue: #005879;
  --gold: #705100;
  --orange: #843c04;
  --red: #a61446;
  --shade: #183d35a6;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 16px/1.5 "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  overflow-wrap: anywhere;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-text); text-underline-offset: 0.2em; }
h1, h2, h3, p { margin: 0; }
p + p { margin-top: .45rem; }
h1, h2, h3 { line-height: 1.2; font-weight: 750; }
h1 { font-size: clamp(1.7rem, 5vw, 2.35rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
strong { font-weight: 750; }
small, .small { font-size: .84rem; }
.frame { width: min(calc(100% - 32px), 68rem); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
  gap: .4rem;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; min-width: 0; }
.brand strong { display: block; font-size: 1.06rem; letter-spacing: .015em; }
.brand small { display: block; color: var(--muted); font-size: .71rem; }
.brand-sign { width: 29px; height: 27px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; transform: skew(-12deg); flex: none; }
.brand-sign i:nth-child(1) { background: #00C19E; border-radius: 3px 0 0 0; }
.brand-sign i:nth-child(2) { background: #FE006B; border-radius: 0 5px 0 0; }
.brand-sign i:nth-child(3) { background: #FF8300; border-radius: 0 0 0 5px; }
.brand-sign i:nth-child(4) { background: #00BEFA; border-radius: 0 0 3px 0; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .47rem .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--muted-panel);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-weight: 650;
  line-height: 1.35;
}
button:hover, .button:hover { border-color: var(--accent-text); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}
button[disabled] { cursor: default; opacity: .52; }
button.primary { color: var(--action); background: var(--brand); border-color: var(--brand); }
button.primary:hover { background: #46d8bd; }
button.quiet { background: transparent; font-size: .83rem; white-space: nowrap; }
button.danger { color: var(--red); }
.main-stack, .stack { display: grid; gap: 1rem; }
.main-stack { gap: 1.08rem; }
.stack.tight { gap: .6rem; }
#app { min-height: 56vh; padding-block: 1.15rem 1.7rem; }
.landing { display: grid; gap: 1.1rem; align-items: start; }
.splash {
  isolation: isolate;
  position: relative;
  overflow: hidden;
  padding: clamp(1.15rem, 5vw, 2.4rem);
  border: 1px solid #295e52;
  border-radius: 16px;
  background: #112620;
  color: #f1f9f5;
}
.splash::before, .splash::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 52%;
  z-index: -1;
}
.splash::before { background: #155343; clip-path: polygon(0 86%, 17% 65%, 32% 68%, 54% 24%, 64% 45%, 81% 13%, 100% 57%, 100% 100%, 0 100%); }
.splash::after { background: #183c35; clip-path: polygon(0 100%, 18% 67%, 31% 84%, 53% 57%, 67% 83%, 89% 46%, 100% 60%, 100% 100%); }
.splash p { color: #c0ddd5; margin-top: .65rem; max-width: 18em; }
.splash .event { color: #71ebce; margin: 0 0 .75rem; font-weight: 700; }
.splash h1 { max-width: 11em; }
.hero-data { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: 1.6rem; font-variant-numeric: tabular-nums; }
.hero-data strong { font-size: 1.1rem; white-space: nowrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; min-width: 0; }
.section-head { display: flex; justify-content: space-between; gap: .7rem; align-items: center; flex-wrap: wrap; }
.field { display: grid; gap: .33rem; min-width: 0; color: var(--text); font-weight: 650; }
.field span + small, .field small { color: var(--muted); font-weight: 400; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .6rem;
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 400;
}
input[type="datetime-local"] { padding-inline: .35rem; max-inline-size: 100%; }
input[readonly], textarea[readonly] { color: var(--muted); }
textarea { resize: vertical; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.field-time { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(81px, .7fr); gap: .4rem; }
.field-group { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: .35rem; }
.field-group legend { font-weight: 700; margin-bottom: .35rem; }
.inline-checkbox { display: flex; align-items: center; gap: .55rem; min-height: 40px; }
.inline-checkbox input { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--brand); }
.form-error { color: var(--red); font-size: .88rem; }
.notice { color: var(--muted); padding: .5rem 0; }
.notice.bad, .red { color: var(--red); }
.muted { color: var(--muted); }
.yellow { color: var(--gold); }
.orange { color: var(--orange); }
.ok, .accent { color: var(--accent-text); }
.actions { display: flex; flex-wrap: wrap; gap: .46rem; align-items: center; }
.actions.grow > * { flex: 1 1 auto; }
.nav-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--page);
}
.nav-tabs button { background: none; border-color: transparent; color: var(--muted); font-size: .92rem; padding-inline: .25rem; min-height: 40px; }
.nav-tabs button[aria-current="page"] { color: var(--text); background: var(--muted-panel); border-color: var(--line); }
.team-line { display: flex; gap: .6rem; align-items: start; justify-content: space-between; }
.team-line h1 { font-size: clamp(1.45rem, 5vw, 2.1rem); }
.team-line p { margin-top: .25rem; }
.status { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 16px; padding: .25rem .5rem; color: var(--muted); font-size: .75rem; width: fit-content; }
.status.signal { color: var(--accent-text); border-color: var(--accent-text); }
.race-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.race-card { display: grid; align-content: start; gap: .24rem; padding: .72rem; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; }
.race-card.primary-card { grid-column: 1 / -1; border-color: var(--accent-text); background: var(--inset); }
.race-card .race-name { font-size: clamp(1.2rem, 5.7vw, 1.9rem); line-height: 1.18; }
.race-card small { color: var(--muted); }
.race-card .arrival { font-size: 1.7rem; color: var(--accent-text); font-weight: 750; font-variant-numeric: tabular-nums; }
.race-card .race-label { font-size: .83rem; font-weight: 650; color: var(--muted); }
.warning { border-left: 3px solid currentColor; }
.warning .big { font-size: clamp(1.35rem, 5vw, 1.75rem); font-weight: 800; }
.warning .small { color: var(--muted); }
.warning .small span { color: var(--text); }
.lead-line { display: grid; gap: .42rem; }
.code-links { display: grid; gap: .55rem; }
.token-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .45rem; }
.schedule, .history, .member-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .48rem; }
.schedule-row, .item {
  display: grid;
  gap: .6rem;
  min-width: 0;
  padding: .58rem;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.schedule-row { grid-template-columns: 2rem minmax(0, 1fr); }
.schedule-row.active { border-color: var(--accent-text); }
.schedule-no {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  font-size: .89rem;
  color: var(--accent-text);
  background: var(--muted-panel);
  font-variant-numeric: tabular-nums;
}
.schedule-body { min-width: 0; display: grid; gap: .35rem; }
.schedule-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: .3rem; }
.schedule-main time { color: var(--accent-text); font-size: 1.02rem; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.schedule-info { display: flex; gap: .2rem .6rem; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.medal { color: var(--gold); }
.night { color: var(--blue); }
.item.member { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.summary { display: grid; gap: .4rem; }
.summary div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.summary dt { font-weight: 700; }
.summary dd { margin: 0; grid-column: 1 / -1; }
.summary dd:nth-child(2) { grid-column: 2; grid-row: 1; }
details > summary { cursor: pointer; font-weight: 700; }
details[open] > summary { margin-bottom: .7rem; }
details ul { padding-left: 1.2rem; margin: .4rem 0 0; }
.history li { border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.rule-lines { margin: 0; padding-left: 1.25em; }
.rule-lines li + li { margin-top: .3rem; }
.footer { border-top: 1px solid var(--line); padding-block: 1.1rem 2rem; color: var(--muted); font-size: .81rem; }
.footer strong { color: var(--text); }
.overlay { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; padding: .75rem; background: var(--shade); overflow: auto; }
.modal { width: min(100%, 33rem); max-height: 94vh; max-height: 94dvh; overflow: auto; }
.modal .title-row { align-items: start; }
.modal .title-row button { min-width: 42px; flex: 0 0 auto; }
.modal .main { margin-top: .75rem; }
.modal .image-out { display: block; width: 100%; height: auto; }
#toast {
  position: fixed;
  inset: auto .55rem calc(.55rem + env(safe-area-inset-bottom));
  margin: auto;
  z-index: 8;
  width: max-content;
  max-width: calc(100% - 1.1rem);
  color: var(--text);
  background: var(--muted-panel);
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line);
}
#toast:empty { display: none; }
#toast:not(:empty) { padding: .6rem .8rem; }
@media (min-width: 42rem) {
  .frame { width: min(calc(100% - 64px), 68rem); }
  #app { padding-top: 1.6rem; }
  .landing { grid-template-columns: minmax(0, 1fr) minmax(0, .76fr); }
  .splash { min-height: 25.5rem; }
  .hero-data { margin-top: 3rem; }
  .panel { padding: 1.18rem; }
  .race-grid { grid-template-columns: 1.2fr 1fr 1fr; }
  .race-card.primary-card { grid-column: auto; }
  .race-card { padding: .95rem; }
  .split-wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: start; }
}
@media (max-width: 23rem) {
  .frame { width: calc(100% - 22px); }
  .topbar-inner { min-height: 62px; }
  .panel { padding: .75rem; }
  .field-pair { gap: .4rem; }
  .actions button { padding-inline: .55rem; }
}
.temporary-copy {
  position: fixed;
  top: 0;
  left: 0;
  max-width: 1px;
  max-height: 1px;
  opacity: 0;
}
