:root {
  color-scheme: light;
  --paper: #f8f8f4;
  --surface: #fffefa;
  --ink: #202c28;
  --muted: #52625b;
  --line: #dce1d8;
  --accent: #c7e9f2;
  --accent-ink: #184759;
  --accent-strong: #2e7388;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1, h2, h3, p, dd { margin: 0; }
.container { width: min(1200px, calc(100% - 72px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; z-index: 3; transform: translateY(-150%); background: var(--accent); color: var(--accent-ink); padding: 12px; }
.skip-link:focus { transform: translateY(0); }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 65px; gap: 16px; }
.brand { white-space: nowrap; font-size: 1.17rem; font-weight: 800; letter-spacing: -.055em; text-decoration: none; }
.header-inner nav { display: flex; align-items: center; gap: clamp(15px, 3vw, 34px); font-size: .93rem; font-weight: 600; }
.header-inner nav a:not(.button) { padding-block: 9px; color: var(--muted); text-decoration: none; }
.header-inner nav a:not(.button):is(:hover, [aria-current="page"]) { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 5px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px; font-size: .94rem; font-weight: 700; text-align: center; text-decoration: none; }
.button-primary { background: var(--accent); color: var(--accent-ink); border-color: #afd9e5; }
.button-primary:hover:not(:disabled) { background: #b7e1ee; }
.button-primary[aria-current="page"] { border-color: var(--accent-strong); }
.button-outline { background: transparent; color: var(--ink); border-color: #c7d1c6; }
.button-outline:hover:not(:disabled) { background: #eff2eb; }
.text-button { border: 0; background: transparent; color: var(--accent-ink); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; padding: 0; }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 22px; padding: 29px 0 25px; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 790; letter-spacing: -.068em; line-height: 1; }
.hero p { margin-top: 8px; color: var(--muted); line-height: 1.4; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(86px, 1fr)); margin: 0; }
.hero-stats > div { display: flex; flex-direction: column-reverse; gap: 3px; padding: 0 23px; }
.hero-stats > div:first-child { padding-left: 0; }
.hero-stats > div:last-child { padding-right: 0; }
.hero-stats > div + div { border-left: 1px solid var(--line); }
.hero-stats dt { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.hero-stats dd { font-size: clamp(1.25rem, 2.7vw, 1.88rem); letter-spacing: -.048em; line-height: 1.15; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stadium { overflow: hidden; border: 1px solid #d8dfd4; border-radius: 12px; background: var(--surface); scroll-margin-top: 10px; }
.stadium-header, .stadium-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-inline: 18px; }
.stadium-header { padding-block: 12px; border-bottom: 1px solid var(--line); }
.stadium-header h2 { font-size: 1.12rem; letter-spacing: -.033em; }
.stadium-header p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.stadium-actions { display: flex; align-items: center; gap: 8px; }
.map-button, .stadium-select select { min-height: 41px; border: 1px solid #cbd6cc; color: var(--accent-ink); background: #fbfdfb; border-radius: 6px; font-size: .88rem; font-weight: 650; white-space: nowrap; }
.map-button { padding: 8px 11px; }
.map-button:hover:not(:disabled), .stadium-select select:hover:not(:disabled) { background: #edf4f1; }
.select-wrap { display: block; position: relative; color: var(--accent-ink); }
.select-wrap::after { content: ""; position: absolute; width: 7px; height: 7px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg); right: 12px; top: calc(50% - 5px); pointer-events: none; }
.select-wrap select { width: 100%; appearance: none; padding-right: 27px; }
.stadium-select select { padding-left: 10px; }

.stadium-map { position: relative; background: #f0f2ea; }
.stadium-map canvas { display: block; width: 100%; height: clamp(390px, 43vw, 510px); touch-action: none; contain: strict; }
.stadium-map canvas:focus-visible { outline-offset: -3px; }
.stadium-map canvas[data-dragging="true"] { cursor: grabbing !important; }
.map-tools { display: flex; align-items: center; gap: 1px; position: absolute; right: 12px; top: 12px; padding: 3px; border: 1px solid #c6d2c6; border-radius: 7px; background: #fffefa; color: var(--accent-ink); box-shadow: 0 1px 3px #273b2717; }
.map-tools button { min-width: 39px; min-height: 36px; padding-inline: 8px; border: 0; border-radius: 4px; background: transparent; color: var(--accent-ink); font-size: 1.13rem; font-weight: 700; }
.map-tools button:hover:not(:disabled) { background: #e8f3f2; }
.map-tools button:last-child { margin-left: 3px; border-left: 1px solid var(--line); border-radius: 0; font-size: .84rem; font-weight: 620; }
.map-tools output { min-width: 49px; text-align: center; font-variant-numeric: tabular-nums; font-size: .84rem; }
.map-tooltip { position: absolute; pointer-events: none; z-index: 1; max-width: min(260px, 82%); padding: 9px 11px; border-radius: 7px; background: var(--surface); color: var(--ink); border: 1px solid #bcccbf; box-shadow: 0 3px 12px #2f493518; font-size: .88rem; line-height: 1.4; overflow-wrap: anywhere; }
.map-tooltip strong { display: block; }
.map-contribution { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid #cde3e8; background: #e9f5f7; color: #244856; font-size: .92rem; font-weight: 650; }
.contribution-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.section-dedications { padding: 11px 18px; border-top: 1px solid var(--line); }
.section-dedications summary { width: fit-content; color: var(--accent-ink); cursor: pointer; font-size: .9rem; font-weight: 650; }
.section-dedications ul { padding: 0; margin: 9px 0 4px; list-style: none; }
.section-dedications li { border-top: 1px solid var(--line); }
.section-dedications li button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 5px 0; border: 0; background: transparent; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.section-dedications li button:hover { color: var(--accent-ink); }
.section-dedications li button small { margin-left: auto; text-align: right; color: var(--muted); }
.section-dedications .map-button { margin: 5px 0; }
.stadium-footer { min-height: 44px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: .84rem; color: var(--muted); padding-block: 9px; }
.legend { display: flex; flex-wrap: wrap; gap: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend .available { background: #a8b8a9; }
.legend .taken { background: repeating-linear-gradient(135deg, #fffef7 0 3px, #417d93 3px 5px); border: 1px solid #829a91; }
.purchase-status { padding: 13px 16px; margin-bottom: 14px; border: 1px solid #bfdce2; border-radius: 8px; background: #edf7f8; }
.purchase-status h2 { font-size: 1.05rem; margin-bottom: 5px; }
.purchase-status p { color: var(--muted); }
#purchase-reference { margin-top: 3px; font-size: .81rem; overflow-wrap: anywhere; }
.purchase-actions { display: flex; flex-wrap: wrap; gap: 9px 13px; align-items: center; }
.purchase-actions > :not([hidden]) { margin-top: 8px; }
.purchase-actions a { text-decoration: none; }
.load-error, .text-error { color: #913d2b; font-size: .92rem; }
.load-error { margin: 11px 0; }

.home-podium { margin-block: clamp(34px, 6vw, 68px); scroll-margin-top: 18px; }
.section-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 9px 16px; }
.section-heading h2, .home-join h2, .flow-heading h2 { font-size: clamp(1.48rem, 3vw, 2.25rem); line-height: 1.09; letter-spacing: -.055em; }
.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; grid-template-rows: auto; align-items: end; gap: clamp(6px, 1.5vw, 16px); list-style: none; margin: 18px 0 0; padding: 0; }
.podium li { display: grid; gap: 5px; align-content: end; min-height: clamp(96px, 13vw, 128px); min-width: 0; padding: clamp(9px, 2vw, 22px); border: 1px solid #cdd9cd; border-bottom: 3px solid #aebfb1; border-radius: 8px 8px 1px 1px; background: #eaf0e7; }
.podium li[data-place="1"] { grid-area: 1 / 2; min-height: clamp(117px, 17vw, 166px); border-color: #bdd7d2; border-bottom-color: var(--accent-strong); background: #e0f0ed; }
.podium li[data-place="2"] { grid-area: 1 / 1; }
.podium li[data-place="3"] { grid-area: 1 / 3; min-height: clamp(85px, 11vw, 114px); }
.podium-place { font-size: clamp(1.18rem, 3.5vw, 2.38rem); color: var(--accent-ink); font-weight: 780; line-height: 1; font-variant-numeric: tabular-nums; }
.podium strong { display: flex; align-items: center; gap: 6px; font-size: clamp(.79rem, 2vw, 1.05rem); line-height: 1.17; overflow-wrap: anywhere; }
.podium strong .club-emblem { width: 22px; height: 22px; flex-basis: 22px; }
.podium p, .ranking-empty { color: var(--muted); font-size: .88rem; }
.podium li.is-ranked p { font-variant-numeric: tabular-nums; }
.home-join { display: grid; grid-template-columns: 1fr 1.12fr; align-items: center; gap: 26px; margin-bottom: 34px; padding: clamp(18px, 4vw, 44px); border: 1px solid #c5d7d0; border-radius: 10px; background: #eaf2eb; }
.home-join p, .flow-heading p { margin-top: 7px; color: var(--muted); line-height: 1.45; }
#join-step-title:focus { outline: none; }
.home-join .home-price { margin-top: 12px; color: var(--ink); font-size: .98rem; }
.home-price strong { font-weight: 780; font-variant-numeric: tabular-nums; }
.home-join-form label { display: block; margin-bottom: 6px; font-size: .92rem; font-weight: 720; }
.home-join-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.home-join-form select { min-height: 44px; width: 100%; padding-inline: 8px; border: 1px solid #aabdb2; border-radius: 6px; color: var(--ink); background: var(--surface); }
.ranking-page, .participation-page { max-width: 820px; margin: 0 auto; padding-bottom: 36px; }
.ranking-head, .standings li { display: grid; grid-template-columns: minmax(3.1rem, .17fr) minmax(0, 1fr) auto; column-gap: 13px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ranking-head { border-top: 1px solid var(--line); font-size: .86rem; font-weight: 650; color: var(--muted); }
.ranking-empty { padding-top: 12px; }
.standings { margin: 0; padding: 0; list-style: none; }
.standing-club { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 690; overflow-wrap: anywhere; }
.standing-position { color: var(--muted); font-variant-numeric: tabular-nums; }
.club-emblem { width: 28px; height: 28px; flex: 0 0 28px; object-fit: contain; }
.standing-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 720; }
.participation-flow { min-height: 178px; border: 1px solid var(--line); padding: clamp(14px, 3vw, 28px); border-radius: 10px; background: var(--surface); }
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding-block: 14px; }
.footer-inner > span { color: var(--muted); font-size: .86rem; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: .86rem; }
.footer-links a, .legal-content a, .terms-acceptance a { color: var(--accent-ink); text-underline-offset: 3px; }
.footer-links .withdrawal-link { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 9px; border: 1px solid #b8cbc0; border-radius: 5px; font-weight: 700; text-decoration: none; }
.footer-links .withdrawal-link:hover { background: #eaf2eb; text-decoration: underline; }
#data-fiscal img { display: block; max-width: 60px; height: auto; }

dialog { margin: auto; width: min(600px, calc(100% - 20px)); max-height: min(88dvh, 770px); padding: 0; border: 1px solid #ccd6cc; border-radius: 12px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #253a36a0; }
.dialog-shell { position: relative; padding: 23px; }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 1; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 1.45rem; line-height: 1; }
.dialog-close:hover { background: #eef3ed; }
.dialog-heading { padding-right: 39px; }
.dialog-heading h2 { font-size: clamp(1.55rem, 5vw, 2.17rem); letter-spacing: -.055em; line-height: 1.07; }
.dialog-heading p { margin-top: 7px; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.legal-content { display: grid; gap: 10px; margin-top: 16px; line-height: 1.5; }
.legal-content h3 { margin-top: 6px; font-size: 1rem; }
.legal-content p { color: var(--muted); }
.seller-details { display: grid; gap: 12px; margin: 0; }
.seller-details dt { font-weight: 700; }
.seller-details dd { overflow-wrap: anywhere; }
#withdrawal-contact p { margin-top: 9px; overflow-wrap: anywhere; }
.dialog-back { display: inline-block; margin-bottom: 12px; }
.seat-form { display: grid; gap: 12px; margin-top: 16px; }
.seat-form label { display: block; font-size: .92rem; font-weight: 700; }
.seat-form label > input, .seat-form label > textarea { margin-top: 5px; }
.seat-form input, .seat-form textarea { display: block; width: 100%; min-height: 44px; border: 1px solid #aabdb2; border-radius: 6px; background: #fff; color: var(--ink); padding: 8px 9px; font-weight: 450; }
.seat-form textarea { resize: vertical; min-height: 70px; }
.seat-form label small { font-size: inherit; color: var(--muted); font-weight: 400; }
.public-note { font-size: .87rem; color: var(--muted); line-height: 1.4; }
.dialog-actions + .public-note:not(:empty) { margin-top: 8px; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.seat-card-details { margin-top: 15px; padding: 13px 15px; background: #edf4ef; border: 1px solid #d1ded3; border-radius: 7px; overflow-wrap: anywhere; }
.seat-card-details .seat-club { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .91rem; font-weight: 700; }
.seat-card-details .seat-name { font-size: 1.25rem; font-weight: 750; letter-spacing: -.02em; }
.seat-card-details .seat-message { margin-top: 5px; line-height: 1.45; color: var(--muted); }
.share-link { display: block; max-width: 100%; width: 100%; padding: 8px; margin-top: 8px; font: inherit; }

.join-progress { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); padding: 0; margin: 16px 0 0; gap: 8px; }
.join-progress li { border-top: 3px solid #dde3dc; color: var(--muted); padding-top: 6px; font-size: .86rem; }
.join-progress li[aria-current="step"] { border-color: var(--accent-strong); color: var(--ink); font-weight: 730; }
.club-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.club-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; max-height: min(35dvh, 293px); overflow: auto; padding: 3px 5px 3px 3px; scrollbar-color: #9aafa2 transparent; }
.club-grid .club-option { position: relative; display: flex; align-items: center; gap: 8px; min-height: 51px; padding: 6px 8px; border: 1px solid #d4ded5; border-radius: 6px; color: var(--ink); background: #fff; cursor: pointer; line-height: 1.17; overflow-wrap: anywhere; }
.club-option img { width: 28px; height: 33px; flex: 0 0 28px; object-fit: contain; }
.club-option > input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; margin: 0; }
.club-option:hover { border-color: #91ab9d; }
.club-option:has(:checked) { border-color: #5a9ab0; background: #e2f2f7; box-shadow: inset 0 0 0 1px #65a1b3; }
.club-option:has(:focus-visible) { outline: 2px solid var(--accent-strong); outline-offset: 1px; }
.join-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1px; }
.join-footer button[type="submit"] { min-width: 125px; }
.join-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-block: 1px solid var(--line); color: var(--muted); }
.join-total output, .join-total strong { color: var(--ink); font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
.terms-acceptance { display: flex; align-items: flex-start; gap: 9px; font-size: .9rem; line-height: 1.55; }
.terms-acceptance input[type="checkbox"] { min-height: 0; width: auto; flex: none; margin: 5px 0 0; accent-color: var(--accent-strong); }
.terms-acceptance label { display: inline; }
.shirt-swatch { display: inline-block; width: 25px; height: 25px; flex: 0 0 25px; border: 1px solid #7b938a; border-radius: 4px; }
.seat-club .shirt-swatch { margin-left: auto; }
.chosen-club { display: flex; gap: 8px; align-items: center; font-size: .93rem; }
.quantity-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.quantity-options button { min-height: 50px; display: grid; justify-items: center; align-content: center; gap: 2px; border: 1px solid #aabdb2; border-radius: 6px; background: transparent; color: var(--ink); }
.quantity-options small { color: var(--muted); }
.quantity-options button[aria-pressed="true"] { border-color: #5a9ab0; background: #e2f2f7; }

@media (max-width: 820px) {
  .container { width: calc(100% - 42px); }
  .home-join { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 600px) {
  .container { width: calc(100% - 24px); }
  .header-inner { flex-wrap: wrap; gap: 8px 14px; padding-block: 10px; }
  .header-inner nav { flex: 1; justify-content: space-between; gap: 8px; }
  .header-action { min-height: 39px; padding-inline: 10px; font-size: .88rem; }
  .hero { display: block; padding: 22px 0 17px; }
  .hero p { margin-top: 6px; }
  .hero-stats { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
  .hero-stats > div { padding-inline: 12px; }
  .hero-stats dt { font-size: .82rem; }
  .stadium-header, .stadium-footer, .map-contribution, .section-dedications { padding-inline: 10px; }
  .stadium-header { flex-wrap: wrap; gap: 9px; }
  .stadium-actions { width: 100%; }
  .stadium-actions > * { flex: 1; }
  .stadium-map canvas { height: clamp(292px, 78vw, 370px); }
  .map-tools { right: 7px; top: 7px; }
  .stadium-footer { font-size: .78rem; row-gap: 8px; }
  .legend { gap: 9px; }
  .podium strong { flex-wrap: wrap; }
  .podium p { font-size: .77rem; }
  .home-join-form > div { grid-template-columns: 1fr; }
  .ranking-head, .standings li { column-gap: 8px; }
  .footer-inner { min-height: 65px; }
  .footer-inner > span { text-align: right; font-size: .8rem; }
  .dialog-shell { padding: 17px 13px; }
  .club-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 36dvh; }
  .club-grid .club-option { min-height: 48px; font-size: .83rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
