@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

.fj-root {
  --void: #0a0908;
  --panel: #171313;
  --panel-2: #1e1919;
  --line: #322a29;
  --red: #c81e1e;
  --red-bright: #ff3b30;
  --red-dim: #5c1414;
  --text: #ece6e2;
  --text-muted: #9a8f8b;
  --text-faint: #665c59;
  font-family: 'Inter', sans-serif;
  background: var(--void);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--red-dim); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--panel-2); border: 2px solid var(--void); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

button {
  font: inherit;
}
button:focus-visible,
.fj-plate:focus-visible,
.fj-row:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 2px;
}

.fj-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

.fj-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(ellipse at center, rgba(200,30,30,0.16) 0%, rgba(200,30,30,0) 70%);
  pointer-events: none;
  z-index: 0;
}

.fj-content {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 120px;
}

/* HEADER */
.fj-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -28px -20px 32px;
  padding: 22px 20px 18px;
  background: rgba(10, 9, 8, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}
.fj-brand { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: opacity 0.15s ease; }
.fj-brand:hover { opacity: 0.85; }
.fj-brand-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, var(--panel-2), var(--panel));
  border: 1px solid var(--red-dim);
  color: var(--red-bright);
  box-shadow: 0 2px 10px rgba(200, 30, 30, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.fj-brand-text h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}
.fj-brand-text span {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.fj-os-btn {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.fj-os-btn:hover { border-color: var(--red-dim); }
.fj-os-btn:active { transform: translateY(1px); }
.fj-os-badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* BREADCRUMB / BACK */
.fj-back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-muted);
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500;
  cursor: pointer; margin-bottom: 22px; padding: 6px 0;
  transition: color 0.15s ease;
}
.fj-back:hover { color: var(--red-bright); }

.fj-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--red-bright);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.fj-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 26px 0;
}

/* GRID */
.fj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.fj-plate {
  position: relative;
  background: linear-gradient(160deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--line);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  padding: 22px 18px 18px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  text-align: left;
}
.fj-plate:hover {
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(200, 30, 30, 0.15);
}
.fj-plate:active { transform: translateY(-1px); }
.fj-plate::before {
  content: '';
  position: absolute;
  top: 8px; left: 8px;
  width: 4px; height: 4px;
  background: var(--text-faint);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
.fj-plate-icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  color: var(--red-bright);
  background: linear-gradient(155deg, rgba(200, 30, 30, 0.14), rgba(200, 30, 30, 0.03));
  border: 1px solid var(--red-dim);
  margin-bottom: 16px;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.fj-plate-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 4px 0;
}
.fj-plate-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}

/* ITEM LIST ROW */
.fj-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red-dim);
  padding: 16px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: border-left-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.fj-row:hover {
  border-left-color: var(--red-bright);
  background: var(--panel-2);
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.fj-row-left { display: flex; flex-direction: column; gap: 4px; }
.fj-row-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.fj-tier {
  display: inline-block;
  width: fit-content;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--red-dim);
  border-radius: 2px;
  background: rgba(200, 30, 30, 0.1);
  color: var(--red-bright);
}

/* SPEC SHEET (item detail) */
.fj-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
}
.fj-sheet-head {
  padding: 24px 24px 20px;
  border-bottom: 1px dashed var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.fj-sheet-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 24px;
  text-transform: uppercase;
  margin: 6px 0 0 0;
}
.fj-sheet-body { padding: 20px 24px 24px; }
.fj-sheet-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.fj-mat-list { list-style: none; margin: 0 0 24px 0; padding: 0; }
.fj-mat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}
.fj-mat-row:last-child { border-bottom: none; }
.fj-mat-qty {
  color: var(--red-bright);
  font-weight: 600;
}
.fj-mat-row--ref {
  cursor: pointer;
  transition: background 0.15s ease;
}
.fj-mat-row--ref:hover { background: rgba(255, 255, 255, 0.03); }
.fj-mat-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid var(--red-dim);
  color: var(--red-bright);
  background: rgba(200, 30, 30, 0.08);
  border-radius: 2px;
  vertical-align: middle;
}
.fj-subassembly-note {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-faint);
  margin: -10px 0 24px 0;
}

.fj-mat-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.fj-mat-name { cursor: pointer; }
.fj-mat-name:hover { color: var(--red-bright); }

.fj-mat-row--owned .fj-mat-name {
  color: var(--text-faint);
  text-decoration: line-through;
}
.fj-owned-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid #2b6a3d;
  color: #5fbf7d;
  background: rgba(43, 106, 61, 0.12);
  border-radius: 2px;
  vertical-align: middle;
}
.fj-missing-tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 6px;
  border: 1px solid var(--red-dim);
  color: var(--red-bright);
  background: rgba(200, 30, 30, 0.08);
  border-radius: 2px;
  vertical-align: middle;
}

.fj-mat-row--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  cursor: default;
}
.fj-mat-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.fj-mat-row-owned {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fj-owned-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fj-qty-control--small { padding: 3px 8px; gap: 8px; }

.fj-qty-control {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line);
  padding: 6px 10px;
}
.fj-qty-control button {
  background: none; border: none; color: var(--text);
  cursor: pointer; display: flex; align-items: center; padding: 4px;
}
.fj-qty-control button:hover { color: var(--red-bright); }
.fj-qty-control button:active { transform: scale(0.9); }
.fj-qty-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.fj-actions { display: flex; align-items: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.fj-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 12px 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(200, 30, 30, 0.25);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.fj-btn:hover { background: var(--red-bright); box-shadow: 0 4px 18px rgba(255, 59, 48, 0.35); }
.fj-btn:active { transform: translateY(1px); }
.fj-btn.added { background: #2b6a3d; box-shadow: 0 2px 10px rgba(43, 106, 61, 0.3); }
.fj-btn.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-muted);
  box-shadow: none;
}
.fj-btn.ghost:hover { border-color: var(--red-dim); color: var(--text); box-shadow: none; }

/* OS PANEL */
.fj-os-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.fj-os-empty svg { color: var(--text-faint); }
.fj-empty-icon-wrap {
  width: 76px; height: 76px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  margin: 0 auto 16px;
}

.fj-os-item {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.fj-os-item-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
}
.fj-os-item-cat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}
.fj-os-item-right { display: flex; align-items: center; gap: 14px; }

.fj-divider {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 30px 0;
}

.fj-summary-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.fj-summary-table thead th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--line);
}
.fj-summary-table thead th:last-child { text-align: right; }
.fj-summary-table tbody tr { border-bottom: 1px solid var(--line); }
.fj-summary-table tbody tr:last-child { border-bottom: none; }
.fj-summary-table tbody tr:nth-child(odd) { background: rgba(255, 255, 255, 0.015); }
.fj-summary-table td {
  padding: 12px 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}
.fj-summary-table td:last-child { text-align: right; color: var(--red-bright); font-weight: 600; }

.fj-empty-cat {
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 40px 0;
  text-align: center;
}

/* VIEW TRANSITION */
@keyframes fj-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fj-view { animation: fj-fade-in 0.25s ease; }

/* FOOTER */
.fj-footer {
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

@media (max-width: 560px) {
  .fj-title { font-size: 24px; }
  .fj-brand-text h1 { font-size: 18px; }
  .fj-content { padding: 20px 14px 100px; }
  .fj-header { margin: -20px -14px 24px; padding: 16px 14px 14px; }
  .fj-os-btn span.label { display: none; }
}
