*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #070d1a;
  --bg-panel:  #0b1323;
  --bg-card:   #0f1c30;
  --border:    #1e2e48;
  --text:      #d8e4f0;
  --muted:     #7a96b4;
  --faint:     #3a5070;
  --accent:    #1e6fc5;
  --accent-h:  #2882e0;
  --rsm: 4px; --rmd: 8px;
}
html,body { height:100%; background:var(--bg); color:var(--text); font-family:'Segoe UI',system-ui,sans-serif; font-size:14px; -webkit-font-smoothing:antialiased;}

/* HEADER */
.site-header { display:flex; align-items:center; justify-content:space-between; padding:0 114px 0 0; background:#060c18; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:100; gap:16px; }
.site-header h1 { font-size:20px; font-weight:700; color:#e8f0ff; text-align:center; }
.header-sub { font-size:16px; color:var(--muted); margin-top:2px; }
.btn-new-list { background:var(--accent); color:#fff; border:none; border-radius:var(--rmd); padding:9px 18px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; transition:background 150ms; }
.btn-new-list:hover { background:var(--accent-h); }

/* LAYOUT */
.layout { display:flex; height:calc(100vh - 57px); overflow:hidden; }

/* LISTS PANEL */
.lists-panel { width:320px; min-width:200px; max-width:700px; background:var(--bg-panel); border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; flex-shrink:0; }
.lists-header { padding:14px 16px 10px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; font-size:13px; font-weight:600; color:#c8d8f0; background:#0b1528; flex-shrink:0; }
.active-list-label { font-size:14px; font-weight:400; color:var(--muted); }
#listsContainer { overflow-y:auto; flex:1; padding:10px; }
.no-lists { color:var(--muted); font-size:12px; text-align:center; padding:24px 16px; line-height:1.8; }

/* LIST BLOCK */
.list-block { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--rmd); margin-bottom:10px; overflow:hidden; transition:border-color 150ms; }
.list-block.list-active { border-color:var(--accent); }
.list-titlebar { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; background:#0d1a2e; border-bottom:1px solid var(--border); }
.list-title-left { display:flex; align-items:center; gap:6px; min-width:0; }
.list-title-right { display:flex; gap:4px; flex-shrink:0; }
.btn-toggle-list { background:none; border:none; color:var(--muted); cursor:pointer; font-size:14px; padding:2px 4px; transition:color 150ms; }
.btn-toggle-list:hover { color:var(--text); }
.list-name-display { font-size:13px; font-weight:600; color:#e0ecff; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px; }
.list-name-display:hover { color:#fff; }
.btn-edit-name { background:none; border:none; cursor:pointer; font-size:13px; opacity:0.5; transition:opacity 150ms; padding:2px; color:#fff;}
.btn-edit-name:hover { opacity:1; }
.list-name-input { background:#112040; border:1px solid var(--accent); border-radius:var(--rsm); color:#fff; font-size:13px; font-weight:600; padding:2px 8px; outline:none; width:140px; }
.btn-close-list,.btn-delete-list { background:none; border:1px solid var(--border); border-radius:var(--rsm); color:var(--muted); font-size:11px; padding:3px 8px; cursor:pointer; transition:all 150ms; }
.btn-close-list:hover { border-color:var(--muted); color:var(--text); }
.btn-delete-list:hover { border-color:#e05050; color:#e05050; }
.list-items { padding:6px 8px; }
.list-empty { color:var(--faint); font-size:12px; text-align:center; padding:12px 8px; }
.list-item-row { display:flex; align-items:center; gap:8px; padding:5px 4px; border-bottom:1px solid var(--border); }
.list-item-row:last-child { border-bottom:none; }
.list-item-img { width:64px; height:64px; object-fit:contain; border:1px solid; border-radius:var(--rsm); background:#0a1525; padding:2px; flex-shrink:0; }
.list-item-name { flex:1; font-size:12px; color:var(--text); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.qty-controls { display:flex; align-items:center; gap:4px; flex-shrink:0; }
.qty-btn { background:#142238; border:1px solid var(--border); border-radius:var(--rsm); color:var(--text); width:22px; height:22px; font-size:15px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background 150ms; }
.qty-btn:hover { background:var(--accent); border-color:var(--accent); }
.qty-value { min-width:24px; text-align:center; font-size:13px; font-weight:600; color:#e0ecff; }
.btn-remove-item { background:none; border:none; color:var(--faint); cursor:pointer; font-size:12px; padding:2px 4px; transition:color 150ms; flex-shrink:0; }
.btn-remove-item:hover { color:#e05050; }

/* RESIZE */
.resize-handle { width:10px; background:var(--border); cursor:ew-resize; flex-shrink:0; transition:background 150ms; }
.resize-handle:hover,.resize-handle:active { background:var(--accent); }

/* CATALOG */
.catalog-panel {
  flex:1; overflow-y:auto; padding:20px 24px; min-width:0;
  position:relative;
  background-image:
    linear-gradient(to bottom, transparent 0%, var(--bg) 60%),
    url('images/bg_1.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: local;
}
.catalog-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; gap:16px; }
.catalog-header h2 { font-size:18px; font-weight:700; color:#e8f0ff; white-space:nowrap; }
.search-input { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--rmd); color:var(--text); font-size:13px; padding:8px 14px; outline:none; width:280px; transition:border-color 150ms; }
.search-input::placeholder { color:var(--faint); }
.search-input:focus { border-color:var(--accent); }

/* RARITY SECTION */
.rarity-section { margin-bottom:32px; }
.rarity-header { display:flex; align-items:center; gap:12px; margin-bottom:14px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.rarity-title { font-size:18px; font-weight:700; color:#e8f0ff; }
.rarity-count { font-size:12px; font-weight:500; }

/* ITEM GRID */
.item-grid { display:flex; flex-wrap:wrap; gap:10px; }
.item-card { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; width:calc(var(--card-size,80px) + 10px); }
.item-img-wrap {
  width:var(--card-size,80px); height:var(--card-size,80px); background:var(--bg-card);
  border:1px solid var(--rc, #333); border-radius:var(--rmd);
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden; transition:all 180ms ease;
  box-shadow:0 0 8px -2px var(--rc, transparent);
}
.item-img-wrap img { width:var(--img-size,64px); height:var(--img-size,64px); object-fit:contain; display:block; transition:transform 180ms ease; }
.item-add-hint {
  position:absolute; inset:0; background:rgba(10,20,50,0.75);
  color:#fff; font-size:32px; display:flex; align-items:center; justify-content:center;
  opacity:0; transition:opacity 160ms ease; border-radius:var(--rmd);
}
.item-card:hover .item-img-wrap { border-color:#fff; box-shadow:0 0 16px 2px var(--rc,#1e6fc5); transform:translateY(-2px); }
.item-card:hover .item-img-wrap img { transform:scale(1.08); }
.item-card:hover .item-add-hint { opacity:1; }
.item-card:active .item-img-wrap { transform:scale(0.97); }
.item-name { font-size:11px; color:#fff; text-align:center; line-height:1.3; max-width:88px; word-break:break-word; }

/* TOAST */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(16px); background:#1a2d4a; border:1px solid var(--accent); border-radius:var(--rmd); color:#e0f0ff; font-size:13px; padding:10px 20px; opacity:0; pointer-events:none; transition:opacity 200ms,transform 200ms; z-index:999; white-space:nowrap; box-shadow:0 4px 20px rgba(0,0,0,.5); }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* SCROLLBAR */
::-webkit-scrollbar { width:6px; } ::-webkit-scrollbar-track { background:transparent; } ::-webkit-scrollbar-thumb { background:#1e3050; border-radius:3px; } ::-webkit-scrollbar-thumb:hover { background:#2a4570; }

/* catalog controls row */
.catalog-controls { display:flex; align-items:center; gap:10px; }
.size-select {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--rmd);
  color:var(--text);
  font-size:13px;
  padding:8px 10px;
  outline:none;
  cursor:pointer;
  transition:border-color 150ms;
}
.size-select:focus { border-color:var(--accent); }
.size-select option { background:#0f1c30; }

/* clicking anywhere on list block selects it */
.list-block { cursor:pointer; }
.list-items { cursor:default; }
.qty-btn, .btn-remove-item, .btn-toggle-list, .btn-edit-name, .btn-close-list, .btn-delete-list { cursor:pointer; }

/* icon size label */
.size-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* lists-header needs to wrap for the button */
.lists-header {
  flex-wrap: wrap;
  gap: 6px;
}

/* Logo */
.header-logo { flex-shrink:0; display:flex; align-items:stretch; padding:0; }
.site-logo { height:100px; width:auto; display:block; padding:0; }
.header-inner { flex:1; text-align:center; }
.header-sub { text-align:center; }
.header-spacer { flex-shrink:0; width:48px; /* balances logo side so title stays centered */ }

/* DB Tabs */
.db-tabs {
  display:flex;
  gap:0;
  padding:0 24px;
  background:#060c18;
  border-bottom:1px solid var(--border);
  justify-content:center;
}
.db-tab {
  background:none;
  border:none;
  border-bottom:2px solid transparent;
  color:var(--muted);
  font-size:15px;
  font-weight:600;
  padding:12px 20px;
  cursor:pointer;
  transition:color 150ms, border-color 150ms;
  margin-bottom:-1px;
}
.db-tab:hover { color:#c8d8f0; }
.db-tab.db-tab-active { color:#fff; border-bottom-color:#fff; }

/* ── FOOTER ── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #060c18;
  border-top: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

.footer-left {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.footer-right {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  line-height: 1.7;
}

.footer-center {
  flex-shrink: 0;
}

.bmac-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #202e45;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: #e0ecff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  text-decoration: none;
  transition: background 150ms, border-color 150ms;
  white-space: nowrap;
}

.bmac-btn:hover {
  background: #2a3e5e;
  border-color: var(--accent);
}

.bmac-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
