:root {
  color-scheme: dark;
  --bg: #16130f;
  --raise: #241c16;
  --ink: #f6f1e8;
  --muted: #b7aa9c;
  --line: #3d3229;
  --accent: #e25b2a;
  --gold: #f0c36a;
  --danger: #ffb4a2;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  font-family: "Segoe UI", Candara, "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(226, 91, 42, 0.16), transparent 55%),
    var(--bg);
  border-top: 6px solid var(--accent);
}

.top, .layout {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 28px;
  align-items: end;
  padding: 36px 0 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

h1, h2, h3 { font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; font-weight: 600; }

h1 { margin: 0; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 0.95; }

.lede, #results-note, #library-path, .drop-sub, .path { color: var(--muted); }

.lede { max-width: 38rem; font-size: 1.05rem; }

.library {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}

#status { margin: 0 0 6px; }

#status.warn { color: var(--danger); }

#library-path {
  margin: 0 0 12px;
  font-size: 0.82rem;
  word-break: break-all;
}

button, .dropzone {
  font: inherit;
}

button {
  background: var(--accent);
  color: #1a0d08;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

details { margin-top: 12px; color: var(--muted); font-size: 0.85rem; }

summary { cursor: pointer; }

#skipped-list {
  max-height: 160px;
  overflow: auto;
  margin: 8px 0 0;
  padding-left: 18px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  padding: 28px 0 48px;
}

.dropzone {
  position: relative;
  display: flex;
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  background: rgba(36, 28, 22, 0.7);
  cursor: pointer;
  text-align: center;
  padding: 20px;
}

.dropzone.dragover, .dropzone:hover { border-color: var(--accent); }

.dropzone.busy { opacity: 0.75; }

.drop-title { font-size: 1.15rem; }

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.preview {
  margin: 16px 0 0;
  background: #100e0c;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #100e0c;
}

.preview figcaption {
  padding: 8px 12px 10px;
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
}

.error {
  color: var(--danger);
  background: rgba(226, 91, 42, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
}

.results-head h2 { margin: 0 0 6px; font-size: 1.7rem; }

#results-note { margin: 0 0 8px; }

#results-message { min-height: 1.4em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.card:hover { border-color: var(--gold); }

.card img {
  width: 100%;
  height: 210px;
  object-fit: contain;
  background: #100e0c;
}

.rank {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 1.6rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1208;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.card-body { padding: 10px 12px 12px; }

.card h3 {
  margin: 0 0 8px;
  font-family: "Segoe UI", Candara, sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track {
  height: 6px;
  border-radius: 999px;
  background: #3a3129;
  overflow: hidden;
}

.track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}

.score {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

.score span, .path { color: var(--muted); font-size: 0.8rem; }

.path { margin: 6px 0 0; word-break: break-all; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .top, .layout { grid-template-columns: 1fr; }
  .top { padding-top: 24px; }
}
