/* ClaimStaker by Imagery Atlas. Copyright (c) USMiner / Imagery Atlas. All rights reserved. */
:root {
    --gold: #f1c40f; --gold-dim: rgba(241, 196, 15, 0.85); --bg: #1c1c1c; --panel: rgba(12, 12, 12, 0.86); --inner: rgba(58, 58, 58, 0.8);
    --line: #8a8a8a; --text: #e8e8e8; --muted: #b4b4b4; --ok: #5bd37a; --warn: #f5a623; --err: #ff6b6b; --radius: 10px;
    --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; --head: 'Oswald', var(--sans);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body.app { overflow: hidden; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 500; letter-spacing: 0.02em; margin: 0 0 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #2a2a2a; color: var(--text);
    border-radius: 8px; padding: 7px 12px; cursor: pointer; font-family: var(--head); letter-spacing: 0.03em; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--gold); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--gold); color: #111; border-color: var(--gold); font-weight: 500; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 8px; font-size: 0.85em; }
.btn.danger { border-color: #a33; color: #ffb3b3; }
.btn.block { width: 100%; }
.btn.active { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.icon-btn { width: 32px; height: 32px; padding: 0; }

/* Top bar */
#topbar { position: absolute; top: 0; left: 0; right: 0; height: 58px; z-index: 1002; display: flex; align-items: center; gap: 14px; padding: 0 14px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.55)); }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; white-space: nowrap; }
.brand .name { font-family: var(--head); font-size: 26px; color: var(--gold); letter-spacing: 0.04em; }
.brand .by { font-size: 12px; color: var(--muted); }
#search { flex: 1; max-width: 460px; position: relative; }
#search input { width: 100%; background: rgba(40, 40, 40, 0.9); border: 1px solid var(--line); border-radius: 18px; padding: 7px 14px; }
#search input:focus { outline: none; border-color: var(--gold); }
#searchResults { position: absolute; top: 38px; left: 0; right: 0; background: #1f1f1f; border: 1px solid var(--line); border-radius: 8px; max-height: 320px; overflow: auto; display: none; }
#searchResults div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #333; }
#searchResults div:hover { background: #333; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--gold); cursor: pointer; object-fit: cover; background: #333; display: inline-flex; align-items: center; justify-content: center; font-family: var(--head); color: var(--gold); }
.menu { position: absolute; right: 12px; top: 54px; background: #1f1f1f; border: 1px solid var(--line); border-radius: 10px; min-width: 220px; padding: 6px; display: none; z-index: 1100; }
.menu.open { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; color: var(--text); text-decoration: none; border-radius: 6px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: #333; }
.menu .who { padding: 8px 10px; color: var(--muted); font-size: 0.85em; border-bottom: 1px solid #333; margin-bottom: 4px; }

/* Map */
#map { position: absolute; inset: 0; background: #2b2b2b; }
.leaflet-container { font-family: var(--sans); }
.leaflet-control-layers, .leaflet-bar a { background: rgba(20, 20, 20, 0.88) !important; color: var(--text) !important; border-color: #555 !important; }
.leaflet-control-layers { border-radius: 8px !important; }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.6) !important; color: #bbb !important; font-size: 10px; }
.leaflet-control-attribution a { color: #ddd !important; }
.leaflet-top.leaflet-right { top: 64px; transition: right 0.15s; }
body.inspector-open .leaflet-top.leaflet-right { right: 352px; }
@media (max-width: 820px) { body.inspector-open .leaflet-top.leaflet-right { right: 0; } }
.map-label { background: rgba(0, 0, 0, 0.72); color: #fff; border: 0; border-radius: 4px; padding: 1px 5px; font-size: 11px; white-space: nowrap; box-shadow: none; }
.map-label.gold { color: var(--gold); font-weight: 600; }
.side-label { overflow: visible; }
.side-label span { position: absolute; left: 0; top: 0; white-space: nowrap; background: rgba(0, 0, 0, 0.72); color: #fff; border-radius: 4px; padding: 1px 5px; font-size: 11px; pointer-events: none; }
.corner-num { width: 22px !important; height: 22px !important; margin: -11px 0 0 -11px !important; border-radius: 50%; background: #111; border: 2px solid var(--gold); color: var(--gold);
    font: 600 12px/18px var(--sans); text-align: center; }
.mon-icon { width: 14px !important; height: 14px !important; margin: -7px 0 0 -7px !important; }
.handle { width: 16px !important; height: 16px !important; margin: -8px 0 0 -8px !important; border-radius: 50%; background: var(--gold); border: 2px solid #111; cursor: grab; }
.handle.disc { background: #fff; border-color: #000; border-radius: 2px; transform: rotate(45deg); }
.corner-pick { width: 18px !important; height: 18px !important; margin: -9px 0 0 -9px !important; border-radius: 50%; border: 2px solid var(--gold); background: rgba(0, 0, 0, 0.6); cursor: pointer; }
.corner-pick:hover { background: var(--gold); }

/* Panels */
.panel { position: absolute; z-index: 1001; background: var(--panel); border: 1px solid #999; border-radius: var(--radius); color: var(--text); }
#side { top: 66px; left: 10px; bottom: 30px; width: 360px; display: flex; flex-direction: column; overflow: hidden; }
#side .scroll { overflow-y: auto; padding: 10px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }
#side .foot { padding: 10px; border-top: 1px solid #444; background: rgba(0, 0, 0, 0.4); }
.box { background: var(--inner); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.box > summary, .box-title { font-family: var(--head); font-size: 1.05em; color: #fff; letter-spacing: 0.03em; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.box > summary::-webkit-details-marker { display: none; }
.box > summary::after { content: '▾'; margin-left: auto; color: var(--gold); font-size: 0.9em; }
.box:not([open]) > summary::after { content: '▸'; }
.box .content { margin-top: 8px; }
.step { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #111; font: 600 13px/22px var(--sans); justify-content: center; }
label.f { display: block; font-size: 0.82em; color: var(--muted); margin: 6px 0 2px; }
input.t, select.t, textarea.t { width: 100%; background: #1d1d1d; border: 1px solid #666; border-radius: 6px; padding: 6px 8px; color: var(--text); }
input.t:focus, select.t:focus, textarea.t:focus { outline: none; border-color: var(--gold); }
textarea.t { resize: vertical; min-height: 54px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools .btn { flex-direction: column; padding: 9px 6px; font-size: 0.9em; }
.tools .btn svg { width: 22px; height: 22px; }
.hint { font-size: 0.82em; color: var(--muted); margin: 6px 0 0; line-height: 1.35; }
.hint b { color: var(--text); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 0.78em; border: 1px solid #666; color: var(--muted); }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.pill.warn { border-color: var(--warn); color: var(--warn); }
.pill.err { border-color: var(--err); color: var(--err); }
.pill.done { border-color: var(--gold); color: var(--gold); }

/* Claims list */
.claim { border: 1px solid #555; border-radius: 9px; padding: 7px 9px; margin-bottom: 6px; background: rgba(0, 0, 0, 0.25); cursor: pointer; }
.claim.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.claim .top { display: flex; align-items: center; gap: 6px; }
.claim .nm { font-family: var(--head); font-size: 1.02em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claim .meta { font-size: 0.8em; color: var(--muted); margin-top: 2px; }
.claim .msgs { font-size: 0.8em; margin-top: 4px; }
.claim .msgs div { margin-top: 2px; line-height: 1.3; }
.claim .msgs .e { color: var(--err); }
.claim .msgs .w { color: var(--warn); }
.claim .msgs .m { color: #9cc7ff; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(255, 255, 255, 0.4); }
.empty { text-align: center; color: var(--muted); font-size: 0.88em; padding: 10px 4px; }

/* Inspector (selected claim) */
#inspector { top: 66px; right: 10px; width: 340px; max-height: calc(100% - 100px); overflow-y: auto; padding: 12px; display: none; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; }
#inspector.open { display: block; }
#inspector h3 { display: flex; align-items: center; gap: 8px; }
#inspector .x { margin-left: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 3px 8px; font-size: 0.86em; margin: 6px 0; }
.kv div:nth-child(odd) { color: var(--muted); }
.calls { width: 100%; border-collapse: collapse; font-size: 0.8em; margin-top: 4px; }
.calls td, .calls th { border-bottom: 1px solid #444; padding: 3px 4px; text-align: left; }
.calls th { color: var(--muted); font-weight: normal; }
.arrows { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); gap: 3px; justify-content: center; margin: 6px 0; }
.arrows .btn { width: 34px; height: 34px; padding: 0; font-size: 16px; }
.lock { background: rgba(241, 196, 15, 0.08); border: 1px dashed var(--gold-dim); border-radius: 8px; padding: 8px; font-size: 0.85em; color: #e9e2c0; margin-top: 8px; }

/* Mode banner */
#banner { position: absolute; z-index: 1003; left: 50%; transform: translateX(-50%); top: 66px; background: rgba(12, 12, 12, 0.92); border: 1px solid var(--gold); color: #fff;
    border-radius: 20px; padding: 7px 14px; font-size: 0.9em; display: none; align-items: center; gap: 10px; max-width: min(720px, calc(100% - 760px)); min-width: 280px; }
#banner.open { display: flex; }

/* Toasts */
#toasts { position: absolute; z-index: 1200; bottom: 40px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: rgba(20, 20, 20, 0.95); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; max-width: 520px; font-size: 0.9em; pointer-events: auto; }
.toast.err { border-color: var(--err); }
.toast.ok { border-color: var(--ok); }

/* Notice bar */
#notice { position: absolute; z-index: 1003; top: 58px; left: 0; right: 0; text-align: center; padding: 5px; font-size: 0.85em; background: rgba(241, 196, 15, 0.92); color: #111; display: none; }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, 0.6); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-back.open { display: flex; }
.modal { background: #202020; border: 1px solid #999; border-radius: 12px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 18px; }
.modal h2 { font-size: 1.5em; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.checklist { max-height: 240px; overflow: auto; border: 1px solid #444; border-radius: 8px; padding: 6px; }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 4px; border-radius: 6px; }
.checklist label:hover { background: #2c2c2c; }
.usage { background: rgba(241, 196, 15, 0.08); border: 1px solid rgba(241, 196, 15, 0.4); border-radius: 8px; padding: 8px 10px; font-size: 0.9em; margin: 10px 0; }
.problems { border: 1px solid var(--err); border-radius: 8px; padding: 8px 10px; margin: 10px 0; font-size: 0.88em; }
.problems b { color: #fff; }
.progress { height: 6px; background: #333; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; width: 0; background: var(--gold); transition: width 0.3s; }
.preview-wrap { display: flex; gap: 14px; align-items: flex-start; }
.preview-wrap canvas { width: 170px; height: 220px; border-radius: 4px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); flex: none; }

/* State rules */
.rules { font-size: 0.85em; line-height: 1.4; }
.rules h4 { font-size: 1em; margin: 10px 0 3px; color: var(--gold); }
.rules ul { margin: 4px 0; padding-left: 18px; }
.rules li { margin: 2px 0; }

/* Mobile */
@media (max-width: 820px) {
    #side { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 46vh; border-radius: 14px 14px 0 0; }
    #side.min { height: 52px; }
    #inspector { top: auto; bottom: 46vh; left: 6px; right: 6px; width: auto; max-height: 40vh; }
    #banner { max-width: calc(100% - 20px); top: 62px; }
    .brand .by { display: none; }
    #search { max-width: none; }
    .top-right .hide-sm { display: none; }
    .leaflet-top.leaflet-right { top: 60px; }
}
.drag-grip { display: none; }
@media (max-width: 820px) { .drag-grip { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--gold-dim); margin: 6px auto 0; cursor: pointer; } }

/* Content pages */
body.page { overflow: auto; background: #161616; }
.page-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: rgba(0, 0, 0, 0.92); border-bottom: 1px solid #333; }
.page-head nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.page-head nav a { color: var(--text); text-decoration: none; font-family: var(--head); letter-spacing: 0.03em; }
.page-head nav a:hover, .page-head nav a.on { color: var(--gold); }
main.wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; line-height: 1.6; }
main.wrap h1 { font-size: 2.2em; color: #fff; }
main.wrap h2 { font-size: 1.45em; margin-top: 30px; color: var(--gold); }
main.wrap h3 { font-size: 1.15em; margin-top: 18px; color: #fff; }
main.wrap p, main.wrap li { color: #ddd; }
.lead { font-size: 1.15em; color: #eee; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 20px 0; }
.card { background: #222; border: 1px solid #444; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; }
.card.feature { border-color: var(--gold); }
.card h3 { margin-top: 0; color: var(--gold); }
.card .price { font-family: var(--head); font-size: 1.8em; color: #fff; margin: 4px 0; }
.card .sub { color: var(--muted); font-size: 0.9em; }
.card ul { padding-left: 18px; flex: 1; }
.card .btn { margin-top: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92em; }
table.data th, table.data td { border-bottom: 1px solid #3a3a3a; padding: 6px 8px; text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-weight: normal; }
.site-foot { border-top: 1px solid #333; padding: 20px; text-align: center; color: var(--muted); font-size: 0.85em; }
.site-foot a { color: var(--muted); margin: 0 8px; }
.note { background: #222; border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 6px; margin: 14px 0; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.toggle button { background: none; border: 0; padding: 6px 14px; cursor: pointer; }
.toggle button.on { background: var(--gold); color: #111; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: #222; border: 1px solid #3a3a3a; border-radius: 10px; padding: 12px; }
.stat .v { font-family: var(--head); font-size: 1.7em; color: #fff; }
.stat .k { color: var(--muted); font-size: 0.85em; }

/* Layers control */
.layers-ctl { position: relative; }
.layers-btn { display: flex; align-items: center; gap: 6px; background: rgba(20, 20, 20, 0.9); color: var(--text); border: 1px solid var(--gold); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-family: var(--head); letter-spacing: 0.03em; }
.layers-btn:hover { color: var(--gold); }
.layers-panel { display: none; position: absolute; right: 0; top: 40px; width: 270px; background: rgba(15, 15, 15, 0.95); border: 1px solid #999; border-radius: 10px; padding: 8px; color: var(--text); max-height: 70vh; overflow: auto; }
.layers-panel.open { display: block; }
.lp-title { font-family: var(--head); color: var(--gold); margin: 6px 4px 4px; letter-spacing: 0.04em; }
.lp-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border-radius: 8px; cursor: pointer; }
.lp-row:hover { background: #2a2a2a; }
.lp-row.on { background: rgba(241, 196, 15, 0.1); }
.lp-row b { display: block; font-weight: 500; }
.lp-row small { display: block; color: var(--muted); font-size: 0.78em; }
.lp-row input[type=range] { width: 100%; accent-color: var(--gold); }
.google-logo img { display: block; margin: 0 0 2px 2px; }

/* PLSS labels */
.plss-twp, .plss-sec, .plss-corner-label { overflow: visible; pointer-events: none; }
.plss-twp b, .plss-sec b { position: absolute; transform: translate(-50%, -60%); white-space: nowrap; font-family: var(--head); color: #fff; text-shadow: 0 0 3px #000, 0 0 6px #000, 0 0 2px #000; letter-spacing: 0.04em; }
.plss-twp b { font-size: 16px; color: var(--gold); }
.plss-twp small, .plss-sec small { position: absolute; transform: translate(-50%, 70%); white-space: nowrap; font-size: 10px; color: #fff; text-shadow: 0 0 3px #000, 0 0 5px #000; }
.plss-sec b { font-size: 26px; opacity: 0.92; }
.plss-sec small { transform: translate(-50%, 115%); }
.plss-corner span { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, 0.55); box-shadow: 0 0 0 1px #000; position: relative; cursor: pointer; }
.plss-corner span::before, .plss-corner span::after { content: ''; position: absolute; background: #fff; }
.plss-corner span::before { left: 6px; top: 1px; width: 2px; height: 12px; }
.plss-corner span::after { top: 6px; left: 1px; height: 2px; width: 12px; }
.plss-corner:hover span { border-color: var(--gold); }
.plss-corner-label span { position: absolute; transform: translate(10px, -26px); white-space: nowrap; font-size: 11px; background: rgba(0, 0, 0, 0.7); color: #fff; padding: 1px 5px; border-radius: 4px; }
.corner-pop { font-family: var(--sans); font-size: 13px; color: #111; }
