:root{--paper:#fff;--ink:#203e35;--muted:#657065;--line:#dce1d8;--soft:#f3f5f0;--accent:#294f3f;font-family:'Noto Sans JP','Yu Gothic',Meiryo,sans-serif;color:var(--ink);font-size:14px}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--paper)}
button,input,select{font:inherit;color:inherit}
button,input,select,a{-webkit-tap-highlight-color:transparent}
button,a{touch-action:manipulation}
button{cursor:pointer}
button:disabled{opacity:.55;cursor:wait}
button,a,input,select{outline-offset:3px}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent)}
button{border:1px solid var(--line);background:#fff;padding:9px 14px;border-radius:3px}
button:hover{background:var(--soft)}
a{color:inherit}
input,select{background:#fff;border:1px solid var(--line);border-radius:3px;padding:9px 10px;max-width:100%}
.header{max-width:1180px;margin:auto;display:flex;align-items:center;justify-content:space-between;gap:24px;padding:24px 28px;border-bottom:1px solid var(--line)}
.header-identity{display:flex;align-items:center;gap:24px;flex:1;min-width:0}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;font-size:23px;font-weight:800;white-space:nowrap}
.brand-ball{font-size:26px;line-height:1}
.team-input{width:260px;min-width:100px;font-size:18px;font-weight:600}
.header nav{display:flex;align-items:center;gap:8px;flex-shrink:0}
.nav-button{border-color:transparent;padding:8px 10px;white-space:nowrap}
main{max-width:1080px;padding:0 24px 40px;margin:auto}
.setup-bar{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:28px 0}
.league-switch{display:flex;gap:0}
.league-switch button{border-radius:0;min-width:100px}
.league-switch button:first-child{border-radius:3px 0 0 3px}
.league-switch button:last-child{border-radius:0 3px 3px 0;border-left:0}
.league-switch button.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.team-select{min-width:220px}
.editor-grid{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:30px;align-items:start}
.debug-grid{display:block}
.debug-grid .panel+.panel{margin-top:26px}
.panel{min-width:0}
h1{font-size:25px;margin:0;font-weight:700}
h2{font-size:18px;margin:0 0 14px;font-weight:700}
h3{font-size:14px;margin:0 0 10px;font-weight:600}
.table-scroll{overflow-x:auto;width:100%}
table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}
th,td{border-bottom:1px solid var(--line);padding:11px 10px;font-weight:400;text-align:left;white-space:nowrap}
th{font-size:13px;font-weight:500;background:var(--soft)}
.lineup-table th:first-child,.lineup-table td:first-child{width:54px;text-align:center}
.lineup-table th:nth-child(2),.lineup-table td:nth-child(2){width:74px;text-align:center}
.lineup-table td:nth-child(3),.pitcher-table td:nth-child(2){width:auto}
.lineup-table td,.pitcher-table td{padding-top:7px;padding-bottom:7px}
.name-input{width:100%;min-width:110px}
.position-select{width:55px;padding:8px 4px;text-align:center}
.pitcher-table th:first-child,.pitcher-table td:first-child{width:82px}
.ability-table{min-width:700px}
.ability-pitchers{min-width:570px}
.ability-table td:nth-child(3),.ability-pitchers td:nth-child(2){min-width:160px}
.ability-table th:nth-child(n+4),.ability-table td:nth-child(n+4),.ability-pitchers th:nth-child(n+3),.ability-pitchers td:nth-child(n+3){text-align:center}
.stat{display:inline-flex;align-items:baseline;gap:5px;font-variant-numeric:tabular-nums}
.stat b{font-size:18px;font-weight:700}
.grade-S,.grade-A{color:#b45637}.grade-B{color:#94751f}.grade-C{color:#39785c}.grade-D{color:#397b91}.grade-E{color:#7377a3}.grade-F{color:#8c6f95}.grade-G{color:#888}
.editor-actions,.result-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:28px}
.primary{display:inline-flex;align-items:center;justify-content:center;min-width:160px;background:var(--accent);border:1px solid var(--accent);color:#fff;padding:12px 22px;text-decoration:none;font-weight:600}
.primary:hover{background:#183b2c}
.secondary{padding:10px 16px;background:#fff}
.action-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.error{color:#a73d29;padding:12px 0;line-height:1.7}
.error:empty,#notice:empty{display:none}
#notice{max-width:1032px;margin:0 auto;padding:0 0 16px;color:#a73d29;line-height:1.7}
.loading{padding:80px 0;text-align:center;font-size:20px}
.result-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:28px 0}
.summary{display:flex;align-items:center;justify-content:space-between;gap:20px;flex-wrap:wrap;padding:24px;border:1px solid var(--line);margin-bottom:30px;font-size:18px}
.summary strong{font-size:40px;font-weight:700;line-height:1}
.result-grid{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:30px;align-items:start;margin-bottom:30px}
.section-heading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:14px}
.section-heading h2{margin:0}
.section-heading select{padding:6px 8px}
.standings-table th,.standings-table td{padding:12px 8px;text-align:right}
.standings-table th:nth-child(2),.standings-table td:nth-child(2){text-align:left}
.standings-table td:nth-child(2){white-space:normal;min-width:135px}
.standings-table tr.own{background:#edf2e8;font-weight:600}
.series-item{padding:15px 0;border-bottom:1px solid var(--line)}
.series-item:first-child{padding-top:0}
.series-score{display:grid;grid-template-columns:1fr auto 1fr;gap:10px;align-items:center}
.series-score span{font-size:13px;overflow-wrap:anywhere}
.series-score span:last-child{text-align:right}
.series-score b{font-size:20px;white-space:nowrap}
.results-panel{margin-bottom:30px}
.results-table{min-width:670px}
.results-table th,.results-table td{text-align:right;padding:12px 10px}
.results-table th:first-child,.results-table td:first-child{text-align:left;min-width:180px}
.season-value{font-variant-numeric:tabular-nums}
.stat-highlight{color:#1764b6;font-weight:600}
.medal{display:inline-block;margin-left:5px;white-space:nowrap;font-weight:600}
.result-actions{justify-content:space-between}
dialog{border:1px solid var(--line);border-radius:4px;background:#fff;color:var(--ink);padding:24px;width:min(520px,92vw);max-height:88vh}
dialog::backdrop{background:#182a2366}
.modal-top{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:20px}
.modal-top h2{font-size:20px;margin:0}
.close-button{padding:4px 10px;font-size:24px;border:0;line-height:1}
#modal-body{line-height:1.7}
#modal-body label{display:block;margin:16px 0 6px}
#modal-body input,#modal-body select{width:100%}
#modal-body .primary{margin-top:24px}
#modal-body .action-row .secondary{margin-top:24px}
.image-preview{width:100%;height:auto;display:block}
@media(max-width:900px){.header{flex-wrap:wrap;padding:20px 24px;gap:16px}.header-identity{gap:16px}.team-input{width:220px}.header nav{margin-left:auto}.editor-grid,.result-grid{grid-template-columns:minmax(0,1fr)}.editor-grid{gap:28px}.result-grid{gap:28px}.summary{font-size:16px;padding:20px}}
@media(max-width:620px){.header{padding:16px;gap:12px}.header-identity{width:100%;flex-basis:100%;gap:12px}.brand{font-size:19px;gap:5px}.brand-ball{font-size:22px}.team-input{min-width:0;width:100%;flex:1;font-size:15px;padding:8px}.header nav{width:100%;margin:0;gap:4px;justify-content:flex-end}.nav-button{font-size:13px;padding:5px 8px}main{padding:0 16px 28px}.setup-bar{margin:22px 0;gap:14px;flex-wrap:wrap}.league-switch{flex:1}.league-switch button{min-width:0;flex:1;white-space:nowrap}.team-select{min-width:0;width:100%;flex-basis:100%}h1{font-size:21px}h2{font-size:17px}.lineup-table th:first-child,.lineup-table td:first-child{width:46px}.lineup-table th:nth-child(2),.lineup-table td:nth-child(2){width:65px}.lineup-table td,.pitcher-table td{padding-left:6px;padding-right:6px}.name-input{min-width:100px;padding:8px}.editor-actions{margin-top:24px;flex-wrap:wrap}.editor-actions .primary{flex:1}.result-heading{margin:22px 0;gap:12px}.result-heading .secondary{font-size:13px;padding:8px 10px;white-space:nowrap}.summary{display:grid;grid-template-columns:1fr 1fr;padding:18px;gap:18px;font-size:15px}.summary strong{text-align:right;font-size:34px}.summary span:last-child{text-align:right}.result-grid{margin-bottom:25px}.results-panel{margin-bottom:25px}.result-actions{flex-wrap:wrap;gap:15px}.result-actions>.action-row{margin-left:auto}.secondary{padding:10px 12px}.standings-table th,.standings-table td{font-size:13px;padding:11px 6px}.standings-table td:nth-child(2){min-width:120px}dialog{padding:20px}.modal-top h2{font-size:19px}#notice{padding:0 16px 16px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

.pitcher-role{display:inline-block;min-width:4.5em;margin-right:.5em}
.name-input.duplicate-name{color:#c62828;border-color:#c62828;background:#fff0f0}

.results-table th:first-child,.results-table td:first-child{min-width:0}
.results-table td{font-variant-numeric:tabular-nums}
.results-table th,.results-table td{white-space:nowrap}
.season-record{display:inline-flex;align-items:center;justify-content:flex-end;gap:5px}
.rank-slot{display:inline-flex;align-items:center;justify-content:center;width:22px;flex:0 0 22px}
.rank-badge{display:inline-flex;align-items:center;justify-content:center;width:21px;height:21px;border:1px solid currentColor;border-radius:50%;font-size:12px;font-weight:700;line-height:1}
.rank-1{color:#826112;background:#fff2bc}.rank-2{color:#526375;background:#edf1f5}.rank-3{color:#925526;background:#f8e8d9}
.results-table td:has(.season-record),.results-table th:has(+ th){vertical-align:middle}

.header{flex-wrap:wrap;gap:12px}.header-identity{flex-wrap:wrap;gap:12px}.team-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.team-controls button{white-space:nowrap}.team-controls .league-switch button{min-width:80px;padding:9px 10px}#foreign-count{font-size:12px;white-space:nowrap}main>.editor-grid{margin-top:28px}@media(min-width:1000px){.header-identity .brand{flex-basis:100%}}

.summary[role="button"]{cursor:pointer}
.summary[role="button"]:focus-visible{outline:3px solid #1764b6;outline-offset:3px}
[role="tab"][aria-selected="true"]{background:#203e35;color:#fff}
.scroll-hint{color:var(--muted);font-size:12px;margin:-6px 0 10px}
.ability-table{min-width:800px}
.ability-pitchers{min-width:680px}
.table-scroll{overscroll-behavior-x:contain}
.ability-table,.ability-pitchers{table-layout:fixed}
.ability-table th:nth-child(3),.ability-table td:nth-child(3),.ability-pitchers th:nth-child(2),.ability-pitchers td:nth-child(2){width:180px}
.ability-pitchers th:first-child,.ability-pitchers td:first-child{width:140px}
.ability-table th:nth-child(3),.ability-table td:nth-child(3){position:sticky;left:0;z-index:1;background:var(--paper);box-shadow:2px 0 3px #203e3514}
.ability-pitchers th:nth-child(2),.ability-pitchers td:nth-child(2){position:sticky;left:0;z-index:1;background:var(--paper);box-shadow:2px 0 3px #203e3514}

:root{color-scheme:light;--paper:#fff;--ink:#242424;--muted:#666;--line:#ddd;--soft:#f5f5f5;--accent:#d62e3d;background:#fff}
body,button,input,select,.secondary,dialog{background:#fff}
button:hover{background:#f5f5f5}
.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.primary:hover{background:#b4202e}
.league-switch button.active{background:#222;border-color:#666;color:#fff}
.standings-table tr.own{background:#fff0f2}
.stat-highlight{color:#1764b6}
.name-input.duplicate-name{color:#c62828;border-color:#c62828;background:#fff0f0}
.error,#notice{color:#b82432}
dialog::backdrop{background:#000b}
.grade-S{color:#c72c70}.grade-A{color:#ff44df}.grade-B{color:#f04455}.grade-C{color:#ff9824}.grade-D{color:#d5cb60}.grade-E{color:#41b34d}.grade-F{color:#25bfff}.grade-G{color:#969696}
.brand{gap:0;letter-spacing:.02em}
.brand-gouketsu{color:#ed263b}.brand-baseball{color:#242424}
.header{display:flex;flex-wrap:nowrap;align-items:flex-start;gap:24px}
.header-identity{flex:0 0 auto;display:block;padding-top:6px}
.header-identity .brand{flex-basis:auto}
.header-controls{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:10px;margin-left:auto;min-width:0}
.header-controls .team-input{width:220px}
.header-controls .team-controls{justify-content:flex-end}
.local-tools{position:fixed;right:14px;bottom:14px;display:flex;gap:6px;padding:6px;border:1px solid var(--line);border-radius:5px;background:#fff;z-index:10;box-shadow:0 2px 14px #0002}
.local-tools .nav-button{border-color:var(--line);font-size:12px}
.local-mode main{padding-bottom:90px}
.summary{margin-top:28px}
[role="tab"][aria-selected="true"]{background:#333;color:#fff;border-color:#777}
.summary[role="button"]:focus-visible{outline-color:#ed263b}
.rank-1{color:#826112;background:#fff2bc}.rank-2{color:#526375;background:#edf1f5}.rank-3{color:#925526;background:#f8e8d9}
@media(max-width:700px){.header{flex-wrap:wrap;padding:16px;gap:16px}.header-identity{width:auto;flex-basis:auto}.header-controls{width:100%;gap:10px}.header-controls .team-input{width:100%;flex-basis:100%;font-size:16px}.header-controls .team-controls{width:100%;gap:8px}.header-controls .league-switch{flex:0 1 auto}.team-controls .league-switch button{min-width:70px;font-size:12px}.team-controls>button{font-size:12px;padding:9px 10px}.local-tools{right:8px;bottom:8px}.summary{margin-top:22px}}

#return-home{font-weight:700;min-width:180px;padding:14px 24px;box-shadow:0 3px 8px #d62e3d33}
.header{justify-content:flex-start}.header-controls{margin-left:0;justify-content:flex-start}.header-controls .team-controls{justify-content:flex-start}
.bracket-scroll{overflow-x:auto;padding:12px 0}
.playoff-bracket{display:grid;grid-template-columns:repeat(3,minmax(190px,1fr));gap:30px;min-width:660px}
.bracket-round{display:flex;flex-direction:column;justify-content:space-around;gap:22px}
.bracket-round h3{font-size:15px;margin:0}
.bracket-match{position:relative;border:1px solid #ccc;border-radius:6px;background:#fff;padding:12px}
.bracket-match h4{font-size:12px;color:#666;margin:0 0 8px}
.bracket-match>div{display:flex;justify-content:space-between;gap:8px;padding:7px 0}
.bracket-match .winner{color:#b4202e;font-weight:700}
.bracket-round:not(:last-child) .bracket-match:after{content:"";position:absolute;right:-31px;top:50%;width:30px;border-top:2px solid #999}
.bracket-final{justify-content:center}

.header-controls{flex:1}.header-controls .team-controls{flex:1}.team-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-left:auto;flex-wrap:wrap}
@media(max-width:700px){.header-controls .team-controls{flex-basis:100%}.team-actions{gap:8px}}

/* Match plain numeric cells and cells containing league rank badges. */
.results-table th,.results-table td{height:48px;line-height:24px;vertical-align:middle;padding-top:12px;padding-bottom:12px}
.season-record{display:flex;height:24px;line-height:24px}
.season-value,.rank-slot{height:24px;line-height:24px}

.lineup-name{display:flex;align-items:center;gap:4px;min-width:0}
.lineup-name .name-input{min-width:0;flex:1;width:0}
.pitcher-moves{display:flex;flex-direction:column;gap:2px;flex-shrink:0}
.pitcher-moves button{width:24px;height:24px;padding:0;line-height:20px}
.pitcher-moves button:disabled{cursor:default;opacity:.3}
.ability-label-short{display:none}
.pitcher-role-short{display:none}
.game-disclaimer{max-width:1080px;margin:0 auto;padding:0 24px 24px;color:var(--muted);line-height:1.7}
.game-disclaimer small{font-size:11px}
.local-mode .game-disclaimer{padding-bottom:76px}
@media(max-width:900px){
  .ability-table,.ability-pitchers{min-width:0;width:100%;table-layout:fixed}
  .ability-table th,.ability-table td,.ability-pitchers th,.ability-pitchers td{padding:7px 1px;text-align:center;font-size:11px;white-space:nowrap}
  .ability-table th:first-child,.ability-table td:first-child{width:20px}
  .ability-table th:nth-child(2),.ability-table td:nth-child(2){width:30px}
  .ability-table th:nth-child(3),.ability-table td:nth-child(3){width:96px;min-width:0;position:static;box-shadow:none}
  .ability-pitchers th:first-child,.ability-pitchers td:first-child{width:58px}
  .ability-pitchers th:nth-child(2),.ability-pitchers td:nth-child(2){width:96px;min-width:0;position:static;box-shadow:none}
  .ability-table .name-input,.ability-pitchers .name-input{width:100%;min-width:0;padding:7px 3px;font-size:16px}
  .ability-table .lineup-name .name-input{width:0}
  .ability-table .position-select{width:28px;min-width:0;padding:7px 0;font-size:11px}
  .ability-table .stat,.ability-pitchers .stat{display:inline-flex;gap:0;align-items:center}
  .ability-table .stat b,.ability-pitchers .stat b{font-size:14px;line-height:24px}
  .ability-table .stat>span,.ability-pitchers .stat>span,.velocity-unit{display:none}
  .ability-label-full{display:none}.ability-label-short{display:inline}
  .pitcher-role-full{display:none}.pitcher-role-short{display:inline}
  .pitcher-role{min-width:0;margin-right:2px;font-size:10px}
  .pitcher-moves button{width:20px;height:20px;font-size:12px;line-height:16px}
}

.results-table tbody td{border-bottom:1px solid #e3e5e8;font-size:17px}

@media(max-width:700px){
  .header-controls{flex:0 0 100%}
  .header-controls .team-controls{justify-content:flex-start;flex-wrap:nowrap;gap:3px;margin:0;min-width:0}
  .header-controls .team-controls .league-switch{flex:0 0 auto}
  .team-controls .league-switch button,.team-actions button{min-width:0;min-height:36px;padding:7px 3px;font-size:clamp(9px,2.5vw,12px);flex-shrink:0}
  .team-controls .team-actions{display:contents}
  .team-controls #random-input{margin-left:auto}
  .team-controls #foreign-count{margin:0;padding:4px 0;line-height:1.4;font-size:clamp(9px,2.5vw,12px);flex-shrink:0}
}

.house-ad{width:min(320px,calc(100% - 32px));margin:24px auto 32px}.house-ad[hidden]{display:none}.house-ad-heading{display:flex;align-items:center;justify-content:space-between;color:#555;font-size:12px}.house-ad-heading button{border:0;background:transparent;color:#333;font-size:24px;line-height:1;cursor:pointer;padding:4px 8px}
