.custom-game-screen {
  --custom-ink: #071111;
  --custom-panel: rgba(4, 11, 11, 0.94);
  --custom-panel-soft: rgba(7, 17, 17, 0.88);
  --custom-cream: #f2dfb0;
  --custom-cream-muted: #b9a982;
  --custom-teal: #36e2cf;
  --custom-teal-soft: rgba(54, 226, 207, 0.34);
  --custom-gold: #f0b94d;
  --custom-red: #ff6242;
  position: fixed;
  z-index: 60;
  inset: 0;
  top: 0;
  left: 0;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 54px;
  width: 100vw;
  height: 100svh;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--custom-cream);
  background: var(--custom-ink);
  text-align: left;
  transform: none;
  transform-origin: center;
}

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

.custom-game-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 8, 8, 0.99) 0 22%, rgba(2, 9, 9, 0.93) 34%, rgba(2, 13, 13, 0.78) 64%, rgba(2, 13, 13, 0.87)),
    linear-gradient(180deg, rgba(1, 8, 8, 0.3), rgba(1, 8, 8, 0.72)),
    url("../assets/generated-art/environment/mars-station-15-campaign-one-v1.png") center / cover no-repeat;
}

.custom-game-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background:
    repeating-linear-gradient(0deg, rgba(54, 226, 207, 0.16) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 72% 42%, transparent 0 28%, rgba(0, 0, 0, 0.42) 78%);
  pointer-events: none;
}

.custom-game-rail,
.custom-game-main,
.custom-game-footer {
  position: relative;
  z-index: 1;
}

.custom-game-rail {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 28px 24px;
  border-right: 1px solid rgba(54, 226, 207, 0.19);
  background:
    linear-gradient(180deg, rgba(4, 11, 11, 0.98), rgba(4, 11, 11, 0.93)),
    rgba(4, 11, 11, 0.96);
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.26);
}

.custom-game-rail__logo {
  display: block;
  width: 168px;
  height: 185px;
  margin: 0 auto 12px;
  object-fit: contain;
}

.custom-game-rail__heading {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}

.custom-game-rail__heading span,
.custom-game-kicker,
.custom-game-panel__header span,
.custom-game-brief article > span,
.custom-game-file-status span,
.custom-game-form-label,
.custom-game-launch-check small,
.custom-game-launch-stat small {
  color: var(--custom-teal);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.custom-game-rail__heading strong {
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.custom-game-rail__back {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(54, 226, 207, 0.18);
  color: rgba(242, 223, 176, 0.55);
  background: transparent;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: left;
  cursor: pointer;
}

.custom-game-rail__back span {
  color: var(--custom-teal);
  font-family: var(--font-ui);
  font-size: 18px;
}

.custom-game-rail__back:hover,
.custom-game-rail__back:focus-visible {
  color: var(--custom-cream);
}

.custom-game-steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.custom-game-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 68px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(54, 226, 207, 0.12);
  opacity: 0.7;
}

.custom-game-step.is-active {
  margin-inline: -8px;
  padding-inline: 16px;
  border: 1px solid rgba(54, 226, 207, 0.32);
  background: linear-gradient(90deg, rgba(54, 226, 207, 0.13), rgba(54, 226, 207, 0.02));
  opacity: 1;
}

.custom-game-step__number {
  color: var(--custom-gold);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.custom-game-step__body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.custom-game-step__body small {
  color: var(--custom-teal);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.custom-game-step__body strong {
  overflow: hidden;
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-game-step em {
  color: rgba(185, 169, 130, 0.68);
  font-family: var(--font-ui);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.custom-game-step.is-active em {
  color: var(--custom-teal);
}

.custom-game-rail__note {
  margin: auto 0 0;
  color: rgba(185, 169, 130, 0.55);
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.custom-game-main {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 36px clamp(36px, 5vw, 80px) 22px;
  overflow: auto;
}

.custom-game-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.custom-game-heading h1 {
  margin: 3px 0 4px;
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1;
}

.custom-game-heading p,
.custom-game-panel__header p {
  margin: 0;
  color: rgba(242, 223, 176, 0.7);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  text-transform: none;
}

.custom-game-file-status {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  min-width: 230px;
  min-height: 42px;
  border: 1px solid rgba(54, 226, 207, 0.26);
  background: rgba(4, 11, 11, 0.76);
}

.custom-game-file-status > * {
  display: grid;
  place-items: center;
  align-self: stretch;
  padding: 0 12px;
  border-right: 1px solid rgba(54, 226, 207, 0.14);
}

.custom-game-file-status strong,
.custom-game-file-status em {
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 9px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.custom-game-file-status em {
  border-right: 0;
  color: var(--custom-teal);
}

.custom-game-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(54, 226, 207, 0.22);
  background: rgba(4, 11, 11, 0.76);
}

.custom-game-brief article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 12px;
  min-width: 0;
  min-height: 64px;
  padding: 11px 16px;
  border-right: 1px solid rgba(54, 226, 207, 0.15);
}

.custom-game-brief article:last-child {
  border-right: 0;
}

.custom-game-brief article > span {
  grid-row: 1 / 3;
  align-self: center;
  color: rgba(54, 226, 207, 0.58);
}

.custom-game-brief strong,
.custom-game-brief small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-game-brief strong {
  align-self: end;
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.custom-game-brief small {
  color: var(--custom-cream-muted);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.custom-game-workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1.4fr) minmax(330px, 0.8fr);
  gap: 14px;
  min-height: 0;
}

.custom-game-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(54, 226, 207, 0.25);
  background:
    linear-gradient(180deg, rgba(54, 226, 207, 0.035), transparent 36%),
    var(--custom-panel);
  box-shadow: inset 0 0 32px rgba(54, 226, 207, 0.025);
}

.custom-game-panel--order {
  border-color: rgba(240, 185, 77, 0.26);
}

.custom-game-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid rgba(54, 226, 207, 0.14);
}

.custom-game-panel__header h2 {
  margin: 3px 0 0;
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.custom-game-panel__header p {
  width: min(260px, 45%);
  color: rgba(185, 169, 130, 0.68);
  font-size: 11px;
  text-align: right;
}

.custom-game-forge-controls,
.custom-game-launch-order {
  min-height: 0;
  overflow: auto;
  scrollbar-color: rgba(54, 226, 207, 0.45) rgba(4, 11, 11, 0.5);
  scrollbar-width: thin;
}

.custom-game-source-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(54, 226, 207, 0.12);
}

.custom-game-source-field {
  display: grid;
  gap: 5px;
}

.custom-game-source-field select,
.custom-game-forge-row input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(54, 226, 207, 0.24);
  border-radius: 0;
  color: var(--custom-cream);
  background: rgba(4, 16, 16, 0.82);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
}

.custom-game-forge-row input[type="number"] {
  appearance: textfield;
}

.custom-game-forge-row input[type="number"]::-webkit-inner-spin-button,
.custom-game-forge-row input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.custom-game-source-field select:focus-visible,
.custom-game-forge-row input:focus-visible {
  border-color: var(--custom-teal);
  outline: 1px solid rgba(54, 226, 207, 0.35);
  outline-offset: 1px;
}

.custom-game-forge-fields {
  display: grid;
}

.custom-game-forge-row {
  display: grid;
  grid-template-columns: 34px minmax(150px, 0.62fr) minmax(160px, 1fr) 58px;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(54, 226, 207, 0.1);
}

.custom-game-forge-row:hover {
  background: linear-gradient(90deg, rgba(54, 226, 207, 0.06), transparent);
}

.custom-game-forge-row__number {
  color: var(--custom-gold);
  font-family: var(--font-display);
  font-size: 12px;
}

.custom-game-forge-row__label {
  color: var(--custom-cream-muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.custom-game-forge-row input {
  height: 32px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.025);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-align: right;
  text-transform: uppercase;
}

.custom-game-forge-row__action {
  color: var(--custom-teal);
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: right;
}

.custom-game-rule-groups {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
  padding: 11px 14px 14px;
}

.custom-game-rule-group {
  display: grid;
  gap: 7px;
}

.custom-game-screen .playtest-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.custom-game-screen .playtest-toggle-row--shields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.custom-game-screen .playtest-toggle-row button {
  min-height: 34px;
  border: 1px solid rgba(54, 226, 207, 0.25);
  color: rgba(242, 223, 176, 0.66);
  background: rgba(4, 16, 16, 0.76);
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.custom-game-screen .playtest-toggle-row button.is-active {
  border-color: rgba(54, 226, 207, 0.65);
  color: var(--custom-ink);
  background: var(--custom-teal);
}

.custom-game-screen .playtest-favourites {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-items: center;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid rgba(240, 185, 77, 0.13);
  background: rgba(240, 185, 77, 0.035);
}

.custom-game-screen .playtest-favourites__label,
.custom-game-screen .playtest-favourites__empty {
  color: rgba(240, 185, 77, 0.72);
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.custom-game-screen .playtest-favourite {
  min-height: 28px;
  border: 1px solid rgba(240, 185, 77, 0.22);
  color: var(--custom-cream);
  background: rgba(4, 11, 11, 0.7);
  font-family: var(--font-ui);
  font-size: 8px;
}

.custom-game-screen .playtest-favourite.is-active,
.custom-game-screen .playtest-favourite:hover,
.custom-game-screen .playtest-favourite:focus-visible {
  border-color: var(--custom-gold);
  color: var(--custom-ink);
  background: var(--custom-gold);
}

.custom-game-launch-order {
  display: grid;
  align-content: start;
}

.custom-game-launch-copy {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(240, 185, 77, 0.12);
  color: rgba(242, 223, 176, 0.72);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.45;
  text-transform: none;
}

.custom-game-launch-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 14px;
  border: 1px solid rgba(54, 226, 207, 0.18);
}

.custom-game-launch-stat {
  display: grid;
  gap: 4px;
  min-height: 64px;
  place-content: center;
  border-right: 1px solid rgba(54, 226, 207, 0.14);
  text-align: center;
}

.custom-game-launch-stat:last-child {
  border-right: 0;
}

.custom-game-launch-stat strong {
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
}

.custom-game-launch-checks {
  display: grid;
  padding: 0 14px 14px;
}

.custom-game-launch-check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid rgba(54, 226, 207, 0.11);
}

.custom-game-launch-check > span {
  color: var(--custom-gold);
  font-family: var(--font-display);
  font-size: 10px;
}

.custom-game-launch-check div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.custom-game-launch-check strong {
  overflow: hidden;
  color: var(--custom-cream);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-game-launch-check em {
  color: var(--custom-teal);
  font-family: var(--font-ui);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.custom-game-actions {
  display: grid;
  grid-template-columns: 160px 110px minmax(240px, 1fr);
  gap: 10px;
  justify-content: end;
}

.custom-game-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(54, 226, 207, 0.3);
  color: var(--custom-cream);
  background: rgba(4, 11, 11, 0.9);
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.07em;
  cursor: pointer;
}

.custom-game-button:hover,
.custom-game-button:focus-visible {
  border-color: var(--custom-teal);
  outline: 2px solid rgba(54, 226, 207, 0.18);
  outline-offset: 2px;
}

.custom-game-button--primary {
  color: var(--custom-ink);
  border-color: var(--custom-gold);
  background: var(--custom-gold);
}

.custom-game-button--primary span {
  margin-right: 10px;
}

.custom-game-button--primary:hover,
.custom-game-button--primary:focus-visible {
  border-color: #ffe09a;
  background: #ffc95d;
}

.custom-game-footer {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 0 28px;
  border-top: 1px solid rgba(54, 226, 207, 0.18);
  background: rgba(3, 9, 9, 0.98);
  color: rgba(185, 169, 130, 0.58);
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.custom-game-footer strong {
  color: var(--custom-gold);
}

.custom-game-footer span:nth-of-type(2) {
  margin-left: auto;
  color: rgba(54, 226, 207, 0.72);
}

@media (max-width: 1180px) {
  .custom-game-screen {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .custom-game-rail {
    padding-inline: 20px;
  }

  .custom-game-rail__logo {
    width: 130px;
    height: 143px;
  }

  .custom-game-main {
    padding-inline: 26px;
  }

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

  .custom-game-panel {
    min-height: 330px;
  }

  .custom-game-panel--order {
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .custom-game-screen {
    display: block;
    overflow: auto;
  }

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

  .custom-game-rail {
    min-height: auto;
    padding: max(16px, var(--safe-top)) 18px 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(54, 226, 207, 0.18);
  }

  .custom-game-rail__logo,
  .custom-game-steps,
  .custom-game-rail__note {
    display: none;
  }

  .custom-game-rail__heading {
    margin-bottom: 6px;
  }

  .custom-game-rail__back {
    position: absolute;
    right: 18px;
    top: max(16px, var(--safe-top));
    width: auto;
    min-height: 34px;
    border-bottom: 0;
  }

  .custom-game-main {
    display: grid;
    padding: 18px 14px calc(72px + var(--safe-bottom));
    overflow: visible;
  }

  .custom-game-heading {
    display: grid;
  }

  .custom-game-file-status {
    min-width: 0;
    width: 100%;
  }

  .custom-game-brief,
  .custom-game-source-fields,
  .custom-game-rule-groups {
    grid-template-columns: 1fr;
  }

  .custom-game-brief article {
    border-right: 0;
    border-bottom: 1px solid rgba(54, 226, 207, 0.15);
  }

  .custom-game-forge-row {
    grid-template-columns: 28px minmax(0, 1fr) 64px;
  }

  .custom-game-forge-row input {
    grid-column: 2 / -1;
    grid-row: 2;
  }

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

  .custom-game-button--primary {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .custom-game-footer {
    display: none;
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .custom-game-rail__logo {
    width: 108px;
    height: 118px;
    margin-bottom: 4px;
  }

  .custom-game-rail__heading {
    margin-bottom: 8px;
  }

  .custom-game-step {
    min-height: 54px;
  }

  .custom-game-main {
    gap: 9px;
    padding-top: 20px;
    padding-bottom: 14px;
  }

  .custom-game-heading p {
    display: none;
  }

  .custom-game-panel__header {
    padding-block: 10px;
  }
}
