:root{
  --ink: #12161d;
  --surface: #1b212b;
  --surface-2: #232b37;
  --paper: #ece4d3;
  --paper-dim: #b9b0a0;
  --brass: #c9a15a;
  --brass-dim: #8a7345;
  --rust: #a8532e;
  --moss: #7fa66b;
  --line: #2c3542;
  --radius: 10px;
  --serif: 'Noto Serif Thai', 'Noto Serif', serif;
  --sans: 'Noto Sans Thai', 'Inter', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

*{ box-sizing: border-box; }

body{
  margin:0;
  background:
    radial-gradient(1200px 600px at 20% -10%, #1e2531 0%, transparent 60%),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  line-height:1.6;
  min-height:100vh;
}

.desk{
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* ---------- hero ---------- */
.hero{ margin-bottom: 36px; }
/* Several rules below set an author-level `display`, which outranks the browser's
   [hidden]{display:none}. Without this, elements toggled via the hidden attribute
   (file chip, progress rows) stay on screen. */
[hidden]{ display:none !important; }

.stamp-row{ display:flex; gap:10px; align-items:center; margin-bottom:18px; }
.stamp{
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink);
  background: var(--brass);
  padding: 4px 10px;
  border-radius: 3px;
  transform: rotate(-2deg);
  display:inline-block;
}
.stamp--ghost{
  background:transparent;
  color: var(--paper-dim);
  border: 1px dashed var(--line);
  transform: rotate(1deg);
}
h1{
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(32px, 6vw, 44px);
  margin: 0 0 12px;
  color: var(--paper);
}
.lede{
  color: var(--paper-dim);
  max-width: 56ch;
  font-size: 15px;
  margin: 0;
}

/* ---------- cards ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-label{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--brass);
  text-transform: uppercase;
  margin-bottom: 16px;
  display:flex;
  align-items:center;
  gap:8px;
}
.card-label .idx{
  color: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}
/* ---------- dropzone ---------- */
.dropzone{
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: pointer;
}
.dropzone.drag{
  border-color: var(--brass);
  background: rgba(201,161,90,0.06);
}
.book-icon{ width: 84px; height: 64px; color: var(--brass-dim); margin-bottom: 8px; }
.dz-title{ font-family: var(--serif); font-size: 18px; margin: 8px 0 4px; }
.dz-sub{ color: var(--paper-dim); font-size: 14px; margin:0; }
.pick-link{ color: var(--brass); text-decoration: underline; cursor: pointer; }

/* ---------- fields / controls ---------- */
select, input[type=text]{
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--paper);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 14px;
}
select:focus, input:focus{ outline: 2px solid var(--brass); outline-offset: 1px; }
/* ---------- buttons ---------- */
.btn{
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  width: fit-content;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-primary{ background: var(--brass); color: var(--ink); }
.btn-primary:hover:not(:disabled){ background:#d8ae66; }
.btn-secondary:hover:not(:disabled){ border-color: var(--brass); color: var(--brass); }
.btn-ghost:hover{ color: var(--paper); }
.btn-stop{
  padding: 6px 14px; font-size: 13px; flex: none;
  background: transparent; color: var(--rust); border-color: var(--rust);
}
.btn-stop:hover:not(:disabled){ background: var(--rust); color: var(--paper); }

/* ---------- file queue ---------- */
.file-list{ list-style:none; margin:16px 0 0; padding:0; display:flex; flex-direction:column; gap:8px; }
.file-row{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:10px 14px; border:1px solid var(--line); border-radius:8px; background:var(--surface-2);
}
.file-row .dot{ width:8px; height:8px; border-radius:50%; background:var(--paper-dim); flex:none; }
.file-row.working .dot{ background:var(--brass); }
.file-row.done .dot{ background:var(--moss); }
.file-row.error .dot, .file-row.cancelled .dot{ background:var(--rust); }
.fr-name{ flex:1; min-width:150px; font-size:14px; color:var(--paper); word-break:break-word; }
.fr-note{ font-family:var(--mono); font-size:12px; color:var(--paper-dim); }
.fr-dl{
  flex:none; font-size:13px; font-weight:600; text-decoration:none;
  color:var(--brass); border:1px solid var(--brass-dim); border-radius:6px; padding:5px 12px;
}
.fr-dl:hover{ background:var(--brass); color:var(--ink); }
.btn-clear{
  margin-top:14px; padding:7px 14px; font-size:13px;
  background:transparent; color:var(--paper-dim); border-color:var(--line);
}
.btn-clear:hover{ color:var(--paper); border-color:var(--brass-dim); }

/* ---------- progress ---------- */
.progress-row{ display:flex; align-items:center; gap:12px; margin-top: 14px; }
.progress-bar{ flex:1; height:6px; background: var(--surface-2); border-radius: 999px; overflow:hidden; }
.progress-fill{ height:100%; width:0%; background: var(--brass); transition: width .2s ease; }
.progress-label{ font-family: var(--mono); font-size: 12px; color: var(--paper-dim); white-space:nowrap; }

/* ---------- pages preview ---------- */
/* ---------- done card ---------- */
.due-card{
  background: var(--surface);
  border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  padding: 28px;
  text-align:center;
  margin-bottom: 24px;
}
.due-card-stamp{
  display:inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing:.1em;
  color: var(--moss);
  border: 1.5px solid var(--moss);
  border-radius: 4px;
  padding: 4px 12px;
  transform: rotate(-2deg);
  margin-bottom: 12px;
}
.due-card p{ margin: 0 0 16px; font-family: var(--serif); font-size: 17px; }
.due-card .btn{ margin: 0 auto; }

/* ---------- footer ---------- */
.foot{ text-align:center; color: var(--paper-dim); font-size: 12px; margin-top: 40px; }

@media (max-width: 480px){
  .desk{ padding: 32px 14px 60px; }
  .card{ padding: 18px; }
}
