.resource-map {
  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  h2, p { margin: 0; }
  h2 { font-size: 17px; }
  #maps button, .workspace :is(button, input, select) {
    min-height: 38px;
    font: inherit;
    color: inherit;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
  }
  button { cursor: pointer; }
  button:hover { border-color: var(--brand); }
  :is(#maps, #tier, #category, #resources) button[aria-pressed="true"] {
    border-color: var(--brand);
    background: var(--active);
    color: var(--active-ink);
  }
  button:disabled { opacity: .55; cursor: default; }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  #maps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .workspace {
    display: grid;
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
    min-height: 480px;
    height: calc(100dvh - 226px);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
  }
  .catalog { min-height: 0; display: flex; flex-direction: column; background: var(--surface); padding: 12px; }
  .catalog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  #filters { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
  .filter-row { display: grid; gap: 8px; }
  .filter-label { color: var(--muted); font-size: 13px; }
  #tier, #category { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
  :is(#tier, #category) button { min-height: 32px; padding: 3px 8px; font-size: 13px; }
  #resources {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    gap: 4px;
    min-height: 0;
    overflow: auto;
    overscroll-behavior-y: contain;
    padding: 2px;
  }
  #resources button { text-align: left; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 9px; align-items: center; }
  .resource-group { display: grid; gap: 4px; }
  .resource-group + .resource-group { margin-top: 8px; }
  .resource-group h3 { margin: 0 0 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
  #resources img { grid-row: span 2; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; }
  #resources small { grid-column: 2; color: var(--muted); }
  .material { color: #f5bf62; }
  .herb { color: #79e4ad; }
  :root[data-theme="light"] & .catalog .material { color: #855300; }
  :root[data-theme="light"] & .catalog .herb { color: #18774b; }
  #toggle-list { display: none; }
  .map { position: relative; overflow: hidden; min-height: 0; background: #12131a; color: #fff; }
  canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
  canvas:active { cursor: grabbing; }
  canvas:focus-visible { outline-offset: -3px; }
  .controls, .map-info, #point-ring, #tooltip, #loading { position: absolute; }
  .controls { top: 10px; right: 10px; display: grid; gap: 4px; }
  .workspace .controls button, .map-info span, #tooltip, #loading {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
  }
  .workspace .controls button { width: 40px; font-size: 20px; }
  .map-info { bottom: 8px; left: 8px; right: 8px; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
  .map-info span, #tooltip, #loading { padding: 5px 8px; font-size: 13px; }
  #point-ring {
    width: 42px;
    height: 42px;
    transform: translate(-50%, -50%);
    border: 1px solid currentColor;
    border-radius: 50%;
    background: color-mix(in srgb, currentColor 16%, transparent);
    pointer-events: none;
  }
  #tooltip {
    z-index: 1;
    padding: 10px 12px;
    max-width: min(290px, 90%);
    background: #11151b;
    border-color: #343844;
    color: #f5eef2;
    box-shadow: 0 8px 22px #0006;
    pointer-events: none;
  }
  .point-resource { display: flex; align-items: center; gap: 8px; }
  .point-resource strong, #tooltip small { display: block; }
  #tooltip img { flex: none; border-radius: 5px; }
  #tooltip small { color: #bbc0cd; font-size: 12px; }
  #point-coordinates { margin-top: 7px; padding-top: 6px; border-top: 1px solid #343844; color: #f5bf62; font-variant-numeric: tabular-nums; }
  #tooltip #point-group { margin-block: 4px; color: #f5eef2; }
  #copy-feedback {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: calc(100% - 16px);
    padding: 6px 10px;
    border: 1px solid #59ac83;
    border-radius: 8px;
    background: #162824;
    box-shadow: 0 4px 12px #0005;
    color: #edfff4;
    font-size: 13px;
    font-weight: 650;
    pointer-events: none;
  }
  #copy-feedback span { color: #86eab3; }
  #loading { top: 50%; left: 50%; transform: translate(-50%, -50%); }
  #status { min-height: 26px; padding: 4px 0; color: var(--muted); }
  @media (max-width: 680px) {
    .workspace { height: auto; grid-template-columns: 1fr; }
    .map { height: max(450px, 60dvh); }
    .catalog { padding: 8px; }
    .catalog-heading { margin-bottom: 0; }
    #toggle-list { display: block; }
    #filters { display: none; margin-top: 8px; }
    .catalog:has(#toggle-list[aria-expanded="true"]) #filters { display: flex; }
    #resources { max-height: 200px; }
  }
}
