html[data-iwashi-screen="game"] {
  overflow: hidden;
}

html[data-iwashi-screen="game"] body { min-height: 0; }

.simple-game {
  --board-text: #897858;
  --board-background: #9EA1A3;
  --board-paper: #fcfcfa;
  --board-muted: #E8ECEF;
  --board-rule: #72672E;
  --board-line: 1px solid var(--board-rule);
  --score-entry-background: #C1E4E9;
  --game-menu-font: clamp(16px, 4.7vw, 24px);
  --sheet-heading-height: 31px;
  --checkout-inline-padding: 20px;
  --checkout-border-width: 4px;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 760px);
  height: 100svh;
  height: 100dvh;
  margin-inline: auto;
  color: var(--board-text);
  background: var(--board-paper);
  font: 400 1rem Arial, Meiryo, sans-serif;
}

.simple-game > .sr-only { inset: 0 auto auto 0; }

.simple-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 2px 8px;
  text-align: center;
  color: white;
  background: var(--board-background);
  font-size: clamp(11px, 2.6vw, 14px);
}

.simple-heading > span:not(.simple-leg) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-leg {
  font-size: clamp(13px, 3.5vw, 17px);
  font-variant-numeric: tabular-nums;
}

.simple-leg strong { font-weight: 400; }
.simple-pc-only { display: none; }

.simple-sheet-wrap {
  grid-row: 2;
  grid-column: 1;
  overflow: hidden auto;
  overscroll-behavior: contain;
  container-type: size;
  border: var(--board-line);
  border-bottom: 0;
}

.simple-sheet {
  --row-height: clamp(38px, calc((100cqh - var(--sheet-heading-height)) / 6), 82px);
  --bust-font-size: min(.72em, 6.4cqw);
  width: 100%;
  table-layout: fixed;
  border-spacing: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.simple-sheet col:nth-child(2),
.simple-sheet col:nth-child(5) { width: 23%; }
.simple-sheet .simple-dart-column { width: 16%; }

.simple-sheet th,
.simple-sheet td {
  padding: 0;
  border-bottom: var(--board-line);
  border-inline-end: var(--board-line);
}

.simple-sheet th:last-child,
.simple-sheet td:last-child { border-inline-end: 0; }

.simple-sheet th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: var(--sheet-heading-height);
  background: var(--board-muted);
  font-size: clamp(13px, 4.1vw, 21px);
  font-weight: 400;
}

.simple-sheet td {
  height: var(--row-height);
  color: #000;
  font-size: clamp(21px, min(8.5vw, calc(var(--row-height) * .66)), 43px);
}

.simple-opening td {
  position: sticky;
  top: var(--sheet-heading-height);
  z-index: 1;
  background: var(--board-paper);
}

.simple-sheet td:nth-child(3),
.simple-opening td:nth-child(odd),
.simple-opening td:nth-child(4) { background: var(--board-muted); }

.simple-sheet .simple-current { background: var(--score-entry-background); }
.simple-sheet td.left-check-round:nth-child(3) { background: #70d88c; }

.round-history-score {
  display: block;
  width: 100%;
  min-height: calc(var(--row-height) - 1px);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.round-history-score:disabled { cursor: default; }
.round-history-score.is-bust { font-size: var(--bust-font-size); }

.inline-score-edit {
  display: block;
  width: 100%;
  min-height: calc(var(--row-height) - 1px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--score-entry-background);
  color: #000;
  font-size: inherit;
  text-align: center;
  appearance: textfield;
}

.inline-score-edit::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.simple-game :focus-visible {
  outline: 2px solid #206ab1;
  outline-offset: -2px;
}

.simple-footer {
  padding: 0 0 env(safe-area-inset-bottom);
  color: white;
  background: var(--board-background);
}

.simple-totals {
  --active-total-background: #fff;
  --inactive-total-background: #7B7C7D;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  border: var(--board-line);
  background: var(--inactive-total-background);
  color: var(--active-total-background);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.simple-totals strong {
  display: grid;
  place-items: center;
  min-height: 1.16em;
  padding: 4px 0;
  font-size: clamp(43px, min(20vw, 12dvh), 100px);
  line-height: 1;
}

.simple-totals .throwing {
  color: var(--inactive-total-background);
  background: var(--active-total-background);
}

.simple-controls {
  --score-controls-width: calc((100% - 2px) * 2 / 3 + 2px);
  position: relative;
  display: grid;
  grid-template-columns: var(--score-controls-width) minmax(0, 1fr);
  border-top: var(--board-line);
  background: linear-gradient(var(--board-rule), var(--board-rule)) left center / var(--score-controls-width) 1px no-repeat;
}

.simple-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.simple-actions .simple-menu { grid-area: 1 / 2; }

.simple-actions > button[aria-pressed="true"] {
  background: #e0eee7;
  color: #234469;
}

.simple-mobile-score-actions { min-width: 0; }

.simple-mobile-score-bottom {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.simple-mobile-score-actions .quick-score {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.simple-mobile-score-actions .quick-score > div { gap: 0; }
.simple-dart-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.simple-mobile-score-actions button {
  min-height: 44px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-inline-end: var(--board-line);
  background: transparent;
  color: white;
  font-size: clamp(11px, 3vw, 15px);
}

.simple-mobile-score-actions button:disabled {
  color: color-mix(in srgb, #f0f0f0 65%, var(--board-background));
}

.left-check-action { font-weight: 700; }

.left-check-action[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px white;
}

.simple-actions > button,
.simple-menu summary {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: white;
  background: none;
  font-size: clamp(12px, 3.7vw, 18px);
  cursor: pointer;
}

.simple-actions > button:disabled { color: #a1adbe; cursor: default; }
.simple-actions > .simple-pc-only { display: none; }

.mic-glyph {
  position: relative;
  flex: 0 0 1.25em;
  height: 1.25em;
  border: .065em solid currentColor;
  border-radius: 50%;
}

.mic-glyph > span {
  position: absolute;
  inset: 15% 34% 39%;
  border-radius: 99px;
  background: currentColor;
}

.mic-glyph::before {
  content: "";
  position: absolute;
  inset: 39% 25% 25%;
  border: .065em solid currentColor;
  border-top: 0;
  border-radius: 0 0 99px 99px;
}

.mic-glyph::after {
  content: "";
  position: absolute;
  inset: 72% 35% 14%;
  background: linear-gradient(currentColor, currentColor) center top / .065em 100% no-repeat,
    linear-gradient(currentColor, currentColor) center bottom / 100% .065em no-repeat;
}

.mic-action[aria-pressed="true"] .mic-glyph {
  background: #234469;
  color: white;
}

.simple-menu summary::-webkit-details-marker { display: none; }

.simple-menu-items {
  position: absolute;
  z-index: 4;
  inset: auto 0 100% auto;
  width: min(300px, 100%);
  max-height: 70dvh;
  overflow: auto;
  border: 1px solid var(--board-rule);
  border-radius: 5px;
  background: var(--board-paper);
  color: var(--board-text);
  box-shadow: 0 3px 12px #132c5033;
}

.simple-menu-items > button {
  width: 100%;
  min-height: 44px;
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--board-rule);
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.simple-menu-items button:disabled { opacity: .5; cursor: default; }
.simple-menu-items button[aria-pressed="true"] { background: #e0eee7; }

.simple-tools,
.simple-checkout-slot {
  position: relative;
  z-index: 2;
  grid-column: 1;
  align-self: start;
  min-width: 0;
}

.simple-footer,
.simple-tools { grid-row: 3; grid-column: 1; }
.simple-checkout-slot { grid-row: 2; pointer-events: none; }
.simple-tools > :not([hidden]) { position: absolute; bottom: 6px; }

.simple-checkout,
.simple-tools .microphone-notice {
  margin: 0;
  padding: 7px 9px;
  color: var(--board-text);
  text-align: center;
}

.simple-checkout {
  position: absolute;
  top: calc(var(--sheet-heading-height) + 1px + var(--opening-overlay-height) / 2);
  inset-inline-start: 9px;
  box-sizing: border-box;
  width: calc(var(--opening-overlay-width) - 16px);
  height: clamp(32px, calc(var(--opening-overlay-height) * .68), 36px);
  transform: translateY(-50%);
  align-content: center;
  padding-block: 0;
  padding-inline: var(--checkout-inline-padding);
  border: var(--checkout-border-width) double #000;
  border-radius: 14px;
  background: #fff;
  font-size: .9rem;
  line-height: 1.15;
}

.simple-checkout strong { font-size: clamp(16px, 3.8vw, 20px); }
.simple-checkout.com-throws #checkoutPlayer { display: inline; }
.simple-checkout.com-throws .checkout-heading { margin-inline-end: .5em; }

.simple-tools .microphone-notice {
  inset-inline: 6px;
  border: var(--board-line);
  border-radius: 5px;
  background: #e5edf5;
  font-size: .85rem;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  min-width: 0;
  margin: 0;
  padding: 1px 0 0;
  border: 0;
  background: var(--board-rule);
}

.keypad > button {
  min-height: clamp(42px, 7.6dvh, 74px);
  padding: 0;
  border: 0;
  background: var(--board-background);
  color: white;
  font-size: clamp(22px, min(7.6vw, 5dvh), 42px);
  cursor: pointer;
  touch-action: manipulation;
}

.keypad .key-enter { background: #234469; font-size: .95rem; font-weight: 700; }
.keypad .key-clear { color: #d5e4f5; font-size: 1.2rem; }
.keypad > button:active:not(:disabled) { background: #385c83; }
.keypad > button:disabled { color: #b5c2d3; cursor: default; }

@media (max-height: 480px) {
  .simple-totals strong { font-size: 38px; }
  .keypad { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (min-width: 921px) and (hover: hover) and (pointer: fine) {
  .simple-game {
    --pc-menu-height: calc(51px + env(safe-area-inset-bottom));
    --pc-history-share: calc(50px / 5);
    --pc-sheet-space: calc(100dvh - 50px - var(--sheet-heading-height) - var(--pc-menu-height) - 1px);
    --pc-base-row-height: max(0px, calc(var(--pc-sheet-space) / 7));
    --pc-row-height: calc(.9 * (var(--pc-base-row-height) + var(--pc-history-share)));
    --pc-opening-height: calc(.9 * (var(--pc-base-row-height) / 2 + var(--pc-history-share)));
    --pc-total-height: max(1px, calc(100dvh - var(--pc-menu-height) - var(--sheet-heading-height) - var(--pc-opening-height) - 5 * var(--pc-row-height)));
    --pc-score-font: clamp(16px, calc(var(--pc-base-row-height) * .81), 9vw);
    --pc-total-text-width: calc(50vw - 7px);
    --pc-total-font: min(max(0px, calc(var(--pc-total-height) - 4px)), calc(var(--pc-total-text-width) / 1.51));
    --pc-total-font-four-digits: min(max(0px, calc(var(--pc-total-height) - 4px)), calc(var(--pc-total-text-width) / 2.02));
    --pc-total-text-span: calc(var(--pc-total-font) * 1.51);
    --pc-total-shift-limit: max(0px, calc((50vw - var(--pc-total-text-span)) / 2 - 4px));
    --pc-total-shift: clamp(calc(-1 * var(--pc-total-shift-limit)), var(--score-align-shift, 0px), var(--pc-total-shift-limit));
    --pc-right-total-shift: max(var(--pc-total-shift), calc(-1 * var(--pc-total-shift)));
    --pc-checkout-space: max(52px, calc(50vw - var(--pc-total-text-span) - 2 * var(--pc-total-shift) - 8px));
    grid-template-rows: minmax(0, 1fr) auto;
    width: 100%;
    background: transparent;
  }

  .simple-game:has(.simple-totals [data-four-digits]) {
    --pc-total-text-span: calc(var(--pc-total-font-four-digits) * 2.02);
  }

  .simple-sheet-wrap,
  .simple-footer,
  .simple-tools,
  .simple-checkout-slot {
    justify-self: center;
    width: 100%;
  }

  .simple-heading,
  .simple-mobile-only,
  .simple-mobile-score-actions { display: none; }
  .simple-pc-only { display: inline; }

  .simple-footer,
  .simple-tools,
  .simple-checkout-slot {
    grid-row: 2;
  }

  .simple-controls {
    display: flow-root;
    border-top: 0;
    background: none;
  }

  .simple-actions {
    position: relative;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 7px 0 0;
  }

  .simple-actions .simple-menu { grid-area: auto; }
  .simple-actions > .simple-pc-only { display: grid; }
  .simple-actions > button,
  .simple-menu summary { font-size: var(--game-menu-font); }
  .simple-actions > .mic-action {
    display: flex;
    justify-content: center;
    gap: 4px;
    font-size: clamp(12px, 3.5vw, 24px);
    white-space: nowrap;
  }

  .simple-sheet-wrap {
    grid-row: 1;
    background: var(--board-paper);
  }

  .simple-sheet {
    --row-height: var(--pc-row-height);
    --bust-font-size: .75em;
  }
  .simple-sheet td { font-size: var(--pc-score-font); }

  .simple-sheet .simple-opening td {
    height: var(--pc-opening-height);
    font-size: calc(var(--pc-score-font) / 2);
  }

  .simple-sheet .simple-opening .simple-opening-label {
    color: white;
    background: var(--opening-label-background, var(--board-background));
  }

  .simple-opening-result { --opening-label-background: #3967C4; }

  .simple-opening-label > span {
    display: block;
    overflow: hidden;
    padding-inline: 4px;
    font-size: clamp(16px, 2.6vw, 32px);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .simple-opening-result > span {
    font-size: min(48px, calc(var(--pc-opening-height) * .86));
    line-height: 1;
  }

  .simple-totals {
    gap: 0;
    height: var(--pc-total-height);
    margin: 0;
    font-size: var(--pc-total-font);
    letter-spacing: -.055em;
  }

  .simple-totals strong {
    min-height: 0;
    padding: 0 1px;
    font-size: inherit;
  }


  .simple-totals strong:first-child > span { transform: translateX(var(--pc-total-shift)); }
  .simple-totals strong:last-child > span { transform: translateX(var(--pc-right-total-shift)); }

  .simple-totals strong[data-four-digits] {
    font-size: var(--pc-total-font-four-digits);
    letter-spacing: -.055em;
  }

  .simple-game:has(.microphone-notice:not([hidden])) .simple-checkout { visibility: hidden; }

  .simple-checkout:not([hidden]) {
    inset: calc(var(--pc-total-height) / 2) auto auto 50%;
    display: grid;
    align-content: center;
    width: max-content;
    height: auto;
    max-width: var(--pc-checkout-space);
    padding-block: 5px;
    transform: translate(-50%, -50%);
    color: #000;
    font-size: .85rem;
    line-height: normal;
  }

  .simple-checkout .checkout-heading {
    overflow: hidden;
    font-size: var(--game-menu-font);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .simple-checkout.com-throws .checkout-heading { margin-inline-end: 0; }

  .simple-checkout strong {
    font-size: min(calc(var(--pc-score-font) * .99), calc((var(--pc-checkout-space) - 2 * (var(--checkout-inline-padding) + var(--checkout-border-width))) / 6.5));
    line-height: 1;
    letter-spacing: -.035em;
    white-space: nowrap;
  }

  .simple-checkout .checkout-arrow {
    display: inline-block;
    margin-inline: .13em;
    font-size: .55em;
    vertical-align: .16em;
  }

  .keypad { display: none; }
}

.simple-game .left-check-value,
.simple-checkout.left-check-value {
  color: #08752c;
}
