/* Custom Games */
#mode-games {
  margin-left: 14px;
  border-left: 1px solid #92784c !important;
  color: #e4c987;
}
.games-mode .chambers,
.games-mode .result-ledger,
.games-mode .controls,
.games-mode .journal {
  display: none;
}
.custom-games[hidden] {
  display: none;
}
.custom-games {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 325px;
  gap: 16px;
  margin: 4px 0 24px;
  position: relative;
}
.games-main,
.games-settings {
  border: 1px solid #62563a;
  background: #101710;
  min-width: 0;
}
.games-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 20px;
  border-bottom: 1px solid #403d2b;
}
.games-heading h2 {
  font:
    30px NoitaClassic,
    Georgia,
    serif;
  color: #e2c583;
  margin: 0;
}
.games-tabs {
  display: flex;
  padding: 3px;
  border: 1px solid #555038;
  background: #0c110d;
  gap: 4px;
}
.games-tabs button {
  font-size: 12px;
  background: none;
  border: 0;
  color: #9fa58f;
  padding: 9px 13px;
}
.games-tabs button[aria-pressed="true"] {
  color: #f2d393;
  background: #343322;
  box-shadow: inset 0 0 0 1px #78633b;
}
.games-scene {
  position: relative;
  aspect-ratio: 960/540;
  min-height: 300px;
  overflow: hidden;
  background: #10140f;
}
.games-scene canvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  cursor: pointer;
}
.games-scene canvas:focus-visible {
  outline: 2px solid #e5c378;
  outline-offset: -4px;
}
.games-result {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(460px, 85%);
  box-sizing: border-box;
  background: #12170ff5;
  border: 2px solid #c6a557;
  box-shadow:
    inset 0 0 0 3px #302d1b,
    0 8px 35px #0008;
  padding: 14px 22px;
  text-align: center;
}
.games-result[hidden] {
  display: none;
}
.games-result > span {
  display: block;
  font: 12px monospace;
  color: #b9a16c;
  letter-spacing: 2px;
}
.games-result h3 {
  color: #f5d993;
  font:
    30px/1.15 NoitaClassic,
    Georgia,
    serif;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.games-result p {
  font-size: 12px;
  color: #b9beaa;
  margin: 0;
}
.games-result-close {
  position: absolute;
  right: 5px;
  top: 4px;
  background: transparent;
  border: 0;
  color: #b8ad90;
  font-size: 18px;
  padding: 2px 7px;
}
.games-bottomline {
  display: grid;
  grid-template-columns: 1fr 210px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 10px 18px;
  border-top: 1px solid #403d2b;
}
.games-bottomline p {
  font:
    12px/1.6 Arial,
    sans-serif;
  color: #a5ae97;
  margin: 0;
}
.games-roll {
  border: 2px solid #a88a47;
  box-shadow: inset 0 0 0 3px #080c08;
  background: #202517;
  color: #edc767;
  font:
    28px NoitaClassic,
    Georgia,
    serif;
  height: 52px;
  width: 210px;
}
.games-roll:disabled {
  opacity: 0.45;
}
.games-chances {
  justify-self: end;
  color: #a99465;
  font-size: 12px;
  text-align: right;
  line-height: 1.7;
}
.games-history {
  min-height: 102px;
  padding: 14px 18px;
  border-top: 1px solid #403d2b;
}
.games-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.games-history h3 {
  margin: 0;
  font:
    16px Georgia,
    serif;
  color: #c8bf9a;
}
.games-history ol {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.games-history li {
  padding: 6px 9px;
  border: 1px solid #424b35;
  background: #1a2318;
  color: #bbc3a7;
  font-size: 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.games-history li:first-child {
  color: #e9cc87;
  border-color: #827044;
}
.games-history-empty {
  font:
    12px Arial,
    sans-serif;
  color: #798570;
  margin: 0;
}
.games-text-button {
  border: 0;
  background: none;
  color: #ac9868;
  font-size: 12px;
  padding: 3px;
}
.games-settings {
  padding: 19px;
  max-height: 900px;
  overflow: auto;
  scrollbar-color: #726847 #141a12;
}
.games-settings h3 {
  font:
    23px Georgia,
    serif;
  color: #d7cca5;
  margin: 0 0 8px;
}
.games-settings h4 {
  font:
    16px Georgia,
    serif;
  color: #c8bd95;
  margin: 20px 0 10px;
}
.games-description,
.games-help {
  font:
    12px/1.6 Arial,
    sans-serif;
  color: #929e85;
  margin: 6px 0 12px;
}
.games-rule {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: #c5c3a7;
  margin: 14px 0;
}
.games-settings select,
.games-settings textarea,
.games-settings input[type="text"],
.games-settings input[type="number"] {
  background: #0f150f;
  border: 1px solid #51593b;
  border-radius: 0;
  color: #d4d5bb;
  padding: 9px;
  font:
    12px Arial,
    sans-serif;
  box-sizing: border-box;
  width: 100%;
}
.games-settings select:focus,
.games-settings textarea:focus,
.games-settings input:focus {
  outline: 1px solid #b49957;
  outline-offset: 1px;
}
.games-settings textarea {
  resize: vertical;
  min-height: 95px;
  line-height: 1.65;
}
.games-setting-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.games-entry-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.games-entry-actions button,
.games-add-actions button,
.games-restore {
  font:
    12px Arial,
    sans-serif;
  padding: 8px 9px;
  border: 1px solid #5d6247;
  background: #1d281b;
  color: #cec6a4;
}
.games-add-actions {
  display: flex;
  gap: 8px;
}
.games-add-actions button:first-child {
  color: #ebd49a;
  border-color: #8e7743;
}
.games-pool-list {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 370px;
  overflow: auto;
}
.games-entry {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) 68px 24px 24px;
  gap: 6px;
  align-items: center;
  padding: 5px;
  background: #192017;
  border: 1px solid #343e2b;
}
.games-entry .games-swatch {
  height: 25px;
  display: block;
}
.games-entry input[type="text"] {
  padding: 6px 3px;
  border: 0;
  background: none;
  font-size: 12px;
  min-width: 0;
}
.games-entry input[type="number"] {
  padding: 5px 2px;
  font-size: 12px;
  text-align: center;
}
.games-entry button {
  border: 0;
  background: #273021;
  color: #bfb98e;
  width: 24px;
  height: 25px;
  padding: 0;
  font-size: 15px;
}
.games-storage {
  font:
    12px/1.6 Arial,
    sans-serif;
  color: #7b8a73;
  margin: 16px 0 0;
}
.games-feedback {
  font-size: 12px;
  line-height: 1.5;
  color: #d9bf80;
  min-height: 17px;
  margin: 8px 0;
}
.games-pool-count {
  font-size: 12px;
  color: #aa9870;
}
.games-settings {
  padding-top: 62px;
}
.games-pool-toggle {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 12;
  background: #1c2418;
  color: #d4bd83;
  border: 1px solid #6b6244;
  padding: 10px 13px;
  font-size: 12px;
}
.custom-games.pool-collapsed {
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
}
.custom-games.pool-collapsed .games-settings {
  display: none;
}
.custom-games.pool-collapsed .games-pool-toggle {
  right: 0;
  top: 0;
  writing-mode: vertical-rl;
  min-height: 160px;
  width: 36px;
  padding: 12px 8px;
}
.games-coin-counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
}
.games-coin-counts > div {
  border: 1px solid #474e35;
  background: #182117;
  padding: 12px;
  text-align: center;
}
.games-coin-counts strong {
  display: block;
  font:
    28px NoitaClassic,
    serif;
  color: #e1c580;
}
.games-coin-counts span {
  font-size: 12px;
  color: #a6af95;
}
.games-mode #stage:fullscreen,
.games-mode #stage.expanded {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: auto;
}
.games-mode #stage:fullscreen .custom-games,
.games-mode #stage.expanded .custom-games {
  flex: 1;
  min-height: 0;
  margin: 0;
}
.games-mode #stage:fullscreen .games-main,
.games-mode #stage.expanded .games-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.games-mode #stage:fullscreen .games-scene,
.games-mode #stage.expanded .games-scene {
  flex: 1;
  min-height: 260px;
  aspect-ratio: auto;
}
.games-mode #stage:fullscreen .games-settings,
.games-mode #stage.expanded .games-settings {
  max-height: none;
}
.games-mode #stage:fullscreen .games-heading,
.games-mode #stage.expanded .games-heading {
  padding: 9px 18px;
}
.games-mode #stage:fullscreen .games-history,
.games-mode #stage.expanded .games-history {
  min-height: 75px;
  padding: 9px 18px;
}
@media (max-width: 1000px) {
  .custom-games {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
  .games-heading {
    flex-wrap: wrap;
    gap: 10px;
  }
  .games-bottomline {
    grid-template-columns: 1fr 170px;
    gap: 9px;
  }
  .games-roll {
    width: 170px;
  }
  .games-chances {
    display: none;
  }
}
@media (max-width: 760px) {
  .custom-games {
    grid-template-columns: minmax(0, 1fr);
  }
  .games-settings {
    max-height: none;
  }
  .games-pool-list {
    max-height: 280px;
  }
  .games-heading h2 {
    font-size: 25px;
  }
  .games-heading {
    padding: 13px;
  }
  .games-bottomline {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .games-bottomline p {
    text-align: center;
    grid-row: 2;
  }
  .games-roll {
    justify-self: center;
    width: 210px;
  }
  .games-scene {
    min-height: 260px;
  }
  .games-result h3 {
    font-size: 25px;
  }
  #mode-games {
    margin-left: 6px;
  }
  .games-mode #stage:fullscreen .games-scene,
  .games-mode #stage.expanded .games-scene {
    min-height: 250px;
  }
}
.mode-switch {
  flex-wrap: wrap;
  max-width: 100%;
  box-sizing: border-box;
}
.games-chances {
  white-space: pre-line;
}
.games-settings [hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .games-scene canvas {
    scroll-behavior: auto;
  }
}
.games-main {
  align-self: start;
}
.games-mode #stage:fullscreen .games-main,
.games-mode #stage.expanded .games-main {
  align-self: stretch;
}

#custom-games[data-game="wheel"] .games-scene canvas {
  image-rendering: auto;
}
@media (max-width: 760px) {
  .custom-games:not(.pool-collapsed) .games-pool-toggle {
    position: static;
    grid-row: 1;
    justify-self: end;
  }
  .custom-games:not(.pool-collapsed) .games-settings {
    padding-top: 19px;
  }
  .custom-games.pool-collapsed {
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 8px;
  }
}

/* TI Range Picker */
.games-tabs {
  flex-wrap: wrap;
}
#games-ti-error {
  color: #dc9a82;
}
.custom-games[data-game="ti"] .games-result {
  top: auto;
  bottom: 14px;
  padding: 16px 25px;
}
.custom-games[data-game="ti"] .games-result h3 {
  font-size: 36px;
}

.games-ti-range {
  border: 1px solid #4d4933;
  margin: 16px 0;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.games-ti-range legend {
  color: #d3b87c;
  font-size: 12px;
  padding: 0 5px;
}
.games-ti-range .games-rule {
  margin: 0;
  min-width: 0;
}
.games-ti-range input {
  width: 100%;
  box-sizing: border-box;
}

.games-ti-optional {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: end;
  gap: 4px;
  min-width: 0;
}
.games-ti-optional button {
  height: 36px;
  padding: 0;
  border: 1px solid #62563a;
  background: #202517;
  color: #d3b87c;
  font-size: 18px;
}
.games-ti-optional button:disabled {
  opacity: 0.3;
  cursor: default;
}

.custom-games[data-game="ti"] #games-storage {
  display: none;
}
