:root {
  --bg: #0d0004;
  --panel: #170408;
  --panel2: #21080d;
  --line: #765d35;
  --text: #dbc9a5;
  --muted: #927a5d;
  --lime: #d6a20b;
}

.topbar,
.sidebar {
  background-color: #160307;
}

.topbar { border-color: #765d35; }
.brand-mark,
.import-main { background: #d6a20b; }
.eyebrow,
.progress-top strong,
.filter-head { color: #d6a20b; }

.map-shell,
.map { background: #050406; }

.map-canvas {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 100%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: transform;
  user-select: none;
}

.terrain {
  inset: 0;
  background-color: #050406;
  background-image: url('assets/map-retro.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  transition: none;
}

.terrain::after,
.terrain > * { display: none; }

.markers {
  inset: 0;
  transition: none;
  z-index: 3;
  pointer-events: none;
}

.marker {
  width: 33px;
  height: 44px;
  border: 0;
  border-radius: 0;
  rotate: none;
  background-color: transparent;
  background-image: url('assets/markers@2x.png');
  background-repeat: no-repeat;
  background-size: 165px 220px;
  background-position: -33px -88px;
  box-shadow: none;
  filter: drop-shadow(0 3px 3px #000);
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  scale: 1;
  pointer-events: auto;
  image-rendering: auto;
  backface-visibility: hidden;
}

.marker.mega {
  background: transparent url('assets/markers@2x.png') no-repeat 0 -88px !important;
  background-size: 165px 220px !important;
}
.marker.static-marker {
  background-position: var(--sprite-x, 0) var(--sprite-y, -176px);
}
.marker::after,
.marker.mega::after { content: none; }
.marker::before {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 220px;
  padding: 7px 9px;
  border: 1px solid #765d35;
  border-radius: 6px;
  background: #160307f2;
  color: #f4ddb0;
  box-shadow: 0 7px 20px #000b;
  font: 700 11px/1.25 Inter, ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 5px) scale(.94);
  transition: opacity .14s, transform .14s;
}
.marker:hover {
  scale: 1.1 !important;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 0 5px #d6a20b);
  z-index: 20;
}
.marker:hover::before,
.marker:focus-visible::before { opacity: 1; transform: translate(-50%, 0) scale(1); }
.marker.collected:hover { opacity: 1; }
.marker.favorite { box-shadow: none; filter: drop-shadow(0 0 5px #f5d65d); }

.filter .symbol {
  width: 33px;
  height: 44px;
  border-radius: 0;
  font-size: 0;
  background-color: transparent;
  background-image: url('assets/markers@2x.png');
  background-repeat: no-repeat;
  background-size: 165px 220px;
  background-position: -33px -88px;
}
.filter .symbol.mega {
  background: transparent url('assets/markers@2x.png') no-repeat 0 -88px !important;
  background-size: 165px 220px !important;
}
.filter-button { width: 100%; color: inherit; text-align: left; background: transparent; }
.filter-button.active .check { background: #d6a20b; border-color: #d6a20b; }
.filter-button.active .check::after { content: '✓'; color: #160307; font-weight: 900; }
.filter-button:not(.active) { opacity: .48; }

.category-groups { margin-top: 14px; border-top: 1px solid #3b291f; }
.category-group { border-bottom: 1px solid #3b291f; }
.category-group > summary {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d6a20b;
  cursor: pointer;
  list-style: none;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.category-group > summary::-webkit-details-marker { display: none; }
.category-group > summary::before { content: '›'; font-size: 17px; transition: transform .18s; }
.category-group[open] > summary::before { transform: rotate(90deg); }
.group-toggle { margin-left: auto; border: 0; background: transparent; color: #9d876d; font-size: 9px; cursor: pointer; }
.category-list { display: grid; gap: 2px; padding: 0 0 9px; }
.category-filter {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #a68d70;
  text-align: left;
  cursor: pointer;
  opacity: .55;
}
.category-filter:hover { background: #2a0d12; opacity: .85; }
.category-filter.active { color: #dbc9a5; background: #2a0d12; opacity: 1; }
.category-filter small { color: #806b55; }
.category-icon {
  display: block;
  width: 33px;
  height: 44px;
  background: transparent url('assets/markers@2x.png') no-repeat var(--sprite-x, 0) var(--sprite-y, -176px);
  background-size: 165px 220px;
  transform: scale(.76);
  transform-origin: 50% 55%;
}

.map-toolbar,
.legend { background: #160307e8; border-color: #765d35; }
.map-toolbar button.active { background: #6b4d17; color: #ffe29a; }
.zoom-controls button { background: #160307; border-color: #765d35; color: #d6a20b; }
.marker-status {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid #765d35;
  border-radius: 5px;
  background: #160307e8;
  color: #e4c06a;
  font-size: 10px;
  font-weight: 800;
  pointer-events: none;
}

.import-dialog {
  max-height: calc(100vh - 30px);
  overflow-y: auto;
}

.detail-dialog.with-photo {
  width: min(720px, calc(100% - 28px));
  max-height: calc(100vh - 30px);
  overflow-y: auto;
}
.molar-photo {
  margin: 16px 0 12px;
  overflow: hidden;
  border: 1px solid #765d35;
  border-radius: 10px;
  background: #080306;
}
.molar-photo img {
  display: block;
  width: 100%;
  max-height: 48vh;
  object-fit: contain;
  background: #050305;
}
.molar-photo figcaption {
  padding: 7px 10px;
  color: #9d876d;
  font-size: 9px;
  text-align: center;
}

.hidden-input { display: none; }
.import-tools { margin-top: 10px; }
.folder-button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #576457;
  border-radius: 8px;
  background: #202b22;
  color: #e7dcc1;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.folder-button:hover { border-color: #d6a20b; color: #f2c94c; }

.save-guide {
  margin-top: 11px;
  border: 1px solid #39463c;
  border-radius: 9px;
  background: #101713;
  overflow: hidden;
}
.save-guide summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  color: #ded2b8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.save-guide summary::-webkit-details-marker { display: none; }
.save-guide summary::after { content: '⌄'; margin-left: auto; color: #d6a20b; }
.save-guide[open] summary::after { content: '⌃'; }
.save-guide summary span {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid #79621f;
  border-radius: 50%;
  color: #d6a20b;
}
.guide-body { padding: 0 13px 13px; border-top: 1px solid #2f3b31; }
.recommended-flow {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #8b6c16;
  border-radius: 8px;
  background: linear-gradient(135deg, #2a2008, #171b14 68%);
}
.recommended-label { color: #efbd24; font-size: 8px; font-weight: 950; letter-spacing: .16em; }
.recommended-flow h3,
.guide-panel h3 { margin: 5px 0 6px; color: #eee1c4; font-size: 12px; }
.recommended-flow ol { margin: 7px 0 10px; padding-left: 20px; color: #c4c9bc; font-size: 10px; line-height: 1.55; }
.recommended-flow kbd { padding: 1px 4px; border: 1px solid #766a49; border-radius: 3px; background: #191d16; color: #fff0c3; }
.recommended-flow code { color: #f1c749; font-family: Consolas,monospace; }
.recommended-flow p { margin: 8px 0 0; color: #8f998c; font-size: 9px; line-height: 1.4; }
.copy-main { width: 100%; padding: 9px; border: 0; border-radius: 6px; background: #d6a20b; color: #1b1504; font-size: 10px; font-weight: 950; cursor: pointer; }
.guide-tabs { display: flex; gap: 5px; padding: 11px 0 8px; }
.guide-tabs button {
  flex: 1;
  border: 1px solid #485348;
  border-radius: 6px;
  padding: 7px;
  background: #18211b;
  color: #9eaa9d;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.guide-tabs button.active { border-color: #a77c0b; background: #50390b; color: #f1d58b; }
.guide-panel ol,
.right-save ol { margin: 7px 0 10px; padding-left: 20px; color: #aeb8ab; font-size: 10px; line-height: 1.55; }
.guide-panel kbd { padding: 1px 4px; border: 1px solid #536055; border-radius: 3px; background: #253027; color: #e8e0ce; }
.path-box { display: flex; align-items: stretch; border: 1px solid #59655a; border-radius: 6px; overflow: hidden; }
.path-box code { flex: 1; min-width: 0; padding: 9px; color: #f1d58b; font: 10px Consolas,monospace; overflow-x: auto; white-space: nowrap; }
.path-box button { border: 0; border-left: 1px solid #59655a; padding: 0 10px; background: #273128; color: #d6a20b; font-size: 9px; font-weight: 900; cursor: pointer; }
.right-save { margin-top: 12px; padding: 10px; border-left: 3px solid #d6a20b; background: #1b241d; }
.right-save h3 { margin: 0 0 5px; color: #e8dcc2; font-size: 11px; }
.right-save ol { margin-bottom: 7px; }
.right-save p { margin: 0; color: #879388; font-size: 9px; line-height: 1.45; }
.platform-note { margin: 8px 0 0; padding: 8px; border-radius: 5px; background: #242116; color: #aaa48d; font-size: 9px; line-height: 1.45; }
.last-resort { margin-top: 10px; border-top: 1px solid #354037; padding-top: 8px; }
.last-resort > summary { padding: 4px 0; color: #9da99c; font-size: 9px; font-weight: 800; cursor: pointer; }
.last-resort ol { padding-left: 20px; color: #929e91; font-size: 9px; line-height: 1.5; }
.command-box { align-items: stretch; }
.command-box code { max-height: 70px; white-space: normal; overflow-y: auto; line-height: 1.4; }
.command-box button { flex: 0 0 76px; }
.result-actions { display: flex; gap: 7px; margin-top: 10px; }
.result-actions button { flex: 1; padding: 8px; border: 1px solid #77631e; border-radius: 6px; background: #2a2f24; color: #e8cf77; font-size: 9px; font-weight: 900; cursor: pointer; }
.result-actions button:last-child { border-color: #506052; color: #c5cec3; }
.import-result small { display: block; margin-top: 7px; color: #899489; font-size: 8px; line-height: 1.4; }

@media (max-width: 760px) {
  .map-canvas { height: 100%; }
}
