/* Shared controls, dialogs and game states. Layout lives in landscape.css. */
* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0px;
  min-height: 100vh;
}

button, input, select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(1400px, 100%);
  margin: 0px auto;
}

.btn {
  min-height: 44px;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 950;
  cursor: pointer;
  transition: filter 100ms, transform 100ms;
}

.btn:hover {
  filter: brightness(1.2);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: rgba(255, 201, 40, 0.45) solid 3px;
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.history-panel {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0px;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.modal[hidden] {
  display: none;
}

.setup {
  position: relative;
  overflow-x: hidden;
}

.form-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.half {
  grid-column: span 3;
}

.field label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.field input, .field select {
  width: 100%;
  min-height: 45px;
  border: 1px solid rgb(112, 48, 30);
  padding: 9px 11px;
  outline: none;
}

.field input:focus, .field select:focus {
  box-shadow: rgba(255, 201, 40, 0.13) 0px 0px 0px 3px;
}

.start-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

@media (max-width: 540px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.half {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  ::before {
    transition: none !important;
  }

  ::after {
    transition: none !important;
  }
}

.score-menu {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.score-head-grid {
  display: grid;
  align-items: stretch;
}

.match-leg-title {
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1.25;
  white-space: nowrap;
}

.score-player {
  position: relative;
  min-width: 0px;
  border-right-width: 1px;
  border-right-style: solid;
  padding: 10px 12px 9px;
}

.score-player:last-child {
  border-right: 0px;
}

.score-player.player-one {
  border-right: 0px;
}

.score-player-name {
  overflow: hidden;
  font-size: clamp(14px, 2.5vw, 20px);
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-action-btn {
  min-width: 0px;
  min-height: 27px;
  border-width: 1px;
  border-style: solid;
  border-image: none;
  padding: 3px 2px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.player-action-btn:hover:not(:disabled) {
  filter: brightness(1.16);
}

.player-action-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.score-values {
  display: grid;
  grid-template-columns: 0.7fr 1fr;
  gap: 8px;
  margin-top: 7px;
}

.score-value {
  min-width: 0px;
  text-align: right;
}

.score-value span {
  display: block;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.score-value strong {
  display: block;
  overflow: hidden;
  font-size: clamp(25px, 6vw, 42px);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-sheet-wrap {
  scrollbar-color: rgb(114, 48, 29) transparent;
}

@media (max-width: 540px) {
  .score-player {
    padding-inline: 8px;
  }

  .score-values {
    gap: 4px;
  }
}

:root {
  color-scheme: light;
  --danger: #d94b55;
}

body {
  font-family: Inter, "Yu Gothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}

.app {
  padding: 18px;
}

.scoreboard {
  overflow: hidden;
}

.score-menu {
  padding: 9px 12px;
}

.score-player {
  opacity: 0.72;
}

.score-player.active {
  opacity: 1;
}

.score-player-name {
  color: rgb(21, 60, 79);
}

.match-leg-title {
  color: rgb(100, 131, 145);
}

.player-action-btn:not(:disabled):active {
  background: rgb(223, 244, 251);
}

.score-value span {
  color: rgb(118, 144, 157);
}

.score-value.to-go strong {
  color: rgb(20, 63, 82);
}

.btn {
  border-width: 1px;
  border-style: solid;
  border-image: none;
}

.btn.danger {
  color: rgb(188, 62, 73);
}

.modal {
  background: rgba(29, 67, 84, 0.44);
}

.setup {
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border-width: 1px;
  border-style: solid;
  border-image: none;
  padding: clamp(22px, 5vw, 34px);
}

.stats-card {
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border: 1px solid rgb(207, 227, 235);
  padding: clamp(22px, 5vw, 34px);
  color: rgb(23, 54, 70);
  background: rgb(255, 255, 255);
  box-shadow: rgba(24, 72, 94, 0.25) 0px 30px 90px;
}

.result-card {
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border: 1px solid rgb(207, 227, 235);
  padding: clamp(22px, 5vw, 34px);
  color: rgb(23, 54, 70);
  background: rgb(255, 255, 255);
  box-shadow: rgba(24, 72, 94, 0.25) 0px 30px 90px;
}

.modal-kicker {
  color: rgb(22, 135, 184);
}

.stats-card h2 {
  margin: 4px 0px 20px;
  color: rgb(18, 61, 80);
  text-shadow: none;
  transform: none;
}

.result-card h2 {
  margin: 4px 0px 20px;
  color: rgb(18, 61, 80);
  text-shadow: none;
  transform: none;
}

.field label {
  color: rgb(101, 129, 142);
}

.field input {
  border-color: rgb(207, 225, 233);
  color: rgb(23, 54, 70);
  background: rgb(248, 251, 252);
}

.field select {
  border-color: rgb(207, 225, 233);
  color: rgb(23, 54, 70);
  background: rgb(248, 251, 252);
}

.start-btn {
  border-width: 0px;
  border-style: none;
  border-image: none;
  color: rgb(255, 255, 255);
  box-shadow: rgba(8, 126, 174, 0.24) 0px 10px 25px;
}

.stats-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.close-btn {
  width: 40px;
  height: 40px;
  border: 0px;
  color: rgb(84, 113, 127);
  background: rgb(237, 245, 248);
  font-size: 25px;
  cursor: pointer;
}

.stats-comparison {
  overflow: hidden;
  border: 1px solid rgb(217, 232, 238);
}

.stats-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(100px, 1.25fr) minmax(90px, 1fr);
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid rgb(229, 238, 242);
  text-align: center;
}

.stats-row:last-child {
  border-bottom: 0px;
}

.stats-row:nth-child(2n) {
  background: rgb(247, 250, 252);
}

.stats-row.header {
  min-height: 52px;
  color: rgb(255, 255, 255);
  background: linear-gradient(135deg, rgb(38, 172, 216), rgb(22, 132, 178));
  font-weight: 900;
}

.stats-label {
  color: rgb(106, 133, 146);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.stats-number {
  color: rgb(23, 63, 82);
  font-size: 16px;
  font-weight: 900;
}

.result-card {
  text-align: center;
}

.result-card #resultSubtitle {
  margin: -12px 0px 22px;
  color: rgb(102, 131, 145);
}

.result-card .stats-comparison {
  margin-bottom: 20px;
  text-align: initial;
}

.win-actions {
  margin-top: 16px;
}

@media (max-width: 540px) {
  .stats-row {
    grid-template-columns: minmax(72px, 1fr) minmax(90px, 1.15fr) minmax(72px, 1fr);
  }

  .stats-label {
    font-size: 9px;
  }

  .stats-number {
    font-size: 13px;
  }
}

.mic-btn {
  width: 112px;
  flex: 0 0 auto;
  border-width: 1px;
  border-style: solid;
  border-image: none;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.mic-btn.listening {
  border-color: rgb(33, 162, 208);
  color: rgb(8, 123, 169);
  background: rgb(234, 249, 254);
  box-shadow: rgba(33, 162, 208, 0.1) 0px 0px 0px 4px;
}

.mic-dot {
  display: block;
  width: 12px;
  height: 12px;
  margin: 0px auto 7px;
  border-radius: 50%;
  background: rgb(155, 176, 186);
}

.mic-btn.listening .mic-dot {
  background: rgb(23, 161, 209);
  box-shadow: rgba(23, 161, 209, 0.13) 0px 0px 0px 7px;
  animation: 1.2s ease-in-out 0s infinite normal none running micPulse;
}

@keyframes micPulse { 
  50% { transform: scale(1.18); }
}

.voice-status {
  min-height: 31px;
  margin: 9px 0px;
  padding: 7px 10px;
  color: rgb(104, 133, 147);
  background: rgb(242, 248, 250);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.keypad {
  display: grid;
  width: min(300px, 100%);
  margin: 0px auto;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.keypad button {
  min-height: 48px;
  border: 1px solid rgb(203, 223, 231);
  color: rgb(36, 75, 93);
  background: rgb(255, 255, 255);
  box-shadow: rgba(34, 84, 107, 0.06) 0px 3px 7px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.keypad button:hover {
  background: rgb(240, 249, 252);
}

.keypad .key-clear {
  color: rgb(189, 72, 81);
  background: rgb(255, 247, 247);
}

.keypad .key-enter {
  color: rgb(255, 255, 255);
  background: rgb(20, 139, 184);
  font-size: 11px;
}

.quick-score {
  margin-top: 14px;
  border: 1px solid rgb(212, 229, 236);
  padding: 10px;
  background: rgb(248, 251, 252);
}

.quick-score > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.quick-score button {
  min-height: 42px;
  border: 1px solid rgb(175, 215, 230);
  color: rgb(8, 123, 169);
  background: rgb(255, 255, 255);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 920px) {
  .compact-game {
    display: flex;
    flex-direction: column;
  }

  .compact-game > .scoreboard {
    order: 1;
  }

  .compact-game > .compact-input {
    order: 2;
  }
}

@media (max-width: 430px) {
  .mic-btn {
    width: 100%;
    min-height: 52px;
  }

  .mic-dot {
    display: inline-block;
    margin: 0px 8px 0px 0px;
    vertical-align: middle;
  }
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0px, 0px, 0px, 0px) !important;
  white-space: nowrap !important;
}

.compact-game {
  display: grid;
  margin: 0px auto;
}

.score-menu .mic-btn.compact {
  width: auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  padding: 6px 10px;
}

.score-menu .mic-btn.compact .mic-dot {
  width: 9px;
  height: 9px;
  margin: 0px;
}

@keyframes cursorBlink { 
  50% { opacity: 0; }
}

.compact-input .voice-status {
  min-height: 24px;
  margin: 0px 0px 7px;
  padding: 4px 8px;
}

.compact-input .keypad {
  gap: 0px;
  border-top: 1px solid rgb(184, 204, 213);
  border-left: 1px solid rgb(184, 204, 213);
}

.compact-input .keypad button {
  margin: 0px;
  border-width: 0px 1px 1px 0px;
  border-style: none solid solid none;
  border-color: currentcolor rgb(184, 204, 213) rgb(184, 204, 213) currentcolor;
  border-image: none;
  box-shadow: none;
}

.compact-input .quick-score {
  margin: 7px auto 0px;
  border: 0px;
  padding: 0px;
  background: transparent;
}

.score-sheet-wrap {
  overscroll-behavior: contain;
}

@media (max-width: 540px) {
  .score-menu {
    font-size: 8px;
  }

  .match-leg-title {
    font-size: 6px;
    letter-spacing: 0px;
  }

  .player-action-btn {
    min-height: 24px;
    padding-inline: 1px;
    font-size: 7px;
  }

  .compact-game {
    height: calc(100dvh - 60px);
    min-height: 0px;
    grid-template-rows: auto auto;
    align-content: start;
  }
}

.score-sheet-wrap {
  overflow-y: auto;
}

.score-player.player-one .score-values {
  grid-template-columns: minmax(0px, 1fr) minmax(72px, 0.45fr);
}

.score-player.player-two .score-values {
  grid-template-columns: minmax(72px, 0.45fr) minmax(0px, 1fr);
}

.score-value.to-go strong {
  overflow: visible;
  text-overflow: clip;
}

.compact-input .keypad {
  max-width: none;
}

.compact-input .quick-score {
  width: 100%;
  max-width: none;
}

@media (max-width: 540px) {
  .score-head-grid {
    grid-template-columns: minmax(0px, 1fr) 92px minmax(0px, 1fr);
  }
}

@media (max-width: 540px) {
  .score-player.player-one .score-values {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .score-player.player-two .score-values {
    gap: 2px;
  }

  .score-player.player-two .score-values {
    grid-template-columns: 1fr;
  }

  .score-player.player-one .score-value {
    text-align: center;
  }

  .score-player.player-two .score-value {
    text-align: center;
  }

  .score-player.player-two .score-values .score-value:first-child {
    order: 2;
  }

  .score-player.player-two .score-values .score-value.to-go {
    order: 1;
  }

  .score-value.to-go strong {
    white-space: nowrap;
  }

  .score-value strong {
    font-size: 20px;
  }
}

.score-player.player-one .score-values {
  display: block;
  margin-top: 3px;
}

.score-player.player-two .score-values {
  display: block;
  margin-top: 3px;
}

.score-player.player-one .score-value {
  text-align: center;
}

.score-player.player-two .score-value {
  text-align: center;
}

.score-value.to-go span {
  line-height: 1;
}

@media (max-width: 540px) {
  .score-player-name {
    font-size: 12px;
  }
}

.score-sheet-wrap {
  height: 236px;
  max-height: 236px;
}

@media (max-width: 540px) {
  .score-sheet-wrap {
    height: 214px;
    max-height: 214px;
  }
}

.score-value strong {
  font-family: Arial, sans-serif;
  font-weight: 500;
  line-height: 1;
  letter-spacing: normal;
}

.score-value.to-go strong {
  font-family: Arial, sans-serif;
  font-size: clamp(76px, 18vw, 132px);
  line-height: 1;
  letter-spacing: normal;
  white-space: nowrap;
}

@media (max-width: 540px) {
  .score-value.to-go strong {
    font-size: clamp(56px, 21vw, 88px);
    line-height: 1;
    letter-spacing: normal;
  }
}

body * {
  font-weight: 400 !important;
}

#playerName0 {
  font-weight: 950 !important;
}

#playerName1 {
  font-weight: 950 !important;
}

.score-value.to-go span {
  font-weight: 400 !important;
}

.compact-input .keypad button {
  font-weight: 800 !important;
}

.stats-note {
  margin: 12px 0px 0px;
  color: rgb(106, 133, 146);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
  font-weight: 400 !important;
}

.scoreboard {
  border-radius: 0px !important;
}

.btn {
  border-radius: 0px !important;
}

.player-action-btn {
  border-radius: 0px !important;
}

.setup {
  border-radius: 0px !important;
}

.stats-card {
  border-radius: 0px !important;
}

.result-card {
  border-radius: 0px !important;
}

.field input {
  border-radius: 0px !important;
}

.field select {
  border-radius: 0px !important;
}

.start-btn {
  border-radius: 0px !important;
}

.close-btn {
  border-radius: 0px !important;
}

.stats-comparison {
  border-radius: 0px !important;
}

.mic-btn {
  border-radius: 0px !important;
}

.voice-status {
  border-radius: 0px !important;
}

.keypad button {
  border-radius: 0px !important;
}

.quick-score {
  border-radius: 0px !important;
}

.quick-score button {
  border-radius: 0px !important;
}

.compact-input {
  border-radius: 0px !important;
}

.compact-input .keypad button {
  border-radius: 0px !important;
}

.compact-input .quick-score button {
  border-radius: 0px !important;
}

.score-value.to-go strong {
  font-weight: 600 !important;
}

.com-avg-field {
  transition: opacity 120ms, filter 120ms;
}

.com-avg-field.inactive {
  opacity: 0.34;
  filter: grayscale(0.8);
}

.com-avg-field.inactive select {
  color: rgb(113, 133, 143);
  background: rgb(231, 238, 241);
  cursor: not-allowed;
}

.com-throw-overlay {
  position: fixed;
  inset: 0px;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 14px;
  pointer-events: none;
  background: transparent;
}

.com-throw-overlay[hidden] {
  display: none;
}

.com-throw-card {
  width: min(460px, 100%);
  border-width: 2px;
  border-style: solid;
  border-image: none;
  border-radius: 0px;
  padding: 14px;
  animation: 140ms ease-out 0s 1 normal none running comThrowIn;
}

@keyframes comThrowIn { 
  0% { opacity: 0; transform: translateY(8px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0px) scale(1); }
}

.com-throw-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgb(199, 223, 232);
  padding: 0px 2px 9px;
}

.com-throw-heading span {
  color: rgb(102, 131, 146);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.com-throw-heading strong {
  overflow: hidden;
  color: rgb(8, 126, 174);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.com-throw-darts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.com-throw-dart {
  min-width: 0px;
  border: 1px solid rgb(203, 223, 232);
  padding: 8px 4px;
  background: rgb(243, 249, 252);
  text-align: center;
}

.com-throw-dart span {
  display: block;
  color: rgb(113, 139, 151);
  font-size: 9px;
}

.com-throw-dart strong {
  display: block;
  margin-top: 3px;
  color: rgb(21, 62, 81);
  font-family: Arial, sans-serif;
  font-size: clamp(30px, 9vw, 48px);
  line-height: 1;
  font-weight: 400 !important;
}

.com-throw-dart small {
  display: block;
  min-height: 14px;
  margin-top: 4px;
  color: rgb(8, 126, 174);
  font-size: 10px;
}

.com-throw-total {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 9px;
  border-top: 1px solid rgb(199, 223, 232);
  padding-top: 8px;
}

.com-throw-total span {
  color: rgb(113, 139, 151);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.com-throw-total strong {
  color: rgb(8, 126, 174);
  font-family: Arial, sans-serif;
  font-size: 34px;
  line-height: 1;
  font-weight: 400 !important;
}

.com-throw-card.bust {
  border-color: rgb(217, 75, 85);
}

.com-throw-card.bust .com-throw-total strong {
  color: rgb(188, 62, 73);
  font-size: 24px;
}

.com-throw-card.checkout {
  border-color: rgb(38, 162, 105);
}

.com-throw-card.checkout .com-throw-total strong {
  color: rgb(24, 121, 78);
}

@media (max-width: 540px) {
  .com-throw-card {
    width: min(390px, 100%);
    padding: 10px;
  }

  .com-throw-darts {
    gap: 4px;
  }

  .com-throw-dart {
    padding: 7px 2px;
  }

  .com-throw-dart strong {
    font-size: clamp(28px, 12vw, 42px);
  }
}

.com-throw-darts[data-visible="0"] {
  grid-template-columns: 1fr;
}

.com-throw-darts[data-visible="1"] {
  grid-template-columns: 1fr;
}

.com-throw-darts[data-visible="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.com-throw-darts[data-visible="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.com-throw-dart.step-hidden {
  display: none;
}

.com-throw-dart.step-show {
  animation: 150ms ease-out 0s 1 normal none running comDartStepIn;
}

@keyframes comDartStepIn { 
  0% { opacity: 0; transform: translateY(5px); }
  100% { opacity: 1; transform: translateY(0px); }
}

.com-throw-total.step-hidden {
  visibility: hidden;
}

.setup-option-field {
  transition: opacity 120ms, filter 120ms;
}

.setup-option-field.inactive {
  opacity: 0.34;
  filter: grayscale(0.8);
}

.setup-option-field.inactive input {
  cursor: not-allowed;
}

.setup-option-field.inactive select {
  cursor: not-allowed;
}

.setup-section-divider {
  grid-column: 1 / -1;
  height: 1px;
  margin: 2px 0px 0px;
}

.score-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0px;
}

#gameRule {
  min-width: 0px;
  flex: 1 1 0%;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-menu-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.score-menu-actions .btn {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 9px;
  white-space: nowrap;
}

.score-menu-actions .mic-btn.compact {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .score-menu {
    gap: 4px;
    padding-inline: 5px;
  }

  #gameRule {
    font-size: 7px;
  }

  .score-menu-actions {
    gap: 2px;
  }

  .score-menu-actions .btn {
    min-height: 30px;
    padding: 4px 5px;
    font-size: 7px;
  }

  .score-menu-actions .mic-btn.compact {
    min-height: 30px;
    padding: 4px 5px;
    font-size: 7px;
  }
}

:root {
  --black: #474a4d;
  --panel: #474a4d;
  --panel-2: #474a4d;
  --line: #eaf4fc;
  --red: #e9546b;
  --red-dark: #e2041b;
  --orange: #c3d825;
  --gold: #c3d825;
  --cream: #eaf4fc;
  --text: #eaf4fc;
  --muted: #eaf4fc;
  --green: #c3d825;
  --shadow: none;
}

body {
  color: rgb(234, 244, 252);
}

body::before {
  display: none;
}

.score-player {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.setup {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.com-throw-card {
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

input {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

select {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.btn {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.player-action-btn {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.mic-btn {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
  border-color: rgb(234, 244, 252);
  box-shadow: none;
}

.btn.primary {
  color: rgb(56, 60, 60);
  background: rgb(195, 216, 37);
  border-color: rgb(195, 216, 37);
  box-shadow: none;
}

.score-player.active {
  color: rgb(56, 60, 60);
  border-color: rgb(195, 216, 37);
  box-shadow: none;
}

.player-action-btn.finish {
  color: rgb(56, 60, 60);
  background: rgb(195, 216, 37);
  border-color: rgb(195, 216, 37);
  box-shadow: none;
}

.score-value strong {
  color: rgb(195, 216, 37);
  text-shadow: none;
}

.setup label {
  color: rgb(234, 244, 252);
}

#gameRule {
  color: rgb(234, 244, 252);
}

.setup-section-divider {
  background: rgb(234, 244, 252);
}

.setup-option-field.inactive input {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
}

.setup-option-field.inactive select {
  color: rgb(234, 244, 252);
  background: rgb(71, 74, 77);
}

.score-player.active {
  background: rgb(224, 235, 175);
}

#newGameBtn {
  color: rgb(234, 244, 252);
}

.start-btn {
  background: rgb(195, 216, 37);
  border-color: rgb(195, 216, 37);
}

body {
  background: rgb(255, 255, 255);
}

.compact-game {
  width: 100%;
  max-width: 760px;
  height: auto;
  gap: 12px;
}

.scoreboard {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(213, 221, 225);
  box-shadow: none;
}

.score-menu {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(213, 221, 225);
  box-shadow: none;
}

.score-head-grid {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(213, 221, 225);
  box-shadow: none;
}

.compact-input {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(213, 221, 225);
  box-shadow: none;
}

.score-menu {
  flex-wrap: wrap;
  gap: 8px;
}

.score-menu #gameRule {
  color: rgb(82, 99, 107);
  letter-spacing: 0px;
}

.score-menu-actions {
  flex-wrap: wrap;
}

.score-menu .btn {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(199, 209, 215);
}

.score-menu .mic-btn {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border-color: rgb(199, 209, 215);
}

.score-menu #newGameBtn {
  color: rgb(23, 37, 44);
}

.com-throw-card {
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
}

.match-heading {
  display: grid;
  grid-template-columns: minmax(0px, 1fr) 36px auto 36px minmax(0px, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgb(199, 209, 215);
  padding: 12px;
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
}

.match-player-heading {
  min-width: 0px;
}

.match-player-heading:last-child {
  text-align: right;
}

.match-heading .score-player-name {
  color: rgb(23, 37, 44);
  font-size: 18px;
}

.match-heading .match-leg-title {
  color: rgb(82, 99, 107);
  font-size: 12px;
  text-align: center;
}

.match-heading .match-leg-count {
  color: rgb(23, 37, 44);
  font: 26px / 1 Arial, sans-serif;
  text-align: center;
}

.score-head-grid {
  grid-template-columns: repeat(2, minmax(0px, 1fr));
}

.score-head-grid.single-player {
  grid-template-columns: minmax(0px, 1fr);
}

.score-head-grid .score-player {
  padding: 16px 10px;
  border: 0px;
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  opacity: 1;
  filter: none;
  box-shadow: none;
}

.score-head-grid .score-player.player-one {
  border-right: 1px solid rgb(199, 209, 215);
}

.score-head-grid.single-player .score-player.player-one {
  border-right: 0px;
}

.score-head-grid .score-player.active {
  background: rgb(237, 243, 204);
}

.score-head-grid .score-player::after {
  display: none;
}

.score-player .score-values {
  margin: 0px;
}

.score-value.to-go span {
  color: rgb(82, 99, 107);
  font-size: 10px;
}

.score-player .score-value.to-go strong {
  color: rgb(23, 37, 44);
  font-size: clamp(64px, 17vw, 112px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-shadow: none;
  opacity: 1;
}

.score-player.active .score-value.to-go strong {
  color: rgb(23, 37, 44);
  font-size: clamp(64px, 17vw, 112px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-shadow: none;
  opacity: 1;
}

.history-panel {
  --history-heading-height: 38px;
  --history-row-height: 48px;
  position: relative;
  isolation: isolate;
}

.player-name-field {
  grid-column: 1 / -1;
  min-width: 0px;
}

.player-name-heading {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: start;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.player-name-heading > label {
  margin: 0px;
  white-space: nowrap;
  letter-spacing: 0px;
  font-size: 12px;
}

.player-name-field.inactive > input {
  opacity: 0.34;
  cursor: not-allowed;
}

.checkout-darts-card {
  width: min(420px, 100%);
  text-align: center;
}

.checkout-darts-card h2 {
  font-size: 20px;
}

.checkout-darts-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0px;
}

.checkout-darts-choices .btn {
  min-height: 56px;
  font-size: 17px;
}

.field label.com-toggle {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 4px;
  min-height: 28px;
  margin: 0px;
  padding: 0px;
  font-size: 12px;
  letter-spacing: 0px;
  line-height: 1.4;
  cursor: pointer;
}

.field .com-toggle input[type="checkbox"] {
  appearance: none;
  display: grid;
  place-items: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0px;
  padding: 0px;
  border: 1px solid rgb(199, 209, 215);
  background: white;
  cursor: pointer;
}

.field .com-toggle input[type="checkbox"]:checked {
  background: rgb(8, 126, 174);
  border-color: rgb(8, 126, 174);
}

.field .com-toggle input[type="checkbox"]:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  border-style: solid;
  border-color: white;
  border-image: none;
  border-width: 0px 2px 2px 0px;
  transform: translateY(-1px) rotate(45deg);
}

.history-panel .score-sheet-wrap {
  height: calc(var(--history-heading-height) + 4 * var(--history-row-height));
  max-height: none;
}

.history-checkout {
  position: absolute;
  top: var(--history-heading-height);
  left: 0px;
  right: 0px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(2 * var(--history-row-height));
  padding: 8px;
  border-block: 1px solid rgb(199, 209, 215);
  color: rgb(23, 37, 44);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.history-checkout[hidden] {
  display: none;
}

.history-checkout span {
  color: rgb(82, 99, 107);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.history-checkout strong {
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.2;
  white-space: nowrap;
  font-weight: 700 !important;
}

.compact-input {
  padding: 10px;
}

.checkout-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.checkout-actions .player-action-btn {
  min-height: 44px;
  padding: 8px;
  color: rgb(23, 37, 44);
  background: rgb(237, 243, 204);
  border-color: rgb(202, 215, 156);
  font-size: 15px;
}

.checkout-actions .player-action-btn:disabled {
  opacity: 1;
  color: rgb(131, 144, 150);
  background: rgb(247, 249, 250);
  border-color: rgb(220, 226, 229);
}

.compact-input .keypad {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0px, 1fr));
}

.compact-input .keypad button {
  min-height: 60px;
  font-size: 25px;
  touch-action: manipulation;
}

.compact-input .keypad .key-enter {
  font-size: 17px;
  background: rgb(195, 216, 37);
  color: rgb(23, 37, 44);
}

.compact-input .quick-score button {
  min-height: 44px;
  font-size: 17px;
  touch-action: manipulation;
}

@media (max-width: 540px) {
  html {
    min-width: 0px;
  }

  .app {
    padding: 6px;
  }

  .compact-game {
    gap: 8px;
  }

  .score-menu {
    padding: 7px;
  }

  .score-menu #gameRule {
    flex-basis: 100%;
    font-size: 8px;
  }

  .score-menu-actions {
    width: 100%;
    justify-content: space-between;
  }

  .score-menu .btn {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .score-menu .mic-btn.compact {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .match-heading {
    grid-template-columns: minmax(0px, 1fr) 22px auto 22px minmax(0px, 1fr);
    gap: 4px;
    padding: 10px 7px;
  }

  .match-heading .score-player-name {
    font-size: clamp(10px, 3vw, 15px);
  }

  .match-heading .match-leg-title {
    font-size: 9px;
  }

  .match-heading .match-leg-count {
    font-size: 20px;
  }

  .score-head-grid .score-player {
    padding: 10px 6px;
  }

  .score-player .score-value.to-go strong {
    font-size: clamp(48px, 17vw, 88px);
  }

  .score-player.active .score-value.to-go strong {
    font-size: clamp(48px, 17vw, 88px);
  }

  .history-panel {
    --history-heading-height: 32px;
    --history-row-height: 36px;
  }

  .compact-input {
    padding: 7px;
  }

  .compact-input .keypad button {
    min-height: 52px;
    font-size: 24px;
  }

  .checkout-actions .player-action-btn {
    min-height: 42px;
    font-size: 14px;
  }

  .compact-input .quick-score button {
    min-height: 42px;
    font-size: 16px;
  }
}

.player-history h3 {
  margin: 8px 0px;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-history-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  min-height: 36px;
  border-bottom: 1px solid rgba(119, 119, 119, 0.4);
  padding: 3px 8px;
}

.player-history-row strong {
  font-size: 24px;
}

#scoreSheet {
  display: grid;
  grid-template-columns: minmax(0px, 1fr);
  gap: 16px;
}

.desktop-round {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  color: rgb(23, 37, 44);
}

#editHistoryBtn {
  border: 1px solid rgb(136, 136, 136);
  padding: 8px 14px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}

#historyEditForm {
  width: min(720px, 100%);
  max-height: 90dvh;
  overflow: auto;
}

#historyEditRows {
  display: grid;
  gap: 8px;
  margin-block: 20px;
}

.history-edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgb(187, 187, 187);
  color: rgb(23, 37, 44);
}

.history-edit-row input {
  width: 110px;
  min-height: 48px;
  font-size: 24px;
  color: rgb(23, 37, 44);
  background: rgb(255, 255, 255);
  border: 1px solid rgb(136, 136, 136);
  padding: 6px;
}

#historyEditError {
  color: rgb(180, 37, 42);
}

.history-average {
  display: none;
}

.footer-remaining {
  display: none;
}

.pc-only {
  display: none;
}

#keySettingsForm {
  width: min(680px, 100%);
  max-height: 90dvh;
  overflow: auto;
}

.key-setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-block: 14px;
}

.key-setting-row strong {
  width: 40px;
  flex-shrink: 0;
}

.key-setting-row select {
  flex: 1 1 0%;
  min-width: 0px;
}

.key-setting-row select, .key-setting-row input {
  min-height: 44px;
  padding: 8px;
  color: rgb(23, 37, 44);
  background: white;
  border: 1px solid rgb(136, 147, 153);
}

.key-setting-row input {
  width: 90px;
}

#keySettingsStatus {
  color: rgb(180, 37, 42);
}

@media (min-width: 921px) {
  .pc-only {
    display: block;
  }

  .score-menu-actions {
    max-height: calc(100dvh - 180px);
    overflow-y: auto;
    flex-wrap: nowrap;
  }

  #functionKeyLegend {
    flex: 0 0 auto;
    padding-bottom: 10px;
    border-bottom: 1px solid rgb(85, 85, 85);
  }

  #functionKeyLegend > div {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 24px;
    color: rgb(238, 238, 238);
    font-size: clamp(12px, 1.15vw, 18px);
    letter-spacing: 0px;
  }

  #functionKeyLegend kbd {
    min-width: 36px;
    color: rgb(170, 178, 184);
    font-family: inherit;
  }

  .score-menu-actions > button {
    flex-shrink: 0;
  }
}


/* Button-based setup; game and result screens retain their existing styles. */
#setupModal .setup{width:min(960px,100%);max-width:960px;padding:24px}
#setupModal .setup .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 18px}
#setupModal .setup .field.half{grid-column:span 1}
#setupModal .setup .choice-field{grid-column:1/-1}
#setupModal .setup select[hidden]{display:none!important}
#setupModal .setup .setup-choices{display:flex;flex-wrap:wrap;gap:7px}
#setupModal .setup .setup-choice{flex:1 0 62px;min-height:46px;padding:10px 12px;border:1px solid #8a9397;background:#474a4d;color:#eaf4fc;font-size:13px;font-weight:600;cursor:pointer}
#setupModal .setup .setup-choice:hover{border-color:#eaf4fc}
#setupModal .setup .setup-choice.selected{background:#d9e1e5;color:#20262a;border-color:#d9e1e5}
#setupModal .setup .setup-choice:focus-visible{outline:2px solid #b7d4e4;outline-offset:2px}
#setupModal .setup .player-name-heading{display:flex;flex-wrap:wrap;justify-content:space-between;gap:8px 14px}
#setupModal .setup .com-toggle{position:relative;gap:8px;min-height:32px}
@media(max-width:600px){#setupModal .setup{padding:18px 14px}#setupModal .setup .form-grid{gap:13px 10px}#setupModal .setup .setup-choice{flex-basis:78px;min-height:46px;padding:9px 7px;font-size:12px}}

#setupModal .setup .com-toggle input[type="checkbox"] { appearance: auto; position: static; opacity: 1; display: inline-block; width: 16px; height: 16px; min-height: 16px; flex: 0 0 16px; margin: 0; padding: 0; accent-color: #38667e; cursor: pointer; }
#setupModal .setup .com-toggle input[type="checkbox"]::after { content: none; }
#setupModal .setup .com-toggle input:focus-visible { outline: 2px solid #b7d4e4; outline-offset: 3px; }
