:root {
  --bg:        #1c1916;
  --bg-1:      #252119;
  --bg-2:      #2e2a22;
  --bg-3:      #3a352c;
  --ink:       #f2ead8;
  --ink-dim:   #c0ae96;
  --ink-faint: #8a7a68;
  --line:      #4a4238;
  --line-hot:  #6e5c48;
  --brass:     #d4a86a;
  --brass-hot: #f3c789;
  --brass-dim: #8a6d45;
  --sel:       #60f8b3;
  --blood:     #c14a2d;
  --blood-hot: #e25c3a;

  --font-display: "Syncopate", "Arial Narrow", sans-serif;
  --font-mono:    "IBM Plex Mono", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brass); text-decoration: none; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: 0.022; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 99;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.28) 100%);
}

.chrome {
  display: flex; align-items: center; justify-content: space-between;
  height: 54px; padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, var(--bg-1), var(--bg));
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-mark {
  color: var(--brass); font-family: var(--font-display);
  letter-spacing: 0.3em; font-size: 11px;
  padding: 3px 6px 3px calc(6px + 0.3em); border: 1px solid var(--brass-dim); line-height: 1;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-line-1 {
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: 0.42em; font-size: 15px; color: var(--ink);
}
.brand-line-2 {
  font-size: 10px; color: var(--brass);
  letter-spacing: 0.28em; text-transform: uppercase;
}
.chrome-right { display: flex; gap: 10px; }
.donate-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10px; font-weight: 500; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: 0.18em;
  padding: 6px 14px;
  border: 1px solid var(--line-hot); border-radius: 999px;
  background: var(--bg-2);
  transition: color 0.18s, border-color 0.18s;
}
.donate-icon { width: 13px; height: 13px; }
.donate-btn:hover { color: #f5c542; border-color: #f5c542; }

html, body { height: 100%; overflow: hidden; }

.bench {
  height: calc(100% - 54px);
  display: grid;
  grid-template-columns: minmax(300px, 420px) 120px minmax(380px, 640px);
  justify-content: center;
  gap: 0;
  padding: 36px 28px 28px;
}

.col { display: flex; flex-direction: column; min-height: 0; }
.col-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.col-num {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: var(--bg); background: var(--brass);
  padding: 2px 7px; letter-spacing: 0.1em;
}
.col-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: 0.4em; color: var(--ink);
}
.col-note { margin-left: auto; font-size: 11px; color: var(--ink-faint); }

/* inputs */

.stack {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
  overflow: auto; min-height: 0;
}
.slab {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 12px 12px 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  cursor: grab; user-select: none;
  transition: transform 0.12s, border-color 0.12s, opacity 0.12s;
}
.slab::before {
  content: ""; align-self: stretch; width: 4px; margin: -12px 0;
  background: var(--hue);
}
.slab:hover { border-color: var(--line-hot); }
.slab.lifted { opacity: 0.4; }
.slab.above { box-shadow: 0 -2px 0 var(--brass-hot); }
.slab.below { box-shadow: 0 2px 0 var(--brass-hot); }
.slab:first-child:not(.bad) { border-color: var(--brass-dim); }
.slab.bad { border-color: var(--blood); }
.slab.bad::before { background: var(--blood); }
.slab-rank {
  width: 26px; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: var(--brass-dim);
}
.slab:first-child .slab-rank { color: var(--brass-hot); }
.slab.bad .slab-rank { color: var(--blood); }
.slab-body { flex: 1; min-width: 0; }
.slab-name { overflow-wrap: anywhere; color: var(--ink); }
.slab-meta { font-size: 11px; color: var(--ink-faint); }
.slab-meta.lost { color: var(--brass); }
.slab.bad .slab-meta { color: var(--blood-hot); }
.slab-rm {
  width: 24px; height: 24px; padding: 0;
  border: 1px solid transparent; background: transparent;
  color: var(--ink-faint); cursor: pointer; font-size: 11px;
}
.slab-rm:hover { border-color: var(--blood); color: var(--blood-hot); }

.add {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; padding: 12px 14px;
  border: 1px dashed var(--line-hot);
  color: var(--ink-dim); cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.add:hover { border-color: var(--brass); color: var(--brass-hot); }
.add-plus { font-size: 20px; line-height: 1; color: var(--brass); }
.add.blank {
  flex-direction: column; justify-content: center; gap: 10px;
  margin-top: 0; padding: 70px 20px;
}
.add.blank .add-plus { font-size: 34px; }
.add.blank .add-text { text-align: center; }
.add.blank .add-text em { display: block; margin: 4px 0 0; text-align: center; }
.add-text em { font-style: normal; color: var(--ink-faint); margin-left: 6px; font-size: 11px; }

/* rail */

.rail {
  display: flex; flex-direction: column; align-items: center;
  padding-top: 48px;
}
.rail-line {
  width: 1px; flex: 1; max-height: 140px;
  background: linear-gradient(to bottom, transparent, var(--line-hot), transparent);
}
.anvil {
  width: 50px; height: 50px; margin: 22px 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--brass-dim); background: var(--bg-1);
  color: var(--brass); transform: rotate(45deg);
}
.anvil-glyph { transform: rotate(-45deg); font-size: 16px; line-height: 1; }

/* output */

.ticket {
  padding: 16px 18px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}
.ticket-name {
  width: 100%; padding: 0 0 8px;
  border: 0; border-bottom: 1px dashed var(--line-hot);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 16px;
}
.ticket-name:focus { outline: none; border-bottom-color: var(--brass); }
.ticket-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0 0; }
.ticket-stats div { display: flex; flex-direction: column; }
.ticket-stats b {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--ink);
}
.ticket-stats span { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint); }
.ticket-stats .hot b { color: var(--brass-hot); }
.forge-btn {
  display: block; width: 100%;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--blood) 0%, #8a2510 100%);
  color: var(--ink); border: 1px solid var(--blood);
  padding: 12px 0;
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; letter-spacing: 0.5em; text-transform: uppercase;
  cursor: pointer; transition: all 0.15s;
}
.forge-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--blood-hot) 0%, var(--blood) 100%);
  box-shadow: 0 0 16px rgba(193,74,45,0.35);
}
.forge-btn:disabled { opacity: 0.4; cursor: default; }
.forge-btn.loading { animation: pulse 1s ease-in-out infinite alternate; }
.forge-btn-zip {
  margin-top: 8px;
  background: linear-gradient(135deg, #2e3f4f 0%, #1e2d3a 100%);
  color: #8fc4d8; border-color: #3a5060;
}
.forge-btn-zip:hover:not(:disabled) {
  background: linear-gradient(135deg, #3a5060 0%, #2e3f4f 100%);
  box-shadow: 0 0 16px rgba(79,163,145,0.25); color: #b8dce8;
}
@keyframes pulse { from { opacity: 0.6; } to { opacity: 1; } }

#oneclick-slot .oneclick-row { margin-top: 8px; }

.status { min-height: 16px; margin-top: 10px; font-size: 11px; color: var(--ink-dim); }
.status.ok { color: var(--sel); }
.status.err { color: var(--blood-hot); }

.contents {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  margin-top: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.contents-head {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.contents-head input[type="search"] {
  flex: 1; min-width: 0; padding: 6px 8px;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font: inherit; font-size: 12px;
}
.contents-head input[type="search"]:focus { outline: none; border-color: var(--brass); }
.only-conf { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-dim); cursor: pointer; }
.only-conf input { accent-color: var(--brass); }

.tree { list-style: none; margin: 0; padding: 4px 0; overflow: auto; flex: 1; font-size: 11.5px; }
.tree li {
  display: grid; grid-template-columns: 13px 8px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 3px 10px;
}
.tree input, .tick-all { margin: 0; width: 13px; height: 13px; accent-color: var(--brass); cursor: pointer; }
.tree li.off .f-path, .tree li.off .f-src { opacity: 0.4; text-decoration: line-through; }
.tree li.off i { opacity: 0.3; }
.tree li.fell .f-src, .tree li.conf.fell .f-src { color: var(--sel); }
.tree li.copy { padding-left: 33px; }
.tree li.copy + li:not(.copy) { margin-top: 4px; }
.tree li.copy .f-path { color: var(--ink-dim); }
.tree li.copy.used .f-path { color: var(--ink); }
.tree li.copy.used .f-src { color: var(--sel); }
.tree li.copy:not(.used):not(.off) .f-src { color: var(--ink-faint); }
.tree li:hover { background: var(--bg-1); }
.tree li i { width: 8px; height: 8px; background: var(--hue); }
.tree li.conf i { outline: 1px solid var(--brass-hot); outline-offset: 2px; }
.f-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.f-dir { color: var(--ink-faint); }
.f-src { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.tree li.conf .f-src { color: var(--brass); }
.tree li.more { display: block; padding: 14px; text-align: center; color: var(--ink-faint); }

.dropveil {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(28,25,22,0.82);
  border: 2px dashed var(--brass);
  pointer-events: none;
}
.dropveil.on { display: flex; }
.dropveil span {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; letter-spacing: 0.5em; color: var(--brass-hot);
}

@media (max-width: 1000px) {
  html, body { overflow: auto; }
  .bench { height: auto; grid-template-columns: 1fr; padding: 24px 16px; }
  .rail { flex-direction: row; padding: 16px 0; }
  .rail-line { height: 1px; width: auto; max-height: none; background: linear-gradient(to right, transparent, var(--line-hot), transparent); }
  .contents { min-height: 360px; }
}
