:root {
  --bg-dark: #070b14;
  --panel-bg: #0f172a;
  --panel-border: #1e293b;
  --panel-hover: #1e293b;
  --accent-gold: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-orange: #f97316;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 60px;
}

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.app-header {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(7, 11, 20, 0.95) 100%);
  border-bottom: 1px solid var(--panel-border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
  font-size: 22px;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #f8fafc, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}
.btn-secondary:hover {
  background: #334155;
  color: #fff;
}

.btn-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #000;
}
.btn-cyan:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

/* Presets Bar */
.presets-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.presets-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.presets-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-pill {
  padding: 6px 12px;
  border-radius: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-pill:hover {
  background: #334155;
  border-color: var(--accent-gold);
  color: #fff;
}

/* Main Grid Layout */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
}

@media (max-width: 1024px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }
}

/* Slots Section */
.slots-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .slots-container {
    grid-template-columns: 1fr;
  }
}

.slot-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
}
.slot-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slot-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slot-item-body {
  display: flex;
  gap: 14px;
  align-items: center;
}

.item-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #1e293b;
  border: 2px solid #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
}

.item-icon-box.grade-MYTHIC { border-color: #f97316; box-shadow: 0 0 10px rgba(249, 115, 22, 0.4); }
.item-icon-box.grade-LEGENDARY { border-color: #eab308; box-shadow: 0 0 10px rgba(234, 179, 8, 0.4); }
.item-icon-box.grade-EPIC { border-color: #a855f7; box-shadow: 0 0 10px rgba(168, 85, 247, 0.4); }
.item-icon-box.grade-RARE { border-color: #3b82f6; box-shadow: 0 0 10px rgba(59, 130, 246, 0.4); }
.item-icon-box.grade-UNCOMMON { border-color: #22c55e; }
.item-icon-box.grade-COMMON { border-color: #94a3b8; }

.astralite-star-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f59e0b;
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-set-source {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.item-stats-preview {
  font-size: 0.75rem;
  color: #38bdf8;
  margin-top: 4px;
  line-height: 1.3;
}

.slot-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.select-sm {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.select-sm:focus {
  border-color: var(--accent-gold);
}

/* Sockets Row */
.sockets-row {
  display: flex;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.socket-pill {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 5px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.socket-pill:hover {
  background: #334155;
  color: #fff;
  border-color: var(--accent-cyan);
}
.socket-pill.has-jewel {
  border-color: #f59e0b;
  color: #fef08a;
}
.socket-pill.has-sigil {
  border-color: #a855f7;
  color: #f3e8ff;
}

/* Stats Sidebar */
.stats-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 90px;
}

.stats-header {
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 12px;
}

.stats-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-notice {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

.specialty-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.specialty-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.specialty-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.stat-category-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
}

.stat-name {
  color: #cbd5e1;
}

.stat-val {
  font-weight: 700;
  color: #38bdf8;
}

.stat-val.inf { color: #f87171; }
.stat-val.rng { color: #38bdf8; }
.stat-val.cav { color: #fbbf24; }
.stat-val.army { color: #34d399; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }

.modal-filter-bar {
  padding: 12px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-search-input {
  flex: 1;
  min-width: 200px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}
.modal-search-input:focus { border-color: var(--accent-gold); }

.modal-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.tab-btn.active, .tab-btn:hover {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.item-picker-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-picker-card:hover {
  border-color: var(--accent-gold);
  background: #273549;
  transform: translateY(-2px);
}

.item-picker-header {
  display: flex;
  gap: 10px;
  align-items: center;
}

.item-picker-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #0f172a;
  border: 2px solid #f97316;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.item-picker-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.item-picker-stats {
  font-size: 0.75rem;
  color: #38bdf8;
  line-height: 1.3;
}

/* Visual refresh: presentation-only overrides. */
:root {
  --bg-dark: #080b13;
  --panel-bg: #111827;
  --panel-border: #263247;
  --accent-gold: #f7bd4f;
  --accent-cyan: #68d7e9;
  --radius: 14px;
}

* { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body {
  background: radial-gradient(circle at 15% -10%, rgba(52, 90, 125, .27), transparent 32rem),
              radial-gradient(circle at 87% 8%, rgba(155, 107, 36, .16), transparent 24rem), var(--bg-dark);
}
.container { max-width: 1440px; padding: 28px 24px 56px; }
.app-header { padding: 14px max(20px, calc((100vw - 1392px) / 2)); border-bottom-color: rgba(247,189,79,.25); }
.brand-icon { border: 1px solid rgba(255,255,255,.22); background: linear-gradient(135deg, #d99b2a, #76501b); }
.brand-title { font-family: Cinzel, serif; letter-spacing: 1px; font-size: 1.12rem; }
.brand-subtitle { color: #aebcd0; letter-spacing: 1.3px; }
.planner-intro { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin: 0 0 22px; padding: 24px; border: 1px solid rgba(104,215,233,.18); border-radius: var(--radius); background: linear-gradient(120deg, rgba(18,32,49,.9), rgba(17,24,39,.78)); }
.eyebrow { color: var(--accent-gold); font-size: .7rem; font-weight: 800; letter-spacing: .14em; }
.planner-intro h2 { font-family: Cinzel, serif; font-size: clamp(1.15rem, 2vw, 1.65rem); margin: 5px 0 7px; }
.planner-intro p { color: var(--text-muted); font-size: .88rem; line-height: 1.5; max-width: 680px; }
.scope-note { max-width: 300px; color: #c3d0df; display: grid; gap: 4px; font-size: .75rem; line-height: 1.45; padding-left: 16px; border-left: 2px solid var(--accent-gold); }
.scope-note strong { color: var(--accent-gold); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.presets-card { background: rgba(15,23,42,.88); border-color: rgba(104,215,233,.18); box-shadow: 0 12px 28px rgba(0,0,0,.16); }
.preset-pill { border-radius: 999px; }
.layout-grid { grid-template-columns: minmax(0, 1fr) 370px; gap: 20px; }
.slots-container { gap: 14px; }
.slot-card { min-height: 205px; padding: 15px; border-color: rgba(148,163,184,.18); background: linear-gradient(145deg, rgba(20,29,45,.98), rgba(12,18,30,.98)); }
.slot-card:hover { transform: translateY(-2px); border-color: rgba(104,215,233,.7); }
.slot-badge { color: #b9eaf3; background: rgba(104,215,233,.1); border: 1px solid rgba(104,215,233,.16); border-radius: 999px; padding: 4px 9px; }
.item-icon-box { width: 72px; height: 72px; overflow: hidden; background: #0a0f1a; border-width: 2px; }
.gear-icon { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.image-unavailable { display: inline-block; color: #a9b8cc; font-size: .54rem; font-weight: 800; line-height: 1.25; letter-spacing: .06em; text-align: center; }
.item-info { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.item-title { white-space: normal; font-size: .98rem; }
.item-set-source { margin-top: 3px; }
.slot-controls { padding-top: 2px; }
.select-sm { flex: 1 1 140px; min-height: 34px; background: #101928; }
.sockets-row { padding-top: 10px; }
.socket-pill { border-radius: 999px; min-height: 29px; }
.stats-panel { background: linear-gradient(165deg, rgba(20,29,45,.98), rgba(10,15,26,.98)); border-color: rgba(247,189,79,.22); box-shadow: 0 18px 38px rgba(0,0,0,.22); }
.stats-title { color: var(--accent-gold); font-family: Cinzel, serif; }
.specialty-card { background: linear-gradient(135deg, rgba(247,189,79,.14), rgba(104,215,233,.1)); }
.stat-row { padding: 8px 0; }
.modal-content { border-color: rgba(104,215,233,.3); background: #101827; }
.modal-body { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); }
.item-picker-card { background: #172235; border-color: rgba(148,163,184,.22); }
.item-picker-card:hover { background: #202f47; }
.item-picker-icon { overflow: hidden; background: #0a0f1a; }
.picker-gear-icon { display: block; width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 760px) {
  .layout-grid { grid-template-columns: 1fr; }
  .app-header { padding: 12px 16px; align-items: flex-start; gap: 10px; }
  .header-actions { margin-left: auto; }
  .header-actions .btn { padding: 7px 9px; font-size: .72rem; }
  .brand-icon { width: 38px; height: 38px; font-size: 18px; }
  .brand-title { font-size: .84rem; }
  .brand-subtitle { font-size: .58rem; letter-spacing: .8px; }
  .container { padding: 18px 14px 40px; }
  .planner-intro { align-items: start; flex-direction: column; padding: 18px; margin-bottom: 16px; }
  .scope-note { max-width: none; padding-left: 12px; }
  .presets-card { padding: 13px; margin-bottom: 16px; }
  .presets-list { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .preset-pill { min-height: 39px; padding: 6px 8px; font-size: .7rem; }
  .slots-container { grid-template-columns: 1fr; }
  .slot-card { min-height: 0; }
  .stats-panel { position: static; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal-content { max-height: 92vh; }
  .modal-header, .modal-filter-bar, .modal-body { padding-left: 14px; padding-right: 14px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-search-input { min-width: 100%; }
}
