/* COUNT-UP: input; managed only in countup/. */
#game .voiceBox {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin: 0px;
  max-width: none;
  width: 100%;
  flex: 0 0 auto;
}

#game .mic {
  font-size: clamp(11px, 1.4cqw, 18px);
  min-height: 32px;
  padding: 4px;
  background: var(--mic-background, var(--page));
  color: rgb(255, 255, 255);
  border-color: var(--mic-background, var(--mic-idle-border, var(--line)));
}

#game .voiceStatus {
  text-align: left;
  padding: 10px 12px;
  border-radius: 0px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.4;
  background: var(--page);
  border: 1px solid var(--line);
  display: none;
}

#game .keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0px, 1fr));
  gap: 4px;
  max-width: none;
  margin: 0px auto;
  width: 100%;
  flex: 1 1 0%;
  grid-template-rows: repeat(4, minmax(24px, 1fr)) minmax(clamp(36px, 10cqh, 64px), 1fr);
}

#game .keypad button {
  font-size: clamp(15px, 2.4cqw, 30px);
  min-height: 0px;
  padding: 3px;
  border-radius: 0px;
  background: rgb(36, 40, 42);
  color: rgb(238, 238, 238);
  border-color: rgb(74, 80, 83);
}

.wide {
  grid-column: span 2;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.mobileSetupBack {
  width: 100%;
  margin-top: 8px;
}

input {
  font-family: Meiryo, メイリオ, "Noto Sans JP", sans-serif;
}

input:focus-visible {
  outline: rgb(195, 216, 37) solid 2px;
  outline-offset: 2px;
}

#game #inputPanel {
  position: absolute;
  right: clamp(6px, 1cqw, 18px);
  top: 8px;
  bottom: calc(var(--footer-height) + 8px);
  width: 31%;
  display: flex;
  flex-direction: column;
  min-height: 0px;
  overflow: auto;
  padding: 0px;
  border: 0px;
  background: transparent;
  margin: 0px;
  gap: 4px;
}

#game .throwSummary {
  display: none;
  grid-template-columns: 1fr;
  flex: 0 0 auto;
  height: auto;
  margin: 0px;
  gap: 4px;
}

#game #inputDisplay {
  min-height: 0px;
  margin: 0px;
  padding: 3px;
  font-size: clamp(26px, 6cqh, 60px);
  line-height: 1.1;
  border-width: 0px 0px 1px;
  border-style: none none solid;
  border-color: currentcolor currentcolor rgb(136, 136, 136);
  border-image: none;
  background: transparent;
  text-align: center;
}

#game #inputDisplay::before {
  font-size: clamp(8px, 1cqw, 12px);
  margin: 0px;
  color: rgb(170, 170, 170);
}

#game #keypadInput {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0px;
}

#game .keypad > :not(.setupBack) {
  display: block;
}

#game .keypad .setupBack {
  display: none;
}

#game .keypad #back {
  font-size: clamp(9px, 1.1cqw, 15px);
}

#game .keypad #undoMobile {
  font-size: clamp(9px, 1.1cqw, 15px);
  min-height: clamp(36px, 10cqh, 64px);
}

#game .keypad .primary {
  color: rgb(23, 37, 44);
  background: rgb(195, 216, 37);
}

#game .gameActions {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin: 0px;
  flex: 0 0 auto;
  display: grid;
}

#game .gameActions button {
  min-height: clamp(36px, 10cqh, 64px);
  padding: 2px;
  font-size: clamp(9px, 1cqw, 14px);
}

#game .keypad #enter {
  min-height: clamp(36px, 10cqh, 64px);
}

.inputPreview {
  display: none;
}

#game .inputPreview:not(:empty) {
  display: block;
  position: absolute;
  left: 22%;
  right: 35%;
  bottom: calc(var(--footer-height) + 12px);
  text-align: center;
  color: rgb(191, 197, 199);
  font-size: clamp(13px, 2cqw, 24px);
  pointer-events: none;
}

#game .keypadToggle {
  display: none;
  position: absolute;
  right: clamp(6px, 1cqw, 18px);
  bottom: 8px;
  width: 31%;
  min-height: 32px;
  padding: 4px;
  color: rgb(238, 238, 238);
  background: rgb(36, 40, 42);
  border: 1px solid rgb(74, 80, 83);
  font-size: clamp(11px, 1.4cqw, 18px);
  z-index: 8;
}

body[data-setup-fit-game="countup"] .micButtons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0px, 1fr));
  gap: 4px;
  min-width: 0px;
  width: 100%;
}

body[data-setup-fit-game="countup"] .micButtons .mic {
  min-width: 0px;
  white-space: normal;
}

#game #singleDartScores {
  position: absolute;
  left: 0px;
  right: 0px;
  top: calc(50% + min(10.2cqw, 24cqh));
  display: grid;
  grid-template-columns: repeat(4, minmax(0px, 1fr));
  gap: 8px;
  height: clamp(50px, 10cqh, 108px);
  pointer-events: none;
}

#game #singleDartScores[hidden] {
  display: none;
}

#game .singleDartScore {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0px;
  gap: 2px;
  border-bottom: 2px solid rgb(136, 136, 136);
}

#game .singleDartScore small {
  color: rgb(191, 197, 199);
  font-size: clamp(8px, 0.8cqw, 12px);
}

#game #singleDartScores .singleDartScore strong {
  font-size: clamp(22px, 3.6cqw, 58px);
  line-height: 1.1;
  letter-spacing: 0px;
  text-shadow: none;
}

#game.voiceCompact #singleDartScores {
  top: calc(50% + min(15cqw, 28.8cqh));
}

#game.singleDartMode .round-start-overlay {
  display: none;
}

#game .microphone-notice {
  position: absolute;
  z-index: 11;
  bottom: calc(var(--footer-height) + 5px);
  left: 26%;
  width: 40%;
  box-sizing: border-box;
  color: rgb(255, 224, 131);
  font-size: clamp(10px, 1.2cqw, 17px);
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
  padding: 4px 6px;
  background: rgba(16, 18, 20, 0.95);
  border-radius: 0px;
}

.microphone-notice[hidden] {
  display: none;
}

#voiceLogBtn {
  font: inherit;
  min-height: 28px;
}

body[data-setup-fit-game="countup"] #game .micButtons #voiceLogBtn {
  grid-column: 1 / -1;
  width: 100%;
  height: auto;
  min-height: 28px;
  aspect-ratio: auto;
}

body[data-setup-fit-game="countup"] #game .micButtons {
  grid-template-rows: minmax(0px, 1fr) minmax(0px, 1fr);
}

body[data-setup-fit-game="countup"] #game .micButtons .mic {
  white-space: nowrap;
  font-size: clamp(8px, 0.75cqw, 11px);
}

@media (max-width: 540px) {
  #game .keypad .setupBack {
    font-size: 14px;
  }
}

@media (max-width: 920px), (pointer: coarse), (hover: none) {
  #game.voiceMode .keypadToggle {
    display: block;
  }
}

@media (max-width: 920px) and (hover: hover) and (pointer: fine) {
  #game.voiceMode:not(.voiceCompact) #inputPanel {
    bottom: 48px;
  }
}

@media (max-width: 920px), (pointer: coarse), (hover: none) {
  #game.voiceCompact #keypadInput {
    display: none;
  }

  #game.voiceCompact #inputPanel {
    position: static;
    display: contents;
  }

  #game.voiceCompact {
    --voice-key-width: calc(31% / 3);
    --voice-key-height: clamp(32px,12cqh,60px);
    --voice-gap: 4px;
    --voice-inset: clamp(6px,1cqw,18px);
  }

  #game.voiceCompact .mainScore {
    right: calc(var(--voice-key-width) + 2 * var(--voice-inset));
    top: 0px;
  }

  #game.voiceCompact .mainScore strong {
    font-size: min(25cqw, 48cqh);
  }

  #game.voiceCompact .voiceBox {
    position: absolute;
    top: 8px;
    left: auto;
    right: var(--voice-inset);
    bottom: auto;
    width: var(--voice-key-width);
    max-width: none;
  }

  #game.voiceCompact .gameActions {
    position: absolute;
    top: calc(8px + var(--voice-key-height) + var(--voice-gap));
    right: var(--voice-inset);
    bottom: auto;
    width: var(--voice-key-width);
    grid-template-columns: 1fr;
    gap: var(--voice-gap);
  }

  #game.voiceCompact .gameActions button {
    min-height: 0px;
    height: var(--voice-key-height);
    padding: 3px;
    font-size: clamp(9px, 1.1cqw, 14px);
    white-space: normal;
    line-height: 1.3;
  }

  #game.voiceCompact .mic {
    min-height: 0px;
    height: var(--voice-key-height);
    padding: 3px;
    font-size: clamp(9px, 1.1cqw, 14px);
    white-space: normal;
    line-height: 1.3;
  }

  #game.voiceCompact .keypadToggle {
    min-height: 0px;
    height: var(--voice-key-height);
    padding: 3px;
    font-size: clamp(9px, 1.1cqw, 14px);
    white-space: normal;
    line-height: 1.3;
    top: calc(8px + 4 * (var(--voice-key-height) + var(--voice-gap)));
    bottom: auto;
    right: var(--voice-inset);
    width: var(--voice-key-width);
  }

  #game.voiceCompact .totals {
    right: 0px;
  }

  #game.voiceCompact .inputPreview {
    display: none;
  }
}

@media (max-width: 920px), (pointer: coarse) {
  #game #inputPanel {
    width: var(--input-width);
    right: var(--input-inset);
    bottom: 8px;
  }
}

@media (pointer: coarse), (hover: none) {
  body[data-setup-fit-game="countup"] #game #inputPanel {
    position: absolute;
    top: 0px;
    bottom: 0px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0px, 1fr));
    grid-template-rows: repeat(5, minmax(0px, 1fr)) 32px;
    gap: 4px;
    overflow: visible;
  }

  body[data-setup-fit-game="countup"] #game #undoMobile {
    display: none;
  }

  body[data-setup-fit-game="countup"] #game .keypadToggle {
    display: none;
  }

  body[data-setup-fit-game="countup"] #game :is(.voiceBox, .gameActions, #keypadInput, .keypad) {
    display: contents;
  }

  body[data-setup-fit-game="countup"] #game #undo {
    position: absolute;
    top: var(--rail-title-height);
    right: 80cqw;
    width: clamp(44px, 9cqw, 68px);
    height: 26px;
    min-height: 0px;
    padding: 2px;
    z-index: 2;
  }

  body[data-setup-fit-game="countup"] #game .keypad > :is([data-key], #clear, #back) {
    grid-column: span 2;
  }

  body[data-setup-fit-game="countup"] #game #enter {
    grid-area: 5 / 1 / 6 / 4;
    min-height: 0px;
  }

  body[data-setup-fit-game="countup"] #game #gameSetupBack {
    grid-area: 6 / 4 / 7 / 7;
  }

  body[data-setup-fit-game="countup"] #game .gameActions button:not(#undo) {
    min-height: 0px;
    height: 100%;
  }

  body[data-setup-fit-game="countup"] #game .micButtons {
    grid-area: 5 / 4 / 6 / 7;
    height: 100%;
  }

  body[data-setup-fit-game="countup"] #game .micButtons #micBtn {
    grid-area: auto;
  }

  body[data-setup-fit-game="countup"] #game .micButtons .mic {
    height: 100%;
    min-height: 0px;
    padding: 2px;
  }
}

@media (min-width: 921px) and (hover: hover) and (pointer: fine) {
  body[data-setup-fit-game="countup"] #game #singleDartScores {
    left: 10%;
    right: 10%;
    top: calc(50% + 30px + min(8.4cqw, 19.2cqh, 144px));
  }

  body[data-setup-fit-game="countup"] #game #inputPanel {
    top: clamp(24px, 6cqh, 64px);
    right: clamp(8px, 1cqw, 20px);
    bottom: calc(var(--footer-height) + clamp(24px,6cqh,64px));
    width: 24%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0px, 1fr));
    grid-template-rows: repeat(4, minmax(0px, 1fr)) clamp(44px, 8cqh, 68px) clamp(36px, 6cqh, 52px);
    gap: 4px;
    overflow: visible;
  }

  body[data-setup-fit-game="countup"] #game :is(.voiceBox, .gameActions, #keypadInput, .keypad) {
    display: contents;
  }

  body[data-setup-fit-game="countup"] #game :is(#undoMobile, .keypadToggle, .setupBack) {
    display: none;
  }

  body[data-setup-fit-game="countup"] #game .keypad > :is([data-key], #clear, #back) {
    grid-column: span 2;
  }

  body[data-setup-fit-game="countup"] #game #enter {
    grid-area: 5 / 1 / 6 / 4;
    min-height: 0px;
  }

  body[data-setup-fit-game="countup"] #game .micButtons {
    grid-area: 5 / 4 / 6 / 7;
    height: 100%;
  }

  body[data-setup-fit-game="countup"] #game .micButtons .mic {
    height: 100%;
    min-height: 0px;
    padding: 3px;
  }

  body[data-setup-fit-game="countup"] #game #undo {
    grid-area: 6 / 1 / 7 / 3;
  }

  body[data-setup-fit-game="countup"] #game #gameSetupBack {
    grid-area: 6 / 5 / 7 / 7;
  }

  body[data-setup-fit-game="countup"] #game .gameActions button {
    height: 100%;
    min-height: 0px;
  }
}

@media (max-width: 920px), (pointer: coarse), (hover: none) {
  body[data-setup-fit-game="countup"] .micButtons #voiceLogBtn {
    grid-column: 1 / -1;
    width: 100%;
    height: auto;
    min-height: 28px;
    aspect-ratio: auto;
    border-radius: 4px;
    padding: 4px;
    font-size: clamp(9px, 1.1cqw, 13px);
  }

  body[data-setup-fit-game="countup"] #game .micButtons {
    grid-template-rows: minmax(0px, 1fr) minmax(0px, 1fr);
    height: 100%;
  }
}

button[data-mic-active="true"] {
  --mic-background: #EB6238;
}

#singleDartMicBtn[aria-pressed="true"] {
  --mic-idle-border: #ffe083;
}
