:root {
  color-scheme: light;
  --ink: #22231f;
  --muted: #565b50;
  --green: #496853;
  --forest: #22231f;
  --lime: #e7ed98;
  --page: #f5f4ef;
  --line: #d8d9cf;
  --card: #fffefa;
  --radius: 15px;
  font-family: Inter, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.55;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .47; }
a { color: inherit; }
:focus-visible { outline: 3px solid #7c991d; outline-offset: 4px; }
[hidden] { display: none !important; }
.topbar { background: var(--page); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1180px, calc(100% - 56px)); margin: auto; height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; text-decoration: none; }
.brand-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); border-radius: 8px; }
.brand-icon svg { width: 23px; height: 23px; fill: none; stroke: var(--lime); stroke-width: 3.8; }
.wordmark { font-size: 24px; font-weight: 800; letter-spacing: -1.2px; }
.saved-link { background: transparent; color: inherit; border: 1px solid #c3c5b8; border-radius: 9px; min-height: 40px; padding: 5px 12px; font-size: 14px; font-weight: 650; }
.saved-link:hover { background: #e9eadd; }
#saved-count:not(:empty) { margin-left: 4px; padding: 1px 6px; border-radius: 8px; color: var(--ink); background: var(--lime); font-variant-numeric: tabular-nums; }
.shell { max-width: 1236px; padding: 42px 28px 42px; margin: 0 auto; }
.page-header { margin-bottom: 25px; display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 5vw, 49px); line-height: 1.16; letter-spacing: -.045em; font-weight: 650; overflow-wrap: anywhere; }
.app-home { text-decoration: none; }
.app-home:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.page-header p { margin-top: 9px; color: var(--muted); font-size: 15px; }
.step-list { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 0; margin: 0 0 16px; }
.step-list li { min-width: 0; }
.step-chip { color: var(--muted); border: 0; background: transparent; border-bottom: 3px solid var(--line); width: 100%; display: flex; justify-content: center; align-items: center; gap: 9px; padding: 7px 4px 10px; font-size: 14px; font-weight: 650; white-space: nowrap; }
.step-chip:disabled { opacity: 1; }
.step-chip.current { color: var(--ink); border-color: var(--green); }
.step-chip.done { border-color: #91b39e; }
.step-number { display: grid; place-items: center; border-radius: 50%; background: #e0e6dc; width: 24px; height: 24px; flex: 0 0 24px; font-size: 13px; }
.current .step-number { background: var(--forest); color: white; }
.done .step-number { background: #d5e6d8; color: var(--ink); }
.setup-layout { display: grid; align-items: start; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 16px; }
.panel { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); min-width: 0; }
.setup-panel { padding: clamp(17px, 3vw, 30px); }
.panel-title { font-size: clamp(21px, 3vw, 29px); line-height: 1.25; letter-spacing: -.04em; font-weight: 650; }
.hint { color: var(--muted); font-size: 15px; margin-top: 6px; }
.fields { margin-top: 22px; display: grid; gap: 16px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .field-label { display: block; padding: 0; margin: 0 0 5px; font-weight: 650; font-size: 14px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.choice { display: grid; gap: 3px; position: relative; padding: 10px 12px; min-height: 48px; align-content: center; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-width: 0; }
.choice strong { font-weight: 650; }
.choice small { color: var(--muted); font-size: 13px; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice:has(:checked) { background: #edf1e3; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.choice:has(:focus-visible) { outline: 3px solid #7c991d; outline-offset: 3px; }
.choice:hover { border-color: var(--green); }
.side-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
input[type=text], input[type=number], select { width: 100%; appearance: none; min-height: 41px; border-radius: 8px; border: 1px solid #bdcabc; background-color: #fff; padding: 6px 10px; color: var(--ink); min-width: 0; }
select { padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #486454 50%), linear-gradient(135deg, #486454 50%, transparent 50%); background-position: calc(100% - 15px) 49%, calc(100% - 10px) 49%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=text]::placeholder { color: #516558; opacity: .85; }
input[type=text]:hover, input[type=number]:hover, select:hover { border-color: #617e66; }
.number-field { display: inline-flex; align-items: center; gap: 9px; }
.number-field input { width: 90px; font-variant-numeric: tabular-nums; }
.team-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.team-field { display: grid; grid-template-columns: 29px minmax(0, 1fr); align-items: center; gap: 6px; }
.team-field input[type=color] { width: 28px; height: 29px; padding: 2px; border-radius: 6px; background: #fff; border: 1px solid #c4cfc1; cursor: pointer; }
.court-fields { display: grid; gap: 7px; }
.court-field { display: grid; grid-template-columns: 21px minmax(0, 1fr) minmax(120px, .7fr); gap: 6px; align-items: center; }
.court-field.no-side { grid-template-columns: 21px minmax(0, 1fr); }
.court-field select { padding-left: 8px; padding-right: 23px; font-size: 14px; background-position: calc(100% - 13px) 49%, calc(100% - 8px) 49%; }
.court-field > span { font-size: 14px; font-weight: 650; }
.court-actions { margin-top: 9px; }
.button.add-court { color: #37513a; background: #edf1e3; }
.button.remove-court { border-color: transparent; color: var(--muted); background: transparent; }
.check-row { display: flex; gap: 11px; align-items: center; min-height: 49px; border: 1px solid var(--line); padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 650; }
.check-row input { width: 20px; height: 20px; accent-color: var(--green); margin: 0; }
.role-choices { display: grid; gap: 9px; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.setup-actions { border-top: 1px solid var(--line); margin-top: 23px; padding-top: 17px; display: flex; gap: 9px; justify-content: space-between; }
.setup-actions .primary { margin-left: auto; min-width: 116px; }
.button { min-height: 42px; padding: 7px 14px; border: 1px solid #bbcbbf; border-radius: 9px; background: #fff; color: var(--ink); font-weight: 650; font-size: 14px; }
.button:hover:enabled { background: #e7eee4; border-color: #779383; }
.primary { background: var(--forest); color: #fff; border-color: var(--forest); }
.primary:hover:enabled { background: #255546; color: #fff; border-color: #255546; }
.form-notice { border-radius: 9px; background: #ecf4e5; padding: 10px 12px; color: var(--ink); font-size: 14px; }
.form-notice strong { display: block; font-weight: 650; }
.form-notice > span { color: var(--muted); }
.preview-panel { background: #fffefa; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; overflow: hidden; padding: clamp(15px, 2.9vw, 27px); }
.preview-header { margin-bottom: 13px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.preview-header h2 { font-size: 18px; letter-spacing: -.035em; }
.preview-header span { color: var(--muted); font-size: 14px; text-align: end; }
.venue { --field: #e2eddf; --ruling: #91a890; --court: #f4f8ee; display: grid; gap: 9px; min-width: 0; }
.venue.field { --field: #f1e7d5; --ruling: #baaa89; --court: #fff9ed; }
.side-marker { color: #314b37; background: #e7eee3; border: 1px solid #c5d2c2; border-radius: 7px; text-align: center; padding: 6px 10px; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.side-marker span { color: #4d6250; font-size: .76em; margin-right: 9px; }
.field .side-marker { background: #f5eddf; border-color: #dacdb5; color: #574a32; }
.pitch { display: grid; gap: 11px; border: 1px solid var(--ruling); border-radius: 12px; padding: clamp(10px, 2vw, 17px); background: var(--field); }
.court-row { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: 10px; }
.court { min-width: 0; min-height: 96px; overflow-wrap: anywhere; border: 1px solid var(--ruling); border-radius: 8px; background: var(--court); padding: 9px; text-align: center; display: grid; align-content: center; justify-items: center; position: relative; isolation: isolate; }
.court::before { content: ""; box-sizing: border-box; position: absolute; z-index: -1; inset: 6px; border: 1px solid var(--ruling); border-radius: 3px; opacity: .45; background: linear-gradient(90deg, transparent 49.7%, var(--ruling) 49.7%, var(--ruling) 50.3%, transparent 50.3%); }
.court h3 { font-size: 15px; line-height: 1.3; font-weight: 650; }
.cycle-marker { display: inline-block; padding: 2px 6px; border-radius: 5px; background: #f7e6ae; color: #4e3a17; font-size: .77em; font-weight: 650; vertical-align: middle; }
.court.empty p { color: var(--muted); font-size: 13px; }
.court-row + .court-row { border-top: 1px dashed var(--ruling); padding-top: 11px; }
.court-row.vacant { min-height: 34px; }
.setup-layout .court-row { grid-template-columns: repeat(min(var(--columns), 3), minmax(0, 1fr)); }
.current-match { display: grid; gap: 8px; width: 100%; padding: 8px 2px 0; min-width: 0; }
.court:has(.current-match) { padding: 12px 10px; }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; width: 100%; }
.vs-label { font-size: 12px; font-weight: 650; }
.team-tag { --team: #bbcabe; display: inline-flex; justify-content: center; align-items: center; gap: 6px; border-radius: 7px; color: #11241c; background: color-mix(in srgb, var(--team) 58%, #fff); padding: 5px 8px; font-weight: 650; font-size: 14px; overflow-wrap: anywhere; line-height: 1.3; max-width: 100%; min-height: 28px; }
.team-tag::before { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 2px; background: var(--team); border: 1px solid #0003; }
.role-pills { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: center; }
.role-pills > span { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; font-size: 13px; }
.role-pills .team-tag { font-size: 12px; padding: 2px 5px; min-height: 23px; }
.court select { max-width: 100%; margin: auto; min-height: 36px; font-size: 14px; width: auto; }
.result-header { align-items: center; }
.result-header h1 { font-size: clamp(29px, 4vw, 43px); }
.result-header .result-plan-name { color: var(--ink); font-size: 17px; font-weight: 650; }
.result-tabs { border-bottom: 1px solid var(--line); display: flex; gap: 4px; margin-bottom: 13px; }
.tab { padding: 10px 12px 9px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 650; font-size: 15px; }
.tab[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--green); }
.tab:hover { background: #e4ebe0; border-radius: 6px 6px 0 0; }
.match-board { padding: clamp(15px, 3vw, 28px); }
.roundbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 13px; }
.round-title { font-size: clamp(25px, 4vw, 37px); line-height: 1.15; letter-spacing: -.055em; }
.round-title span { display: inline-block; font-size: 15px; font-weight: 650; color: var(--muted); letter-spacing: 0; margin-left: 9px; }
.round-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.round-controls .button { background: #edf1e4; color: var(--ink); border-color: #c1caba; }
.round-controls .button:hover:enabled { background: #e0e9d5; }
.round-controls select { background-color: #fffefa; width: auto; min-width: 77px; font-weight: 650; }
.match-board .court { min-height: 125px; }
.match-board .court h3 { font-size: clamp(17px, 2.3vw, 23px); }
.match-board .vs .team-tag { font-size: clamp(15px, 2.8vw, 29px); min-height: 39px; }
.match-board .side-marker { font-size: clamp(16px, 2.3vw, 21px); }
.board-mode { margin-bottom: 12px; }
.lesson-boards { display: grid; grid-template-columns: repeat(min(var(--boards), 3), minmax(0, 1fr)); gap: 12px; }
.lesson-slot { min-width: 0; padding: 10px; border: 1px solid var(--line); background: var(--page); border-radius: 10px; }
.lesson-slot-title { margin-bottom: 8px; text-align: center; font-size: clamp(17px, 2.1vw, 24px); font-weight: 650; }
.lesson-board .pitch { padding: 9px; gap: 8px; }
.lesson-board .court-row { grid-template-columns: repeat(min(var(--columns), 2), minmax(0, 1fr)); gap: 6px; }
.lesson-board .court-row + .court-row { padding-top: 8px; }
.lesson-board .court { min-height: 95px; padding: 8px; }
.lesson-board .court h3, .lesson-board .side-marker { font-size: clamp(14px, 1.35vw, 18px); }
.lesson-board .vs .team-tag { font-size: clamp(15px, 2.1vw, 29px); }
.waiting { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; }
.waiting .team-tag { font-size: 13px; min-height: 23px; padding: 3px 6px; }
.table-panel { overflow: hidden; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.ending-toolbar { background: #f1f4eb; }
.ending-label { font-size: 14px; font-weight: 650; }
.ending-summary { margin-left: auto; color: var(--muted); font-size: 14px; }
.table-scope { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--page); }
.table-scope .button { min-height: 36px; border-color: transparent; background: transparent; }
.table-scope .button[aria-pressed=true] { background: var(--forest); border-color: var(--forest); color: #fff; }
.table-lesson { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; }
.table-lesson select { width: auto; }
.table-match-count { margin-left: auto; color: var(--muted); font-size: 14px; }
.team-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.team-picker .button {
  --team: #bbcabe;
  min-width: 44px;
  min-height: 44px;
  background: color-mix(in srgb, var(--team) 25%, #fff);
  border-color: color-mix(in srgb, var(--team) 60%, #adb3a9);
  overflow-wrap: anywhere;
}
.team-picker .button:hover:enabled { background: color-mix(in srgb, var(--team) 50%, #fff); }
.team-picker .button[aria-pressed=true] {
  background: color-mix(in srgb, var(--team) 62%, #fff);
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid #dce4da; padding: 10px 13px; min-width: 70px; }
th { font-size: 14px; background: #e1ebe0; color: var(--ink); white-space: nowrap; }
td { font-size: 15px; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #f6f8f3; }
.lesson-start td { border-top: 2px solid #a8b8a8; }
.table-panel select { min-width: 104px; }
.tag-versus { display: inline-block; margin: 0 3px; font-size: 13px; }
.projection .topbar, .projection .result-tabs, .projection .result-actions { display: none; }
.projection .shell { max-width: 1600px; padding-top: 16px; }
.projection .page-header { margin-bottom: 12px; }
.projection .page-header h1 { font-size: clamp(22px, 3.5vw, 40px); }
.projection .court { min-height: 150px; }
.projection .match-board .vs .team-tag { font-size: clamp(17px, 4.3vw, 48px); }
.projection .role-pills > span { font-size: clamp(14px, 2vw, 23px); }
.projection .role-pills .team-tag { font-size: clamp(14px, 1.9vw, 22px); padding: 3px 7px; }
.projection .lesson-board .court { min-height: 112px; }
.projection .lesson-board .vs .team-tag { font-size: clamp(16px, 2.4vw, 34px); }
.projection .lesson-board .role-pills > span { font-size: clamp(13px, 1.2vw, 17px); }
.projection .lesson-board .role-pills .team-tag { font-size: clamp(13px, 1.35vw, 19px); }
#dialog { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: #fff; color: var(--ink); width: min(470px, calc(100% - 24px)); }
#dialog::backdrop { background: #0e221ccc; }
.dialog-title { font-size: 23px; margin-bottom: 11px; }
.dialog-actions { justify-content: flex-end; margin-top: 15px; }
.saved-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.saved-item { width: 100%; text-align: left; overflow-wrap: anywhere; }
.saved-item small { display: block; color: var(--muted); font-size: 13px; font-weight: 550; }
.toast { position: fixed; z-index: 3; bottom: 14px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 10px; background: #112d24; color: #fff; border: 1px solid #91ad95; text-align: center; font-weight: 650; }
@media (max-width: 950px) {
  .lesson-boards { grid-template-columns: repeat(min(var(--boards), 2), minmax(0, 1fr)); }
}
@media (max-width: 590px) {
  .lesson-boards { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .setup-layout { grid-template-columns: minmax(0, 1fr); }
  .shell { padding: 25px 16px 26px; }
  .topbar-inner { width: calc(100% - 32px); height: 54px; }
  .brand { gap: 9px; }
  .brand-icon { width: 30px; height: 30px; }
  .brand-icon svg { width: 21px; height: 21px; }
  .wordmark { font-size: 21px; }
  .step-chip { gap: 4px; font-size: 12px; }
  .step-number { width: 19px; height: 19px; flex-basis: 19px; font-size: 12px; }
  .court-row, .setup-layout .court-row { grid-template-columns: repeat(min(var(--columns), 2), minmax(0, 1fr)); }
}
@media (max-width: 395px) {
  .step-chip { flex-direction: column; }
  .court-row, .setup-layout .court-row { grid-template-columns: 1fr; }
}
