/* Inter and Lora ship with the app (SIL Open Font License, see vendor/fonts), so it works offline. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(vendor/fonts/inter.woff2) format("woff2"); }
@font-face { font-family: "Lora"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(vendor/fonts/lora.woff2) format("woff2"); }

/* Neutral near-black, white pill buttons, serif headings and a dotted ground. No colour accent: white is the accent. */
:root {
  color-scheme: dark;
  --bg: #141414;
  --panel: #191919;
  --panel-solid: #1c1c1c;
  --raised: rgba(255, 255, 255, 0.045);
  --raised-hover: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --focus: rgba(255, 255, 255, 0.38);
  --text: #f2f2f2;
  --muted: #9b9b9b;
  --accent: #f2f2f2;
  --accent-strong: #ffffff;
  --accent-hover: #e4e4e4;
  --accent-ink: #111111;
  --accent-soft: rgba(255, 255, 255, 0.09);
  --dot: rgba(255, 255, 255, 0.055);
  --warn: #e9b35f;
  --error: #ef7d7d;
  --ok: #6fd39b;
  --radius: 14px;
  --radius-small: 9px;
  --radius-pill: 999px;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 18px 18px;
  color: var(--text);
  font: 13px/1.45 var(--sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
/* The web version, for customers: what needs Emil's folders, GTA install or keys is left out. */
.web-limited .admin-only, .web-limited #setupBox, .web-limited .comp-check,
.web-limited .admin-only + .divider, .web-limited .empty span { display: none !important; }

button {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: var(--radius-small);
  padding: 6px 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover { background: var(--raised-hover); border-color: var(--line-strong); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
select:focus, input[type=text]:focus, input[type=number]:focus, input[type=search]:focus { border-color: var(--focus); outline: none; }
.primary { background: var(--accent-strong); border-color: transparent; color: var(--accent-ink); font-weight: 600; border-radius: var(--radius-pill); }
.primary:hover { background: var(--accent-hover); border-color: transparent; }
.wide { width: 100%; }
.grow { flex: 1; }
.icon { padding: 6px 10px; flex: none; }

.topbar {
  display: grid;
  /* The sides take what they need, so the buttons never wrap onto two lines. */
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(12px);
}
.brand { font-weight: 650; letter-spacing: .01em; display: flex; align-items: center; gap: 9px; font-size: 14px; white-space: nowrap; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 16px; letter-spacing: 0; }
.brand-mark { position: relative; width: 20px; height: 20px; border-radius: 6px; background: var(--text); }
.brand-mark::after { content: ""; position: absolute; left: 7.5px; top: 5px; border-left: 7px solid var(--bg); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.categories { justify-self: center; display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--raised); }
.categories button { border: 0; background: transparent; padding: 5px 18px; color: var(--muted); border-radius: var(--radius-pill); }
.categories button:hover { color: var(--text); background: transparent; }
.categories button.active { background: var(--accent-strong); color: var(--accent-ink); font-weight: 600; }
.top-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.top-actions > button { border-radius: var(--radius-pill); padding: 6px 14px; white-space: nowrap; }

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr) 310px;
  gap: 10px;
  padding: 10px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel-title { padding: 12px 14px 4px; font-family: var(--serif); font-weight: 600; font-size: 15px; }
.files > *:not(.panel-title):not(.item-list) { margin-inline: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-block: 8px; }
.field label, .slider label { color: var(--muted); font-size: 12px; }
select, input[type=text], input[type=number], input[type=search] {
  width: 100%;
  min-width: 0;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  padding: 6px 9px;
}
select option { background: var(--panel-solid); }
/* The open menu may reach past its own panel, and has to stay above the panels next to it. */
.files { position: relative; z-index: 2; }
.comp-menu { position: relative; }
.comp-button { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.comp-button::after { content: "▾"; color: var(--muted); }
.comp-list {
  position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); max-height: min(620px, 70vh); overflow-y: auto; padding: 4px;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--radius-small); box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.comp-row { display: flex; align-items: center; border-radius: 6px; }
.comp-row:hover { background: var(--raised-hover); }
.comp-row.current { background: var(--accent-soft); }
.comp-check { display: flex; padding: 7px 4px 7px 9px; cursor: pointer; }
.comp-check input { margin: 0; accent-color: var(--accent); cursor: pointer; }
.comp-name { flex: 1; min-width: 0; padding: 7px 9px 7px 5px; background: none; border: 0; border-radius: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.comp-name:hover { background: none; }
.comp-row.approved .comp-name { color: var(--muted); }
input[type=color] { width: 100%; height: 30px; padding: 2px; background: transparent; border: 1px solid var(--line); border-radius: var(--radius-small); cursor: pointer; }
.row { display: flex; gap: 6px; align-items: center; }
.row.gap { gap: 8px; margin-top: 8px; }
.row.end { justify-content: flex-end; }

.segmented { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: rgba(255, 255, 255, .03); margin-block: 8px; }
.segmented.wrap { flex-wrap: wrap; }
.segmented button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 4px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.segmented button.active { background: var(--accent-strong); color: var(--accent-ink); font-weight: 600; }
/* The panel's side margins come on top of the width, so the field is narrowed by them. */
.search { margin-block: 4px 6px; }
.files > .search { width: calc(100% - 28px); }
.list-count { color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.item-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; }
.item-list button {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 8px;
  text-align: left; border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 7px;
}
.item-row { display: flex; align-items: center; gap: 2px; }
.item-row input { flex: none; margin: 0 4px; accent-color: var(--accent); cursor: pointer; }
.item-row button { flex: 1; min-width: 0; }
.item-row.skipped .item-name, .item-row.skipped .item-meta { color: var(--muted); opacity: .6; text-decoration: line-through; }
.item-list button:hover { background: var(--raised); }
.item-list button.active { background: var(--accent-soft); border-color: var(--line-strong); }
.item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--muted); font-size: 11px; flex: none; }
.group-head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 8px 3px; }
.more { color: var(--muted); }
.ai-panel { flex: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-head button { flex: none; }
.ai-cards { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.ai-card { flex: none; width: 112px; padding: 4px; display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--raised); border: 1px solid transparent; }
.ai-card.active { border-color: var(--accent); background: var(--accent-soft); }
.ai-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 4px; background: #0b0b0f; }
.ai-card img:not([src]) { opacity: .4; }
.ai-card .ai-name { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card .ai-why { font-size: 10.5px; color: var(--muted); display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.inv-thumb { width: 32px; height: 32px; flex: none; object-fit: contain; border-radius: 4px; background: var(--raised); }
.inv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.item-list button.inv-row { justify-content: flex-start; gap: 8px; }
.inv-head { padding: 6px 8px 10px; }
.inv-head strong { display: block; margin-top: 6px; overflow-wrap: anywhere; }
.inv-error { padding: 8px; color: var(--muted); overflow-wrap: anywhere; }

.viewport { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.stage-wrap {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #101010;
}
.stage-frame { position: relative; box-shadow: 0 0 0 1px var(--line-strong); }
.stage-frame.checker {
  background-color: #1a1a1a;
  background-image: linear-gradient(45deg, #232323 25%, transparent 25%, transparent 75%, #232323 75%), linear-gradient(45deg, #232323 25%, transparent 25%, transparent 75%, #232323 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}
#stage { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#stage:active { cursor: grabbing; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; pointer-events: none; color: var(--muted); }
.empty strong { color: var(--text); font-size: 15px; font-weight: 600; }
.busy {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
  padding: 6px 12px; background: rgba(10, 10, 14, .85); border: 1px solid var(--line); border-radius: 999px;
}
.spinner { width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 11.5px; }
.shoot-all { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.shoot-all select { width: auto; }
.shoot-all .check { margin: 0; white-space: nowrap; }
.status { color: var(--muted); font-size: 11.5px; min-height: 17px; padding-inline: 2px; overflow-wrap: anywhere; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); padding: 6px 8px 0; }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 7px 2px 9px; border-radius: 0; border-bottom: 2px solid transparent; }
.tabs button:hover { background: none; color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-body { padding: 8px 14px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.check { display: flex; gap: 8px; align-items: center; margin-block: 9px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.slider { margin-block: 10px; }
.slider-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.slider-value { font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.panel-title.inset { padding: 8px 0 2px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0 8px; }
.number-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 12px 0; font-size: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.warnings > div { margin-top: 6px; padding: 7px 10px; border-radius: var(--radius-small); border: 1px solid rgba(233, 179, 95, .3); background: rgba(233, 179, 95, .08); color: var(--warn); font-size: 12px; overflow-wrap: anywhere; }
.warnings > div.error { border-color: rgba(239, 125, 125, .35); background: rgba(239, 125, 125, .09); color: var(--error); }
.note { color: var(--muted); font-size: 12px; margin-block: 8px; overflow-wrap: anywhere; }
.note code { font: 11.5px ui-monospace, Consolas, monospace; color: var(--text); }
.custom-preview { color: var(--text); font: 12px ui-monospace, Consolas, monospace; }
.custom-preview.bad { color: var(--error); font-family: var(--sans); }
.lead { margin-block: 6px 10px; }
.setup { margin-block: 10px; padding: 10px; border-radius: var(--radius-small); border: 1px solid var(--line-strong); background: var(--raised); }
.setup p { margin: 0 0 8px; font-size: 12px; }
.setup pre { white-space: pre-wrap; font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.progress { height: 7px; border-radius: 99px; background: var(--raised); overflow: hidden; margin-top: 10px; }
.bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.batch-state { color: var(--muted); font-size: 12px; margin-top: 6px; min-height: 18px; overflow-wrap: anywhere; }
.link-button { display: block; text-align: center; text-decoration: none; padding: 7px 12px; border-radius: var(--radius-small); margin-top: 8px; }

dialog { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-strong); border-radius: 18px; padding: 22px; width: min(500px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 21px; }
dialog p { margin: 0 0 12px; color: var(--muted); }
.drop-veil { position: fixed; inset: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; background: rgba(20, 20, 20, .8); border: 2px dashed var(--accent); border-radius: var(--radius); pointer-events: none; z-index: 20; }
/* Messages sit over the top of the image, under the loading pill, so they never cover a button. */
.toasts { position: fixed; top: 124px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 30; width: min(560px, calc(100vw - 32px)); }
.toast { padding: 10px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); overflow-wrap: anywhere; }
.toast.error { border-color: rgba(239, 125, 125, .5); color: var(--error); }

@media (max-width: 1100px) {
  body { overflow: auto; height: auto; }
  .layout { grid-template-columns: 1fr; }
  .topbar { grid-template-columns: 1fr; justify-items: start; }
  .top-actions { justify-content: flex-start; flex-wrap: wrap; }
  .viewport { order: -1; }
  .stage-wrap { height: 62vh; flex: none; }
  .item-list { max-height: 320px; }
  .hint { display: none; }
}
