* { box-sizing: border-box; }
:root { color-scheme: dark; font: 15px/1.45 system-ui, sans-serif; color: #eee7d9; background: #1d1b19; }
body { margin: 0; }
header { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .85rem clamp(1rem, 4vw, 3rem); background: #221e1b; border-bottom: 1px solid #534436; }
.identity { display: flex; align-items: center; gap: .72rem; }
.identity strong { font: 700 1.6rem/1 Georgia, serif; white-space: nowrap; }
.crest { color: #da9567; }
#subtitle { color: #cec0aa; font-size: .9rem; }
button, select, input { font: inherit; color: inherit; }
select, input { border: 1px solid #665547; background: #28231f; padding: .48rem .65rem; border-radius: 4px; }
:focus-visible { outline: 2px solid #e9af86; outline-offset: 2px; }
.layout { display: grid; grid-template-columns: minmax(230px, 310px) minmax(0, 1fr); height: calc(100dvh - 62px); min-height: 400px; }
.catalog { padding: 1.35rem 1rem 1rem; overflow: auto; border-right: 1px solid #534436; }
h1, h2 { font: 700 1.35rem/1.25 Georgia, system-ui, serif; margin: 0 0 .75rem; }
#search-label { display: block; margin-bottom: .25rem; color: #cbbda9; }
#search { width: 100%; margin-bottom: .75rem; }
#results { list-style: none; padding: 0; margin: 0; }
#results li + li { border-top: 1px solid #43382e; }
#results button { width: 100%; text-align: start; padding: .63rem .5rem; display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; cursor: pointer; }
#results button:hover, #results button[aria-current="true"] { background: #393027; color: #f4c6a9; }
.bullet { color: #d08c67; }
.empty { color: #cbbda9; padding: .65rem .5rem; }
.map { overflow: hidden; position: relative; background: #302c24; touch-action: none; cursor: grab; }
.map.dragging { cursor: grabbing; }
#stage { position: absolute; top: 0; left: 0; transform-origin: top left; }
#stage img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
#pins { position: absolute; inset: 0; pointer-events: none; }
.pin { display: flex; justify-content: center; align-items: center; position: absolute; width: 29px; height: 29px; border: 1px solid #e9c7a2; border-radius: 50%; background: #4b2624; color: #ffe6c6; font-size: 13px; transform: translate(-50%, -50%) scale(var(--counter-scale,1)); cursor: pointer; pointer-events: auto; box-shadow: 0 1px 6px #0008; }
.pin[aria-current="true"] { background: #9a4132; color: #fff; }
.pin[hidden], .detail[hidden] { display: none; }
.controls { display: grid; gap: .35rem; position: absolute; top: .75rem; right: .75rem; }
.controls button, #close { background: #211c18; border: 1px solid #8b715d; border-radius: 4px; inline-size: 38px; block-size: 38px; cursor: pointer; }
.detail { position: absolute; bottom: .85rem; left: .85rem; right: 4rem; max-width: 32rem; background: #281f19f5; padding: 1rem 3rem 1rem 1rem; border: 1px solid #b08b6f; border-radius: 5px; }
.detail h2 { overflow-wrap: anywhere; }
.detail p { margin: 0; color: #d0bdab; }
#quarry-open, #catalog-return, #quarry-dialog button {
  border: 1px solid #a17a5d;
  border-radius: 4px;
  background: #372a22;
  color: #f6e7d8;
  min-height: 36px;
  padding: .4rem .65rem;
  cursor: pointer;
}
#quarry-open, #catalog-return { margin-top: .75rem; }
#catalog-return { margin-inline-end: .4rem; }
.recipe-item { min-width: 0; overflow-wrap: anywhere; }
.recipe-item button { display: block; margin-top: .35rem; text-align: start; color: #f4d0a5; }
#quarry-dialog {
  box-sizing: border-box;
  width: min(56rem, calc(100vw - 1rem));
  max-width: none;
  max-height: calc(100dvh - 1rem);
  padding: .75rem;
  border: 1px solid #a17a5d;
  border-radius: 6px;
  background: #251d18;
  color: #f6e7d8;
}
#quarry-dialog::backdrop { background: #100c09c9; }
.quarry-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.quarry-heading h2 { margin: .1rem 0 .65rem; overflow-wrap: anywhere; }
#quarry-stage { position: relative; background: #181612; }
#quarry-canvas { display: block; width: 100%; height: min(61dvh, 32rem); touch-action: none; cursor: grab; }
#quarry-canvas:active { cursor: grabbing; }
#quarry-minimap { position:absolute; right:.65rem; top:.65rem; width:clamp(64px,15vw,108px); aspect-ratio:1; border:1px solid #ae8d66; border-radius:50%; overflow:hidden; background:#302a22; pointer-events:none; }
#quarry-mini-world { position:absolute; inset:0; }
#quarry-mini-image { position:absolute; max-width:none; }
#quarry-north { position:absolute; top:5%; left:0; width:100%; text-align:center; color:#ffda9c; font-size:.7rem; text-shadow:0 1px 3px #000; }
.minimap-target { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:6px; height:6px; border-radius:50%; background:#ffd388; box-shadow:0 0 0 1px #251b16; }
#quarry-controls { position: absolute; display: flex; gap: .35rem; bottom: .45rem; right: .45rem; }
#quarry-controls button { min-width: 42px; }
#quarry-status { position: absolute; inset: 1rem auto auto 1rem; margin: 0; pointer-events: none; }
#quarry-help { margin: .6rem 0 0; color: #d0bdab; font-size: .9rem; }
#close { position: absolute; right: .45rem; top: .45rem; width: 32px; height: 32px; }
@media (max-width: 680px) { header { gap: .5rem; padding: .6rem .75rem; } .identity { gap: .38rem; } .identity strong { font-size: 1.32rem; } #subtitle { display: none; } select { max-width: 48%; } .layout { height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(330px, 59dvh) auto; } .map { grid-row: 1; } .catalog { grid-row: 2; max-height: 37dvh; border-right: 0; border-top: 1px solid #534436; padding: .8rem; } }

.catalog-modes { display: flex; gap: .35rem; margin-bottom: .9rem; }
.catalog-modes button { border: 1px solid #665547; background: #28231f; border-radius: 4px; padding: .35rem .65rem; cursor: pointer; }
.catalog-modes button[aria-pressed="true"] { background: #704432; border-color: #b67a57; }
.spawn-area { position: absolute; pointer-events: auto; border: 1px solid #ffd4a0; background: #742a1e70; cursor: pointer; }
.spawn-area[hidden] { display: none; }
.spawn-area:hover, .spawn-area[aria-current="true"] { background: #912a1fba; border-color: #fff2d3; }
.resource-area { border-color: #e0be67; background: #a776174f; }
.resource-area:hover, .resource-area[aria-current="true"] { border-color: #ffdd7d; background: #be8a2670; }

.catalog-modes { flex-wrap: wrap; }
.spawn-anchor { background: #7e392b; color: #ffe6c6; font-size: 12px; }
.waygate-anchor { background: #2c554b; border-color: #d6e1c7; font-size: 19px; }
.waygate-anchor[aria-current="true"] { background: #326c5e; }

#locations-nav { display:flex; align-items:center; gap:.6rem; margin-top:.65rem; }
#locations-nav[hidden] { display:none; }
#locations-nav button { cursor:pointer; padding:.1rem .65rem; border:1px solid #8b715d; background:#211c18; border-radius:4px; }
#locations-nav button:disabled { opacity:.5; cursor:default; }

#map[hidden], #recipe-panel[hidden] { display:none; }
#recipe-panel { overflow:auto; padding:clamp(1rem,3.5vw,2.75rem); }
#recipe-detail { max-width:55rem; margin:auto; }
#recipe-detail h2 { font-size:1.7rem; }
.location-status { color: #e0ba9e; font-size: .89rem; margin: .45rem 0; line-height: 1.4; overflow-wrap: anywhere; }
.recipe-variant > .location-status { grid-column: 1 / -1; margin-block: 0 .3rem; }
.journal-objectives li > div { min-width: 0; overflow-wrap: anywhere; }
.recipe-variant { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem 1rem; padding:1rem; margin:.85rem 0; background:#26211d; border:1px solid #534436; border-radius:6px; }
.recipe-variant h3 { margin:0 0 .45rem; color:#dac4ab; font-size:.9rem; font-weight:600; }
.recipe-variant ul { list-style:none; padding:0; margin:0; }
.recipe-variant li { display:flex; justify-content:space-between; gap:.5rem; padding:.35rem 0; border-bottom:1px solid #382f27; }
.recipe-variant li strong { flex:none; }
.recipe-time { grid-column:1/-1; margin:0 0 .2rem; color:#e0ba9e; }
.recipe-stations { grid-column:1/-1; margin-bottom:.25rem; }
.recipe-stations p { margin:0; }
.journal-description { color:#d0bdab; line-height:1.6; white-space:pre-line; }
.journal-objectives { list-style:none; padding:0; margin:1.2rem 0; }
.journal-objectives li { display:flex; justify-content:space-between; gap:1rem; padding:.85rem 0; border-bottom:1px solid #534436; }
.journal-map-link { flex:none; align-self:start; padding:.3rem .55rem; background:#392d25; border:1px solid #8f6c50; border-radius:4px; cursor:pointer; }
#item-filter { margin:.5rem 0; max-width:100%; }
#progress-tools { display:flex; flex-wrap:wrap; align-items:center; gap:.4rem; margin:.5rem 0; }
#progress-tools[hidden], #boss-progress[hidden] { display:none; }
#progress-tools button { padding:.25rem .4rem; background:#392d25; border:1px solid #8f6c50; border-radius:4px; cursor:pointer; }
#boss-progress { display:block; margin-top:.65rem; }
.journal-progress { display:flex; align-items:center; gap:.4rem; margin-top:.8rem; color:#e0c7ab; }
.item-stack { color:#e8caa9; }
.item-actions { display:flex; flex-wrap:wrap; gap:.5rem; margin:1rem 0; }
.item-actions button { padding:.5rem .7rem; background:#392d25; border:1px solid #8f6c50; border-radius:4px; cursor:pointer; }
@media (max-width:680px) {
  .layout.show-recipes { grid-template-rows:auto auto; }
  .show-recipes .catalog { grid-row:1; max-height:42dvh; }
  #recipe-panel { grid-row:2; min-height:44dvh; overflow:visible; }
}
@media (max-width:370px) { .recipe-variant { grid-template-columns:1fr; } }

.material-routes { grid-column: 1 / -1; margin-top: .45rem; }
.material-routes li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem .9rem; align-items: center; }
.material-routes li > span { min-width: 0; overflow-wrap: anywhere; }

#nearby-locations:not(:empty) { display: grid; justify-items: start; gap: .45rem; margin-block-start: .65rem; }
#nearby-locations button { text-align: start; }
