:root {
  color-scheme: light;
  --green: #006b4e;
  --green-dark: #00523d;
  --green-pale: #edf5f0;
  --line: #d6dcd8;
  --text: #252c29;
  --muted: #616c65;
  --paper: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Meiryo", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f5f3; color: var(--text); line-height: 1.65; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #bd7d08; outline-offset: 3px; }
[hidden] { display: none !important; }
.joke-banner { background: #fff9e6; border-bottom: 1px solid #e6d8ad; color: #544624; }
.joke-banner p { max-width: 1160px; margin: auto; padding: 12px 28px; font-size: .9rem; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.masthead { background: var(--green); color: #fff; }
.header-inner, .shell { width: min(1160px, 100%); margin: auto; padding: 0 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; font-size: .78rem; border-bottom: 1px solid #ffffff30; }
.topbar a, .topbar .version { color: #fff; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 22px 0 30px; }
.hero-title { min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 1.2rem; font-weight: 800; letter-spacing: .06em; }
.horse-mark { font-size: 1.8rem; line-height: 1; }
h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.35; letter-spacing: .02em; }
h1 span { display: inline-block; margin-left: .45em; }
.lead { margin: 10px 0 0; font-size: .88rem; color: #e3eee7; }
.unit-chip { flex-shrink: 0; min-width: 220px; padding: 12px 20px; background: #fffef6; color: #273b2e; border: 1px solid #e8e4d2; text-align: center; }
.ticket-caption { display: block; font-size: .7rem; letter-spacing: .08em; color: var(--green); border-bottom: 1px dashed #b5c3ac; padding-bottom: 6px; margin-bottom: 8px; }
.ticket-label { font-size: .85rem; margin-right: 8px; font-weight: 700; }
.unit-chip strong { font-size: 1.9rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.unit-chip strong span { font-size: .85rem; margin-left: 4px; }
.ticket-note { display: block; font-size: .65rem; color: #717765; margin-top: 6px; }
.race-nav { background: #fff; border-bottom: 1px solid var(--line); }
.race-nav > div { display: flex; max-width: 1104px; margin: auto; }
.race-nav a { flex: 1; padding: 13px 12px; text-align: center; font-size: .85rem; font-weight: 700; border-left: 1px solid #e8ece9; }
.race-nav a:last-child { border-right: 1px solid #e8ece9; }
.race-nav a:hover { background: var(--green-pale); }
.shell { padding-top: 22px; padding-bottom: 32px; }
.purchase-info { margin: 0 0 18px; padding: 10px 14px; border-left: 4px solid var(--green); background: #fff; color: var(--green); font-size: .86rem; font-weight: 700; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 18px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { border: 1px solid #bfcac3; border-radius: 3px; padding: 8px 12px; background: #fff; color: #34493d; font-size: .82rem; font-weight: 600; line-height: 1.5; }
.button:hover { background: #eef3ef; border-color: #809b89; }
.button.primary { background: var(--green); color: #fff; border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.quiet { color: var(--muted); }
.button.danger { color: #a02c31; border-color: #bf8080; background: #fff6f4; }
button:disabled { opacity: .55; cursor: wait; }
.access { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .78rem; }
.mode { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; background: #e8ece9; color: #56645b; }
.mode::before { content: ""; width: 6px; height: 6px; background: #87978c; border-radius: 50%; }
.mode.editor { color: var(--green); background: #e4f1e9; }
.mode.editor::before { background: var(--green); }
.muted { color: var(--muted); font-size: .8rem; }
.notice { padding: 12px 16px; margin: 0 0 18px; border: 1px solid #aecbb9; background: #edf6ee; color: #28513a; font-size: .85rem; }
.notice.error { background: #fff1ef; border-color: #ddb3ac; color: #9a3530; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--green); }
.stat { padding: 14px 20px; border-right: 1px solid #e1e6e2; }
.stat:last-child { border-right: 0; }
.stat > span { display: block; color: var(--muted); font-size: .76rem; }
.stat strong { display: block; font-size: 1.7rem; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat small { margin-left: 5px; color: var(--muted); font-size: .75rem; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.board-heading h2 { border-left: 5px solid var(--green); padding-left: 12px; margin: 0; font-size: 1.18rem; }
.board-heading p { color: var(--muted); font-size: .8rem; margin: 6px 0 0 17px; }
.filters { display: flex; margin-bottom: 20px; border-bottom: 2px solid var(--green); }
.filter { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-bottom: 0; background: #fff; color: #56665c; font-size: .85rem; font-weight: 700; }
.filter + .filter { border-left: 0; }
.filter span { display: inline-block; }
.filter.active { background: var(--green); border-color: var(--green); color: #fff; }
.filter:hover:not(.active) { background: var(--green-pale); }
#matches { display: grid; gap: 24px; }
.participant-summary { min-width: 0; padding: 20px; border: 1px solid var(--line); background: #fff; }
.participant-summary h2 { margin: 0; padding-left: 12px; border-left: 5px solid var(--green); font-size: 1.18rem; }
.participant-description, .participant-note { margin: 12px 0; color: var(--muted); font-size: .8rem; }
.participant-table-scroll { max-width: 100%; overflow-x: auto; }
.participant-table-scroll:focus-visible { outline: 3px solid #bd7d08; outline-offset: 3px; }
.participant-table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: .88rem; }
.participant-table th, .participant-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.participant-table thead th { background: var(--green-pale); color: var(--green); white-space: nowrap; }
.participant-table th:not(:first-child), .participant-table .participant-money { text-align: right; }
.participant-name { max-width: 240px; overflow-wrap: anywhere; }
.participant-table small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.participant-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.participant-money.net-positive strong { color: var(--green); }
.participant-money.net-negative strong { color: #a02c31; }
.participant-table tfoot { background: #f7f8f0; }
.participant-table tfoot th, .participant-table tfoot td { border-top: 2px solid var(--green); border-bottom: 0; }
.table-caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.table-scroll-hint { display: none; color: var(--muted); font-size: .7rem; }
.match { min-width: 0; background: var(--paper); border: 1px solid #c8d2cb; }
.match-top { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #edf3ed; border-bottom: 1px solid #cbd7cb; }
.race-number { display: grid; place-items: center; flex-shrink: 0; min-width: 47px; height: 43px; padding: 0 6px; background: var(--green); color: #fff; font-size: 1.2rem; font-weight: 800; }
.match-title { min-width: 0; flex: 1; }
.match-top h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.match-top .meta { display: block; margin-top: 2px; font-size: .75rem; color: var(--muted); }
.status { flex-shrink: 0; padding: 3px 8px; border: 1px solid #bbc5be; background: #fff; color: #546358; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.status.open { border-color: #8db19a; color: var(--green); }
.status.settled { border-color: #cca856; background: #fff9e7; color: #836416; }
.status.cancelled { border-color: #c8b3ae; background: #fff8f5; color: #79554d; }
.match-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 20px; color: var(--muted); font-size: .8rem; }
.match-summary strong { color: var(--green); font-size: 1.4rem; margin-left: 10px; font-variant-numeric: tabular-nums; }
.match-summary strong small { font-size: .78rem; margin-left: 4px; }
.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 20px 18px; }
.side { min-width: 0; background: #fff; border: 1px solid #d3dad4; }
.side.winner { border-color: #bd9b41; box-shadow: inset 0 0 0 1px #bd9b41; }
.side-head { padding: 14px 16px 12px; }
.side-name { display: flex; align-items: center; gap: 10px; }
.runner-number { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 34px; border: 1px solid #949c96; background: #fff; color: #222; font-size: 1.25rem; font-weight: 800; }
.runner-number[data-color="black"] { border-color: #272e29; background: #272e29; color: #fff; }
.runner-number[data-color="red"] { border-color: #b52c2c; background: #c83535; color: #fff; }
.runner-number[data-color="blue"] { border-color: #2153a0; background: #2862b6; color: #fff; }
.runner-number[data-color="yellow"] { border-color: #bf9c13; background: #f8d847; color: #242b25; }
.runner-number[data-color="green"] { border-color: #21733c; background: #2b8247; color: #fff; }
.runner-number[data-color="orange"] { border-color: #c37521; background: #f5a347; color: #242b25; }
.runner-number[data-color="pink"] { border-color: #c579a4; background: #efb0d0; color: #242b25; }
.side h4 { display: flex; align-items: center; gap: .2em; flex: 1; min-width: 0; margin: 0; font-size: 1.35rem; line-height: 1.4; }
.contestant-name { min-width: 0; overflow-wrap: anywhere; }
.character-faces { display: flex; flex-wrap: wrap; flex-shrink: 0; gap: .1em; max-width: 2.1em; }
.character-faces .character-face { margin-left: 0; }
/* Face-only windows from the first color of each existing arcade sprite. Scale uniformly. */
.character-face {
  display: inline-block; flex-shrink: 0; width: 1em; height: 1em; margin-left: .2em; vertical-align: -.12em;
  background-repeat: no-repeat;
  background-size: calc(1em * var(--sprite-width) / var(--face-size)) calc(1em * var(--sprite-height) / var(--face-size));
  background-position: calc(-1em * var(--face-x) / var(--face-size)) 0;
}
.character-face[data-character="kenshiro"] { --sprite-width: 715; --sprite-height: 262; --face-size: 35; --face-x: 50; background-image: url("../surrender-web/assets/avatars/kenshiro-colors.png"); }
.character-face[data-character="raoh"] { --sprite-width: 885; --sprite-height: 317; --face-size: 38; --face-x: 68; background-image: url("../surrender-web/assets/avatars/raoh-colors.png"); }
.character-face[data-character="toki"] { --sprite-width: 825; --sprite-height: 261; --face-size: 49; --face-x: 43; background-image: url("../surrender-web/assets/avatars/toki-colors.png"); }
.character-face[data-character="jagi"] { --sprite-width: 850; --sprite-height: 232; --face-size: 36; --face-x: 71; background-image: url("../surrender-web/assets/avatars/jagi-colors.png"); }
.character-face[data-character="shin"] { --sprite-width: 495; --sprite-height: 274; --face-size: 43; --face-x: 32; background-image: url("../surrender-web/assets/avatars/shin-colors.png"); }
.character-face[data-character="rei"] { --sprite-width: 815; --sprite-height: 260; --face-size: 41; --face-x: 56; background-image: url("../surrender-web/assets/avatars/rei-colors.png"); }
.character-face[data-character="yuda"] { --sprite-width: 1190; --sprite-height: 255; --face-size: 40; --face-x: 120; background-image: url("../surrender-web/assets/avatars/yuda-colors.png"); }
.character-face[data-character="souther"] { --sprite-width: 745; --sprite-height: 273; --face-size: 34; --face-x: 50; background-image: url("../surrender-web/assets/avatars/souther-colors.png"); }
.character-face[data-character="heart-sama"] { --sprite-width: 1250; --sprite-height: 320; --face-size: 43; --face-x: 100; background-image: url("../surrender-web/assets/avatars/heart-sama-colors.png"); }
.character-face[data-character="mamiya"] { --sprite-width: 500; --sprite-height: 242; --face-size: 40; --face-x: 27; background-image: url("../surrender-web/assets/avatars/mamiya-colors.png"); }
.character-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 1.4em; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.character-preview .character-face { margin-left: 0; }
.character-help { margin: -6px 0 14px; color: var(--muted); font-size: .75rem; }
.win-tag { flex-shrink: 0; padding: 2px 7px; background: #a6352b; color: #fff; font-size: .68rem; font-weight: 700; }
.side-stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: .8rem; color: #526458; }
.side-stats > strong { color: var(--green); font-size: .95rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.side meter { display: block; width: 100%; height: 5px; margin-top: 10px; appearance: none; background: #e7ece7; }
.side meter::-webkit-meter-bar { background: #e7ece7; border: 0; border-radius: 0; }
.side meter::-webkit-meter-optimum-value { background: #7a9e7c; }
.side meter::-moz-meter-bar { background: #7a9e7c; }
.side-payout { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px; padding: 8px 16px; border-top: 1px solid #e1e5d9; border-bottom: 1px solid #e1e5d9; background: #f7f8f0; color: #606c56; font-size: .75rem; }
.side-payout strong { color: #344d30; }
.bet-list { list-style: none; padding: 0 16px; margin: 0; }
.bet-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px 0; border-bottom: 1px solid #e4e7e3; font-size: .85rem; }
.bet-row:last-child { border-bottom: 0; }
.bet-name { font-weight: 700; overflow-wrap: anywhere; }
.bet-units { margin-top: 2px; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.bet-points { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bet-points strong { display: block; font-size: .97rem; }
.bet-points small { display: block; color: var(--muted); font-size: .68rem; }
.bet-points.paid strong { color: #987014; }
.bet-controls { grid-column: 1 / -1; display: flex; gap: 14px; }
.text-button { padding: 1px 0; border: 0; background: transparent; color: var(--green); font-size: .74rem; text-decoration: underline; }
.no-bets { margin: 0; padding: 18px 16px; color: var(--muted); font-size: .78rem; }
.outcome { margin: 0 20px 18px; padding: 10px 14px; border: 1px solid #dbc990; border-left: 4px solid #ab852b; background: #fff9e7; color: #6e541d; font-size: .82rem; overflow-wrap: anywhere; }
.outcome.refund { border-color: #d3c0b7; background: #fff7f1; color: #7f5744; }
.match-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 12px 20px; background: #fafbf9; }
.match-actions .button { max-width: 100%; overflow-wrap: anywhere; }
.match-actions .spacer { flex: 1; }
.match-actions .right-choice { color: #fff; background: #323b35; border-color: #323b35; }
.empty { border: 1px solid var(--line); padding: 40px 24px; text-align: center; background: #fff; color: var(--muted); font-size: .88rem; }
.empty h3 { color: var(--text); margin: 0 0 8px; }
.empty p { margin: 0; }
.empty .button { margin-top: 18px; }
.rules { margin-top: 28px; padding: 15px 20px; border: 1px solid var(--line); border-top: 3px solid var(--green); background: #fff; color: var(--muted); font-size: .82rem; scroll-margin-top: 16px; }
.rules summary { cursor: pointer; color: var(--green); font-size: .9rem; font-weight: 700; }
.rules p { margin: 13px 0 0; }
.rules strong { color: var(--text); }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: .72rem; }
dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 24px; border: 1px solid #bbc7bf; border-top: 5px solid var(--green); border-radius: 4px; background: #fff; color: var(--text); box-shadow: 0 12px 48px #15291a40; }
dialog::backdrop { background: #15291a80; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-heading h2 { margin: 0; font-size: 1.18rem; }
.icon-button { padding: 4px 7px; border: 0; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; }
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: block; margin: 14px 0; color: #4b5b51; font-size: .83rem; }
input, select { display: block; min-width: 0; width: 100%; margin-top: 6px; border: 1px solid #bbc7bf; border-radius: 3px; padding: 10px 12px; background: #fff; color: var(--text); font-size: 1rem; }
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.color-select { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.color-select select { flex: 1; margin-top: 0; }
.color-select .runner-number { width: 32px; height: 36px; }
.left-text, .right-text { color: #405a49; }
.stake-hint { padding: 10px 14px; background: var(--green-pale); border-left: 3px solid var(--green); color: var(--green); font-size: .9rem; font-weight: 700; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-error { padding: 12px; border: 1px solid #ddb3ac; background: #fff1ef; color: #9a3530; font-size: .83rem; }
.confirm-warning { padding: 10px 12px; background: #fff8e3; color: #765d22; font-size: .83rem; }
.confirm-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.confirm-table th, .confirm-table td { text-align: left; padding: 8px 5px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.confirm-table th { background: var(--green-pale); }
.confirm-table th:last-child, .confirm-table td:last-child { text-align: right; white-space: nowrap; }
.noscript { padding: 20px; text-align: center; color: #9a3530; }
@media (max-width: 720px) {
  .header-inner, .shell { padding-left: 16px; padding-right: 16px; }
  .joke-banner p { padding: 10px 16px; font-size: .8rem; }
  .hero { gap: 16px; padding: 20px 0 24px; }
  .brand { font-size: 1rem; }
  h1 span { display: block; margin-left: 0; }
  .lead { font-size: .8rem; }
  .unit-chip { min-width: 155px; padding: 10px 12px; }
  .unit-chip strong { font-size: 1.6rem; }
  .ticket-label { display: block; margin-right: 0; }
  .ticket-caption { font-size: .62rem; }
  .race-nav a { font-size: .76rem; padding: 11px 8px; }
  .toolbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .toolbar-actions { width: 100%; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 24px; }
  .stat { padding: 10px 16px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid #e1e6e2; }
  .stat strong { font-size: 1.45rem; }
  .board-heading { align-items: flex-start; gap: 8px; }
  .board-heading h2 { font-size: 1.05rem; }
  .board-heading p { margin-left: 0; font-size: .74rem; }
  .board-heading > span { flex-shrink: 0; font-size: .65rem; padding-top: 5px; }
  .filter { padding: 9px 5px; font-size: .75rem; }
  #matches { gap: 18px; }
  .participant-summary { padding: 16px 12px; }
  .participant-summary h2 { font-size: 1.05rem; }
  .participant-description, .participant-note { font-size: .74rem; }
  .participant-table { font-size: .8rem; }
  .participant-table th, .participant-table td { padding: 10px; }
  .table-scroll-hint { display: block; }
  .match-top { padding: 12px; gap: 9px; }
  .race-number { min-width: 37px; height: 38px; font-size: 1rem; }
  .match-top h3 { font-size: .86rem; }
  .match-top .meta { font-size: .66rem; }
  .status { padding: 3px 5px; font-size: .65rem; }
  .match-summary { padding: 10px 12px; font-size: .72rem; }
  .match-summary strong { margin-left: 6px; font-size: 1.2rem; }
  .sides { padding: 0 12px 12px; gap: 10px; }
  .side-head { padding: 12px 10px 10px; }
  .side-name { gap: 6px; flex-wrap: wrap; }
  .runner-number { width: 25px; height: 28px; font-size: 1rem; }
  .side h4 { font-size: 1.05rem; }
  .side-stats { font-size: .7rem; }
  .side-stats > strong { font-size: .8rem; }
  .side-payout { padding: 8px 10px; font-size: .67rem; }
  .no-bets { padding: 14px 10px; font-size: .7rem; }
  .bet-list { padding: 0 10px; }
  .bet-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .bet-name { font-size: .79rem; }
  .bet-units { font-size: .65rem; }
  .bet-points { text-align: left; }
  .bet-points strong { font-size: .87rem; }
  .bet-points small { font-size: .62rem; }
  .win-tag { font-size: .6rem; padding: 2px 5px; }
  .outcome { margin: 0 12px 12px; padding: 9px 10px; font-size: .74rem; }
  .match-actions { padding: 12px; }
  .match-actions .button { padding: 8px 9px; font-size: .75rem; }
  .match-actions .spacer { display: none; }
  .rules { padding: 14px 16px; font-size: .76rem; }
  dialog { padding: 18px; }
  .form-pair { gap: 10px; }
}
@media (max-width: 380px) {
  .hero { gap: 12px; }
  .unit-chip { min-width: 135px; padding: 10px; }
  .unit-chip strong { font-size: 1.45rem; }
  .lead { font-size: .74rem; }
  .button { padding: 8px 10px; font-size: .76rem; }
  .side h4 { font-size: .95rem; }
  .sides { padding: 0 10px 10px; gap: 8px; }
}
