﻿@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Deep Forge Dashboard – design tokens ── */
  --bg:        #0b1326;
  --surface:   #131b2e;
  --surface2:  #171f33;
  --card:      #222a3d;
  --card2:     #2d3449;
  --border:    #3e4850;
  --border2:   #88929b;

  --accent:    #89ceff;   /* primary  – cyan      */
  --accent2:   #4fdbc8;   /* secondary – teal     */
  --tertiary:  #ffb86e;   /* amber – kamas/prices */
  --on-accent: #001e2f;   /* text on accent bg    */

  --text:      #dae2fd;
  --muted:     #bec8d2;
  --muted2:    #88929b;

  --success:   #4fdbc8;
  --danger:    #ffb4ab;
  --radius: 6px;
}

/* ── Typography ─────────────────────────────────── */
.section-label, header h1, .queue-item-name,
.mat-name, .monster-name, .detail-header h2 {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
}

.price-val, .qty-val, .qt-val,
.mat-needed, .owned-input, .mat-price-input, .buy-price-input {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Icons (Lucide) ───────────────────────────── */
.icon-sm { width: 14px; height: 14px; vertical-align: middle; flex-shrink: 0; display: inline-block; }
.icon-md { width: 18px; height: 18px; vertical-align: middle; flex-shrink: 0; display: inline-block; }
.app-logo    { width: 24px; height: 24px; vertical-align: middle; flex-shrink: 0; object-fit: contain; }
.app-logo-lg { width: 56px; height: 56px; }
.icon-lg { width: 22px; height: 22px; vertical-align: middle; flex-shrink: 0; display: inline-block; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

/* ── Header ─────────────────────────────────────── */
header {
  background: linear-gradient(135deg, #060e20 0%, #0b1326 60%, #0e1730 100%);
  border-bottom: 2px solid var(--accent);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

header h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 800;
  color: #ffffff;
}

.header-selectors { display: flex; gap: 8px; }

.header-selectors select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.header-selectors select:focus { border-color: var(--accent); }

/* ── Layout ──────────────────────────────────────────────────────── */
main.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

.panel { padding: 20px; }

.panel-left {
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 62px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 62px;
  max-height: calc(100vh - 62px);
  overflow-y: auto;
}

.panel-right { padding: 20px 28px; }

/* ── Common components ───────────────────────────── */
.section-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.queue-totals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 7px 10px;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 0.75rem;
}
.queue-totals.hidden { display: none; }
.qt-block { display: flex; flex-direction: column; gap: 1px; }
.qt-lbl { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.qt-val { font-weight: 700; color: var(--text); }
.qt-val.qt-accent { color: var(--tertiary); }
.qt-sep { color: var(--border); font-weight: 300; padding: 0 2px; align-self: center; }

.badge {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.badge.hidden { display: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover { border-color: var(--danger); color: var(--danger); }
.btn-small { font-size: 0.75rem; padding: 3px 8px; margin-left: auto; }

/* ── View-mode toggle group ─────────────────────── */
.toggle-group {
  display: flex;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-left: auto;
}
.toggle-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--border); }
.toggle-btn:hover:not(.active) { background: rgba(137,206,255,.08); color: var(--text); }
.toggle-btn.active { background: var(--accent); color: #0b1326; font-weight: 600; }

.empty-hint {
  color: var(--muted);
  font-size: 0.83rem;
  padding: 16px 0;
  text-align: center;
  list-style: none;
}

.no-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--border);
  border-radius: 6px;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Search section ──────────────────────────────── */
.search-section { display: flex; flex-direction: column; gap: 8px; }
.search-row { display: flex; gap: 6px; }

.search-row select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 120px;
  transition: border-color 0.2s;
}

.search-row select:focus { border-color: var(--accent); }
.search-input-wrap { position: relative; flex: 1; }

.search-input-wrap input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrap input:focus { border-color: var(--accent); }
.search-hint { font-size: 0.77rem; color: var(--muted); min-height: 1.1em; }

/* ── Search dropdown ─────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
  list-style: none;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.search-dropdown li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.search-dropdown li:hover { background: var(--card); }
.search-dropdown li .no-icon { width: 28px; height: 28px; }
.search-dropdown img { image-rendering: pixelated; border-radius: 4px; flex-shrink: 0; }
.res-name { flex: 1; font-size: 0.86rem; font-weight: 500; }
.res-meta { font-size: 0.75rem; color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ── Queue list ──────────────────────────────────── */
.queue-section { flex: 1; }
.queue-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.queue-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.vis-checkbox {
  width: 16px;
  height: 16px;
  margin-top: 16px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.queue-item {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s, opacity 0.15s;
  min-width: 0;
}

.queue-item:hover { border-color: var(--accent); }
.queue-item > img { image-rendering: pixelated; border-radius: 6px; flex-shrink: 0; margin-top: 2px; }
.queue-item .no-icon { width: 36px; height: 36px; font-size: 1.2rem; }

.queue-row-hidden .queue-item { opacity: 0.45; }
.queue-row-hidden .queue-item-name { text-decoration: line-through; }

.queue-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.queue-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta { font-size: 0.73rem; color: var(--muted); }

.qty-control { align-self: flex-start; margin-top: 3px; }
.remove-btn  { align-self: flex-start; margin-top: 3px; }

/* ── Queue item price bar ────────────────────────── */
.price-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.price-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.price-block:last-child { align-items: flex-end; }
.price-lbl {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.price-lbl-diff {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.price-lbl-diff.up   { color: var(--danger); }
.price-lbl-diff.down { color: var(--success); }
.price-lbl-diff.eq   { color: var(--muted); }
.price-sub {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.price-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.price-val.val-good { color: var(--success); }
.price-val.val-bad  { color: var(--danger); }

.price-arrow {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
  line-height: 1.4;
}
.price-arrow.arrow-up    { color: var(--danger);  background: rgba(255,180,171,0.12); }
.price-arrow.arrow-down  { color: var(--success); background: rgba(79,219,200,0.12); }
.price-arrow.arrow-equal { color: var(--muted2); }

/* price inputs */
.mat-price-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}
.mat-price-input {
  width: 80px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.7rem;
  padding: 2px 5px;
  text-align: right;
}
.mat-price-input:focus { outline: none; border-color: var(--accent); }

.buy-price-input {
  width: 80px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 6px;
  text-align: right;
}
.buy-price-input:focus { outline: none; border-color: var(--accent); }

/* Quantity control */
.qty-control { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.qty-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  width: 22px;
  height: 22px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.qty-btn:hover { background: var(--card); border-color: var(--accent); color: var(--accent); }
.qty-val { font-size: 0.82rem; font-weight: 700; min-width: 20px; text-align: center; color: var(--accent); }

.remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.remove-btn:hover { color: var(--danger); background: rgba(255,180,171,0.1); }

.float-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.float-btn:hover { color: var(--accent); background: rgba(137,206,255,0.1); }

/* ── Materials header stats ──────────────────────── */
.materials-stats { font-size: 0.78rem; color: var(--muted); margin-left: 4px; }
.materials-stats strong { color: var(--success); }

/* ── Materials list ──────────────────────────────── */
.materials-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.mat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color 0.2s;
}

.mat-item img { image-rendering: pixelated; border-radius: 6px; flex-shrink: 0; }
.mat-item .no-icon { width: 40px; height: 40px; font-size: 1.4rem; }

.mat-item.mat-done { border-color: var(--success); opacity: 0.6; }

.mat-info { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.mat-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.mat-progress-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 3px;
  transition: width 0.3s;
}

.mat-item.mat-done .mat-progress-fill { background: var(--success); }

.mat-count { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.owned-input {
  width: 60px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  outline: none;
  transition: border-color 0.2s;
}

.owned-input:focus { border-color: var(--accent); }
.mat-sep { color: var(--border); font-size: 0.9rem; }

.mat-needed {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
}

.mat-item.mat-done .mat-needed { color: var(--success); }

/* ── Spinner ─────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────── */

.top-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.selectors {
  display: flex;
  gap: 8px;
}

.selectors select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.selectors select:focus { border-color: var(--accent); }

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-btn {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: capitalize;
}

.cat-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cat-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.search-bar input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 14px;
  font-size: 0.9rem;
  width: 220px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus { border-color: var(--accent); }

/* ── Status ──────────────────────────────────────── */
.status {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 1rem;
}

.status.error { color: #f85149; }

/* ── Grid ────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px 32px;
}

/* ── Card ────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 6px 24px rgba(137,206,255,0.12);
}

.card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}

.card-placeholder {
  width: 64px;
  height: 64px;
  background: var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.card-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.card-level {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

.card-type {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ── Modal ───────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

.modal-close:hover { color: var(--text); border-color: var(--accent); }

/* ── Modal content ───────────────────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-header img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
}

.detail-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.detail-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.detail-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
  font-style: italic;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* ── Drop info ───────────────────────────────────── */
.mat-drops {
  margin-top: 4px;
  font-size: 0.72rem;
}

.mat-drops summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  list-style: none;
  padding: 2px 0;
  transition: color 0.15s;
}
.mat-drops summary:hover { color: var(--text); }
.mat-drops summary::-webkit-details-marker { display: none; }
.mat-drops summary::before { content: '▸ '; font-size: 0.65rem; }
details.mat-drops[open] summary::before { content: '▾ '; }

.mat-drop-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 0 2px 10px;
}

.drop-monster {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 0.73rem;
}
.drop-monster img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  image-rendering: pixelated;
  border-radius: 3px;
}

.drop-subarea {
  color: var(--muted);
  font-size: 0.68rem;
  padding-left: 2px;
}

.mat-drop-loading {
  height: 6px;
  width: 60px;
  background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
  background-size: 200% 100%;
  border-radius: 3px;
  animation: shimmer 1.2s infinite;
  margin-top: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Monster-grouped view ────────────────────────── */
.materials-list.monster-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  align-items: start;
}

.monster-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--muted);
  font-size: 0.88rem;
}

.monster-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.monster-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.monster-group-header img {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  border-radius: 6px;
  flex-shrink: 0;
}

.monster-group-icon {
  font-size: 1.8rem;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.monster-group-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.monster-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.monster-zones {
  font-size: 0.72rem;
  color: var(--muted);
}

.monster-mat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.monster-mat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}
.monster-mat-item:hover { background: rgba(255,255,255,0.025); }

.monster-mat-item img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  border-radius: 4px;
  flex-shrink: 0;
}

.monster-mat-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.monster-mat-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monster-mat-item.mat-done { opacity: 0.55; }
.monster-mat-item.mat-done .mat-progress-fill { background: var(--success); }
.monster-mat-item.mat-done .mat-needed { color: var(--success); }
.monster-group-other .monster-group-header { border-color: var(--border); }
.monster-group-other { opacity: 0.8; }

.stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stat-tag {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 0.78rem;
  color: var(--text);
}

.condition-list {
  list-style: none;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.condition-list li::before { content: '• '; color: var(--accent); }

/* ── Recipe list ─────────────────────────────────────────────────────────────── */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recipe-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}

.recipe-name {
  flex: 1;
  font-size: 0.84rem;
  color: var(--text);
}

.recipe-qty {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Load more ───────────────────────────────────────────────────────────────── */
.load-more-btn {
  display: block;
  margin: 0 auto 32px;
  padding: 10px 36px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 24px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.load-more-btn:hover {
  background: var(--accent);
  color: var(--on-accent);
}

/* ── Spinner ─────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 720px) {
  main.layout { grid-template-columns: 1fr; }
  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
    position: static;
    max-height: none;
  }
  .materials-list { grid-template-columns: 1fr; }
}

/* ── Floating craft windows ───────────────────────── */
#float-windows {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.float-win {
  position: absolute;
  pointer-events: all;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  min-width: 240px;
  max-width: 320px;
  font-size: 0.82rem;
  user-select: none;
}
.fw-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: 10px 10px 0 0;
  cursor: grab;
  border-bottom: 1px solid var(--border);
}
.fw-header:active { cursor: grabbing; }
.fw-title {
  flex: 1;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
}
.fw-qty {
  color: var(--muted);
  font-size: 0.75rem;
}
.fw-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color 0.15s;
  pointer-events: all;
}
.fw-close:hover { color: var(--danger); }
.fw-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fw-mat {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface2);
  transition: opacity 0.2s;
}
.fw-mat-done {
  opacity: 0.45;
}
.fw-mat-done .fw-mat-name {
  text-decoration: line-through;
  color: var(--muted);
}
.fw-mat-icon { flex-shrink: 0; line-height: 1; }
.fw-mat-name { flex: 1; color: var(--text); }
.fw-mat-count {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.fw-owned { font-weight: 700; color: var(--accent); min-width: 16px; text-align: right; }
.fw-sep   { color: var(--muted); }
.fw-needed { color: var(--muted); min-width: 16px; }
.fw-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}
.fw-btn:hover { background: var(--accent); color: var(--on-accent); }

/* ── Footer ─────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 24px;
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
  font-size: .72rem;
  color: var(--muted);
}
.footer-sep {
  color: var(--border);
  user-select: none;
}
.footer-credit a,
.footer-disclaimer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-credit a:hover,
.footer-disclaimer a:hover {
  color: var(--accent);
}

/* ── Toast notification ─────────────────────── */
#app-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.82rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  white-space: nowrap;
}
#app-toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#app-toast.toast-confirm {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast-msg { flex: 1; }
.toast-confirm-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  pointer-events: all;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.toast-confirm-btn.toast-yes { border-color: var(--danger); color: var(--danger); }
.toast-confirm-btn.toast-yes:hover { background: var(--danger); color: #1a0a09; }
.toast-confirm-btn.toast-no:hover { border-color: var(--accent); color: var(--accent); }

/* ── Auth gate ───────────────────────────────────── */
#auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 40px 36px;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  box-shadow: 0 32px 80px rgba(0,0,0,.7);
}

/* Brand block */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 24px;
}

.app-logo-lg { width: 56px; height: 56px; object-fit: contain; }

.auth-brand-name {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1;
}

.auth-brand-sub {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Divider */
.auth-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 24px;
}

/* State sections */
.auth-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.auth-state[hidden] { display: none; }

.auth-state-label {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

/* Subtitle */
.auth-subtitle {
  font-size: .9rem;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

/* Google button */
.auth-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #3c4043;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.auth-google-btn:hover  { box-shadow: 0 4px 16px rgba(0,0,0,.35); transform: translateY(-1px); }
.auth-google-btn:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.auth-google-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Ghost button (retry) */
.auth-ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 20px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  width: 100%;
}

.auth-ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Beta badge */
.auth-beta-badge {
  display: inline-block;
  background: rgba(255,184,110,.12);
  color: var(--tertiary);
  border: 1px solid rgba(255,184,110,.3);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 20px;
}

/* Denied message */
.auth-denied-msg {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.65;
  text-align: center;
  margin: 0;
}

/* Spinner */
.auth-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Auth user label in header */
.auth-user-label {
  font-size: .75rem;
  color: var(--muted);
  align-self: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
