:root {
  --cork: #855736;
  --paper: #eee2bd;
  --paper-light: #f8f0d2;
  --ink: #342a1e;
  --muted: #71644f;
  --green: #50765a;
  --green-dark: #34553d;
  --gold: #b8772f;
  --red: #9c4f3c;
  --line: rgba(94, 73, 44, 0.3);
  --shadow: 9px 12px 0 rgba(55, 31, 16, 0.17), 0 24px 52px rgba(45, 25, 12, 0.24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--cork);
  background-image:
    radial-gradient(circle at 13px 19px, rgba(48, 29, 17, 0.22) 0 1px, transparent 1.7px),
    radial-gradient(circle at 43px 47px, rgba(247, 214, 161, 0.11) 0 1.1px, transparent 1.9px),
    repeating-linear-gradient(19deg, rgba(255, 226, 179, 0.018) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, #986942, #75482d 56%, #8c5c38);
  background-size: 82px 64px, 91px 73px, auto, auto;
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input, select { font: inherit; }
.hidden { display: none !important; }
.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  min-height: 72px;
  gap: 28px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(234, 202, 150, 0.22);
  color: #f1e3c7;
  background: rgba(35, 27, 18, 0.96);
  box-shadow: 0 6px 22px rgba(45, 26, 14, 0.2);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand > span:last-child { display: grid; }
.brand strong { font: 700 1.05rem/1.1 Georgia, serif; letter-spacing: 0.04em; }
.brand small { color: #b8a78a; font-size: 0.55rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(213, 170, 97, 0.52);
  border-radius: 50%;
  color: #d5aa61;
  background: rgba(211, 165, 85, 0.08);
  font: 700 1rem Georgia, serif;
  place-items: center;
}
.site-nav { display: flex; justify-content: center; gap: 6px; }
.site-nav a { padding: 8px 10px; color: #c5b494; font-size: 0.75rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a.active { color: #f1e3c7; }
.edition-badge { padding: 6px 9px; border: 1px solid rgba(213, 170, 97, 0.3); border-radius: 2px; color: #cfb98f; font-size: 0.63rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }

.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 45px 0 90px; }
.import-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr); align-items: center; gap: 35px; margin-bottom: 54px; }
.hero-paper, .paper-panel {
  position: relative;
  border: 1px solid rgba(91, 68, 40, 0.36);
  border-radius: 4px 16px 5px 12px;
  background:
    linear-gradient(90deg, transparent 0 45px, rgba(152, 75, 61, 0.06) 46px, transparent 47px),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(87, 78, 59, 0.065) 36px),
    linear-gradient(145deg, #f2e7c4, #d9c695);
  box-shadow: var(--shadow);
}
.hero-paper { padding: clamp(38px, 6vw, 70px); }
.hero-paper::before, .panel-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 92px;
  height: 23px;
  background: rgba(220, 197, 149, 0.86);
  box-shadow: 0 1px 2px rgba(45, 34, 19, 0.18);
  content: "";
  transform: translateX(-50%) rotate(-2deg);
}
.eyebrow { margin: 0 0 10px; color: #8d5d2d; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 21px; font: 700 clamp(3rem, 6.4vw, 5.65rem)/0.96 Georgia, serif; letter-spacing: -0.05em; }
h1 em { color: var(--green-dark); font-weight: 500; }
.hero-copy { max-width: 700px; color: #5f513d; font: italic 1.03rem/1.72 Georgia, serif; }
.privacy-promises { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 25px; }
.privacy-promises span { padding: 7px 10px; border: 1px solid rgba(52, 85, 61, 0.24); border-radius: 3px; color: var(--green-dark); background: rgba(80, 118, 90, 0.08); font-size: 0.67rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.path-note { position: relative; padding: 40px 28px 28px; border: 1px solid rgba(84, 70, 43, 0.34); border-radius: 3px 12px 4px 8px; background: #d9d078; box-shadow: 7px 9px 0 rgba(55, 31, 16, 0.16); transform: rotate(1deg); }
.pin { position: absolute; top: 12px; left: 50%; width: 11px; height: 11px; border-radius: 50%; background: #904a3a; box-shadow: 0 2px 3px rgba(50, 27, 14, 0.3); transform: translateX(-50%); }
.note-label { color: #765024; font-size: 0.65rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.path-note code { display: block; padding: 10px; overflow-wrap: anywhere; border: 1px dashed rgba(73, 63, 39, 0.28); background: rgba(255,255,255,0.2); font-size: 0.73rem; }
.path-note ol { padding-left: 21px; color: #594d35; font: italic 0.86rem/1.8 Georgia, serif; }
.note-small { margin-bottom: 0; color: #6c603f; font-size: 0.69rem; }

.paper-panel { margin-top: 34px; padding: clamp(28px, 5vw, 52px); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font: 700 clamp(1.8rem, 4vw, 3rem)/1 Georgia, serif; }
.section-heading > p { max-width: 430px; margin: 0; color: var(--muted); font-size: 0.82rem; }
.drop-zone { display: grid; min-height: 260px; padding: 32px; border: 2px dashed rgba(52, 85, 61, 0.42); border-radius: 7px 18px 7px 15px; background: rgba(249, 242, 210, 0.46); text-align: center; place-items: center; align-content: center; cursor: pointer; transition: 150ms ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--green-dark); background: rgba(224, 229, 188, 0.54); transform: translateY(-2px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-icon { display: grid; width: 52px; height: 52px; margin-bottom: 10px; border: 2px solid var(--green-dark); border-radius: 50%; color: var(--green-dark); font: 700 1.6rem Georgia, serif; place-items: center; }
.drop-zone strong { font: 700 1.35rem Georgia, serif; }
.drop-zone small { margin: 3px 0 17px; color: var(--muted); }
.choose-button { padding: 9px 15px; border-radius: 4px 9px 4px 8px; color: #f8eed3; background: var(--green-dark); font-size: 0.74rem; font-weight: 900; }
.file-status { display: flex; align-items: center; gap: 9px; min-height: 42px; margin-top: 14px; padding: 10px 13px; border-left: 3px solid #9b896d; color: #665944; background: rgba(255,255,255,0.22); font-size: 0.78rem; }
.file-status.success { border-color: var(--green); color: var(--green-dark); }
.file-status.error { border-color: var(--red); color: #813f31; }
.file-status.working { border-color: var(--gold); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: currentColor; }
.format-help { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.format-help article { padding: 12px; border-left: 3px solid rgba(80,118,90,0.5); background: rgba(255,255,255,0.18); }
.format-help article:nth-child(1) { background: rgba(225, 232, 195, 0.46); }
.format-help article:nth-child(2) { background: rgba(205, 224, 226, 0.46); }
.format-help article:nth-child(3) { background: rgba(231, 211, 222, 0.46); }
.format-help strong, .format-help span { display: block; }
.format-help strong { color: var(--green-dark); font-size: 0.75rem; }
.format-help span { margin-top: 3px; color: var(--muted); font-size: 0.68rem; }
.decoder-credit { margin-top: 15px; padding: 12px 14px; border: 1px solid rgba(83, 67, 43, 0.22); background: rgba(255,255,255,0.15); color: var(--muted); font-size: 0.7rem; }
.decoder-credit summary { color: #5c4e38; font-weight: 900; cursor: pointer; }
.decoder-credit p { margin: 9px 0 5px; }
.decoder-credit a { color: var(--green-dark); font-weight: 800; }

.collection-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 20px; }
.collection-summary div { padding: 16px; border-left: 4px solid var(--green); background: rgba(255,255,255,0.2); }
.collection-summary div:nth-child(1) { background: rgba(241, 224, 181, 0.5); }
.collection-summary div:nth-child(2) { background: rgba(216, 229, 196, 0.5); }
.collection-summary div:nth-child(3) { background: rgba(207, 224, 226, 0.5); }
.collection-summary strong, .collection-summary span { display: block; }
.collection-summary strong { color: var(--green-dark); font: 700 1.75rem Georgia, serif; }
.collection-summary span { color: var(--muted); font-size: 0.66rem; font-weight: 850; text-transform: uppercase; }
.review-tools { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 12px; margin-bottom: 19px; }
.review-tools label { display: grid; gap: 5px; }
.review-tools span { color: #6a5b45; font-size: 0.65rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; }
.review-tools input, .review-tools select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid rgba(83, 67, 43, 0.33); border-radius: 4px; color: var(--ink); background: rgba(255, 251, 227, 0.72); }
.pal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; max-height: 660px; padding: 3px 8px 3px 3px; overflow-y: auto; scrollbar-color: var(--green) rgba(83, 66, 42, 0.14); scrollbar-width: thin; }
.pal-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; min-width: 0; padding: 13px; border: 1px solid rgba(85, 66, 41, 0.25); border-radius: 4px 10px 4px 8px; background: rgba(255, 250, 223, 0.42); }
.pal-card:nth-child(5n + 1) { background: rgba(244, 229, 190, 0.62); }
.pal-card:nth-child(5n + 2) { background: rgba(218, 230, 196, 0.6); }
.pal-card:nth-child(5n + 3) { background: rgba(207, 225, 226, 0.6); }
.pal-card:nth-child(5n + 4) { background: rgba(234, 211, 215, 0.6); }
.pal-card:nth-child(5n) { background: rgba(222, 214, 232, 0.6); }
.pal-card img { width: 72px; height: 72px; object-fit: contain; }
.pal-card-copy { min-width: 0; }
.pal-card h3 { margin: 0; font: 700 1rem Georgia, serif; }
.pal-meta { margin: 3px 0 8px; color: var(--muted); font-size: 0.66rem; font-weight: 800; }
.passive-list { display: flex; flex-wrap: wrap; gap: 4px; }
.passive-list span { max-width: 100%; padding: 3px 6px; overflow: hidden; border: 1px solid rgba(80, 118, 90, 0.22); border-radius: 3px; color: var(--green-dark); background: rgba(80,118,90,0.08); font-size: 0.61rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.passive-list .no-passives { color: #877762; border-color: rgba(100,80,50,0.15); background: transparent; }
.empty-results { padding: 28px; color: var(--muted); text-align: center; font: italic 0.9rem Georgia, serif; }
.import-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.import-actions > div, .saved-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.import-actions p { max-width: 460px; margin: 0; color: var(--muted); font-size: 0.72rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 16px; border: 1px solid transparent; border-radius: 4px 9px 4px 8px; font-size: 0.76rem; font-weight: 900; text-decoration: none; cursor: pointer; }
.button-primary { color: #f8eed3; background: var(--green-dark); }
.button-secondary { border-color: rgba(80, 64, 40, 0.36); color: #574832; background: rgba(252, 245, 215, 0.44); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.saved-panel { background: linear-gradient(145deg, #e3dfb3, #c5c790); }
.saved-panel .section-heading { margin-bottom: 20px; }

.site-footer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; min-height: 105px; padding: 20px max(24px, calc((100vw - 1180px) / 2)); color: #d7c5a4; background: #2e2116; }
.site-footer div strong { font: 700 1rem Georgia, serif; }
.site-footer p { margin: 3px 0 0; color: #aa987b; font-size: 0.72rem; }
.site-footer small { color: #a89576; font-size: 0.65rem; }

@media (max-width: 900px) {
  .import-hero { grid-template-columns: 1fr; }
  .path-note { width: min(100%, 580px); justify-self: center; }
  .format-help { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .site-header { grid-template-columns: auto 1fr; padding-inline: 14px; }
  .edition-badge { display: none; }
  .site-nav { justify-content: flex-end; overflow-x: auto; }
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 26px; }
  .hero-paper, .paper-panel { padding: 36px 22px; }
  .section-heading, .import-actions { align-items: start; flex-direction: column; }
  .pal-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .brand small { display: none; }
  .site-nav a { padding-inline: 6px; font-size: 0.66rem; }
  .site-nav a:nth-child(2) { display: none; }
  h1 { font-size: clamp(2.75rem, 14vw, 4.25rem); }
  .collection-summary { grid-template-columns: 1fr; }
  .review-tools { grid-template-columns: 1fr; }
  .pal-card { grid-template-columns: 58px 1fr; }
  .pal-card img { width: 58px; height: 58px; }
  .site-footer { grid-template-columns: auto 1fr; }
  .site-footer > small { grid-column: 1 / -1; }
}
