@import url("https://fonts.googleapis.com/css2?family=Teko:wght@400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&display=swap");

:root {
  --bg: #121212;
  --bg-panel: #161616;
  --bg-input: #0c0c0c;
  --ink: #e8e8e8;
  --muted: #8a8a8a;
  --yellow: #e6b422;
  --yellow-hot: #ffcc00;
  --yellow-dim: rgba(230, 180, 34, 0.35);
  --line: rgba(230, 180, 34, 0.28);
  --danger: #c45a5a;
  --ok: #6f9e6a;
  --font-display: "Teko", "Arial Narrow", Impact, sans-serif;
  --font-body: "Barlow Condensed", "Arial Narrow", sans-serif;
  --hud: 2px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.02em;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(230, 180, 34, 0.07), transparent 60%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-blend-mode: normal, soft-light;
}

.page {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

/* ── Hero / brand lockup ─────────────────────────────── */

.hero {
  position: relative;
  margin-bottom: 2rem;
  padding: 2.25rem 1.5rem 2rem;
  text-align: center;
  border: var(--hud) solid var(--yellow-dim);
  background: rgba(10, 10, 10, 0.72);
}

/* HUD corner brackets */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--yellow);
  border-style: solid;
  pointer-events: none;
}
.hero::before {
  top: -1px;
  left: -1px;
  border-width: 3px 0 0 3px;
}
.hero::after {
  top: -1px;
  right: -1px;
  border-width: 3px 3px 0 0;
}

.hero-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-corners::before,
.hero-corners::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--yellow);
  border-style: solid;
}
.hero-corners::before {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 3px 3px;
}
.hero-corners::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 3px 3px 0;
}

.hero-slashes {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.hero-slashes span {
  width: 14px;
  height: 4px;
  background: var(--yellow);
  transform: skewX(-28deg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 3.75rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 2px 3px 0 #000, 0 0 18px rgba(0, 0, 0, 0.8);
}

.brand-brackets {
  color: var(--yellow);
  font-weight: 700;
  text-shadow: 2px 2px 0 #000;
}

.plaque {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem auto 0.85rem;
  padding: 0.35rem 1.4rem 0.28rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--yellow);
  background: #0a0a0a;
  border: 2px solid var(--yellow);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
  text-shadow: 0 0 1px rgba(230, 180, 34, 0.4);
}

.plaque-rivet {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffe066, var(--yellow) 55%, #8a6a10);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
}

.hero-hazard {
  display: flex;
  justify-content: center;
  margin-top: 0.35rem;
}
.hero-hazard span {
  width: 52px;
  height: 12px;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(
    -45deg,
    var(--yellow) 0 4px,
    #0a0a0a 4px 8px
  );
  border: 1px solid var(--yellow);
  border-top: 0;
}

.lede {
  margin: 1.1rem auto 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.45;
  text-transform: uppercase;
}

/* ── Panels ──────────────────────────────────────────── */

.panel {
  position: relative;
  background: rgba(14, 14, 14, 0.88);
  border: 1px solid var(--line);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1rem;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
  opacity: 0.55;
}

form.panel {
  display: grid;
  gap: 1.05rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.optional {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 0;
  appearance: none;
}

textarea {
  min-height: 5rem;
  resize: vertical;
  line-height: 1.45;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px rgba(230, 180, 34, 0.25);
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--yellow) 50%),
    linear-gradient(135deg, var(--yellow) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

/* ── Dropzones ───────────────────────────────────────── */

.dropzone {
  border: 1px dashed var(--yellow-dim);
  background:
    linear-gradient(160deg, rgba(230, 180, 34, 0.05), transparent 55%),
    rgba(0, 0, 0, 0.35);
  padding: 1.35rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--yellow);
  outline: none;
  background: rgba(230, 180, 34, 0.08);
}

.dropzone.dragover {
  border-color: var(--yellow-hot);
  border-style: solid;
  background: rgba(230, 180, 34, 0.14);
  transform: scale(1.01);
}

.dropzone.has-file {
  border-style: solid;
  border-color: rgba(230, 180, 34, 0.7);
}

.dropzone-inner {
  text-align: center;
  pointer-events: none;
}

.dropzone-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.dropzone-sub {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.file-name {
  margin: 0.85rem 0 0;
  color: #b8b8b8;
  font-size: 0.95rem;
  word-break: break-all;
}

.file-name.ready {
  color: var(--yellow);
}

.tex-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 560px) {
  .tex-grid { grid-template-columns: 1fr; }
}

.dropzone-sm {
  padding: 0.9rem 0.7rem;
}

.dropzone-sm .dropzone-title {
  font-size: 1.05rem;
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.02em;
  color: var(--yellow);
  text-transform: none;
}

.dropzone-sm .dropzone-sub {
  margin-bottom: 0.55rem;
  font-size: 0.85rem;
}

.hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  letter-spacing: 0.03em;
}

.hint code {
  color: var(--yellow);
  font-size: 0.92em;
}

/* ── Checkboxes / ack ────────────────────────────────── */

.ack {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.65rem;
  padding: 0.9rem;
  border: 1px solid var(--yellow-dim);
  background: rgba(230, 180, 34, 0.06);
  line-height: 1.45;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.ack input { margin-top: 0.2rem; accent-color: var(--yellow); }

.ack.option {
  border-color: rgba(230, 180, 34, 0.22);
  background: rgba(255, 255, 255, 0.02);
}

.ack strong {
  color: var(--yellow-hot);
  font-weight: 700;
}

/* ── Buttons ─────────────────────────────────────────── */

button[type="submit"] {
  justify-self: stretch;
  margin-top: 0.25rem;
  padding: 0.85rem 1.4rem 0.75rem;
  border: 2px solid var(--yellow);
  background: linear-gradient(180deg, #2a2208 0%, #16120a 100%);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
  transition: background 0.15s ease, color 0.15s ease, filter 0.15s ease;
}

button[type="submit"]:hover {
  background: linear-gradient(180deg, var(--yellow) 0%, #c49a12 100%);
  color: #111;
  filter: none;
}

button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: wait;
}

button.browse-btn {
  pointer-events: auto;
  padding: 0.5rem 1.1rem 0.4rem;
  border: 1px solid var(--yellow-dim);
  background: #0a0a0a;
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}

button.browse-btn:hover {
  border-color: var(--yellow);
  background: rgba(230, 180, 34, 0.12);
  filter: none;
}

/* ── Result / notes ──────────────────────────────────── */

.result .download {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.7rem 1.25rem 0.55rem;
  border: 2px solid var(--yellow);
  background: var(--yellow);
  color: #111;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
}

.result .download:hover {
  filter: brightness(1.08);
}

.notes h2,
.result h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
}

.notes ul {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  color: #b0b0b0;
  line-height: 1.55;
}

.notes code,
.result code {
  font-size: 0.9em;
  color: var(--yellow);
}

.result.ok { border-color: rgba(111, 158, 106, 0.55); }
.result.err { border-color: rgba(196, 90, 90, 0.65); }

.pbo-hash {
  margin: 0.75rem 0;
  font-size: 0.9rem;
  word-break: break-all;
  color: #cfcfcf;
}
.pbo-hash code {
  font-size: 0.82em;
  color: var(--yellow);
}

.result pre {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  line-height: 1.4;
  color: #cfcfcf;
}

.hidden { display: none; }

/* ── Motion ──────────────────────────────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slash-in {
  from { opacity: 0; transform: skewX(-28deg) scaleX(0.2); }
  to { opacity: 1; transform: skewX(-28deg) scaleX(1); }
}

.hero { animation: rise 0.5s ease both; }
.panel { animation: rise 0.45s ease both; }
.panel:nth-of-type(1) { animation-delay: 0.05s; }
.panel:nth-of-type(2) { animation-delay: 0.1s; }
.panel:nth-of-type(3) { animation-delay: 0.15s; }

.hero-slashes span {
  animation: slash-in 0.4s ease both;
}
.hero-slashes span:nth-child(2) { animation-delay: 0.08s; }
.hero-slashes span:nth-child(3) { animation-delay: 0.16s; }

/* ── Floating queue status ───────────────────────────── */

.queue-status {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  width: min(280px, calc(100vw - 2rem));
  padding: 0.85rem 1rem 1rem;
  border: var(--hud) solid var(--yellow-dim);
  background: rgba(12, 12, 12, 0.94);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font-size: 0.95rem;
  animation: rise 0.4s ease both;
}

.queue-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.queue-status-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
  line-height: 1;
}

.queue-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.queue-dot.busy {
  background: var(--yellow-hot);
  box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.55);
  animation: queue-pulse 1.4s ease infinite;
}
.queue-dot.idle {
  background: var(--ok);
}

@keyframes queue-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(255, 204, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 204, 0, 0); }
}

.queue-status-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin: 0 0 0.55rem;
}
.queue-status-stats > div {
  text-align: center;
}
.queue-status-stats dt {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.queue-status-stats dd {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1;
  color: var(--ink);
}

.queue-current {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #cfcfcf;
  line-height: 1.3;
}
.queue-current.muted,
.queue-ttl.muted {
  color: var(--muted);
}

.queue-progress {
  margin: 0 0 0.65rem;
}
.queue-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: #d4d4d4;
}
#q-progress-pct {
  font-family: var(--font-display);
  color: var(--yellow-hot);
  letter-spacing: 0.04em;
}
.queue-progress-track {
  height: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.queue-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow), var(--yellow-hot));
  transition: width 0.35s ease;
}
.queue-progress-stages {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
}
.queue-progress-stages li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.25;
}
.queue-progress-stages .stage-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a3a3a;
  flex-shrink: 0;
}
.queue-progress-stages li.stage-done {
  color: #9a9a9a;
}
.queue-progress-stages li.stage-done .stage-mark {
  background: var(--ok);
}
.queue-progress-stages li.stage-active {
  color: var(--yellow);
}
.queue-progress-stages li.stage-active .stage-mark {
  background: var(--yellow-hot);
  box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.45);
  animation: queue-pulse 1.4s ease infinite;
}

.queue-mine {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.queue-mine-pos {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}
.queue-mine-pos strong {
  color: var(--yellow-hot);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}
.queue-mine-status {
  margin: 0 0 0.4rem;
  color: #d4d4d4;
  line-height: 1.35;
}
.queue-warn,
.queue-warn-inline {
  margin: 0 0 0.35rem;
  color: var(--yellow);
  font-size: 0.85rem;
  line-height: 1.35;
}
.queue-ttl {
  margin: 0;
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .queue-status {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    width: auto;
  }
  .page {
    padding-bottom: 11rem;
  }
}
