:root {
  color-scheme: dark;
  /* Palette: Tarkov menu charcoal with worn khaki/tan accents */
  --bg: #161613;
  --surface: #1d1c18;
  --raised: #25231e;
  --line: #3a372e;
  --line-soft: #2a2822;
  --ink: #ddd6c1;
  --muted: #948e7b;
  --green: #c2ae7c; /* primary accent (tan); kept the old name so existing rules follow */
  --tan-bright: #e0cd98;
  --gold: #d9a54a;
  --blue: #8fb0b8;
  --red: #c7684e;
  --ok: #8fa165;
  --font: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button,
select,
input[type="search"],
input[type="text"],
input[type="number"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
}
button {
  cursor: pointer;
}
button:hover {
  background: #2c2a23;
  border-color: #6f6853;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
input[type="checkbox"] {
  accent-color: var(--green);
  width: 17px;
  height: 17px;
  cursor: pointer;
  flex: none;
}
a {
  color: var(--green);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 22px;
  letter-spacing: -0.6px;
}
h2 {
  font-size: 18px;
}
h3 {
  font-size: 15px;
}
small,
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--green);
  font-weight: 700;
  text-transform: uppercase;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 23px;
  transform: rotate(-8deg);
}
header {
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.header-actions,
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.header-actions a {
  font-size: 12px;
  text-decoration: none;
  margin-left: 10px;
}
.primary {
  background: var(--green);
  color: #1a1814;
  border-color: var(--green);
  font-weight: 650;
}
.primary:hover {
  background: var(--tan-bright);
}
.workspace {
  display: grid;
  grid-template-columns: 294px minmax(0, 1fr) 335px;
  height: calc(100dvh - 91px);
  min-height: 620px;
}
.workspace.library-hidden {
  grid-template-columns: minmax(0, 1fr) 335px;
}
.workspace.library-hidden .library {
  display: none;
}
.library {
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #1a1916;
}
.library-head {
  padding: 18px 15px 12px;
  border-bottom: 1px solid var(--line);
}
.library-head h2 {
  font-size: 16px;
  margin-bottom: 12px;
}
.library-head input {
  width: 100%;
  margin: 8px 0;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.filter-grid select {
  width: 100%;
  min-width: 0;
  font-size: 12px;
  padding: 7px;
}
.filter-grid label {
  font-size: 11px;
  color: var(--muted);
}
.tabs {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}
.tabs button {
  border: 0;
  font-size: 12px;
  padding: 5px 8px;
  background: transparent;
}
.tabs button[aria-pressed="true"] {
  background: #34301f;
  color: var(--green);
}
#quest-count {
  font-size: 11px;
  margin-top: 10px;
  color: var(--muted);
}
.quest-list {
  overflow: auto;
  min-height: 0;
  flex: 1;
  padding: 6px 9px;
}
.quest-row {
  display: flex;
  gap: 9px;
  padding: 10px 7px;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
  border-radius: 2px;
}
.quest-row:has(input:checked) {
  background: #26241c;
}
.quest-row[data-focused="true"] {
  box-shadow: inset 2px 0 var(--green);
}
.quest-row input {
  margin-top: 4px;
}
.quest-open {
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  text-align: left;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
}
.quest-open small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  margin-top: 5px;
}
.badge {
  display: inline-block;
  font-size: 10px;
  border-radius: 2px;
  padding: 2px 5px;
  background: #2f2c22;
  color: #cdbf95;
  margin: 4px 4px 0 0;
}
.badge.warn {
  background: #463724;
  color: #edc890;
}
.badge.blue {
  background: #22302f;
  color: var(--blue);
}
.library-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
}
.library-foot button {
  font-size: 11px;
  padding: 3px 6px;
  margin-top: 6px;
}
.map-column {
  padding: 17px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.map-toolbar select {
  min-width: 140px;
  font-size: 15px;
  font-weight: 600;
}
.map-tools {
  display: flex;
  gap: 5px;
}
.map-tools button {
  padding: 6px 10px;
}
.map-options {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.map-options select {
  font-size: 11px;
  padding: 5px 7px;
  min-width: 0;
}
.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}
.legend b {
  color: var(--green);
}
.legend .gold {
  color: var(--gold);
}
.map-viewport {
  position: relative;
  flex: 1;
  min-height: 380px;
  background: #10100e;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  touch-action: none;
}
.map-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.map-viewport canvas.dragging {
  cursor: grabbing;
}
.map-stat {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: #161613e8;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 11px;
  pointer-events: none;
}
.map-tip {
  position: absolute;
  max-width: 285px;
  padding: 9px 12px;
  background: #161613f5;
  border: 1px solid var(--green);
  border-radius: 2px;
  pointer-events: none;
  font-size: 12px;
  z-index: 5;
}
.map-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  padding: 24px;
  width: min(320px, 85%);
  background: #161613eb;
  border: 1px solid var(--line);
  border-radius: 2px;
  pointer-events: none;
}
.map-empty .map-empty-close {
  position: absolute;
  top: 4px;
  right: 4px;
  margin: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
}
.map-empty .map-empty-close:hover {
  color: var(--ink);
  border-color: var(--line);
}
.map-empty h3 {
  font-size: 18px;
  margin-bottom: 7px;
}
.map-empty p {
  font-size: 12px;
  color: var(--muted);
}
.map-empty button {
  pointer-events: auto;
  margin-top: 13px;
}
.map-caption {
  font-size: 10px;
  color: var(--muted);
  padding-top: 9px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.reminder {
  padding: 9px 12px;
  border: 1px solid #a47443;
  border-radius: 2px;
  margin-bottom: 10px;
  background: #34281b;
  color: #f5d5a1;
  font-size: 12px;
}
.detail-pane {
  border-left: 1px solid var(--line);
  padding: 18px;
  overflow-y: auto;
  background: #1a1916;
  min-height: 0;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.section-title small {
  font-size: 11px;
}
.detail-pane details {
  margin: 14px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.detail-pane details:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}
.detail-pane summary {
  cursor: pointer;
  font-weight: 600;
  list-style-position: outside;
  margin-left: 13px;
}
.detail-pane summary small {
  font-weight: 400;
  font-size: 11px;
}
.packing-list {
  padding-left: 19px;
  margin: 10px 0;
}
.packing-list li {
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.packing-list small {
  display: block;
  font-size: 10px;
  margin-top: 3px;
}
.packing-list button {
  font-size: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: underline;
  color: var(--muted);
}
.quiet {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0;
}
.detail-title {
  margin: 18px 0 4px;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.detail-meta {
  font-size: 11px;
  color: var(--muted);
  margin: 9px 0;
}
.quest-actions {
  display: flex;
  gap: 7px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.quest-actions button {
  font-size: 12px;
}
.objective {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 10px;
  margin: 9px 0;
  background: #1f1e1a;
}
.objective[data-focused="true"] {
  border-color: var(--green);
}
.objective.done {
  opacity: 0.6;
}
.objective-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.objective-head label {
  font-size: 12px;
  cursor: pointer;
}
.objective-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 9px 0 0 27px;
}
.objective-actions button {
  font-size: 10px;
  padding: 3px 6px;
}
.objective-actions input {
  width: 59px;
  padding: 3px 5px;
  font-size: 11px;
}
.objective-actions small {
  font-size: 10px;
}
.objective-note {
  font-size: 10px;
  color: var(--muted);
  margin: 7px 0 0 27px;
}
.place-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 7px 0 0 27px;
}
.place-buttons button {
  font-size: 10px;
  padding: 4px 6px;
}
.warning-note {
  font-size: 11px;
  color: #e8c28b;
  background: #342b1d;
  border-left: 2px solid #d9b06d;
  padding: 8px 10px;
  margin: 11px 0;
}
.info-note {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 10px;
  background: #22211c;
  border-left: 2px solid #7a7254;
  margin: 11px 0;
}
.photo-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.photo-grid figure {
  margin: 0;
}
.photo-grid img {
  max-width: 100%;
  width: 100%;
  border-radius: 2px;
  background: #25231e;
}
.photo-grid figcaption {
  font-size: 11px;
  color: var(--muted);
  padding-top: 4px;
}
.photo-grid a {
  font-size: 11px;
}
.on-map-row {
  display: block;
  width: 100%;
  text-align: left;
  margin: 7px 0;
  font-size: 12px;
  background: #201f1a;
}
.on-map-row small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.welcome {
  padding: 18px 0;
}
.welcome h2 {
  font-size: 25px;
  letter-spacing: -0.6px;
  line-height: 1.2;
  margin-bottom: 13px;
}
.welcome p {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0;
}
.welcome .metric {
  font-size: 31px;
  color: var(--green);
  font-weight: 600;
  margin-top: 18px;
}
.welcome .metric small {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
dialog {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 25px;
  max-width: min(660px, 94vw);
  width: 660px;
  max-height: 86vh;
  overflow: auto;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin-bottom: 12px;
}
dialog p {
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}
dialog label {
  font-size: 12px;
  display: block;
  margin: 12px 0 4px;
}
.dialog-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.dialog-top button {
  padding: 0 8px;
  font-size: 20px;
}
.profile-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.profile-row button {
  font-size: 12px;
}
.profile-row strong {
  display: block;
}
.profile-row small {
  font-size: 11px;
}
.profile-form {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.profile-form input {
  flex: 1;
  min-width: 130px;
}
.dialog-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 15px;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--green);
  color: #1a1814;
  border-radius: 2px;
  box-shadow: 0 6px 25px #0008;
  z-index: 20;
  display: flex;
  gap: 15px;
  align-items: center;
  max-width: 90vw;
}
#toast[hidden] {
  display: none;
}
#toast button {
  background: transparent;
  color: inherit;
  border-color: #6f6853;
  padding: 3px 7px;
  font-size: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
[hidden] {
  display: none !important;
}
.coverage-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.coverage-row button {
  font-size: 12px;
}
.danger {
  color: var(--red);
}
@media (min-width: 1600px) {
  .workspace {
    grid-template-columns: 315px minmax(0, 1fr) 365px;
  }
  .workspace.library-hidden {
    grid-template-columns: minmax(0, 1fr) 365px;
  }
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: 250px minmax(0, 1fr);
    height: auto;
    min-height: calc(100dvh - 90px);
  }
  .workspace.library-hidden {
    grid-template-columns: 1fr;
  }
  .library {
    grid-row: 1/3;
    max-height: calc(100dvh - 90px);
    position: sticky;
    top: 0;
  }
  .detail-pane {
    border-left: 0;
    border-top: 1px solid var(--line);
    overflow: visible;
  }
  .map-column {
    height: 75vh;
    min-height: 590px;
  }
  .header-actions a {
    display: none;
  }
}
@media (max-width: 700px) {
  header {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  h1 {
    font-size: 20px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .header-actions {
    width: 100%;
  }
  .header-actions button,
  .header-actions select {
    font-size: 12px;
    padding: 6px 9px;
  }
  .workspace,
  .workspace.library-hidden {
    display: block;
    height: auto;
    min-height: 0;
  }
  .library {
    position: relative;
    max-height: 60vh;
    border-bottom: 1px solid var(--line);
    border-right: 0;
  }
  .library-head {
    padding: 12px;
  }
  .quest-list {
    max-height: 32vh;
  }
  .library-foot {
    display: none;
  }
  .map-column {
    padding: 12px;
    height: 68vh;
    min-height: 500px;
  }
  .map-toolbar select {
    font-size: 14px;
    min-width: 120px;
    max-width: 170px;
  }
  .map-toolbar {
    gap: 6px;
  }
  .map-tools button {
    padding: 5px 8px;
  }
  .map-viewport {
    min-height: 300px;
  }
  .map-caption {
    font-size: 9px;
  }
  .legend {
    gap: 8px;
    font-size: 10px;
  }
  .detail-pane {
    padding: 17px;
  }
  .profile-row {
    align-items: flex-start;
  }
  .profile-form select {
    max-width: 100%;
  }
}

/* ---------- Tarkov theme: typography & chrome ---------- */
h1,
h2,
h3,
.detail-title,
.welcome h2,
.map-toolbar select {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}
h2 {
  font-size: 21px;
}
h3 {
  font-size: 18px;
}
.detail-title {
  font-size: 28px;
  letter-spacing: 0;
}
header {
  background: #1a1916;
  padding: 12px 22px;
}
.brand {
  display: block;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 27px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--tan-bright);
}
.tagline {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
button,
select,
input[type="search"],
input[type="text"],
input[type="number"] {
  background: var(--raised);
}
button:hover {
  border-color: var(--green);
  background: #2c2a23;
}
.primary,
.primary:hover {
  color: #1a1814;
}
.map-viewport {
  border-color: var(--line);
  background: #10100e;
}
#toast {
  color: #1a1814;
  border-radius: 0;
}

/* ---------- Library: tabs, search, filters ---------- */
.library-head h2 {
  margin-bottom: 10px;
}
.tabs {
  margin: 0 0 10px;
  gap: 0;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 10px 7px;
  color: var(--muted);
  border-radius: 0;
}
.tabs button:hover {
  color: var(--ink);
  background: transparent;
}
.tabs button[aria-pressed="true"] {
  background: transparent;
  color: var(--tan-bright);
  box-shadow: inset 0 -2px var(--green);
}
#filters-panel summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 6px;
}
.count-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
}
#quest-count {
  margin: 0;
}
.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 11px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-button:hover {
  background: transparent;
  color: var(--ink);
}
.quest-row {
  border-radius: 0;
}
.quest-row:has(input:checked) {
  background: #26241c;
  box-shadow: inset 2px 0 var(--green);
}

/* ---------- Trader grid (the trader screen) ---------- */
.trader-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px 0 10px;
}
.trader-tile {
  position: relative;
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 10px 11px 11px;
  background: linear-gradient(180deg, #2a2822, #201f1a);
  border: 1px solid var(--line);
}
.trader-tile:hover {
  border-color: var(--green);
  background: linear-gradient(180deg, #312e26, #24221c);
}
.trader-mono {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 0.95;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.trader-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.1;
  margin-top: 4px;
}
.trader-progress {
  font-size: 11px;
  color: var(--muted);
}
.meter {
  display: block;
  height: 3px;
  background: var(--line-soft);
  margin-top: 6px;
}
.meter i {
  display: block;
  height: 100%;
  background: var(--green);
}
.trader-picked {
  position: absolute;
  top: 9px;
  right: 9px;
  font-size: 10px;
  padding: 1px 5px;
  background: var(--green);
  color: #1a1814;
  font-weight: 600;
}

/* ---------- One trader's quest list ---------- */
.trader-head {
  position: sticky;
  top: -6px;
  z-index: 1;
  background: #1a1916;
  padding: 8px 2px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.back-button {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}
.back-button::before {
  content: "‹ ";
  font-size: 15px;
}
.back-button:hover {
  background: transparent;
  color: var(--tan-bright);
}
.trader-title {
  font-size: 30px;
  line-height: 1.05;
  margin: 2px 0 8px;
  color: var(--tan-bright);
}
.trader-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.trader-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.level-input input {
  width: 58px;
  padding: 3px 6px;
  font-size: 12px;
}
.trader-row {
  align-items: center;
}
.trader-row .quest-open small {
  margin-top: 2px;
}
.trader-row[data-state="done"] .quest-open {
  color: var(--muted);
}
.trader-row[data-state="done"] .quest-open small {
  color: var(--ok);
}
.trader-row[data-state="locked"] .quest-open {
  color: #a9a28c;
}
.trader-row[data-state="locked"] .quest-open small {
  color: #a8826a;
}
.done-button {
  flex: none;
  font-size: 11px;
  padding: 3px 8px;
  color: var(--muted);
}
.done-button[aria-pressed="true"] {
  color: var(--ok);
  border-color: #56603f;
  background: #23271b;
}
.pad {
  padding: 8px 4px;
}
@media (max-width: 700px) {
  .tagline {
    display: none;
  }
  .wordmark {
    font-size: 22px;
  }
}

/* ---------- Trader tiles with portraits ---------- */
.trader-grid {
  grid-template-columns: 1fr 1fr;
}
.trader-tile {
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 7px;
}
.trader-tile[aria-pressed="true"] {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
.trader-text {
  display: grid;
  min-width: 0;
}
.trader-text .trader-name {
  margin-top: 0;
  font-size: 14px;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trader-portrait {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: #121210;
  border: 1px solid var(--line);
  overflow: hidden;
}
.trader-portrait .trader-mono {
  font-size: 17px;
}
.trader-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
}
.trader-portrait.large {
  width: 72px;
  height: 72px;
}
.trader-portrait.large .trader-mono {
  font-size: 32px;
}
.trader-tile .trader-picked {
  position: static;
  justify-self: start;
  margin-top: 4px;
  padding: 0 4px;
}

/* ---------- Trader picker (opens over the map) ---------- */
.workspace {
  position: relative;
}
.trader-panel {
  grid-column: 2 / -1;
  grid-row: 1;
  z-index: 4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #1a1916;
  border-left: 1px solid var(--line);
}
/* Pin every panel to its grid cell so the picker can sit on top of the map and details. */
.library {
  grid-column: 1;
  grid-row: 1;
}
.map-column {
  grid-column: 2;
  grid-row: 1;
}
.detail-pane {
  grid-column: 3;
  grid-row: 1;
}
.workspace.library-hidden .map-column {
  grid-column: 1;
}
.workspace.library-hidden .detail-pane {
  grid-column: 2;
}
.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #23211c, #1a1916);
}
.picker-title {
  display: flex;
  gap: 14px;
  align-items: center;
}
.picker-title .trader-title {
  margin: 0;
  font-size: 36px;
}
.picker-title .trader-title:focus {
  outline: none;
}
.picker-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.picker-head .trader-controls {
  gap: 16px;
}
.picker-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding: 6px 22px 22px;
}
.picker-group h3 {
  font-size: 15px;
  color: var(--muted);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px;
}
.picker-grid .trader-row {
  border: 1px solid var(--line-soft);
  background: #201f1a;
  padding: 7px 8px;
  gap: 8px;
}
.picker-grid .trader-row:hover {
  border-color: var(--line);
}
.picker-grid .trader-row:has(input:checked) {
  border-color: var(--green);
  background: #2a2720;
  box-shadow: none;
}
.picker-grid .quest-open {
  font-size: 13px;
  line-height: 1.25;
}
.picker-grid .done-button {
  font-size: 10px;
  padding: 2px 6px;
}
@media (max-width: 1150px) {
  .library {
    grid-row: 1 / 3;
  }
  .detail-pane {
    grid-column: 2;
    grid-row: 2;
  }
  .workspace.library-hidden .detail-pane {
    grid-column: 1;
  }
  .trader-panel {
    grid-column: 2;
    grid-row: 1 / 3;
    max-height: calc(100dvh - 90px);
    position: sticky;
    top: 0;
  }
}
@media (max-width: 700px) {
  .trader-panel {
    position: fixed;
    inset: 0;
    max-height: none;
    z-index: 30;
  }
  .picker-head {
    padding: 12px 14px;
  }
  .picker-body {
    padding: 4px 14px 18px;
  }
  .picker-title .trader-title {
    font-size: 28px;
  }
}

/* ---------- Objective photos ---------- */
.objective-photos {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
  margin: 9px 0 0 27px;
}
.objective-photos figure {
  margin: 0;
}
.objective-photos .photo-button {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  background: #121210;
  line-height: 0;
}
.objective-photos .photo-button:hover {
  border-color: var(--green);
}
.objective-photos img {
  width: 64px;
  height: 44px;
  object-fit: cover;
}
.objective-photos .photo-more {
  margin-left: 4px;
}
/* The focused objective shows its photos at full panel width: the exact spot first. */
.objective-photos.open {
  display: grid;
  gap: 10px;
  margin-left: 0;
}
.objective-photos.open img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
}
.objective-photos.open .is-map img {
  max-height: 200px;
  object-fit: contain;
  background: #121210;
}
.objective-photos figcaption {
  font-size: 12px;
  color: var(--ink);
  padding-top: 4px;
  line-height: 1.4;
}
.objective-photos .is-map figcaption {
  color: var(--muted);
}
.photo-dialog {
  width: min(1100px, 96vw);
  max-width: 96vw;
  padding: 16px 18px;
}
.photo-dialog .dialog-top p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}
.photo-view {
  margin: 10px 0;
  background: #0d0d0b;
  display: grid;
  place-items: center;
  min-height: 200px;
}
.photo-view img {
  max-width: 100%;
  max-height: 72vh;
  display: block;
}
.photo-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.photo-bar a {
  margin-left: auto;
}

.upcoming-list > li {
  display: grid;
  gap: 3px;
}
.upcoming-quest {
  justify-self: start;
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
  color: var(--tan-bright);
}
.upcoming-when {
  color: var(--muted);
}
.upcoming-needs {
  margin: 2px 0 0;
  padding-left: 16px;
  font-size: 12px;
}
#upcoming-panel summary small:not(:empty) {
  color: var(--tan-bright);
}

/* ---- Story chapters page ---- */
.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
}
.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 12px;
}
.segmented button[aria-pressed="true"] {
  background: var(--raised);
  color: var(--tan-bright);
  box-shadow: inset 0 -2px 0 var(--green);
}
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.story-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.story-card:hover {
  border-color: var(--green);
}
.story-card[data-state="done"] {
  opacity: 0.7;
}
.story-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.story-open:hover {
  background: transparent;
}
.story-art {
  position: relative;
  height: 120px;
  background: #0f0f0d;
  overflow: hidden;
}
.story-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(0.85) brightness(0.55) contrast(1.1);
  transition: filter 0.2s;
}
.story-card:hover .story-art img {
  filter: grayscale(0.4) brightness(0.7);
}
.story-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, var(--surface) 100%);
}
.story-text {
  position: relative;
  padding: 0 14px 14px;
  display: grid;
  gap: 7px;
}
.story-card .story-text {
  margin-top: -34px;
}
.story-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
}
.story-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--green);
  background: #161613dd;
  color: var(--tan-bright);
  font-size: 13px;
  letter-spacing: 0.05em;
}
.story-blurb {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}
.story-status {
  margin: 0;
  font-size: 12px;
  color: var(--ink);
}
.story-card[data-state="new"] .story-status {
  color: var(--muted);
}
.story-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #6f6853;
  background: #161613cc;
  color: var(--ok);
  font-size: 14px;
  line-height: 1;
}
.story-check[aria-pressed="true"] {
  border-color: var(--ok);
}
.story-wiki {
  position: absolute;
  top: 12px;
  right: 42px;
  font-size: 11px;
  color: var(--muted);
}
.story-banner {
  display: grid;
  grid-template-columns: minmax(200px, 320px) 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.story-banner .story-art {
  height: 170px;
  border: 1px solid var(--line);
}
.story-banner .story-art::after {
  display: none;
}
.story-banner .story-text {
  padding: 0;
}
.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}
.story-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.story-step {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.story-pick {
  flex: 1;
  display: grid;
  grid-template-columns: 30px 1fr;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  background: var(--surface);
}
.step-dot {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.step-meta {
  grid-column: 2;
  font-size: 11px;
  color: var(--muted);
}
.story-step[data-state="done"] .story-pick {
  color: var(--muted);
}
.story-step[data-state="done"] .step-dot {
  border-color: var(--ok);
  color: var(--ok);
}
.story-step[data-state="current"] .story-pick {
  border-color: var(--green);
  background: #2a271f;
  box-shadow: inset 3px 0 0 var(--tan-bright);
}
.story-step[data-state="current"] .step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #1a1814;
  font-weight: 700;
}
.story-step[data-state="current"] .step-meta {
  color: var(--tan-bright);
}
.story-step[data-optional="true"] .step-text {
  font-style: italic;
}
.step-map {
  font-size: 12px;
  padding: 0 12px;
}
@media (max-width: 700px) {
  .story-banner {
    grid-template-columns: 1fr;
  }
}

/* ======== Layout v2: scrolling page, lists under the map ======== */
@media (min-width: 1151px) {
  header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 91px;
    box-sizing: border-box;
  }
  .workspace,
  .workspace.library-hidden {
    height: auto;
    min-height: calc(100dvh - 91px);
    align-items: start;
  }
  .library,
  .detail-pane,
  .trader-panel {
    position: sticky;
    top: 91px;
    height: calc(100dvh - 91px);
    align-self: start;
  }
  .map-column {
    min-height: calc(100dvh - 91px);
  }
  .map-viewport {
    flex: none;
    height: calc(100dvh - 91px - 128px);
    min-height: 440px;
  }
}
@media (max-width: 1150px) {
  .map-column {
    height: auto;
    min-height: 0;
  }
  .map-viewport {
    flex: none;
    height: 70vh;
    min-height: 420px;
  }
}

/* Progress counters next to the map selector */
.progress-counters {
  display: flex;
  gap: 8px;
  margin-left: auto;
  margin-right: 8px;
}
.counter {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 8px;
  align-items: baseline;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  line-height: 1.2;
}
.counter-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.counter strong {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 18px;
  color: var(--tan-bright);
  grid-row: span 2;
}
.counter-left {
  font-size: 10px;
  color: var(--muted);
}
.counter.kappa {
  border-color: #6f6853;
}

/* Map layer chips and floor buttons */
.layer-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 2px;
  color: var(--muted);
}
.layer-chip i {
  width: 8px;
  height: 8px;
  border: 1px solid var(--chip);
}
.layer-chip small {
  color: var(--muted);
  font-size: 10px;
}
.layer-chip[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--chip);
}
.layer-chip[aria-pressed="true"] i {
  background: var(--chip);
}
.floor-buttons {
  display: inline-flex;
  border: 1px solid var(--line);
}
.floor-buttons button {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  padding: 5px 10px;
}
.floor-buttons button + button {
  border-left: 1px solid var(--line);
}
.floor-buttons button[aria-pressed="true"] {
  background: var(--raised);
  color: var(--tan-bright);
  box-shadow: inset 0 -2px 0 var(--green);
}

/* Overlays on the map */
.map-overlay {
  position: absolute;
  z-index: 3;
  background: #141412ee;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 11.5px;
  max-width: 300px;
}
.map-overlay[hidden] {
  display: none;
}
.overlay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tan-bright);
}
.overlay-toggle {
  padding: 0 6px;
  font-size: 13px;
  line-height: 18px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}
.boss-legend {
  top: 10px;
  left: 10px;
  min-width: 180px;
}
.boss-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px 4px;
  display: grid;
  gap: 3px;
}
.boss-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
}
.boss-pct {
  color: var(--tan-bright);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.boss-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  margin-top: -2px;
}
.boss-none {
  margin: 0;
  padding: 6px 10px;
  color: var(--muted);
}
.boss-src {
  display: block;
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 9.5px;
}
.map-todo {
  right: 10px;
  bottom: 10px;
  width: min(300px, 45%);
}
.todo-list {
  list-style: none;
  margin: 0;
  padding: 3px 0;
  max-height: 34vh;
  overflow-y: auto;
}
.todo-row {
  display: grid;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 4px 10px;
  gap: 1px;
}
.todo-row:hover {
  background: #2a271f;
}
.todo-what {
  color: var(--ink);
  font-size: 11.5px;
}
.todo-quest {
  color: var(--muted);
  font-size: 10px;
}

/* Raid lists: under the map (two columns) or in the right panel (stacked) */
.bottom-dock {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.bottom-dock[hidden] {
  display: none;
}
.raid-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.raid-lists h3 {
  font-size: 14px;
  margin: 0 0 6px;
  color: var(--tan-bright);
}
.raid-lists h3 small {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}
.raid-lists .lists-keep h3 + div + h3,
.raid-lists .lists-keep > h3:nth-of-type(2) {
  margin-top: 18px;
}
.bottom-dock .lists-keep {
  order: -1;
}
.raid-lists.docked-side {
  grid-template-columns: 1fr;
  gap: 18px;
}
.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-close {
  padding: 0 9px;
  font-size: 18px;
  line-height: 26px;
}
.side-hint {
  margin: 0 0 14px;
}
.prereqs .link-button {
  font-size: 12px;
}
@media (max-width: 900px) {
  .raid-lists {
    grid-template-columns: 1fr;
  }
  .progress-counters {
    margin-left: 0;
  }
}

.wordmark a {
  color: inherit;
  text-decoration: none;
}

.data-date {
  align-self: center;
  margin-left: 4px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* PvE / PvP switch under the trader tiles. */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 2px 0 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.mode-option {
  border: 0;
  border-radius: 0;
  padding: 9px 0;
  background: var(--surface);
  color: var(--muted);
  font: 600 15px/1 var(--font-display);
  letter-spacing: 0.08em;
  cursor: pointer;
}
.mode-option + .mode-option {
  border-left: 1px solid var(--line);
}
.mode-option:hover {
  color: var(--ink);
}
.mode-option[aria-checked="true"] {
  background: var(--green);
  color: #1a1814;
}
