.yaml-gen main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px 20px;
}
@media (min-width: 900px) {
  .yaml-gen main { grid-template-columns: 1fr 1fr; }
  .yaml-gen .unavail-panel { grid-column: 1 / -1; }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 8px;
  padding: 14px 16px;
}
.panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 12px;
}
.muted { color: var(--muted); }
.muted.small { font-size: 12px; }

#search {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--dim);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  min-width: 220px;
}

.game-list, .unavail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.bundled-panel .game-list,
.custom-panel .game-list {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}
.game-list li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.game-list li a:hover { border-color: var(--accent); }
.game-list li .tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.unavail-list li {
  padding: 6px 10px;
  background: var(--panel-2);
  border-radius: 4px;
  font-size: 12px;
}
.unavail-list li .err { color: var(--err); font-family: ui-monospace, monospace; font-size: 11px; display: block; margin-top: 2px; }

/* --- form page --- */
.yaml-gen-form .opt-group {
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 8px;
  padding: 12px 14px;
}
.yaml-gen-form .opt-group > h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.yaml-gen-form .opt {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-2);
}
.yaml-gen-form .opt:last-child { border-bottom: 0; }
.yaml-gen-form .opt label.opt-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 500;
}
.yaml-gen-form .opt .doc {
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
  margin: 2px 0 6px;
}
.yaml-gen-form .opt .ctrl {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.yaml-gen-form .opt input[type="text"],
.yaml-gen-form .opt input[type="number"],
.yaml-gen-form .opt select,
.yaml-gen-form .opt textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--dim);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  min-width: 160px;
}
.yaml-gen-form .opt textarea {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.yaml-gen-form .opt .random-toggle { font-size: 11px; color: var(--muted); }
.yaml-gen-form .opt.unsupported { opacity: 0.6; }
.yaml-gen-form .opt .badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  text-transform: uppercase;
}
.yaml-gen-form .actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 12px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--panel-2);
}
.yaml-gen-form .actions input[type="text"] {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--dim);
  border-radius: 4px;
  padding: 6px 10px;
  font: inherit;
  flex: 1 1 160px;
  min-width: 140px;
}
.yaml-gen-form .actions input[name="_library_preset"] {
  flex: 1 1 180px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.yaml-gen-form .actions input[name="_library_preset"]:invalid {
  border-color: var(--err);
}
.yaml-gen-form .actions .action-buttons {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.yaml-gen-form .actions button {
  background: var(--accent);
  color: #0f1115;
  font-weight: 600;
  padding: 6px 14px;
  white-space: nowrap;
}
.yaml-gen-form .actions button.submit-library {
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.yaml-gen-form .actions button.submit-library:hover {
  background: var(--accent);
  color: #0f1115;
}

/* --- mobile: stack the actions row, drop sticky so it doesn't eat screen --- */
@media (max-width: 720px) {
  .yaml-gen-form .actions {
    position: static;
    background: var(--panel);
    border: 1px solid var(--panel-2);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    border-top: 1px solid var(--panel-2);
  }
  .yaml-gen-form .actions input[type="text"],
  .yaml-gen-form .actions input[name="_library_preset"] {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
  }
  .yaml-gen-form .actions .action-buttons {
    flex: 1 1 auto;
    width: 100%;
  }
  .yaml-gen-form .actions .action-buttons button {
    flex: 1 1 0;
    padding: 10px 8px;
    font-size: 14px;
  }
}

/* --- weighted form --- */
.yaml-gen-form .badge.weighted {
  background: var(--accent);
  color: #0f1115;
  margin-left: 8px;
  font-weight: 600;
}
.yaml-gen-form .ctrl-weighted {
  flex-direction: column;
  align-items: stretch;
}
.yaml-gen-form .weights-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}
.yaml-gen-form .weight-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--dim);
  border-radius: 4px;
  padding: 4px 6px;
}
.yaml-gen-form .weight-cell .weight-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yaml-gen-form .weight-cell input[type="number"] {
  width: 56px;
  min-width: 0;
  padding: 2px 4px;
  text-align: right;
}
.yaml-gen-form .weighted-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.yaml-gen-form #weighted-link,
.yaml-gen-form #switch-link {
  margin-right: 12px;
  text-decoration: underline;
}

