:root {
  color-scheme: dark;
  --cyan: #16c8e8;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.58);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(255, 255, 255, 0.06);
  --card: rgba(8, 8, 9, 0.86);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: #000;
  color: var(--white);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #020202;
  padding: 32px clamp(18px, 4vw, 40px);
}

.grid-layer,
.glow-layer,
.shade-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-layer {
  opacity: 0.75;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 28px 28px;
}

.glow-layer {
  opacity: 0.3;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.07), transparent 48%);
}

.shade-layer {
  background: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.3));
}

.content {
  position: relative;
  z-index: 1;
  width: min(100%, 1320px);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  padding: 16px 28px;
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0.28em;
}

.brand span:last-child {
  color: var(--cyan);
}

.game-picker {
  margin-top: 48px;
  padding-bottom: 24px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 330px);
  justify-content: start;
  gap: 28px;
}

.game-card {
  appearance: none;
  width: 330px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: var(--card);
  color: inherit;
  cursor: pointer;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.game-card:not(.unavailable):hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.5);
}

.game-card.unavailable {
  cursor: not-allowed;
  opacity: 0.75;
}

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1b1b1f;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.unavailable .thumb img {
  filter: grayscale(1) brightness(0.5);
}

.status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  border: 1px solid;
  border-radius: 999px;
  padding: 6px 13px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.status.online {
  border-color: rgba(134, 239, 172, 0.45);
  background: rgba(34, 197, 94, 0.9);
  color: #fff;
}

.status.fixing {
  border-color: rgba(254, 240, 138, 0.6);
  background: rgba(250, 204, 21, 0.95);
  color: #1f1700;
}

.status.coming-soon {
  border-color: rgba(224, 242, 254, 0.8);
  background: rgba(240, 249, 255, 0.95);
  color: #082f49;
}

.status.offline {
  border-color: rgba(252, 165, 165, 0.45);
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.game-card h3 {
  margin: 0;
  min-height: 46px;
  padding: 14px 16px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 950;
}

.load-error {
  grid-column: 1 / -1;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 28px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  font-weight: 800;
}

.load-error code {
  color: var(--cyan);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.config-view {
  margin-top: 42px;
  padding-bottom: 32px;
}

.config-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.config-header p,
.config-header h1,
.config-header span {
  margin: 0;
}

.config-header p {
  color: var(--cyan);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.22em;
}

.config-header h1 {
  margin-top: 6px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  font-weight: 950;
}

.config-header span {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 14px;
  font-weight: 700;
}

.back-button,
.copy-button,
.confirm-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.back-button {
  min-width: 84px;
  padding: 10px 16px;
}

.copy-button {
  padding: 8px 14px;
  background: var(--cyan);
  color: #00141a;
}

.confirm-button {
  min-width: 180px;
  padding: 12px 24px;
  background: var(--cyan);
  color: #00141a;
}

.back-button:hover,
.copy-button:hover,
.confirm-button:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
}

.copy-button:hover {
  background: #51ddf4;
}

.confirm-button:hover {
  background: #51ddf4;
}

.config-sections {
  display: grid;
  gap: 16px;
}

.config-section,
.output-panel {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(8, 8, 9, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.config-section {
  padding: 18px;
}

.config-section.has-open-dropdown {
  z-index: 70;
}

.config-section-title {
  margin-bottom: 16px;
}

.config-section-title h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}

.config-section-title p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.46);
  font-size: 13px;
  font-weight: 650;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-list {
  grid-column: span 2;
}

.field-compact {
  grid-column: auto;
  max-width: none;
}

.field-label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 850;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  height: 42px;
  padding: 0 12px;
}

.field select {
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-repeat: no-repeat;
  background-size: 6px 6px;
  padding-right: 36px;
}

.field select option {
  background: #080809;
  color: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 116px;
  padding: 11px 12px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(22, 200, 232, 0.75);
  box-shadow: 0 0 0 3px rgba(22, 200, 232, 0.12);
}

.field small {
  color: rgba(255, 255, 255, 0.38);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}

.field-boolean {
  display: grid;
  gap: 8px;
}

.boolean-control {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
  cursor: pointer;
}

.boolean-text {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boolean-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 160ms ease;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.boolean-control input:checked + .toggle {
  background: var(--cyan);
}

.boolean-control input:checked + .toggle::after {
  transform: translateX(18px);
}

.multi-field {
  position: relative;
}

.multi-field.is-open {
  z-index: 80;
}

.multi-dropdown {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.multi-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.36);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 0 12px;
  text-align: left;
}

.multi-summary {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-caret {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-bottom: 2px solid rgba(255, 255, 255, 0.72);
  border-right: 2px solid rgba(255, 255, 255, 0.72);
  transform: rotate(45deg) translateY(-2px);
}

.multi-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 100;
  display: none;
  max-height: 220px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 7, 8, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  padding: 6px;
}

.multi-dropdown.is-open .multi-menu {
  display: grid;
  gap: 6px;
}

.multi-dropdown.drop-up .multi-menu {
  top: auto;
  bottom: calc(100% + 6px);
}

.multi-search {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  outline: none;
  padding: 0 10px;
}

.multi-search::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.multi-search:focus {
  border-color: rgba(22, 200, 232, 0.75);
  box-shadow: 0 0 0 3px rgba(22, 200, 232, 0.12);
}

.multi-options {
  display: grid;
  gap: 4px;
}

.multi-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px;
}

.multi-option:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.multi-option input {
  width: 15px;
  height: 15px;
  accent-color: var(--cyan);
}

.output-panel {
  position: sticky;
  top: 22px;
  overflow: hidden;
}

.output-panel-full {
  position: static;
  width: min(100%, 980px);
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 16px;
}

.output-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 950;
}

.output-panel pre {
  max-height: 72vh;
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: #d4d4d4;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
}

.output-panel code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.code-keyword {
  color: #c586c0;
}

.code-string {
  color: #ce9178;
}

.code-number {
  color: #b5cea8;
}

.code-punctuation {
  color: #808080;
}

.code-keyword + .code-punctuation,
.code-punctuation + .code-keyword {
  color: #c586c0;
}

.config-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(8, 8, 9, 0.82);
  padding: 16px;
}

.config-actions p {
  margin: 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .game-grid {
    grid-template-columns: repeat(auto-fit, 330px);
    gap: 24px;
  }

  .output-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .content {
    width: 100%;
  }

  .topbar {
    min-height: 62px;
    border-radius: 18px;
    padding: 14px 16px;
  }

  .brand {
    gap: 8px;
    font-size: 13px;
    letter-spacing: 0.2em;
  }

  .game-picker,
  .config-view {
    margin-top: 24px;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .game-card {
    width: 100%;
    max-width: 360px;
  }

  .config-section {
    padding: 14px;
  }

  .config-section-title h2 {
    font-size: 16px;
  }

  .config-section-title p {
    font-size: 12px;
    line-height: 1.35;
  }

  .fields {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .field-list {
    grid-column: auto;
  }

  .multi-menu {
    max-height: 190px;
  }

  .config-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .confirm-button,
  .copy-button,
  .back-button {
    min-height: 42px;
  }

  .output-panel pre {
    max-height: 62vh;
    font-size: 11px;
    overflow: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 14px 10px 24px;
  }

  .topbar {
    min-height: 56px;
    border-radius: 16px;
    padding: 12px 14px;
  }

  .brand {
    gap: 7px;
    font-size: 12px;
    letter-spacing: 0.16em;
  }

  .game-picker {
    margin-top: 32px;
  }

  .game-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .game-card {
    width: 100%;
    max-width: none;
  }

  .status {
    top: 8px;
    right: 8px;
    padding: 5px 10px;
    font-size: 10px;
  }

  .config-header {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }

  .config-header h1 {
    font-size: 28px;
  }

  .config-header span {
    font-size: 12px;
  }

  .fields {
    grid-template-columns: 1fr;
  }

  .field-list {
    grid-column: auto;
  }

  .config-actions {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .confirm-button {
    width: 100%;
    min-width: 0;
  }

  .multi-trigger,
  .boolean-control,
  .field input[type="text"],
  .field input[type="number"],
  .field select {
    height: 40px;
    min-height: 40px;
  }

  .multi-menu {
    left: 0;
    right: 0;
    max-height: 180px;
  }

  .output-header {
    padding: 12px;
  }

  .output-panel pre {
    padding: 12px;
  }
}
