* {
  box-sizing: border-box;
}

:root {
  --bg-main: #0f1117;
  --bg-panel: #171a23;
  --bg-panel-soft: #1f2330;
  --bg-input: #10131b;

  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-main: #f2f3f5;
  --text-muted: #a7adbd;
  --text-soft: #d0d4df;

  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-soft: rgba(88, 101, 242, 0.15);

  --success: #3ba55d;
  --warning: #faa61a;
  --danger: #ed4245;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-panel: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-button: 0 10px 25px rgba(88, 101, 242, 0.28);

  --transition-fast: 160ms ease;
  --transition-normal: 240ms ease;

  --font-main: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(88, 101, 242, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(59, 165, 93, 0.08), transparent 30%),
    var(--bg-main);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  font-family: var(--font-main);
  background: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ================================
   LANDING PAGE STYLES (Current)
   ================================ */

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 18px;
}

.hero-card {
  width: min(1100px, 100%);
  min-height: 680px;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(300px, 420px);
  align-items: center;
  justify-content: center;
  gap: 46px;
  padding: 38px;
  border: 1px solid var(--border-soft);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02)),
    rgba(20, 27, 43, 0.78);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.45),
    inset 0 0 70px rgba(0, 217, 255, 0.045);
  backdrop-filter: blur(14px);
}

.ghost-scene {
  position: relative;
  width: 100%;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  isolation: isolate;
}

/* Soft glow behind the slideshow */
.ghost-scene::before {
  content: '';
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 217, 255, 0.16), transparent 68%);
  filter: blur(12px);
  z-index: -1;
  animation: pulseGlow 4s ease-in-out infinite;
}

/* ================================
   SLIDESHOW STYLES
   ================================ */

.slideshow {
  position: relative;
  width: min(450px, 100%);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  opacity: 0;
  transition: opacity 0.8s ease, filter 0.8s ease;
  filter:
    drop-shadow(0 0 18px rgba(0, 217, 255, 0.55))
    drop-shadow(0 0 48px rgba(0, 217, 255, 0.26))
    drop-shadow(0 24px 42px rgba(0, 0, 0, 0.42));
  will-change: opacity, filter;
}

.slide.active {
  opacity: 1;
}

.slideshow-dots {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding: 0;
}

.slideshow-dots .dot {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition:
    background 0.3s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.slideshow-dots .dot:hover {
  transform: scale(1.25);
  background: rgba(255, 255, 255, 0.4);
}

.slideshow-dots .dot.active {
  background: rgba(0, 217, 255, 0.85);
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.6);
  transform: scale(1.15);
}

.hero-actions {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #00d9ff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.menu-btn {
  width: 100%;
  min-height: 58px;
  padding: 15px 20px;
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(88, 101, 242, 0.22), rgba(0, 217, 255, 0.08)),
    rgba(15, 23, 42, 0.88);
  color: #f4f7fb;
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.28),
    inset 0 0 24px rgba(0, 217, 255, 0.04);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.menu-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 217, 255, 0.65);
  background:
    linear-gradient(135deg, rgba(88, 101, 242, 0.34), rgba(0, 217, 255, 0.15)),
    rgba(15, 23, 42, 0.95);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.36),
    0 0 22px rgba(0, 217, 255, 0.18);
}

.menu-btn:active {
  transform: translateY(0);
}

.primary-btn {
  border-color: rgba(0, 217, 255, 0.75);
  background:
    linear-gradient(135deg, rgba(0, 217, 255, 0.32), rgba(88, 101, 242, 0.32)),
    rgba(15, 23, 42, 0.95);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.36),
    0 0 24px rgba(0, 217, 255, 0.22);
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 0.65;
    scale: 0.96;
  }

  50% {
    opacity: 1;
    scale: 1.06;
  }
}

/* ================================
   APP SHELL STYLES (Original)
   ================================ */

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 22px 24px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(23, 26, 35, 0.96), rgba(31, 35, 48, 0.88)),
    rgba(23, 26, 35, 0.9);
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(14px);
}

.app-header h1 {
  margin: 0 0 5px;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.app-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.home-lock-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.builder-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(250, 166, 26, 0.45);
  border-radius: var(--radius-md);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(250, 166, 26, 0.24), rgba(88, 101, 242, 0.18)),
    rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 25px rgba(250, 166, 26, 0.16);
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.builder-link-btn:hover {
  transform: translateY(-1px);
  background:
    linear-gradient(135deg, rgba(250, 166, 26, 0.32), rgba(88, 101, 242, 0.24)),
    rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(250, 166, 26, 0.2);
}

.status-pill {
  flex: 0 0 auto;
  min-width: 92px;
  padding: 10px 15px;
  border: 1px solid rgba(88, 101, 242, 0.35);
  border-radius: 999px;
  color: #ffffff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.status-pill.success {
  border-color: rgba(59, 165, 93, 0.45);
  background: rgba(59, 165, 93, 0.14);
}

.status-pill.warning {
  border-color: rgba(250, 166, 26, 0.45);
  background: rgba(250, 166, 26, 0.14);
}

.status-pill.error {
  border-color: rgba(237, 66, 69, 0.45);
  background: rgba(237, 66, 69, 0.14);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.single-layout {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(23, 26, 35, 0.98), rgba(18, 21, 30, 0.98)),
    var(--bg-panel);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.panel-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
}

.panel-header h2 {
  margin: 0 0 7px;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.panel-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

form {
  padding: 24px;
}

.analysis-start-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid rgba(88, 101, 242, 0.32);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(88, 101, 242, 0.16), rgba(88, 101, 242, 0.05)),
    rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.analysis-start-box h3 {
  margin: 0 0 6px;
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.analysis-start-box p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.analysis-start-box button {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  margin-bottom: 19px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: var(--bg-input);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 98px;
  padding: 13px;
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: rgba(167, 173, 189, 0.62);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(88, 101, 242, 0.78);
  background: #111521;
  box-shadow:
    0 0 0 4px rgba(88, 101, 242, 0.16),
    0 10px 28px rgba(0, 0, 0, 0.22);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-row.multi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.targeting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 19px;
}

.targeting-grid .field {
  margin-bottom: 0;
}

.targeting-grid .checkbox-row,
.targeting-grid .checkbox-row.multi {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
}

.check-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
  user-select: none;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.check-card:hover {
  transform: translateY(-1px);
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.08);
}

.check-card input {
  width: 17px;
  height: 17px;
  min-height: auto;
  accent-color: var(--accent);
}

.check-card:has(input:checked) {
  border-color: rgba(88, 101, 242, 0.78);
  background: rgba(88, 101, 242, 0.17);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.08);
}

.button-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 18px;
  color: #ffffff;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    opacity var(--transition-fast);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #6d78ff);
  box-shadow: var(--shadow-button);
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--accent-hover), #5e6bff);
}

.secondary-btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.preview-panel {
  position: sticky;
  top: 18px;
}

.json-preview {
  min-height: 520px;
  max-height: 70vh;
  margin: 0;
  padding: 22px 24px;
  overflow: auto;
  color: #e7e9ff;
  background:
    linear-gradient(180deg, rgba(15, 17, 23, 0.98), rgba(12, 14, 20, 0.98)),
    #0b0d12;
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-actions {
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
}

.report-panel {
  margin-top: 24px;
}

/* ================================
   MODAL STYLES
   ================================ */

/* Inventory Modal */
.inventory-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: 22px;
  overflow: auto;
  background: rgba(5, 7, 12, 0.72);
}

.inventory-modal-overlay.open {
  display: flex;
}

.inventory-modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
}

.inventory-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(23, 26, 35, 0.98);
}

.inventory-modal-header h2 {
  margin: 0 0 5px;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.inventory-modal-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.inventory-modal-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.inventory-modal-controls select,
.inventory-modal-controls input {
  width: auto;
  min-width: 190px;
}

.inventory-modal-controls input {
  min-width: min(330px, 100%);
}

.inventory-modal-controls button {
  width: auto;
  white-space: nowrap;
}

.close-modal-btn {
  min-width: 44px;
  padding: 0 12px;
  font-size: 1.1rem;
}

.inventory-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
}

.inventory-modal-footer button {
  width: auto;
}

/* Saved Builds Modal */
.saved-builds-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: 22px;
  overflow: auto;
  background: rgba(5, 7, 12, 0.72);
}

.saved-builds-modal-overlay.open {
  display: flex;
}

.saved-builds-modal {
  width: min(580px, 100%);
  max-height: calc(100vh - 44px);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
}

.saved-builds-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(23, 26, 35, 0.98);
}

.saved-builds-modal-header h2 {
  margin: 0 0 5px;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.saved-builds-modal-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.saved-builds-modal-body {
  padding: 18px 22px;
}

.saved-builds-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-build-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.saved-build-card:hover {
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.08);
  transform: translateY(-1px);
}

.saved-build-card-info {
  flex: 1;
  min-width: 0;
}

.saved-build-card-info h3 {
  margin: 0 0 5px;
  color: #ffffff;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-build-card-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.saved-build-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.saved-build-card-actions button {
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.88rem;
}

.saved-builds-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
}

.saved-builds-modal-footer button {
  width: auto;
}

/* Build Modal */
.build-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: 22px;
  overflow: auto;
  background: rgba(5, 7, 12, 0.72);
}

.build-modal-overlay.open {
  display: flex;
}

.build-modal {
  width: min(900px, 100%);
  max-height: calc(100vh - 44px);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
}

.build-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(23, 26, 35, 0.98);
}

.build-modal-header h2 {
  margin: 0 0 5px;
  font-size: 1.22rem;
  letter-spacing: -0.025em;
}

.build-modal-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.build-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

.build-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
}

.build-modal-footer button {
  width: auto;
}

/* Inventory specific styles */
.inventory-summary {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 0.94rem;
}

.inventory-filter-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.018);
}

.inventory-filter-bar label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.inventory-filter-bar span {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.inventory-filter-bar select {
  width: 100%;
  min-height: 42px;
}

.inventory-filter-bar button {
  align-self: end;
  width: auto;
  min-height: 42px;
  white-space: nowrap;
}

.inventory-output {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px;
  max-height: min(78vh, 920px);
  padding: 18px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.08);
}

.inventory-card {
  display: grid;
  gap: 13px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.inventory-card-exotic {
  border-color: rgba(255, 215, 0, 0.5);
  background:
    linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 180, 0, 0.05)),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.15),
    inset 0 0 30px rgba(255, 215, 0, 0.04);
}

.inventory-card-exotic .inventory-card-top h3 {
  color: #ffd700;
}

.inventory-card-exotic .inventory-score {
  border-color: rgba(255, 215, 0, 0.5);
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
}

.inventory-card-exotic .inventory-score .score-row strong {
  color: #ffd700;
  opacity: 1;
}

.inventory-card-exotic .inventory-badges span:first-child {
  border-color: rgba(255, 215, 0, 0.4);
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.inventory-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  flex: 1;
}

.inventory-card h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.25;
}

.inventory-card p {
  margin: 5px 0 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.inventory-score {
  display: grid;
  gap: 5px;
  min-width: 148px;
  padding: 7px 9px;
  border: 1px solid rgba(106, 116, 255, 0.42);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(88, 101, 242, 0.18);
  line-height: 1.15;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
}

.score-row span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.score-row strong {
  min-width: 0;
  font-weight: 900;
  font-size: 0.78rem;
  color: #ffffff;
  text-align: right;
}

.inventory-badges,
.inventory-tags,
.inventory-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.inventory-badges span,
.inventory-tags span,
.inventory-stats span {
  padding: 5px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.16);
  font-size: 0.78rem;
  line-height: 1.2;
}

.inventory-tags span {
  color: #dfe3ff;
  border-color: rgba(106, 116, 255, 0.28);
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inventory-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.14);
}

.inventory-grid strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.inventory-grid span {
  display: block;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.inventory-perks,
.inventory-notes {
  padding-top: 2px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.inventory-perks strong {
  display: block;
  margin-bottom: 5px;
  color: #ffffff;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.inventory-match {
  padding: 0 3px;
  border-radius: 4px;
  color: #111318;
  background: #ffd166;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* Item Actions, Comments & Dispensable Styles */
.inventory-card-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.favorite-btn,
.dispose-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  font-size: 1.3rem;
  cursor: pointer;
  transition:
    transform var(--transition-fast),
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.favorite-btn {
  color: var(--text-muted);
}

.favorite-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.4);
  color: #ffd700;
}

.favorite-btn.favorite-active {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
}

.favorite-btn.favorite-active:hover {
  background: rgba(255, 215, 0, 0.3);
  transform: scale(1.15);
}

.dispose-btn {
  color: var(--text-muted);
  font-size: 1rem;
}

.dispose-btn:hover {
  transform: scale(1.1);
  background: rgba(237, 66, 69, 0.15);
  border-color: rgba(237, 66, 69, 0.4);
  color: #ed4245;
}

.dispose-btn.dispensable-active {
  background: rgba(237, 66, 69, 0.25);
  border-color: rgba(237, 66, 69, 0.6);
  color: #ed4245;
}

.dispose-btn.dispensable-active:hover {
  background: rgba(237, 66, 69, 0.35);
  transform: scale(1.15);
}

.item-comment {
  margin-bottom: 8px;
}

.comment-textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.comment-textarea::placeholder {
  color: rgba(167, 173, 189, 0.5);
}

.comment-textarea:focus {
  outline: none;
  border-color: rgba(88, 101, 242, 0.6);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.12);
}

.report-output {
  min-height: 420px;
  max-height: 70vh;
  margin: 0;
  padding: 24px;
  overflow: auto;
  color: #f2f3f5;
  background:
    linear-gradient(180deg, rgba(15, 17, 23, 0.98), rgba(10, 12, 18, 0.98)),
    #0b0d12;
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.report-output::selection,
.json-preview::selection {
  background: rgba(88, 101, 242, 0.45);
}

.build-view-page {
  min-height: 100vh;
}

.build-view-shell {
  width: min(100% - 28px, 1200px);
}

.build-view-layout {
  display: block;
}

.build-view-panel {
  min-height: calc(100vh - 150px);
}

.build-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.build-view-header button {
  width: auto;
  white-space: nowrap;
}

.build-view-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.build-view-actions button {
  width: auto;
}

.build-view-content,
.build-modal-content {
  padding: 22px;
}

.dim-build-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dim-section {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.dim-section h3 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: #ffffff;
  font-size: 0.98rem;
}

.dim-section h4,
.armor-mod-box h4 {
  margin: 0 0 10px;
  color: var(--text-main);
  font-size: 0.92rem;
}

.dim-section-body {
  padding: 14px 16px 16px;
}

.build-kv {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.build-kv:last-child {
  border-bottom: 0;
}

.build-kv strong {
  color: var(--text-muted);
  font-weight: 650;
}

.build-kv span,
.build-list {
  color: var(--text-main);
}

.build-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.build-list li + li {
  margin-top: 8px;
}

.build-list .muted {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.armor-mods-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.armor-mod-box {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.16);
}

.build-raw {
  max-height: 360px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: var(--radius-sm);
  color: #f2f3f5;
  background: rgba(0, 0, 0, 0.24);
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  margin: 0;
  padding: 28px;
  color: var(--text-muted);
}

.error-state {
  color: var(--danger);
}

.modal-open {
  overflow: hidden;
}

/* ================================
   BUILD BUILDER STYLES
   ================================ */

.builder-page {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(250, 166, 26, 0.16), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(59, 165, 93, 0.12), transparent 30%),
    linear-gradient(180deg, #10131b, #090b10 72%);
}

.builder-shell {
  width: min(1560px, calc(100% - 32px));
  margin: 0 auto;
  height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
}

.builder-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(31, 35, 48, 0.95), rgba(15, 17, 23, 0.92)),
    rgba(23, 26, 35, 0.96);
  box-shadow: var(--shadow-panel);
}

.builder-sidebar h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--text-main);
}

.builder-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.builder-sidebar-actions .home-lock-btn,
.builder-sidebar-actions .primary-btn,
.builder-sidebar-actions .secondary-btn {
  width: 100%;
  justify-content: center;
  border-radius: 6px;
  min-height: 44px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 0;
  gap: 12px;
  align-items: stretch;
}

.builder-stage {
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.builder-stage,
.builder-loadout-panel,
.builder-intel-panel {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(23, 26, 35, 0.98), rgba(14, 17, 25, 0.98)),
    var(--bg-panel);
  box-shadow: var(--shadow-panel);
}

.builder-side-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  align-self: start;
}

.builder-intel-panel,
.builder-loadout-panel {
  overflow: hidden;
  max-height: none;
}

.intel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(135deg, rgba(88, 101, 242, 0.12), rgba(59, 165, 93, 0.08)),
    rgba(255, 255, 255, 0.025);
}

.intel-header > div:first-child {
  flex: 1;
  min-width: 0;
}

.intel-header h2 {
  margin: 0 0 2px;
  font-size: 0.96rem;
}

.intel-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.intel-meter {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(88, 101, 242, 0.55);
  border-radius: 12px;
  color: #dfe2ff;
  background: rgba(88, 101, 242, 0.14);
  font-size: 1rem;
  font-weight: 950;
}

.intel-ai-btn {
  padding: 0 12px;
  min-height: 34px;
  border: 1px solid rgba(88, 101, 242, 0.45);
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.3), rgba(59, 165, 93, 0.2));
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.intel-ai-btn:hover {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.5), rgba(59, 165, 93, 0.35));
  border-color: rgba(88, 101, 242, 0.7);
  transform: translateY(-1px);
}

.ai-intel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid rgba(59, 165, 93, 0.45);
  border-radius: 999px;
  color: #b8ffd0;
  background: rgba(59, 165, 93, 0.14);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.intel-auto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.intel-auto-toggle:hover {
  border-color: rgba(88, 101, 242, 0.4);
  background: rgba(88, 101, 242, 0.08);
  color: var(--text-main);
}

.intel-auto-toggle input {
  width: 14px;
  height: 14px;
  min-height: auto;
  accent-color: var(--accent);
}

.intel-block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.intel-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 8px;
  overflow: auto;
}

.intel-block {
  min-height: auto;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.intel-block h3 {
  margin: 0 0 5px;
  font-size: 0.8rem;
}

.intel-block p,
.intel-list {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.3;
}

.intel-list {
  padding-left: 16px;
}

.intel-list li + li {
  margin-top: 4px;
}

.builder-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.builder-progress-step {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
  font-weight: 850;
}

.builder-progress-step span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
}

.builder-progress-step.active {
  border-color: rgba(250, 166, 26, 0.45);
  color: #ffffff;
  background: rgba(250, 166, 26, 0.11);
}

.builder-command-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: 1fr;
  min-height: 0;
  height: 100%;
  gap: 10px;
  align-items: stretch;
}

.builder-command {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 0;
  aspect-ratio: 1;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  background:
    linear-gradient(145deg, rgba(88, 101, 242, 0.2), rgba(255, 255, 255, 0.035)),
    #131722;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.builder-command::before {
  content: '';
  position: absolute;
  inset: 10px 10px auto auto;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  transform: rotate(12deg);
}

.builder-command:hover {
  transform: translateY(-2px);
  border-color: rgba(250, 166, 26, 0.46);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(250, 166, 26, 0.12);
}

.builder-command:active {
  transform: translateY(-1px) scale(0.99);
}

.builder-command:focus-visible,
.builder-choice-card:focus-visible,
.builder-slot-button:focus-visible,
.builder-mod-card:focus-visible,
.builder-item-card:focus-visible,
.builder-pill:focus-visible {
  outline: 3px solid rgba(250, 166, 26, 0.48);
  outline-offset: 3px;
}

.builder-command.partial {
  border-color: rgba(250, 166, 26, 0.52);
  background:
    linear-gradient(145deg, rgba(250, 166, 26, 0.22), rgba(88, 101, 242, 0.1)),
    #181821;
}

.builder-command.complete {
  border-color: rgba(59, 165, 93, 0.68);
  background:
    linear-gradient(145deg, rgba(59, 165, 93, 0.24), rgba(88, 101, 242, 0.1)),
    #111d19;
  box-shadow:
    0 16px 34px rgba(59, 165, 93, 0.12),
    inset 0 0 0 1px rgba(59, 165, 93, 0.16);
}

.builder-command.partial::after,
.builder-command.complete::after {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 12px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 18px rgba(0, 0, 0, 0.24);
  transform: rotate(12deg);
  pointer-events: none;
}

.builder-command.partial::after {
  content: 'Started';
  color: var(--warning);
  background:
    linear-gradient(145deg, rgba(250, 166, 26, 0.2), rgba(22, 24, 32, 0.92)),
    #171a23;
}

.builder-command.complete::after {
  content: 'Done';
  color: #b8ffd0;
  background:
    linear-gradient(145deg, rgba(59, 165, 93, 0.24), rgba(22, 24, 32, 0.94)),
    #111d19;
}

.builder-command.partial:hover::after,
.builder-command.complete:hover::after {
  filter: brightness(1.12);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 12px 24px rgba(0, 0, 0, 0.3);
}

.builder-command.partial::before,
.builder-command.complete::before {
  opacity: 0;
}

.class-command,
.subclass-command,
.weapons-command,
.armor-command,
.mods-command {
  grid-column: span 1;
}

.command-index {
  position: absolute;
  top: 10px;
  left: 12px;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.76rem;
  font-weight: 950;
}

.builder-command strong {
  position: relative;
  margin-bottom: 4px;
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  line-height: 1;
}

.builder-command small {
  position: relative;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.builder-loadout-panel {
  min-height: 0;
  overflow: hidden;
}

.loadout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.loadout-header h2 {
  margin: 0 0 3px;
  font-size: 0.9rem;
}

.loadout-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.loadout-power {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(250, 166, 26, 0.42);
  border-radius: 14px;
  color: var(--warning);
  background: rgba(250, 166, 26, 0.1);
  font-size: 1rem;
  font-weight: 950;
}

.guardian-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.guardian-silhouette {
  display: grid;
  width: 56px;
  height: 66px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px 999px 18px 18px;
  color: rgba(255, 255, 255, 0.8);
  background:
    linear-gradient(180deg, rgba(88, 101, 242, 0.28), rgba(250, 166, 26, 0.12)),
    rgba(255, 255, 255, 0.04);
  font-size: 1.3rem;
  font-weight: 950;
}

.guardian-card h3 {
  margin: 3px 0 3px;
  font-size: 0.9rem;
}

.guardian-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.loadout-slots {
  display: grid;
  gap: 5px;
  overflow: auto;
  padding: 8px;
  max-height: 260px;
}

.loadout-slot {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}

.loadout-slot span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.loadout-slot strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
}

.builder-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  padding: 22px;
  overflow: auto;
  background: rgba(5, 7, 12, 0.78);
}

.builder-modal-overlay.open {
  display: flex;
}

.builder-modal {
  width: min(1180px, 100%);
  max-height: calc(100vh - 44px);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(23, 26, 35, 0.99), rgba(12, 14, 20, 0.99)),
    var(--bg-panel);
  box-shadow: var(--shadow-panel);
}

.builder-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(23, 26, 35, 0.98);
}

.builder-modal-header h2 {
  margin: 0 0 5px;
  font-size: 1.28rem;
}

.builder-modal-header p {
  margin: 0;
  color: var(--text-muted);
}

.builder-modal-body {
  padding: 22px;
}

.builder-choice-grid,
.builder-slot-grid,
.builder-mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.builder-choice-card,
.builder-slot-button,
.builder-mod-card,
.builder-item-card {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.builder-choice-card:hover,
.builder-slot-button:hover,
.builder-mod-card:hover,
.builder-item-card:hover,
.builder-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(250, 166, 26, 0.46);
  background: rgba(255, 255, 255, 0.075);
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(250, 166, 26, 0.1);
}

.builder-choice-card:active,
.builder-slot-button:active,
.builder-mod-card:active,
.builder-item-card:active,
.builder-pill:active {
  transform: translateY(0) scale(0.99);
}

.builder-choice-card.selected,
.builder-mod-card.selected,
.builder-pill.selected {
  border-color: rgba(250, 166, 26, 0.62);
  background: rgba(250, 166, 26, 0.14);
}

.choice-marker {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  color: var(--warning);
  background: rgba(250, 166, 26, 0.12);
  font-weight: 950;
}

.builder-choice-card strong,
.builder-slot-button span,
.builder-mod-card strong,
.builder-item-card strong {
  display: block;
  margin-bottom: 7px;
  color: #ffffff;
  font-size: 1.05rem;
}

.builder-choice-card small,
.builder-slot-button strong,
.builder-mod-card small,
.builder-item-card small,
.builder-item-card em {
  display: block;
  color: var(--text-muted);
  font-style: normal;
  line-height: 1.35;
}

.subclass-setup-panel {
  display: grid;
  gap: 18px;
}

.subclass-detail-panel {
  min-height: 58px;
  padding: 13px 14px;
  border: 1px solid rgba(250, 166, 26, 0.28);
  border-radius: var(--radius-md);
  color: #f4e8c4;
  background:
    linear-gradient(135deg, rgba(250, 166, 26, 0.12), rgba(88, 101, 242, 0.08)),
    rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.45;
}

.subclass-setup-panel h3 {
  margin: 0 0 10px;
}

.builder-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.builder-pill {
  min-height: 40px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.055);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.builder-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.builder-item-card {
  position: relative;
  min-height: 190px;
}

.builder-item-card .item-score {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 42px;
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--warning);
  text-align: center;
  background: rgba(250, 166, 26, 0.12);
  font-size: 0.82rem;
  font-weight: 950;
}

.builder-item-card strong {
  padding-right: 48px;
}

.builder-item-card em {
  margin-top: 12px;
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.item-tags span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #dfe2ff;
  background: rgba(88, 101, 242, 0.14);
  font-size: 0.72rem;
  font-weight: 800;
}


/* ================================
   BUILD BUILDER CLEANUP OVERRIDES
   ================================ */

/* The step navigation pills, the Auto AI checkbox, and the small numeric
   intel meter are intentionally kept in the DOM for JavaScript compatibility,
   but removed from the visible interface. */
.builder-progress,
.intel-auto-toggle,
.intel-meter {
  display: none !important;
}

.intel-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.builder-stage {
  grid-template-rows: minmax(0, 1fr) auto;
}

.builder-command-grid {
  margin-top: 0;
}

.builder-command-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px 4px;
}

.builder-command-progress-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.builder-command-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #00d9ff);
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(0, 217, 255, 0.35);
}

.builder-command-progress-dots {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.builder-command-progress-dots span {
  flex: 1;
  height: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.builder-command-progress-dots span:first-child {
  border-left: 0;
}

.builder-command-progress-pct {
  flex: 0 0 auto;
  min-width: 38px;
  text-align: right;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .builder-command-progress {
    padding: 6px 8px 2px;
    gap: 10px;
  }
}


@media (max-width: 720px) {
  .intel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .intel-header-actions {
    justify-content: stretch;
  }

  .intel-ai-btn {
    width: 100%;
  }
}

/* ================================
   SCROLLBAR STYLES
   ================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

::-webkit-scrollbar-thumb {
  border: 2px solid rgba(15, 17, 23, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ================================
   RESPONSIVE STYLES
   ================================ */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .builder-layout {
    grid-template-columns: 1fr;
  }

  .intel-body {
    grid-template-columns: 1fr;
  }

  .builder-loadout-panel {
    position: static;
  }

  .builder-side-stack {
    position: static;
  }

  .builder-command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .class-command,
  .subclass-command,
  .weapons-command,
  .armor-command,
  .mods-command {
    grid-column: span 1;
  }

  .preview-panel {
    position: static;
  }

  .json-preview {
    min-height: 320px;
    max-height: 460px;
  }
}

@media (max-height: 820px) and (min-width: 1101px) {
  .builder-shell {
    gap: 10px;
    padding: 10px 0;
  }

  .builder-hero {
    min-height: 88px;
    padding: 14px 18px;
  }

  .builder-hero h1 {
    font-size: clamp(1.8rem, 3.5vw, 3.1rem);
  }

  .builder-hero p:not(.builder-kicker) {
    font-size: 0.9rem;
  }

  .builder-command strong {
    font-size: clamp(1.12rem, 2vw, 1.65rem);
  }

  .builder-command small {
    font-size: 0.78rem;
  }

  .builder-progress-step {
    min-height: 36px;
    font-size: 0.78rem;
  }

  .builder-command-grid {
    height: 100%;
  }
}

@media (max-width: 850px) {
  .hero-card {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 26px;
    gap: 22px;
    text-align: center;
  }

  .ghost-scene {
    min-height: 420px;
  }

  .slideshow {
    width: min(360px, 100%);
  }

  .hero-actions {
    max-width: 460px;
    margin: 0 auto;
  }

  .menu-btn {
    text-align: center;
  }
}

@media (max-width: 720px) {
  .builder-page {
    height: auto;
    overflow: auto;
  }

  .builder-shell {
    height: auto;
    display: block;
  }

  .builder-shell,
  .app-shell {
    width: min(100% - 20px, 1500px);
    padding-top: 14px;
  }

  .builder-hero,
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .builder-top-actions,
  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .builder-link-btn,
  .home-lock-btn {
    width: 100%;
  }

  .builder-progress,
  .builder-command-grid {
    grid-template-columns: 1fr;
  }

  .builder-stage {
    padding: 14px;
  }

  .builder-command {
    min-height: 150px;
  }

  .guardian-card {
    grid-template-columns: 1fr;
  }

  .builder-modal-overlay {
    padding: 10px;
  }

  .builder-modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .builder-modal-body {
    padding: 14px;
  }

  .status-pill {
    width: 100%;
  }

  .panel-header,
  form,
  .json-preview,
  .result-actions {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .analysis-start-box {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .analysis-start-box button {
    width: 100%;
  }

  .inventory-modal-header {
    flex-direction: column;
  }

  .inventory-modal-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .inventory-modal-controls select,
  .inventory-modal-controls input,
  .inventory-modal-controls button {
    width: 100%;
  }

  .inventory-controls select,
  .inventory-controls input,
  .inventory-controls button {
    width: 100%;
  }

  .inventory-summary {
    padding-left: 16px;
    padding-right: 16px;
  }

  .inventory-filter-bar {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .inventory-filter-bar button {
    width: 100%;
  }

  .inventory-output {
    grid-template-columns: 1fr;
    max-height: none;
    padding: 14px;
  }

  .inventory-grid {
    grid-template-columns: 1fr;
  }

  .inventory-score {
    min-width: 138px;
  }

  .checkbox-row.multi {
    grid-template-columns: 1fr;
  }

  .checkbox-row {
    flex-direction: column;
  }

  .targeting-grid {
    grid-template-columns: 1fr;
  }

  .check-card {
    width: 100%;
  }

  .button-row,
  .result-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .report-output {
    min-height: 320px;
    max-height: 520px;
    padding: 16px;
    font-size: 0.86rem;
  }

  .build-view-header,
  .build-modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .build-view-header button,
  .build-modal-header button,
  .build-view-actions button {
    width: 100%;
  }

  .build-view-actions {
    justify-content: stretch;
  }

  .build-view-content,
  .build-modal-content {
    padding: 14px;
  }

  .dim-build-view,
  .armor-mods-grid {
    grid-template-columns: 1fr;
  }

  .build-kv {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .page {
    padding: 18px 12px;
  }

  .hero-card {
    padding: 18px;
    border-radius: 22px;
  }

  .ghost-scene {
    min-height: 360px;
  }

  .slideshow {
    width: min(280px, 100%);
  }

  .slideshow-dots {
    gap: 8px;
    margin-top: 16px;
  }

  .slideshow-dots .dot {
    width: 10px;
    height: 10px;
  }
}

/* ================================
   BUILD BUILDER — FULL INTEL LAYOUT
   ================================ */

/* The old right-side loadout summary panel has been removed from
   build_builder.html. Build Intel now owns the full lower area. */
.builder-layout {
  grid-template-rows: auto minmax(0, 1fr);
}

.builder-side-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-self: stretch;
  min-height: 0;
}

.builder-intel-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.intel-body {
  flex: 1;
  min-height: 0;
  align-content: start;
}

.builder-command small {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 100%;
}

@media (min-width: 1101px) {
  .builder-stage {
    min-height: 290px;
  }

  .builder-intel-panel {
    min-height: 0;
  }
}

@media (max-width: 1100px) {
  .builder-side-stack {
    grid-template-columns: 1fr;
  }
}


/* ================================
   BUILD COMMAND READABILITY UPDATE
   ================================ */
.builder-command {
  justify-content: flex-start;
  padding: 72px 14px 14px;
}

.builder-command strong {
  margin-bottom: 8px;
  font-size: clamp(1.05rem, 1.7vw, 1.55rem);
}

.builder-command small {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  color: var(--text-soft);
  font-size: clamp(0.72rem, 0.86vw, 0.84rem);
  line-height: 1.18;
  overflow: visible !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
}

.builder-command small span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-command small span:first-child {
  color: #ffffff;
  font-weight: 900;
}

.builder-command.weapons-command small span,
.builder-command.armor-command small span,
.builder-command.mods-command small span {
  font-size: clamp(0.68rem, 0.78vw, 0.78rem);
}

.builder-command.mods-command small {
  gap: 2px;
}

@media (min-width: 1101px) {
  .builder-stage {
    min-height: 315px;
  }
}

@media (max-width: 720px) {
  .builder-command {
    min-height: 180px;
    padding: 70px 14px 14px;
  }

  .builder-command small span {
    white-space: normal;
  }
}


/* ================================
   INDEX MENU BUTTONS — FINAL COMPACT CENTERED
   ================================ */
.hero-actions {
  width: 100%;
  max-width: 300px !important;
  margin: 0 auto;
  align-items: center;
}

.hero-actions .menu-btn {
  width: 100%;
  max-width: 300px !important;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center !important;
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 850px) {
  .hero-actions {
    max-width: 300px !important;
  }

  .hero-actions .menu-btn {
    max-width: 300px !important;
  }
}
