:root {
  color-scheme: light;
  font-family: "Pretendard", "Noto Sans CJK KR", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #232820;
  background: #f6f8f1;
  font-synthesis: none;
  /* 키 컬러: 성대 연두. 여기 값만 바꾸면 버튼·배지·강조가 함께 바뀐다. */
  --accent: #8cc63f;
  --accent-hover: #7db32f;
  --accent-active: #6ea125;
  --accent-ink: #172410;
  --accent-soft: #eef7df;
  --accent-line: #cfe6a6;
  --accent-deep: #4f7a12;
  --muted: #6f7a66;
  --line: #e0e6d8;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { min-height: 44px; font-size: 14px; font-weight: 600; transition: background .15s, transform .15s, border-color .15s; -webkit-tap-highlight-color: transparent; }
button, a, input, select { touch-action: manipulation; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 3px solid var(--accent-deep); outline-offset: 4px; }
h1:focus { outline: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 30px; font-weight: 750; line-height: 1.4; letter-spacing: -1px; }
h2, h3 { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.primary-button, .secondary-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 10px; padding: 12px 18px; line-height: 1.5; }
.primary-button { color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); }
.primary-button:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary-button { color: #49523f; background: #fff; border: 1px solid #dce1d5; }
.secondary-button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.text-button { color: var(--muted); background: transparent; border: 1px solid transparent; }
.text-button:hover:not(:disabled) { color: #303829; background: var(--accent-soft); }
button:active:not(:disabled) { transform: translateY(1px); }
input, select { min-height: 44px; border: 1px solid #ccd4c3; border-radius: 9px; background: #fafbf8; color: #30372a; padding: 10px 12px; }
input[aria-invalid="true"] { border-color: #b94323; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app-shell { max-width: 1400px; padding: 0 40px; margin: auto; }
.topbar { min-height: 80px; border-bottom: 1px solid #dfe3d7; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: -.8px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; overflow: hidden; }
.brand-mark.has-logo { background: transparent; border-radius: 0; }
.brand-mark .icon { width: 24px; height: 24px; stroke-width: 2; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; }
.brand-description { border-left: 1px solid #d1d7c7; margin-left: 3px; padding-left: 13px; font-size: 13px; font-weight: 500; letter-spacing: -.2px; color: var(--muted); }
.phase-badge { font-size: 12px; color: var(--accent-deep); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 6px 12px; border-radius: 30px; white-space: nowrap; }
.setup-view { max-width: 480px; margin: 72px auto 46px; }
.setup-card, .result-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; }
.setup-card { padding: 36px; }
#setup-form { margin-top: 30px; }
.field-label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.team-count-field { position: relative; }
.team-count-field input { width: 100%; min-height: 64px; padding: 13px 54px 13px 16px; font-size: 24px; font-variant-numeric: tabular-nums; }
.team-count-field > span { position: absolute; right: 33px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
.field-hint { margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.field-error { margin-top: 10px; color: #b53e20; font-size: 13px; }
.setup-start { width: 100%; margin-top: 26px; min-height: 54px; font-size: 16px; }
.setup-back { width: 100%; margin-top: 10px; }
.legacy-records { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.legacy-records p { color: var(--muted); font-size: 13px; }
.legacy-records button { font-size: 12px; padding: 10px 12px; }
.match-view { margin-top: 22px; }
.scoreboard { position: relative; display: flex; flex-direction: column; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 62px 28px 26px; box-shadow: 0 4px 20px #23331b03; }
.scoreboard-tools { position: absolute; right: 20px; top: 14px; display: flex; align-items: center; gap: 2px; }
.utility-button { gap: 7px; padding: 10px 12px; font-size: 12px; font-weight: 500; }
.utility-button .icon { width: 17px; height: 17px; }
.cars { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; }
.car { position: relative; display: flex; flex-direction: column; align-items: center; padding: 18px 20px 22px; border: 1px solid var(--line); border-radius: 20px; background: #fbfcf8; transition: border-color .15s, box-shadow .15s; }
.car-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.car-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 18px; }
.car-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-family: Arial, Helvetica, sans-serif; font-size: 15px; font-weight: 800; letter-spacing: 0; flex-shrink: 0; }
.car-key { font-size: 12px; color: var(--muted); padding: 4px 9px; }
.order-row { display: grid; grid-template-columns: 52px minmax(150px, 1fr) 52px; align-items: center; gap: 14px; width: 100%; max-width: 520px; margin-top: 16px; }
.order-field { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.order-label { font-size: 12px; color: var(--muted); }
.order-select { width: 100%; min-height: 64px; padding: 4px 34px 4px 16px; text-align: center; text-align-last: center; font-size: 34px; font-weight: 750; letter-spacing: -1.2px; line-height: 1.3; border-radius: 14px; background: #fff; color: #232820; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-select.has-name { font-size: 22px; letter-spacing: -.5px; }
.team-arrow { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #e0e5d9; border-radius: 50%; color: #3c4533; background: #fff; }
.team-arrow .icon { width: 22px; height: 22px; stroke-width: 2; }
.team-arrow:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.team-arrow:disabled { opacity: .27; }
.score-label { margin-top: 18px; color: #767d6d; font-size: 15px; line-height: 1.5; font-weight: 500; }
.count { display: block; max-width: 100%; padding: 0 12px; margin-top: 2px; color: #232820; font-family: Arial, Helvetica, sans-serif; font-size: clamp(120px, 22vh, 220px); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.07; letter-spacing: -.055em; text-indent: -.055em; text-align: center; overflow-wrap: anywhere; }
.count[data-digits="4"], .count[data-digits="5"] { font-size: clamp(96px, 16vh, 170px); }
.count[data-digits="6"], .count[data-digits="7"] { font-size: clamp(76px, 12vh, 130px); }
.count[data-digits="8"], .count[data-digits="9"], .count[data-digits="10"] { font-size: clamp(60px, 9vh, 100px); }
.car.is-empty .count { color: #b7bdad; }
.record-button { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; max-width: 460px; min-height: 76px; padding: 16px 96px; margin-top: 14px; border: 0; border-radius: 15px; background: var(--accent); color: var(--accent-ink); font-size: 28px; line-height: 1.35; font-weight: 750; letter-spacing: -.6px; }
.record-button:hover:not(:disabled) { background: var(--accent-hover); }
.record-button:active:not(:disabled) { background: var(--accent-active); }
.record-plus { margin-left: 3px; font-family: Arial, sans-serif; font-size: 26px; font-weight: 500; }
kbd { font: inherit; font-size: 11px; border: 1px solid #dce1d5; background: #fff; border-radius: 5px; padding: 3px 6px; line-height: 1.3; white-space: nowrap; }
.record-button kbd { position: absolute; right: 18px; color: var(--accent-ink); background: #ffffff55; border-color: #ffffff90; font-size: 12px; font-weight: 500; letter-spacing: 0; padding: 4px 8px; }
.car.recorded { animation: recorded .3s ease-out; }
@keyframes recorded { 0% { border-color: var(--accent); box-shadow: 0 0 0 4px #8cc63f55; } 100% { border-color: var(--line); box-shadow: 0 0 0 0 #8cc63f00; } }
.run-navigation { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px 18px; width: 100%; margin-top: 18px; }
.run-button { min-height: 46px; font-size: 13px; padding: 10px 16px; }
.run-button .icon { width: 17px; height: 17px; }
.team-progress { color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; min-width: 120px; }
.same-order { color: #b06a1c; }
.counter-actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-top: 16px; }
.undo-button { justify-self: start; min-height: 48px; font-size: 13px; }
.undo-button .icon { width: 17px; height: 17px; }
.undo-button kbd { color: #7b8372; font-size: 10px; font-weight: 400; }
.screen-status { color: #666f5b; font-size: 12px; line-height: 1.6; text-align: center; }
.screen-status.error { color: #b43f21; }
.results-button { justify-self: end; min-height: 48px; padding-left: 22px; padding-right: 16px; }
.results-button .icon { width: 17px; height: 17px; margin-left: 6px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 38px 0 24px; }
.result-view, .list-view { max-width: 820px; margin: 0 auto; }
.result-team-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.result-team-meta strong { font-weight: 500; }
.result-card { padding: 30px; }
.result-times { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-bottom: 24px; font-size: 12px; line-height: 1.6; }
.result-times > div { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.result-times dt { color: var(--muted); }
.result-table { width: 100%; border-collapse: collapse; font-size: 17px; font-variant-numeric: tabular-nums; }
.result-table th { background: #f3f5ee; color: #66725a; font-size: 12px; font-weight: 500; }
.result-table th, .result-table td { text-align: left; padding: 18px 20px; border-bottom: 1px solid #e8ecdf; }
.result-table th:last-child, .result-table td:last-child { text-align: right; }
.result-table tbody th { background: transparent; color: #353d2e; font-size: 17px; font-weight: 600; }
.result-table td:last-child { color: #232820; font-size: 24px; font-weight: 650; }
.list-table th, .list-table td { padding: 12px 16px; }
.list-table .list-count { font-size: 22px; font-weight: 650; color: #232820; }
.list-table td { vertical-align: middle; }
.list-table .list-cars { white-space: nowrap; }
.list-table .list-cars .car-badge { margin-right: 6px; vertical-align: middle; }
.list-table .list-cars:empty::before { content: "–"; color: #c2c8b9; }
.list-table td:last-child { font-size: inherit; font-weight: inherit; }
.list-actions { display: flex; justify-content: flex-end; gap: 6px; }
.mini-button { min-width: 52px; min-height: 40px; padding: 6px 10px; border: 1px solid #dce1d5; border-radius: 8px; background: #fff; color: #3c4533; font-family: Arial, Helvetica, sans-serif; font-size: 15px; font-weight: 700; }
.mini-button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.list-status { margin-top: 16px; color: var(--accent-deep); font-size: 13px; line-height: 1.6; text-align: center; }
.list-status:empty { display: none; }
.list-hint { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.result-download { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 28px; }
.result-download button { min-height: 56px; font-size: 15px; }
#csv-status { color: var(--accent-deep); font-size: 12px; line-height: 1.7; text-align: center; }
#csv-status:empty { display: none; }
#csv-status.error { color: #b43f21; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.resume-button .icon { width: 17px; height: 17px; }
.page-footer { padding: 22px 0 24px; font-size: 11px; line-height: 1.6; color: #818878; }
#storage-status { display: flex; align-items: center; justify-content: center; gap: 6px; }
#storage-status .icon { width: 14px; height: 14px; }
#storage-status.error { color: #b43f21; }
.credit { margin-top: 8px; text-align: center; color: #8a917f; letter-spacing: .1px; }
dialog { border: 1px solid var(--line); border-radius: 20px; padding: 28px; color: #232820; width: min(430px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; box-shadow: 0 20px 80px #17200f26; }
dialog::backdrop { background: #20271e66; backdrop-filter: blur(4px); }
dialog h2 { font-size: 21px; line-height: 1.5; letter-spacing: -.6px; }
dialog > form > p { font-size: 14px; color: var(--muted); line-height: 1.8; margin: 12px 0 24px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions button { flex: 1; padding-left: 8px; padding-right: 8px; }
.settings-dialog { width: min(520px, calc(100% - 32px)); }
.settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: -7px -7px 16px 0; }
.icon-button { display: grid; place-items: center; width: 44px; padding: 10px; color: #6f7766; background: transparent; border: 0; border-radius: 10px; }
.icon-button:hover { background: #f0f3eb; }
.audio-card { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.audio-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.audio-heading h3 { display: flex; align-items: center; gap: 8px; }
.audio-heading h3 .icon { color: var(--accent-deep); width: 18px; height: 18px; }
.switch { position: relative; width: 48px; height: 44px; padding: 0; background: transparent; border: 0; flex-shrink: 0; border-radius: 8px; }
.switch::before { content: ""; position: absolute; top: 9px; left: 1px; width: 46px; height: 26px; background: #6f9a2c; border-radius: 30px; }
.switch span { position: absolute; top: 13px; left: 5px; border-radius: 50%; width: 18px; height: 18px; background: white; transform: translateX(20px); transition: transform .2s; box-shadow: 0 1px 3px #0002; }
.switch[aria-checked="false"]::before { background: #bdc4b6; }
.switch[aria-checked="false"] span { transform: translateX(0); }
.voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.voice-picker { display: flex; flex-direction: column; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafbf8; }
.voice-picker label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #4a5340; font-weight: 600; }
.voice-picker label .car-badge { width: 22px; height: 22px; border-radius: 6px; font-size: 12px; }
.voice-picker select { width: 100%; font-size: 13px; }
.volume-heading { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
#volume { display: block; margin: 0; padding: 0; width: 100%; height: 44px; appearance: none; background: linear-gradient(to right, #7aa832 0%, #7aa832 77.78%, #e8eedd 77.78%, #e8eedd 100%) center / 100% 5px no-repeat; border: 0; border-radius: 4px; accent-color: #7aa832; cursor: pointer; }
#volume::-webkit-slider-thumb { appearance: none; border-radius: 50%; width: 18px; height: 18px; background: #7aa832; border: 2px solid white; box-shadow: 0 0 0 1px #7aa832; }
#volume::-moz-range-thumb { border-radius: 50%; width: 14px; height: 14px; background: #7aa832; border: 2px solid white; box-shadow: 0 0 0 1px #7aa832; }
.preview-button { width: 100%; margin-top: 2px; min-height: 40px; font-size: 12px; padding: 8px 10px; }
.preview-button .icon { width: 14px; height: 14px; }
.audio-status { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.status-dot { width: 6px; height: 6px; background: #6f9a2c; border-radius: 50%; flex-shrink: 0; }
.audio-status.off .status-dot { background: #a3ac9a; }
.audio-status.error { color: #b43f21; }
.audio-status.error .status-dot { background: #b43f21; }
.history-card { padding-top: 23px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-heading > span { font-size: 11px; color: var(--muted); }
.empty-history { padding: 24px 0; color: var(--muted); font-size: 13px; text-align: center; }
.history-list { list-style: none; padding: 0; margin: 10px 0 0; }
.history-row { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid #edf0e7; font-size: 12px; }
.history-row:last-child { border-bottom: 0; }
.history-number { display: inline-grid; place-items: center; background: #f2f5ec; color: var(--muted); border-radius: 4px; min-width: 23px; padding: 4px; font-size: 10px; font-variant-numeric: tabular-nums; }
.history-row:first-child .history-number { background: var(--accent-soft); color: var(--accent-deep); }
.history-name { color: #505c43; }
.history-row time { margin-left: auto; font: 11px Arial, sans-serif; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.reset-button { color: #aa5237; font-size: 12px; padding-left: 0; padding-right: 0; }
.reset-button:hover:not(:disabled) { color: #ac3e20; background: #fff3ec; padding-left: 12px; padding-right: 12px; }
/* 팀명 · 음성 상태 */
.names-label { margin-top: 22px; }
.field-optional { font-weight: 400; font-size: 13px; color: var(--muted); }
.names-input { display: block; width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid #ccd4c3; border-radius: 9px; background: #fafbf8; color: #30372a; font: inherit; font-size: 14px; line-height: 1.6; resize: vertical; }
.names-input[aria-invalid="true"] { border-color: #b94323; }
.team-name-input { display: block; width: min(100%, 380px); min-height: 36px; margin-top: 8px; padding: 2px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 20px; font-weight: 600; line-height: 1.5; color: #3c4533; text-align: center; }
.team-name-input::placeholder { color: #b7bdad; font-size: 15px; font-weight: 500; }
.team-name-input:hover:not(:disabled) { border-color: var(--line); background: #fff; }
.team-name-input:focus { border-color: var(--accent-line); background: #fff; outline-offset: 2px; }
.car.is-empty .team-name-input { visibility: hidden; }
.audio-inline { position: absolute; left: 20px; top: 14px; max-width: min(60%, 560px); gap: 7px; padding: 10px 12px; font-size: 12px; font-weight: 500; text-align: left; color: #8a6d1f; background: #fff8e1; border-color: #f1e2a6; }
.audio-inline.error { color: #b43f21; background: #fff1ea; border-color: #f2cdbf; }
.audio-inline .icon { width: 17px; height: 17px; }
.audio-inline span { overflow-wrap: anywhere; }
.name-input { width: 100%; min-width: 120px; max-width: 280px; min-height: 40px; padding: 6px 10px; font-size: 14px; }
.result-table:not(.has-names) .name-col { display: none; }
.result-table .name-cell { color: #3c4533; font-weight: 500; overflow-wrap: anywhere; }
.names-bulk { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.names-bulk summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #4a5340; }
.names-bulk .names-input { margin-top: 12px; }
.names-bulk-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.audio-diag { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.audio-diag summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #4a5340; }
.audio-diag .field-hint { margin-top: 8px; }
.diag-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.diag-buttons button { flex: 0 1 200px; min-height: 40px; padding: 8px 10px; font-size: 12px; }
.diag-text { margin: 10px 0 0; padding: 10px 12px; max-height: 220px; overflow: auto; background: #f3f5ee; border-radius: 8px; font: 11px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #3c4533; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
#copy-diag { margin-top: 6px; font-size: 12px; padding: 8px 10px; }
/* 경기 구분 · 팀명 읽기 */
.mode-field { margin: 0 0 22px; padding: 0; border: 0; }
.mode-field .field-label { margin-bottom: 10px; padding: 0; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-option { position: relative; display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 10px 12px; border: 1px solid #dce1d5; border-radius: 12px; background: #fff; font-size: 15px; font-weight: 600; color: #49523f; cursor: pointer; transition: background .15s, border-color .15s; }
.mode-option:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.mode-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.mode-option:has(input:checked) { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.mode-option:has(input:focus-visible) { outline: 3px solid var(--accent-deep); outline-offset: 3px; }
.names-label { margin-top: 22px; }
.mode-badge { display: inline-block; padding: 2px 9px; border-radius: 30px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-deep); font-size: 11px; font-weight: 600; vertical-align: middle; }
.result-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.result-tab { flex: 1 1 0; min-height: 46px; padding: 10px 14px; border: 1px solid #dce1d5; border-radius: 12px; background: #fff; color: #6b7562; font-size: 14px; font-weight: 600; }
.result-tab:hover:not(.is-active) { background: var(--accent-soft); border-color: var(--accent-line); }
.result-tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.result-tab.is-empty:not(.is-active) { color: #a3ac9a; }
.result-tab.is-empty:not(.is-active)::after { content: " (없음)"; font-size: 11px; font-weight: 500; }
.result-empty { padding: 34px 10px; color: var(--muted); font-size: 14px; line-height: 1.8; text-align: center; }
.result-empty strong { color: #3c4533; font-weight: 600; }
.name-speech { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.name-speech-title { font-size: 13px; font-weight: 600; color: #3c4533; }
.name-speech .field-hint { margin-top: 4px; max-width: 340px; }
.name-speech .switch { margin-top: -6px; }
/* 토너먼트 대진 보기 */
.result-rounds { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.round-chip { min-height: 38px; padding: 8px 16px; border: 1px solid #dce1d5; border-radius: 30px; background: #fff; color: #5d6854; font-size: 13px; font-weight: 600; }
.round-chip:hover:not(.is-active) { background: var(--accent-soft); border-color: var(--accent-line); }
.round-chip.is-active { background: var(--accent-soft); border-color: var(--accent-deep); color: var(--accent-deep); }
.bracket-summary { margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.bracket-summary strong { color: #3c4533; font-size: 14px; font-weight: 700; }
.bracket { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 0; margin: 0; }
.bracket-pair { padding: 14px 16px 8px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcf8; }
.bracket-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bracket-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.bracket-note { font-size: 11px; color: #b06a1c; }
.bracket-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: 10px; row-gap: 1px; padding: 10px 0; border-top: 1px solid #edf0e7; font-size: 15px; }
.bracket-row:first-of-type { border-top: 0; }
.bracket-row.is-empty { color: #a3ac9a; font-size: 13px; grid-template-columns: 1fr; }
.bracket-order { display: inline-grid; place-items: center; min-width: 40px; padding: 4px 8px; border-radius: 6px; background: #eef1e8; color: #5d6854; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bracket-name { min-width: 0; font-weight: 600; color: #2f362a; word-break: keep-all; overflow-wrap: break-word; }
.bracket-name.is-blank { color: #a3ac9a; font-weight: 500; }
.bracket-count { grid-column: 3; grid-row: 1 / -1; align-self: center; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: #232820; white-space: nowrap; }
.bracket-mark { grid-column: 2; color: var(--accent-deep); font-size: 11px; font-weight: 600; }
.bracket-row.is-lower .bracket-count { color: var(--accent-deep); }
/* 진출 선택과 다음 라운드 */
.bracket-row { position: relative; }
.advance-button, .advance-state { grid-column: 4; grid-row: 1 / -1; align-self: center; min-height: 34px; padding: 6px 12px; border-radius: 30px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.advance-button { border: 1px solid #dce1d5; background: #fff; color: #6b7562; }
.advance-button:hover:not(.is-on) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.advance-button.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.advance-state { display: inline-grid; place-items: center; border: 1px solid transparent; background: #f2f5ec; color: #8a917f; }
.advance-state.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.bracket-row.is-winner .bracket-name { color: #1f2a15; }
.next-round { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; padding: 16px 18px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--accent-soft); }
.next-round-title { font-size: 15px; font-weight: 700; color: #2f362a; }
.next-round-title strong { color: var(--accent-deep); }
.next-round .field-hint { margin-top: 4px; }
.next-round-hint { color: #b06a1c; }
.next-round button { min-height: 48px; padding-left: 22px; padding-right: 22px; }
.champion { margin-top: 22px; padding: 18px; border: 1px solid var(--accent-line); border-radius: 14px; background: var(--accent-soft); color: var(--accent-deep); font-size: 15px; font-weight: 600; text-align: center; }
.champion strong { display: block; margin-top: 6px; color: #1f2a15; font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.result-download { flex-direction: column; }
#download-all { min-height: 46px; font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:fullscreen { background: #f6f8f1; }
.is-scoreboard .topbar { min-height: 58px; }
.is-scoreboard .match-view { margin-top: 16px; margin-bottom: 16px; }
.is-scoreboard .scoreboard { min-height: calc(100svh - 190px); justify-content: center; }
.is-scoreboard .page-footer { padding: 0 0 12px; }
.is-scoreboard #storage-status:not(.error) { display: none; }
@media (min-width: 1600px) {
  .app-shell { max-width: 1560px; }
  .topbar { min-height: 88px; }
  .scoreboard { padding-top: 66px; padding-bottom: 34px; }
  .cars { gap: 28px; }
  .car { padding: 24px 28px 28px; }
  .order-select { font-size: 40px; min-height: 72px; }
  .count { font-size: clamp(160px, 26vh, 260px); }
  .record-button { margin-top: 20px; min-height: 88px; max-width: 520px; font-size: 32px; }
  .run-navigation { margin-top: 24px; }
}
@media (max-width: 980px) {
  .app-shell { padding: 0 24px; }
  .scoreboard { padding: 58px 18px 22px; }
  .scoreboard-tools { top: 12px; right: 12px; }
  .utility-button { padding: 10px; }
  .utility-button span { display: none; }
  .utility-button .icon { width: 20px; height: 20px; }
  .cars { gap: 14px; }
  .car { padding: 16px 14px 18px; }
  .order-row { gap: 10px; grid-template-columns: 46px minmax(110px, 1fr) 46px; max-width: none; }
  .team-arrow { width: 46px; height: 46px; }
  .order-select { font-size: 28px; min-height: 56px; padding-right: 28px; }
  .order-select.has-name { font-size: 19px; }
  .count { font-size: clamp(88px, 16vw, 160px); }
  .record-button { padding: 14px 70px; font-size: 24px; min-height: 66px; }
  .record-plus { font-size: 22px; }
}
@media (max-width: 600px) {
  .app-shell { padding: 0 16px; }
  .topbar { min-height: 70px; }
  .brand { font-size: 21px; gap: 9px; }
  .brand-description { display: none; }
  .phase-badge { font-size: 11px; padding: 6px 10px; }
  h1 { font-size: 26px; }
  .setup-view { margin: 36px auto; }
  .setup-card { padding: 26px; }
  .match-view { margin-top: 18px; }
  .scoreboard { border-radius: 20px; padding: 60px 14px 22px; }
  .scoreboard-tools { top: 10px; right: 10px; }
  .utility-button span { display: inline; }
  .utility-button { gap: 5px; padding: 10px 8px; font-size: 11px; }
  .utility-button .icon { width: 16px; height: 16px; }
  .cars { grid-template-columns: 1fr; gap: 12px; }
  .car { padding: 14px 14px 16px; }
  .car-heading h2 { font-size: 16px; }
  .car-key { font-size: 10px; padding: 3px 6px; }
  .mode-options { grid-template-columns: 1fr; }
  .result-tabs { gap: 4px; }
  .bracket { grid-template-columns: 1fr; }
  .next-round { flex-direction: column; align-items: stretch; }
  .next-round button { width: 100%; }
  .advance-button, .advance-state { padding: 6px 9px; font-size: 11px; }
  .round-chip { padding: 8px 12px; font-size: 12px; }
  .order-row { width: 100%; max-width: 340px; grid-template-columns: 44px minmax(100px, 1fr) 44px; gap: 10px; margin-top: 12px; }
  .team-arrow { width: 44px; height: 44px; }
  .team-arrow .icon { width: 20px; height: 20px; }
  .order-select { font-size: 26px; min-height: 52px; }
  .order-select.has-name { font-size: 18px; }
  .score-label { margin-top: 12px; font-size: 13px; }
  .count { font-size: clamp(72px, 26vw, 130px); line-height: 1.1; padding: 0 4px; }
  .count[data-digits="4"], .count[data-digits="5"] { font-size: clamp(56px, 20vw, 100px); }
  .count[data-digits="6"], .count[data-digits="7"] { font-size: clamp(44px, 15vw, 80px); }
  .count[data-digits="8"], .count[data-digits="9"], .count[data-digits="10"] { font-size: clamp(36px, 12vw, 64px); }
  .record-button { min-height: 62px; font-size: 22px; margin-top: 10px; padding: 12px 40px; border-radius: 12px; }
  .record-plus { font-size: 20px; }
  .record-button kbd { display: none; }
  .run-navigation { margin-top: 14px; gap: 10px; }
  .run-button { font-size: 12px; padding: 10px 12px; }
  .team-progress { order: -1; flex-basis: 100%; }
  .counter-actions { grid-template-columns: auto 1fr; gap: 12px; margin-top: 14px; }
  .undo-button, .results-button { min-height: 48px; padding: 11px 13px; font-size: 12px; gap: 7px; }
  .undo-button kbd { display: none; }
  .screen-status { grid-column: 1 / -1; grid-row: 2; font-size: 11px; }
  .screen-status:empty { display: none; }
  .results-button { grid-column: 2; grid-row: 1; }
  .page-heading { margin-top: 28px; gap: 14px; }
  .result-card { padding: 20px; }
  .result-times { flex-direction: column; font-size: 11px; gap: 6px; }
  .result-table th, .result-table td { padding: 15px 12px; }
  .list-table th, .list-table td { padding: 10px 8px; }
  .list-table .list-count { font-size: 18px; }
  .mini-button { min-width: 44px; padding: 6px; }
  .result-download button { font-size: 14px; padding-left: 10px; padding-right: 10px; }
  .result-actions { flex-direction: column; }
  .resume-button { width: 100%; }
  .page-footer { font-size: 10px; padding: 20px 0; }
  .voice-grid { grid-template-columns: 1fr; }
  .team-name-input { font-size: 16px; min-height: 32px; }
  .audio-inline { position: static; width: 100%; max-width: none; margin-bottom: 10px; }
  .name-input { min-width: 90px; }
  .names-bulk-actions { flex-direction: column; align-items: stretch; }
  dialog { padding: 24px; }
  dialog h2 { font-size: 19px; }
}
@media (max-height: 760px) and (min-width: 601px) {
  .topbar { min-height: 60px; }
  .match-view { margin-top: 14px; }
  .scoreboard { padding-top: 54px; padding-bottom: 18px; }
  .car { padding-top: 12px; padding-bottom: 14px; }
  .order-row { margin-top: 8px; }
  .order-select { font-size: 28px; min-height: 54px; }
  .score-label { margin-top: 8px; }
  .count { font-size: clamp(96px, 20vh, 150px); line-height: 1.02; }
  .record-button { margin-top: 8px; min-height: 60px; padding-top: 10px; padding-bottom: 10px; font-size: 24px; }
  .run-navigation { margin-top: 10px; }
  .counter-actions { margin-top: 10px; }
  .page-footer { padding: 12px 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* 추월 표시 (본선). 누른 쪽 버튼이 켜지고 상대 카드에는 완주 실패 배지가 뜬다. */
.overtake-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 460px; min-height: 42px; margin-top: 12px; }
.overtake-button { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 18px; border: 1px solid #dce1d5; border-radius: 30px; background: #fff; color: #6b7562; font-size: 15px; font-weight: 600; }
.overtake-button:hover:not(:disabled):not(.is-on) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-deep); }
.overtake-button.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.overtake-button:disabled { opacity: .45; cursor: default; }
.overtaken-badge { display: inline-block; padding: 8px 14px; border: 1px solid #f1d6ad; border-radius: 30px; background: #fff4e5; color: #b06a1c; font-size: 14px; font-weight: 700; }
.car.is-overtaken { border-color: #f1d6ad; background: #fffaf3; }
.car.is-overtaken .count { color: #b06a1c; }
.bracket-note.is-overtake, .bracket-mark.is-overtake { color: var(--accent-deep); }
.bracket-mark.is-overtaken { color: #b06a1c; }
@media (max-width: 600px) {
  .overtake-row { gap: 8px; margin-top: 8px; }
  .overtake-button { min-height: 38px; padding: 6px 14px; font-size: 13px; }
  .overtaken-badge { padding: 6px 10px; font-size: 12px; }
}

/* 재경기용 횟수 초기화 (차량 카드). 전체 초기화와 같은 붉은 톤. */
.car-reset { margin-top: 6px; padding: 8px 12px; font-size: 12px; color: #aa5237; }
.car-reset:hover:not(:disabled) { color: #ac3e20; background: #fff3ec; }
.car-reset:disabled { opacity: .45; }
