@font-face {
  font-family: "Audiowide";
  src: url("./fonts/Audiowide/Audiowide-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --game-dark-color: #171b1f;
  --game-light-color: #d5d1c8;
  color-scheme: dark;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0e1114;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.ball-debug-panel {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 30;
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  background: rgba(14, 17, 20, 0.84);
  color: #e8e8e8;
  font:
    11px/1.45 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  white-space: pre;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.ball-debug-panel[hidden] {
  display: none;
}

.site-credit {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 10;
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.site-credit a {
  color: inherit;
  text-decoration: none;
}

.site-credit a:hover,
.site-credit a:focus-visible {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
}

.controls {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  z-index: 10;
  display: flex;
  gap: 8px;
}

.control-button {
  min-width: 36px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(14, 17, 20, 0.78);
  color: #d8d8d8;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.control-button:hover {
  background: rgba(30, 34, 38, 0.92);
}

.pause-control-button {
  width: 36px;
  padding: 0;
}

.pause-control-button__icon {
  display: inline-block;
  width: 10px;
  height: 12px;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
  box-sizing: border-box;
  vertical-align: middle;
}

.controls[hidden] {
  display: none;
}

.one-player-result-actions {
  position: fixed;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  transform-origin: left top;
}

.one-player-result-actions[hidden] {
  display: none;
}

.ranking-result-status {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: 7px;
  border-radius: 5px;
  background: rgba(15, 18, 21, 0.9);
  color: #ccc;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.ranking-result-status button,
.ranking-refresh {
  border: 1px solid #666;
  border-radius: 5px;
  padding: 6px 12px;
  background: #171b1f;
  color: #eee;
  font: inherit;
  cursor: pointer;
}

.ranking-result-status button[hidden],
.ranking-refresh[hidden],
.ranking-filters[hidden],
.ranking-notice[hidden] {
  display: none;
}

.ranking-notice {
  margin: 14px 0 0;
  color: #aaa;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: normal;
}

.ranking-notice p { margin: 6px 0; }
.ranking-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 20px; }
.ranking-refresh { margin-top: 12px; font-size: 11px; }

.two-players-result {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  pointer-events: none;
}

.two-players-result[hidden] {
  display: none;
}

.two-players-result__side {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.two-players-result__side--top {
  transform: rotate(180deg);
}

.two-players-result__message {
  color: #fff;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(24px, 6vmin, 40px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.two-players-result__message[data-outcome="lose"] {
  color: rgba(255, 255, 255, 0.62);
}

.two-players-result__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: auto;
}

.two-players-result__actions .scene-menu__button {
  touch-action: manipulation;
}

.scene-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(14, 17, 20, 0.72);
  backdrop-filter: blur(8px);
}

.scene-overlay[hidden],
.scene-menu[hidden] {
  display: none;
}

.scene-menu {
  width: min(320px, 100%);
  padding: 28px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(14, 17, 20, 0.94);
  color: #ddd;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  text-align: center;
}

.scene-menu__title {
  margin: 0;
  color: #eee;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.scene-menu__status {
  margin-top: 5px;
  color: #999;
  font-size: 11px;
  letter-spacing: 0.2em;
}

.scene-menu__notice {
  margin-top: 12px;
  color: #d6b37a;
  font-size: 11px;
  line-height: 1.5;
}

.scene-menu__notice[hidden] {
  display: none;
}

.scene-menu__actions {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.scene-menu__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: #ddd;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.scene-menu__button[hidden] {
  display: none;
}

.scene-menu__button:hover,
.scene-menu__button:focus-visible,
.scene-menu__button--primary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.scene-menu__button:disabled {
  color: #777;
  cursor: not-allowed;
}

.scene-menu__button small {
  color: #777;
  font-size: 9px;
}

.game-setup {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.game-setup__player-name {
  display: grid;
  grid-template-columns: auto minmax(120px, 220px);
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  color: #999;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.game-setup__player-name[hidden] {
  display: none;
}

.game-setup__player-name input,
.game-setup__player-name select {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  box-sizing: border-box;
  background: #171b1f;
  color: #fff;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-align: center;
}

.game-setup__player-name select {
  appearance: none;
  padding-right: 32px;
  padding-left: 32px;
  background-image: linear-gradient(45deg, transparent 50%, #ddd 50%), linear-gradient(135deg, #ddd 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  text-align-last: center;
}


.custom-select__native {
  display: none !important;
}

.custom-select {
  position: relative;
  min-width: 96px;
}

.custom-select__button {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 7px 30px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  box-sizing: border-box;
  background: #171b1f;
  color: #fff;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.custom-select__button::after {
  position: absolute;
  top: calc(50% + 2px);
  right: 10px;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  border-top-color: currentColor;
  content: "";
  transform: translateY(-50%);
}

.custom-select__button:hover,
.custom-select__button:focus-visible,
.custom-select__button[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.68);
  outline: none;
}

.custom-select__button:disabled {
  opacity: 0.45;
  cursor: default;
}

.custom-select__list {
  position: fixed;
  z-index: 100;
  max-height: min(240px, calc(100vh - 16px));
  margin: 0;
  overflow-y: auto;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 5px;
  box-sizing: border-box;
  background: #171b1f;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  list-style: none;
}

.custom-select__list[hidden] {
  display: none;
}

.custom-select__option {
  padding: 7px 9px;
  border-radius: 3px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.custom-select__option[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.22);
}

.custom-select__option[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

.custom-select--light .custom-select__button,
.custom-select__list--light {
  border-color: rgba(23, 27, 31, 0.36);
  background: #d5d1c8;
  color: #171b1f;
}

.custom-select--light .custom-select__button:hover,
.custom-select--light .custom-select__button:focus-visible,
.custom-select--light .custom-select__button[aria-expanded="true"] {
  border-color: rgba(23, 27, 31, 0.72);
}

.custom-select__list--light .custom-select__option:hover,
.custom-select__list--light .custom-select__option:focus-visible {
  background: rgba(23, 27, 31, 0.1);
}

.custom-select__list--light .custom-select__option[aria-selected="true"] {
  background: rgba(23, 27, 31, 0.18);
}

.game-setup__player-name .custom-select__button {
  padding: 8px 32px;
  font-size: 13px;
}

.two-player-handicap__control .custom-select {
  min-width: 0;
}

.two-player-handicap__control .custom-select__button {
  height: 28px;
  padding: 4px 22px 4px 7px;
  border-color: currentColor;
  background: transparent;
  color: inherit;
  font-size: 10px;
}

.high-score-filter .custom-select__button {
  padding: 6px 26px 6px 10px;
  font-size: 10px;
}

.settings .custom-select__button {
  padding: 4px 26px 4px 8px;
  border-color: rgba(255, 255, 255, 0.18);
  color: #ddd;
  font-size: 12px;
}

.two-player-handicap[hidden] {
  display: none;
}

.two-player-handicap {
  min-width: 0;
}

.two-player-handicap__field {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

.two-player-handicap__player {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(86px, 130px) 52px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.two-player-handicap__player--top {
  background: var(--game-light-color);
  color: var(--game-dark-color);
}

.two-player-handicap__player--bottom {
  background: var(--game-dark-color);
  color: var(--game-light-color);
}

.two-player-handicap__identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-align: left;
}

.two-player-handicap__identity strong,
.two-player-handicap__identity small {
  display: block;
}

.two-player-handicap__identity strong {
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.two-player-handicap__identity small {
  margin-top: 2px;
  font-size: 8px;
  letter-spacing: 0.12em;
  opacity: 0.68;
}

.two-player-handicap__direction {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  place-items: center;
  font-size: 15px;
  line-height: 1;
}

.two-player-handicap__control {
  display: grid;
  gap: 3px;
  min-width: 0;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-align: left;
}

.two-player-handicap__control select {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 4px;
  box-sizing: border-box;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 10px;
  text-align: center;
}

.two-player-handicap__player--top select {
  background: var(--game-light-color);
}

.two-player-handicap__player--bottom select {
  background: var(--game-dark-color);
}

.two-player-handicap__centerline {
  position: relative;
  height: 10px;
  background: linear-gradient(
    to bottom,
    var(--game-light-color) 50%,
    var(--game-dark-color) 50%
  );
}

.two-player-handicap__centerline::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.48);
  content: "";
}

.two-player-handicap__centerline span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: #626a72;
  transform: translate(-50%, -50%);
}

.high-score-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  color: #999;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.high-score-filter select {
  padding: 6px 24px 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  background: #171b1f;
  color: #fff;
  font: inherit;
}

.high-score-filter + .high-score-list {
  margin-top: 12px;
}

.high-score-menu {
  width: min(760px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}

.high-score-list {
  display: grid;
  gap: 7px;
  max-height: min(58vh, 520px);
  margin-top: 22px;
  overflow-y: auto;
  padding-right: 4px;
}

.high-score-list__header,
.high-score-list__row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(72px, 0.7fr) minmax(80px, 0.8fr) minmax(150px, 1.2fr) minmax(80px, 0.8fr);
  gap: 10px;
  align-items: center;
  text-align: left;
}

.high-score-list__header {
  padding: 0 10px 3px;
  color: #777;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.high-score-list__row {
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.03);
  color: #bbb;
  font-size: 11px;
}

.high-score-list__category,
.high-score-list__score {
  color: #eee;
  font-weight: 700;
}

.high-score-list__score {
  font-size: 14px;
}

@media (max-width: 640px) {
  .high-score-list__header {
    display: none;
  }

  .high-score-list__row {
    grid-template-columns: 1fr 1fr;
  }

  .high-score-list__row > span::before {
    display: block;
    margin-bottom: 2px;
    color: #777;
    font-size: 8px;
    letter-spacing: 0.08em;
    content: attr(data-label);
  }

  .high-score-list__category {
    grid-column: 1 / -1;
  }
}

.game-setup__section {
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.game-setup__section legend {
  width: 100%;
  padding: 0;
  color: #999;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.stage-size-options {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.stage-size-option {
  min-width: 0;
  cursor: pointer;
}

.stage-size-option__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stage-size-option__content {
  display: grid;
  grid-template-rows: 42px auto;
  place-items: center;
  gap: 6px;
  min-height: 88px;
  padding: 10px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.03);
  color: #999;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.stage-size-option:hover .stage-size-option__content,
.stage-size-option__input:focus-visible + .stage-size-option__content {
  border-color: rgba(255, 255, 255, 0.3);
  color: #ddd;
}

.stage-size-option__input:checked + .stage-size-option__content {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.stage-size-option__icon {
  display: block;
  border: 1px solid currentColor;
  box-sizing: border-box;
  background-image: linear-gradient(to right, transparent calc(100% - 1px), currentColor calc(100% - 1px)), linear-gradient(to bottom, transparent calc(100% - 1px), currentColor calc(100% - 1px));
  align-self: center;
}

.stage-size-option__icon--small {
  width: 38px;
  height: 38px;
  background-size: 50% 50%;
}

.stage-size-option__icon--medium {
  width: 38px;
  height: 38px;
  background-size: 33.333% 33.333%;
}

.stage-size-option__icon--large {
  width: 38px;
  height: 38px;
  background-size: 20% 20%;
}

.stage-size-option__icon--wide {
  width: 42px;
  height: 26px;
  background-size: 25% 33.333%;
}

.stage-size-option__icon--tall {
  width: 24px;
  height: 40px;
  background-size: 33.333% 20%;
}

.stage-size-option__icon--custom {
  position: relative;
  width: 38px;
  height: 32px;
  border-style: dashed;
  background-size: 50% 50%;
}

.stage-size-option__icon--custom::after {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  box-sizing: border-box;
  background: #171b1f;
  content: "";
}

.game-setup__custom-size {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: #aaa;
  font-size: 11px;
}

.game-setup__custom-size[hidden] {
  display: none;
}

.game-setup__custom-size-inputs {
  display: flex;
  align-items: center;
  gap: 7px;
}

.game-setup__custom-size input[type="number"] {
  width: 58px;
  box-sizing: border-box;
  padding: 5px 6px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  background: #171b1f;
  color: #fff;
  font: inherit;
  text-align: center;
}

.game-setup__section--compact {
  margin-top: 18px;
}

.segment-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  overflow: hidden;
}

.segment-option {
  min-width: 0;
  cursor: pointer;
}

.segment-option + .segment-option {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.segment-option__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segment-option__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #888;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.segment-option:hover .segment-option__content,
.segment-option__input:focus-visible + .segment-option__content {
  background: rgba(255, 255, 255, 0.07);
  color: #ddd;
}

.segment-option__input:checked + .segment-option__content {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.block-type-icon {
  display: block;
  flex: 0 0 auto;
  height: 10px;
  background: currentColor;
}

.block-type-icon--standard {
  width: 10px;
}

.block-type-icon--traditional {
  width: 22px;
}

.game-setup__actions {
  grid-template-columns: 1fr;
}

#gameSetupStartButton:not(:disabled) {
  min-height: 50px;
  border-color: #fff;
  background: #fff;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  box-shadow: 0 5px 18px rgba(255, 255, 255, 0.12);
}

#gameSetupStartButton:not(:disabled):hover,
#gameSetupStartButton:not(:disabled):focus-visible {
  background: #dcdcdc;
}

@media (max-width: 520px) {
  .game-setup {
    width: min(320px, 100%);
  }

  .game-setup__player-name {
    grid-template-columns: 1fr;
    gap: 7px;
    text-align: left;
  }

  .stage-size-options {
    grid-template-columns: repeat(3, 1fr);
  }

  .two-player-handicap__player {
    grid-template-columns: minmax(92px, 1fr) minmax(76px, 92px) 52px;
    gap: 7px;
    padding: 9px 8px;
  }

  .two-player-handicap__identity {
    gap: 6px;
  }

  .two-player-handicap__direction {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }
}

.settings {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: 240px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(14, 17, 20, 0.94);
  color: #ddd;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(10px);
}

.settings[hidden] {
  display: none;
}

.settings__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.settings__row + .settings__row {
  margin-top: 12px;
}

.settings__label {
  font-size: 13px;
}

.settings__sound-test-link {
  color: #c9c5bc;
  font-size: 11px;
}

.settings__sound-test-description + .settings__row {
  margin-top: 14px;
}

.settings input[type="color"] {
  width: 42px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.settings__speed {
  display: grid;
  grid-template-columns: 1fr 54px;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.settings__speed + .settings__row {
  margin-top: 12px;
}

.settings input[type="range"] {
  width: 100%;
}

.settings__range-row output {
  min-width: 52px;
  color: #ddd;
  font-size: 12px;
  text-align: right;
}

.settings__range-row + input[type="range"] {
  margin-top: 6px;
}

.draw-mode-setting {
  margin-top: 14px;
}

.settings select {
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: #171b1f;
  color: #ddd;
  font: inherit;
  font-size: 12px;
}

.settings input[type="number"] {
  width: 54px;
  box-sizing: border-box;
  padding: 4px 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: #171b1f;
  color: #ddd;
  font: inherit;
  font-size: 12px;
}

.settings .settings__name-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: #171b1f;
  color: #ddd;
  font: inherit;
  font-size: 12px;
}

.player-settings {
  margin: 14px 0 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
}

.player-settings legend {
  padding: 0 5px;
  color: #eee;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.player-settings__controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.player-settings__controls input[type="color"] {
  width: 36px;
}

.player-settings + .settings__row {
  margin-top: 14px;
}

.display-setting-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 13px;
  cursor: pointer;
}

.display-setting-toggle input {
  margin: 0;
}

.display-setting-description {
  margin: 4px 0 0 22px;
  color: #999;
  font-size: 10px;
  line-height: 1.4;
}

.display-setting-toggle + .display-setting-toggle {
  margin-top: 10px;
}

.display-setting-toggle + .settings__row {
  margin-top: 14px;
}

.settings__volume-value {
  color: #ddd;
  font-size: 12px;
  text-align: right;
}

.settings-close-button {
  width: 100%;
  margin-top: 18px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #bbb;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.settings-close-button:hover,
.settings-close-button:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  color: #eee;
}

.settings-reset-button {
  display: block;
  margin: 9px auto 0;
  padding: 3px 6px;
  border: 0;
  background: transparent;
  color: #777;
  font: inherit;
  font-size: 10px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.18);
  text-underline-offset: 2px;
  cursor: pointer;
}

.settings-danger-zone {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(214, 102, 102, 0.32);
}

.settings-danger-zone[hidden] {
  display: none;
}

.settings-danger-zone__heading {
  margin: 0;
  color: #e3a0a0;
  font-size: 12px;
  font-weight: 600;
}

.settings-danger-zone__description {
  margin: 6px 0 10px;
  color: #a98a8a;
  font-size: 10px;
  line-height: 1.5;
}

.settings-danger-zone__button {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(224, 112, 112, 0.52);
  border-radius: 6px;
  background: rgba(176, 55, 55, 0.12);
  color: #e3a0a0;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.settings-danger-zone__button:hover,
.settings-danger-zone__button:focus-visible {
  border-color: rgba(235, 130, 130, 0.8);
  background: rgba(176, 55, 55, 0.22);
  color: #f2b8b8;
}

.settings-reset-button:hover,
.settings-reset-button:focus-visible {
  color: #aaa;
}

.rule-settings {
  width: 310px;
}

.settings__heading {
  margin-bottom: 14px;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
}

.rule-category + .rule-category {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.rule-category__heading {
  margin: 0 0 11px;
  color: #eee;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.rule-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}

.rule-choice:not(:first-of-type) {
  margin-top: 13px;
}

.rule-choice input {
  margin: 0;
}

.rule-choice__description {
  margin: 4px 0 0 22px;
  color: #999;
  font-size: 10px;
  line-height: 1.4;
}

.rule-choice__option {
  margin: 8px 0 0 22px;
}

.rule-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.rule-setting + .rule-setting,
.rule-setting + .settings__row {
  margin-top: 14px;
}

.rule-setting__toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
}

.rule-setting__toggle input {
  margin: 0;
}

.rule-setting select:disabled,
.rule-setting input[type="number"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rule-setting__percent {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.grid-size-setting__inputs {
  display: flex;
  align-items: center;
  gap: 5px;
}

.grid-size-setting__inputs input[type="number"] {
  width: 48px;
}

.display-setting-description + .grid-size-setting {
  margin-top: 14px;
}
