:root {
  color-scheme: light;
  --forest: #153b2f;
  --forest-deep: #102e25;
  --green: #295b46;
  --ink: #1c3129;
  --muted: #58665a;
  --gold: #e4bd72;
  --paper: #fffdf6;
  --ground: #f1eee3;
  --line: #dedacd;
  --serif: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #ad792b; outline-offset: 3px; }

.wrap { width: min(1060px, calc(100% - 64px)); margin-inline: auto; }
.top { background: var(--forest-deep); color: var(--paper); border-bottom: 1px solid #b79854; }
.top-inner { min-height: 74px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: #fff9e8; min-height: 44px; }
.brand-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #b79854; border-radius: 50%; color: #eac782; font-size: 20px; }
.brand-name { display: flex; flex-direction: column; font: 700 18px/1.2 var(--serif); white-space: nowrap; }
.brand-name small { margin-top: 4px; color: #eac782; font: 700 9px/1.1 var(--sans); letter-spacing: .2em; }
.top nav { display: flex; margin-left: auto; align-items: center; gap: 7px; }
.top nav a { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 5px 11px; border-radius: 7px; color: #eee9d9; font-size: 14px; white-space: nowrap; }
.top nav a[aria-current="page"] { color: #f6d998; background: #ffffff13; box-shadow: inset 0 -2px #e4bd72; }
.nav-icon { display: block; width: 20px; color: inherit; text-align: center; font: 600 17px/1 var(--sans); }
.ghost, .subtle { min-height: 44px; border: 1px solid #b9c2b3; border-radius: 8px; background: #f7f7ee; padding: 7px 13px; color: var(--forest); white-space: nowrap; font-size: 14px; font-weight: 700; }
.ghost { color: #f7dfa8; border-color: #a88b55; background: transparent; }
.subtle:hover { background: #e7ecdf; }
.ghost:hover { background: #ffffff13; }
.primary { min-height: 46px; background: var(--forest); color: #fffdf6; border: 1px solid transparent; border-radius: 8px; padding: 10px 17px; font-weight: 750; }
.primary:hover { filter: brightness(1.12); }
.primary.gold { background: var(--gold); color: #1d332a; }

.hero {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
  min-height: 328px;
  border: 1px solid #45634b;
  border-radius: 18px;
  margin-top: 28px;
  color: #fff9e8;
  background: #263f30;
}
.landscape {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #102d24f5 0%, #102d24b3 32%, #102d2433 61%, transparent 100%),
    url("/reserve.webp") 65% 56% / cover no-repeat,
    radial-gradient(ellipse at 80% 30%, #8b7e44, #234638 72%);
}
.hero-text { padding: 38px 44px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; font-size: 11px; font-weight: 800; letter-spacing: .15em; color: #f0ce8a; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
.hero h1 { margin: 0; font: 800 clamp(38px, 5.9vw, 66px)/1.08 var(--serif); letter-spacing: .01em; }
.hero h1 span { display: block; margin-top: 5px; color: #edcb83; font-size: .62em; letter-spacing: .14em; }
.hero-copy { margin: 13px 0 18px; color: #f5f0e0; font-size: 14px; }
.hero .primary { margin-top: 1px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; margin: 14px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.stats > div { background: var(--paper); padding: 11px 19px 10px; }
.stats span { display: block; color: var(--muted); font-size: 12px; }
.stats strong { font: 700 32px/1.15 Georgia, var(--serif); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stats small { margin-left: 5px; color: var(--muted); font-size: 12px; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 23px; }
.league-page { margin-top: 18px; }
.stats:not([hidden]) + .league-page { margin-top: 0; }
.section-head, .dialog-head, .dialog-sub { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-head { margin-bottom: 14px; }
.section-head h2, .dialog-head h2 { margin: 0; font: 800 25px/1.2 var(--serif); }
.section-head p, .note { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-width: 430px; background: #edece1; padding: 4px; border: 1px solid #e3dfd1; border-radius: 9px; margin-bottom: 14px; }
.tabs button { min-height: 44px; border: 0; border-radius: 6px; padding: 7px 4px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 750; }
.tabs button[aria-pressed="true"] { background: var(--forest); color: #fff3d5; }
.empty { display: grid; justify-items: center; align-content: center; text-align: center; min-height: 142px; padding: 14px; border: 1px dashed #b7c2ad; border-radius: 9px; background: #f1f3e9; }
.empty::before { content: "✧"; display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 5px; border: 1px solid #b7c2ad; border-radius: 50%; color: var(--green); line-height: 1; }
.empty strong { font-size: 15px; }
.empty p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.status { color: var(--muted); margin: 14px 0; padding: 10px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; }

table { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { font-size: 12px; color: var(--muted); white-space: nowrap; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.points { color: var(--green); font-weight: 850; font-size: 16px; }
.rank { color: var(--green); font-weight: 800; }
.rank span { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #e9eee3; }
.rank[data-rank="1"] span { color: #5c3915; background: #edd49a; }
.rank[data-rank="2"] span { color: #394b48; background: #dce4df; }
.rank[data-rank="3"] span { color: #643c24; background: #e8d5bf; }
.match-row { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 9px; overflow: hidden; }
.match-row summary { cursor: pointer; padding: 12px; font-weight: 750; overflow-wrap: anywhere; }
.match-row summary time { display: block; font-size: 12px; font-weight: 450; margin-left: 16px; color: var(--muted); }
.match-row[open] summary { background: #f0f3e9; }
.match-detail { margin: 1px 9px 10px; }
.match-detail .subtle { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 11px; border: 1px solid #d5ddd0; border-radius: 7px; background: #eef3e9; color: var(--green); overflow-wrap: anywhere; }
.rule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.rule-grid > div { padding: 12px 16px; background: #f1f3e9; border: 1px solid #dce2d3; border-top: 3px solid #68836a; border-radius: 9px; }
.rule-grid > div + div { background: #f8f1dd; border-color: #e8dbb9; border-top-color: #b78839; }
.rule-grid h3, .dialog-sub h3 { margin: 0 0 4px; font-size: 15px; }
.rule-grid dl { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 6px 0; font-size: 14px; }
.rule-grid dd { margin: 0; font-weight: 800; }
footer { padding: 18px 0 25px; color: var(--muted); font-size: 12px; }

dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; border: 1px solid #aab5a4; border-radius: 15px; background: var(--paper); color: var(--ink); padding: 19px; }
dialog::backdrop { background: #0b241ccb; }
.dialog-head { margin-bottom: 12px; }
.close { flex: 0 0 44px; height: 44px; border: 0; border-radius: 8px; background: #edf1e8; color: var(--ink); font-size: 24px; line-height: 1; }
.form-grid, .entrant { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 9px; margin-bottom: 8px; }
.entrant { padding: 7px; border: 1px solid #e4e2d5; border-radius: 8px; background: #f7f6ee; }
.dialog-sub { margin: 10px 0 7px; }
label { display: block; min-width: 0; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-width: 0; min-height: 44px; border: 1px solid #aabcab; border-radius: 7px; background: #fff; color: var(--ink); padding: 6px 8px; margin-top: 4px; font-size: 16px; }
dialog .primary { width: 100%; margin-top: 9px; }
.form-error { color: #962d26; font-size: 14px; margin: 7px 0; }
.form-error:empty { display: none; }
#score-preview { margin-top: 9px; }
body:has(dialog[open]) { overflow: hidden; }

@media (max-width: 700px) {
  .wrap { width: calc(100% - 28px); }
  .top-inner { min-height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); justify-content: space-between; gap: 8px; }
  .brand { gap: 8px; }
  .brand-icon { width: 33px; height: 33px; }
  .brand-name { font-size: 16px; }
  .ghost { font-size: 13px; min-height: 44px; padding-inline: 10px; }
  .top nav {
    position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 3px;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: #102e25f8; border-top: 1px solid #9a8150;
  }
  .top nav a { min-height: 49px; flex-direction: column; justify-content: center; gap: 4px; padding: 4px 1px; font-size: 11px; line-height: 1.2; }
  .top nav a[aria-current="page"] { box-shadow: inset 0 2px #e4bd72; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .hero { margin-top: 11px; min-height: 222px; border-radius: 13px; }
  .hero-text { padding: 21px 15px; }
  .hero h1 { font-size: clamp(35px, 9.5vw, 50px); }
  .hero-copy { margin: 10px 0 12px; font-size: 12px; }
  .eyebrow { font-size: 10px; margin-bottom: 8px; }
  .landscape { background-position: center, 70% 54%, center; }
  .stats { margin: 10px 0; border-radius: 10px; }
  .stats > div { padding: 8px 7px; }
  .stats span { font-size: 11px; white-space: nowrap; }
  .stats strong { font-size: 26px; }
  .stats small { margin-left: 3px; font-size: 10px; }
  .panel { padding: 13px; border-radius: 11px; }
  .league-page { margin-top: 11px; }
  .section-head { margin-bottom: 11px; }
  .section-head h2, .dialog-head h2 { font-size: 21px; }
  .tabs { max-width: none; margin-bottom: 9px; }
  .empty { min-height: 108px; }
  th, td { padding-inline: 3px; }
  .rule-grid { gap: 7px; }
  .rule-grid > div { padding: 8px; }
  .rule-grid dl { font-size: 12px; }
  dialog { position: fixed; inset: auto 0 0; margin: 0; width: 100%; max-width: none; max-height: 94dvh; border-radius: 17px 17px 0 0; padding: 13px 13px calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 355px) {
  .wrap { width: calc(100% - 20px); }
  .match-detail table { font-size: 12px; }
  .match-detail th { font-size: 11px; }
}
