:root {
  --steam-bg: #101822;
  --steam-sidebar: #162332;
  --steam-card: #1b2838;
  --steam-border: #263c54;
  --steam-border-focus: #1a9fff;
  --steam-text: #c6d4df;
  --steam-text-muted: #8295a5;
  --steam-text-bright: #ffffff;
  --steam-blue: #1a9fff;
  --steam-blue-hover: #2ba6ff;
  --steam-blue-glow: rgba(26, 159, 255, 0.28);
  --steam-gold: #e5a849;
  --steam-danger: #e0455a;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--steam-bg);
  color: var(--steam-text);
  font-family: var(--font-main);
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: #132130;
  border-bottom: 2px solid #22374d;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}
.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #1a9fff, #0d6efd);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: bold;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(26,159,255,0.4);
}
.brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand-text small {
  display: block;
  font-size: 8px;
  color: #6d88a2;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Buttons ────────────────────────────────────────── */
.button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid #334e6d;
  border-radius: 6px;
  background: #213347;
  color: #cde1f5;
  padding: 7px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
}
.button:hover {
  background: #2b435d;
  border-color: #4b739e;
  color: #fff;
}
.button.primary {
  background: linear-gradient(180deg, #1a9fff 0%, #107ac2 100%);
  border-color: #1a9fff;
  color: #fff;
  box-shadow: 0 2px 8px rgba(26, 159, 255, 0.35);
}
.button.primary:hover {
  background: linear-gradient(180deg, #32abff 0%, #148ad6 100%);
  box-shadow: 0 3px 12px rgba(26, 159, 255, 0.5);
}
.button.quiet {
  background: transparent;
  border-color: #2b3e54;
  color: #8fa6bd;
}
.button.quiet:hover {
  border-color: #486689;
  color: #cce1f5;
}
.button.full {
  width: 100%;
}
.btn-mini {
  padding: 3px 8px;
  font-size: 11px;
}

/* ── Workspace ──────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ── Controls (Side Menu NO SCROLL) ─────────────────── */
.controls {
  background: var(--steam-sidebar);
  border-right: 1px solid #203348;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid #23374d;
  margin-bottom: 10px;
}
.panel-tag {
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: #6082a3;
}
.save-status {
  font-size: 11px;
  color: #7296b8;
  font-weight: 600;
}

/* ── Nav Tabs (4 Sections) ──────────────────────────── */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  background: #111a24;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #23374d;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #8fa6bd;
  padding: 7px 2px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.nav-tab:hover {
  background: #172637;
  color: #cde1f5;
}
.nav-tab.active {
  background: #1d334a;
  color: #fff;
  border-color: #2b5581;
  box-shadow: 0 0 10px rgba(26,159,255,0.3);
}
.tab-icon {
  font-size: 15px;
}
.tab-title {
  letter-spacing: .2px;
}

/* ── Tab Panels ─────────────────────────────────────── */
.tab-panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  background: var(--steam-card);
  border: 1px solid var(--steam-border);
  border-radius: 8px;
  padding: 14px;
}
.tab-panel.active {
  display: flex;
}
.tab-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #23374c;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tab-footer.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── Form Inputs ────────────────────────────────────── */
.field-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--steam-text-muted);
}
.field-label-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--steam-text-muted);
}
.sub-label {
  font-size: 10.5px;
  color: #657f99;
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}

input, textarea, select {
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  color: #e1ebf4;
  background: #111a24;
  border: 1px solid #2b415a;
  border-radius: 6px;
  padding: 7px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--steam-blue);
  box-shadow: 0 0 0 3px var(--steam-blue-glow);
}
textarea {
  resize: none;
  line-height: 1.35;
  font-family: monospace;
}

.split-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

/* ── Chips ──────────────────────────────────────────── */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.chip {
  background: #142231;
  border: 1px solid #273e57;
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  color: #92afcc;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
}
.chip:hover {
  background: #1e354e;
  border-color: #3f658f;
  color: #fff;
}
.chip.highlight {
  border-color: #2b5581;
  background: #14273c;
  color: #80b3e5;
}
.chip.highlight:hover {
  background: var(--steam-blue);
  color: #fff;
}

/* ── Avatar Row ─────────────────────────────────────── */
.avatar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.avatar-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.avatar-preview-img {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  border: 2px solid #3d6288;
  background: #101822;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
}
.avatar-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.avatar-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}
.upload-btn {
  display: inline-flex;
  align-items: center;
  background: #142436;
  border: 1px dashed #3a5c82;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  color: #80b0db;
  cursor: pointer;
  font-weight: 600;
  transition: border-color .15s;
}
.upload-btn:hover {
  border-color: var(--steam-blue);
  color: #fff;
}
.upload-btn input { display: none; }
.link-btn {
  background: none;
  border: none;
  color: #72a5d6;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: #fff; text-decoration: underline; }

/* ── Games Selector Grid ────────────────────────────── */
.games-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.game-card {
  position: relative;
  background: #121c27;
  border: 2px solid #23364c;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: all .15s ease;
  display: flex;
  flex-direction: column;
}
.game-card img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  display: block;
}
.game-card-label {
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #a4c4e2;
  background: #152232;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.game-card:hover {
  border-color: #3b5c82;
  transform: translateY(-1px);
}
.game-card.active {
  border-color: var(--steam-blue);
  box-shadow: 0 0 12px rgba(26, 159, 255, 0.45);
}
.game-card.active .game-card-label {
  background: #1a9fff;
  color: #fff;
}

/* ── Items Showcase & List ──────────────────────────── */
.presets-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-urls-box {
  background: #121b25;
  border: 1px solid #233549;
  border-radius: 6px;
  padding: 8px;
}
.items-slots-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 130px;
  overflow-y: auto;
  padding-right: 3px;
}
.item-slot-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #121b26;
  border: 1px solid #223549;
  border-radius: 5px;
  padding: 4px 6px;
}
.item-slot-img {
  width: 30px;
  height: 30px;
  background: #0d141d;
  border: 2px solid #D2D2D2;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}
.item-slot-input {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
}
.item-slot-color {
  width: 48px;
  padding: 3px;
  font-size: 10px;
  cursor: pointer;
  background: #162332;
  border: 1px solid #29405c;
  color: #c4d7ec;
  border-radius: 4px;
}
.item-slot-del {
  background: none;
  border: none;
  color: #e0455a;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
}
.item-slot-del:hover {
  background: rgba(224, 69, 90, 0.2);
}

/* ── Save Section ───────────────────────────────────── */
.bot-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #9ab4ce;
  cursor: pointer;
}
.check-label input {
  width: auto;
  cursor: pointer;
}
.save-main-btn {
  padding: 9px;
  font-size: 13px;
  font-weight: 700;
}
.saved-configs-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid #20354c;
  padding-top: 8px;
  flex: 1;
  overflow: hidden;
}
.config-list-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 120px;
  overflow-y: auto;
}
.config-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111b27;
  border: 1px solid #22364c;
  border-radius: 5px;
  padding: 5px 8px;
  gap: 6px;
}
.config-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.config-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #dceaf7;
}
.config-card-meta {
  font-size: 10px;
  color: #637d97;
}
.config-card-actions {
  display: flex;
  gap: 4px;
}

/* ── Stage (Preview) ────────────────────────────────── */
.stage {
  padding: 14px 20px;
  min-width: 0;
  background: var(--steam-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  height: 100%;
}
.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  max-width: 1400px;
  flex-shrink: 0;
}
.stage-tag {
  margin: 0 0 2px;
  color: #55728f;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 800;
}
.stage-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #e5f1fc;
}
.stage-controls {
  display: flex;
  gap: 8px;
}
.view-switch {
  background: #152232;
  border: 1px solid #243950;
  border-radius: 6px;
  padding: 2px;
  display: flex;
}
.view-switch button {
  border: 0;
  background: transparent;
  border-radius: 4px;
  padding: 4px 9px;
  font-size: 11px;
  color: #7995b0;
  cursor: pointer;
  font-weight: 600;
}
.view-switch button.active {
  background: #1a9fff;
  color: #fff;
  box-shadow: 0 1px 4px rgba(26,159,255,0.4);
}
.preview-picker {
  display: flex;
  gap: 10px;
  max-width: 1400px;
  flex-shrink: 0;
}
.preview-picker .field-label {
  width: 190px;
}
.previews {
  max-width: 1400px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  flex: 1;
}
.previews.two-cols {
  grid-template-columns: 1fr 1fr;
}
.preview-card {
  min-width: 0;
  background: #171a21;
  border: 1px solid #283e56;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}
.preview-card[hidden] {
  display: none !important;
}
.preview-label {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #142232;
  border-bottom: 1px solid #23374d;
  color: #bcd2e8;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.preview-label small {
  margin-left: auto;
  color: #637f9b;
  font-weight: 600;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--steam-blue);
  box-shadow: 0 0 6px var(--steam-blue);
}
iframe {
  width: 100%;
  height: 100%;
  min-height: 680px;
  border: 0;
  display: block;
  background: #18222f;
}
.previews.mobile {
  grid-template-columns: minmax(280px, 390px);
  justify-content: center;
}
.previews.mobile.two-cols {
  grid-template-columns: repeat(2, minmax(280px, 390px));
}

/* ── Mobile Responsive ──────────────────────────────── */
@media (max-width: 950px) {
  html, body {
    overflow: auto;
  }
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .controls {
    border-right: 0;
    border-bottom: 1px solid #203348;
    height: auto;
    overflow: visible;
  }
  .stage {
    padding: 16px;
    height: auto;
    overflow: visible;
  }
}
