/* Look after valheimgame.com: near-black ground, Norse display type in capitals, Roboto Slab for reading,
   orange-to-red buttons with rough edges, thin tapered divider lines. Fonts are served from /static/fonts. */
@font-face { font-family: "Norse"; src: url(fonts/norse.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Norse Bold"; src: url(fonts/norse-bold.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto Slab"; src: url(fonts/roboto-slab.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #040f10;
  --panel: #111717;
  --panel-2: #181d1d;
  --line: #2d3030;
  --text: #d6d8d8;
  --heading: #fff;
  --muted: #8d8d8d;
  --accent: #dd6119;
  --accent-2: #ad2817;
  --link: #ff8201;
  --danger: #e06c5a;
  --ok: #7fc47a;
  --steam: #1b2838;
  --steam-2: #2a475e;
  --display: "Norse", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --display-bold: "Norse Bold", "Norse", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --body: "Roboto Slab", Rockwell, Georgia, serif;
  --rough: polygon(0 3px, 6% 0, 31% 2px, 58% 0, 94% 1px, 100% 4px, calc(100% - 2px) 55%, 100% calc(100% - 3px),
    71% 100%, 44% calc(100% - 2px), 12% 100%, 0 calc(100% - 4px), 2px 45%);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--body); }
h1, h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; color: var(--heading); line-height: 1; }
button, input { font: inherit; }
.muted { color: var(--muted); }
::selection { background: var(--accent-2); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---------- buttons ---------- */
button, .download-button, .steam-button { cursor: pointer; position: relative; padding: 9px 22px; border: 0; border-radius: 0;
  font-family: var(--display-bold); font-size: 1.25rem; line-height: 1.2; text-transform: uppercase; letter-spacing: .025em;
  color: #fff; text-decoration: none; clip-path: var(--rough);
  background-color: var(--accent-2);
  background-image: linear-gradient(#fff, #fff), var(--grain), linear-gradient(180deg, var(--accent), var(--accent-2));
  background-repeat: no-repeat, repeat, no-repeat; background-position: bottom, 0 0, 0 0;
  background-size: 100% 0, auto, 100% 100%;
  transition: background-size .5s, color .5s; }
button:hover:not(:disabled), .download-button:hover, .steam-button:hover { background-size: 100% 100%, auto, 100% 100%;
  color: var(--accent-2); transition-duration: .2s, .1s; }
button:focus-visible, .download-button:focus-visible, .steam-button:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px #fff; }
button:disabled { cursor: not-allowed; filter: saturate(0); opacity: .45; }
button.secondary, .buttons button { background-color: rgba(255,255,255,.2);
  background-image: linear-gradient(#fff, #fff); background-repeat: no-repeat; background-position: bottom; background-size: 100% 0; }
button.secondary:hover, .buttons button:hover { background-size: 100% 100%; }

/* text links in the header: the site's menu items */
button.link, a.link { clip-path: none; background: none; padding: 4px 2px; font-family: var(--display-bold); font-size: 1.1875rem;
  line-height: 1; text-transform: uppercase; letter-spacing: .02em; color: #fff; text-decoration: none; white-space: nowrap;
  transition: color .1s; }
button.link:hover:not(:disabled), a.link:hover { color: var(--accent); background: none; }
button.link:focus-visible, a.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 16px; height: auto; min-height: 100%; background-attachment: fixed;
  background: var(--grain), radial-gradient(ellipse at top, #1b2626 0%, var(--bg) 65%); }
.login-card { position: relative; width: 100%; max-width: 440px; background: rgba(17,23,23,.92); border: 1px solid var(--line);
  padding: 34px 28px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.login-card::before, .dialog::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent-2) 70%, transparent); }
.eyebrow { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; font-family: var(--display-bold); font-size: 1rem;
  text-transform: uppercase; letter-spacing: .2625em; color: #fff; }
.eyebrow::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,.25), transparent); }
.login-card h1 { margin: 0 0 12px; font-size: 3.4rem; line-height: .9; letter-spacing: -.01em; }
.subtitle { margin: 0 0 20px; color: var(--muted); line-height: 1.7; }
.error { margin: 0 0 14px; padding: 10px 12px; background: rgba(173,40,23,.18);
  border: 1px solid rgba(224,108,90,.5); color: #f2b3a8; }
.error:empty { display: none; }
.steam-button { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 16px;
  background-color: var(--steam);
  background-image: linear-gradient(#fff, #fff), var(--grain), linear-gradient(180deg, var(--steam-2), var(--steam)); }
.steam-button:hover { color: var(--steam); }
.steam-logo { width: 22px; height: 22px; border-radius: 50%; background:
  radial-gradient(circle at 68% 34%, #fff 0 18%, transparent 19%),
  radial-gradient(circle at 34% 68%, #fff 0 13%, transparent 14%), #171a21; border: 2px solid #fff; }
.hint { color: var(--muted); font-size: .88rem; line-height: 1.7; margin: 12px 0 18px; }
.password-login summary { cursor: pointer; color: var(--muted); }
.password-login summary:hover { color: var(--link); }
.password-login form { display: grid; gap: 12px; margin-top: 14px; }
.password-login label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.password-login input { padding: 10px 12px; border-radius: 0; border: 1px solid var(--line);
  background: var(--bg); color: #fff; }
.password-login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- map page ---------- */
.map-page { display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 22px; padding: 8px 20px; min-height: 58px;
  background: var(--grain), linear-gradient(180deg, #0a1415, var(--bg)); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 2.1rem; letter-spacing: -.01em; white-space: nowrap; }
.topbar form { margin: 0; }
.spacer { flex: 1; }
.status { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.status.live::before { content: "● "; color: var(--ok); }
.status.stale::before { content: "● "; color: var(--danger); }
.me { white-space: nowrap; }
button.link.me { color: var(--accent); }
button.link.me:hover { color: #fff; }
.panel-toggle { display: none; padding: 6px 14px; font-size: 1.1rem; }

.layout { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; background: #0a1114; }
.panel { width: 310px; overflow-y: auto; overflow-x: hidden; background: var(--grain), var(--panel); border-left: 1px solid var(--line);
  padding: 4px 18px 18px; }
.panel h2 { font-size: 1.55rem; letter-spacing: .01em; margin: 24px 0 10px; display: flex; align-items: center; gap: 10px; }
.panel h2::after { content: ""; flex: 1; min-width: 12px; height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,.22), transparent); }
.count { order: 1; font: 600 .78rem/1.5 var(--body); letter-spacing: 0; background: var(--accent-2); padding: 0 8px; color: #fff; }
.list { list-style: none; margin: 0 0 6px; padding: 0; }
.list li { padding: 6px 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px;
  border-left: 2px solid transparent; transition: color .1s; }
.list li:hover { background: var(--panel-2); border-left-color: var(--accent); color: #fff; }
.list .sub { color: var(--muted); font-size: .82rem; text-align: right; }
.list .empty { cursor: default; color: var(--muted); }
.list .empty:hover { background: none; border-left-color: transparent; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.check:hover { color: #fff; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.spoiler small { color: var(--muted); }
.buttons { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.buttons button { padding: 6px 14px; font-size: 1.05rem; }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: .85rem; }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid rgba(255,255,255,.3); flex: none; margin: 0 2px; }

/* ---------- points ---------- */
.points-card { margin-top: 16px; padding: 2px 16px 12px; background: var(--panel-2); border: 1px solid var(--line);
  border-top: 2px solid var(--accent-2); }
.points-card h2 { margin-top: 14px; }
.points-value { margin: 0; font-family: var(--display-bold); font-size: 3.4rem; color: var(--accent); line-height: 1; }
.points-value small { font-family: var(--body); font-size: .9rem; font-weight: 400; color: var(--muted); }
.points-detail { margin: 4px 0 10px; font-size: .85rem; }
/* ---------- boar counter ---------- */
.boar-card { margin-top: 12px; padding: 2px 16px 10px; background: var(--panel-2); border: 1px solid var(--line);
  border-top: 2px solid var(--accent-2); }
.boar-card.clickable { cursor: pointer; }
.boar-card.clickable:hover { border-color: var(--accent-2); }
.boar-card h2 { margin-top: 12px; }
.boar-value { margin: 0; display: flex; align-items: baseline; gap: 8px; font-family: var(--display-bold);
  font-size: 2.4rem; color: var(--accent); line-height: 1; }
.boar-value small { font-family: var(--body); font-size: .9rem; font-weight: 400; color: var(--muted); }
.boar-icon { width: 34px; height: 24px; align-self: center; flex: none;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 22'><path fill='%23dd6119' d='M3 9c0-4 5-7 12-7 5 0 9 2 11 4l3-1-1 3 3 2-2 3c0 3-2 5-4 5l-1 3h-3l-1-2h-8l-1 2H10l-1-3C5 17 3 13 3 9zm-3 1 3-2v3z'/><circle cx='25' cy='9' r='1.2' fill='%23040f10'/></svg>") center / contain no-repeat; }
.boar-card #boar-detail { margin: 6px 0 4px; }
.boar-spark[hidden] { display: none; }
.boar-spark { display: block; width: 100%; height: 24px; }
.boar-spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.points-rules summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.points-rules summary:hover { color: var(--link); }
.points-rules ul { margin: 8px 0 0; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.points-rules li { position: relative; padding: 2px 0 2px 18px; }
.points-rules li::before { content: ""; position: absolute; left: 1px; top: .6em; width: 7px; height: 7px; transform: rotate(45deg);
  border: 2px solid var(--accent-2); }

/* ---------- shop (a dialog opened from the points card) ---------- */
button.open-shop { width: 100%; margin: 2px 0 10px; }
.dialog.shop-dialog { max-width: min(900px, calc(100vw - 32px)); }
.shop-balance { margin: -4px 0 16px; color: var(--muted); }
.shop-balance b { font-family: var(--display-bold); font-weight: 400; font-size: 1.7rem; line-height: 1; color: var(--accent); margin: 0 2px; }
.shop { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.offer { min-width: 0; display: flex; flex-direction: column; padding: 12px 14px 14px; background: var(--panel-2); border: 1px solid var(--line);
  border-top: 2px solid var(--accent-2); }
.offer.unavailable { border-top-color: var(--line); }
.offer-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.offer-name { font-family: var(--display-bold); font-size: 1.45rem; line-height: 1.1; text-transform: uppercase; letter-spacing: .02em; color: #fff; }
.price { flex: none; font-size: .82rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.offer.unavailable .price { color: var(--muted); }
.offer-text { margin: 4px 0 12px; font-size: .84rem; line-height: 1.5; }
.offer-buy { display: flex; gap: 8px; align-items: stretch; margin-top: auto; }
.offer-buy select { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 0; border: 1px solid var(--line); background: var(--bg);
  color: #fff; font: inherit; font-size: .85rem; }
.offer-buy select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.offer-buy select[hidden] { display: none; }
.offer-buy button { flex: none; padding: 6px 16px; font-size: 1.1rem; }
.offer-buy select[hidden] + button, .offer-buy button:only-child { flex: 1; }
.offer-hint { font-size: .8rem; margin: 8px 0 0; min-height: 1.3em; }

/* ---------- dialogs ---------- */
.dialog { background: var(--grain), var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 0; padding: 22px 24px;
  max-width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.dialog::backdrop { background: rgba(2, 8, 9, .75); }
.dialog h2 { margin: 0 0 12px; font-size: 2.2rem; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dialog.wide { max-width: min(980px, calc(100vw - 32px)); width: 100%; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.table-wrap { overflow-x: auto; margin-top: 6px; }
#stats-table { border-collapse: collapse; width: 100%; font-size: .88rem; white-space: nowrap; }
#stats-table th, #stats-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
#stats-table th:first-child, #stats-table td:first-child { text-align: left; }
#stats-table th { font-family: var(--display-bold); font-size: 1.1rem; font-weight: 400; text-transform: uppercase; letter-spacing: .03em;
  color: #fff; position: sticky; top: 0; background: var(--panel); border-bottom: 2px solid var(--accent-2); }
#stats-table tbody tr:hover td { background: var(--panel-2); }
#stats-table tr.me td { background: rgba(221,97,25,.12); }
#stats-table .online::after { content: " ●"; color: var(--ok); font-size: .75rem; }
.biomes { font-size: .78rem; color: var(--muted); white-space: normal; text-align: left !important; min-width: 180px; }
.small { font-size: .8rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-2); color: #fff;
  border: 1px solid var(--line); border-left-width: 3px; padding: 10px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.6);
  z-index: 2000; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.ok { border-left-color: var(--ok); }
.toast.fail { border-left-color: var(--danger); }

/* ---------- map markers ---------- */
.leaflet-container { font: inherit; background: #0a1114; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel-2); color: var(--text); border-radius: 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.leaflet-popup-content-wrapper { border-top: 2px solid var(--accent-2); }
.leaflet-popup-content { margin: 10px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--accent); }
.leaflet-bar, .leaflet-touch .leaflet-bar { border: 1px solid var(--line); border-radius: 0; }
.leaflet-bar a, .leaflet-bar a:first-child, .leaflet-bar a:last-child { background: var(--panel); color: #fff; border-color: var(--line);
  border-radius: 0; }
.leaflet-bar a:hover { background: var(--accent-2); color: #fff; }
.leaflet-control-attribution { display: none; }
.pin { position: relative; }
/* Pins drawn like the game's map: cream icons with a dark outline, the name underneath. Every icon is a
   30 px box centred on the place (the pin's own corner sits 8 px up and left of it). */
.pin > :where(div:not(.label)) { position: absolute; left: -7px; top: -7px; width: 30px; height: 30px; background: center / contain no-repeat;
  transform-origin: 15px 15px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.75)); }
.label { position: absolute; left: 8px; top: 24px; transform: translateX(-50%); white-space: nowrap; font-size: .76rem; font-weight: 600;
  line-height: 1.15; color: #f6ecd0; text-align: center;
  text-shadow: -1px 0 #000, 1px 0 #000, 0 -1px #000, 0 1px #000, 0 2px 3px rgba(0,0,0,.9); pointer-events: none; }
.player-pin .dot { border-radius: 50%; filter: none; background: radial-gradient(circle, rgba(241,230,200,.38) 0 30%, transparent 68%); }
.player-pin.me .dot { background: radial-gradient(circle, rgba(255,130,1,.6) 0 30%, transparent 70%); }
.player-pin.dead .dot { background: none; }
.player-pin .arrow { z-index: 1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3 26.5 27.5 16 21.5 5.5 27.5Z' fill='%23f1e6c8' stroke='%2317110c' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M16 8.5V20' stroke='%237a6a45' stroke-width='1.4' stroke-linecap='round' opacity='.35'/%3E%3C/svg%3E"); }
.player-pin.me .arrow { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3 26.5 27.5 16 21.5 5.5 27.5Z' fill='%23f08a2e' stroke='%2317110c' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M16 8.5V20' stroke='%237a3407' stroke-width='1.4' stroke-linecap='round' opacity='.35'/%3E%3C/svg%3E"); }
.player-pin.dead .arrow { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 3 26.5 27.5 16 21.5 5.5 27.5Z' fill='%238d8d8d' stroke='%2317110c' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M16 8.5V20' stroke='%23333' stroke-width='1.4' stroke-linecap='round' opacity='.35'/%3E%3C/svg%3E"); }
.player-pin .label { top: 25px; font-family: var(--display-bold); font-size: 1.08rem; font-weight: 400; text-transform: uppercase;
  letter-spacing: .05em; color: #fff; }
.player-pin.me .label { color: #ffc27a; }
.player-pin.dead .label { color: #b9b9b9; }
.portal-pin .ring { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M12 28V14.5a4 4 0 0 1 8 0V28Z' fill='%23e2551a'/%3E%3Cpath d='M14 28V17a2 2 0 0 1 4 0V28Z' fill='%23ffd27a'/%3E%3Cpath d='M6.5 28.5V14a9.5 9.5 0 0 1 19 0V28.5H20V14.5a4 4 0 0 0-8 0V28.5Z' fill='%23cfc4a6' stroke='%2317110c' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M9.2 20h1.6M21.2 20h1.6M11 10.5l1.2 1.2M21 10.5l-1.2 1.2M16 6.5v1.6' stroke='%2317110c' stroke-width='1.3' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E"); }
.portal-pin.unlinked .ring { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M12 28V14.5a4 4 0 0 1 8 0V28Z' fill='%232b2927'/%3E%3Cpath d='M14 28V17a2 2 0 0 1 4 0V28Z' fill='%233d3a36'/%3E%3Cpath d='M6.5 28.5V14a9.5 9.5 0 0 1 19 0V28.5H20V14.5a4 4 0 0 0-8 0V28.5Z' fill='%23cfc4a6' stroke='%2317110c' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M9.2 20h1.6M21.2 20h1.6M11 10.5l1.2 1.2M21 10.5l-1.2 1.2M16 6.5v1.6' stroke='%2317110c' stroke-width='1.3' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E"); }
.portal-pin.unlinked .label { color: #b7b1a2; }
.grave-pin .stone { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 27.5V13a7 7 0 0 1 14 0V27.5Z' fill='%23d9d2bd' stroke='%2317110c' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M5.5 27.5h21v2.5h-21Z' fill='%238f866f' stroke='%2317110c' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M16 11.5v10M12.5 15h7M13.5 19.5l2.5 2 2.5-2' fill='none' stroke='%2317110c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.grave-pin.mine .stone { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 27.5V13a7 7 0 0 1 14 0V27.5Z' fill='%23ffb45e' stroke='%2317110c' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M5.5 27.5h21v2.5h-21Z' fill='%238f866f' stroke='%2317110c' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M16 11.5v10M12.5 15h7M13.5 19.5l2.5 2 2.5-2' fill='none' stroke='%2317110c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.grave-pin.mine .label { color: #ffc27a; }
.ship-pin .hull { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 1.8C22.5 8 23.5 19 20 30H12C8.5 19 9.5 8 16 1.8Z' fill='%23b9824c' stroke='%2317110c' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M16 6.5V27' stroke='%236b4423' stroke-width='1.5' stroke-linecap='round'/%3E%3Cpath d='M8.5 14.5h15' stroke='%2317110c' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M8.5 14.5h15' stroke='%23f1e6c8' stroke-width='2.6' stroke-linecap='round'/%3E%3Ccircle cx='16' cy='14.5' r='1.9' fill='%236b4423'/%3E%3C/svg%3E"); }
.cart-pin .cart { width: 26px; height: 26px; left: -5px; top: -5px; transform-origin: 13px 13px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M13 8V2.5M19 8V2.5' stroke='%2317110c' stroke-width='3.6' stroke-linecap='round'/%3E%3Cpath d='M13 8V2.5M19 8V2.5' stroke='%23b9824c' stroke-width='1.6' stroke-linecap='round'/%3E%3Crect x='4.5' y='12' width='4' height='10' rx='1.5' fill='%235a4632' stroke='%2317110c' stroke-width='1.6'/%3E%3Crect x='23.5' y='12' width='4' height='10' rx='1.5' fill='%235a4632' stroke='%2317110c' stroke-width='1.6'/%3E%3Crect x='9' y='8' width='14' height='19' rx='2' fill='%23b9824c' stroke='%2317110c' stroke-width='2'/%3E%3Cpath d='M13.5 9.5v16M18.5 9.5v16' stroke='%236b4423' stroke-width='1.3'/%3E%3C/svg%3E"); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 6px 14px; padding: 8px 16px; }
  .topbar h1 { font-size: 1.7rem; }
  button.link, a.link { font-size: 1.05rem; }
  .status { font-size: .78rem; }
  .panel-toggle { display: inline-block; }
  .panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 88vw); z-index: 1000;
    transform: translateX(100%); transition: transform .2s ease; box-shadow: -10px 0 30px rgba(0,0,0,.6); }
  .panel.open { transform: none; }
  .layout { position: relative; overflow: hidden; }   /* the closed panel waits off-screen; without this it widens the page */
  .login-card h1 { font-size: 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01s !important; }
}

/* ---------- mod page ---------- */
.mod-card { max-width: 580px; }
.mod-card h2 { font-size: 1.7rem; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.mod-card h2::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,.22), transparent); }
.mod-card code { background: var(--bg); border: 1px solid var(--line); padding: 1px 5px; font-size: .9em;
  overflow-wrap: anywhere; color: #fff; }
.mod-card .back { margin: 0 0 14px; }
.mod-card .back a { font-family: var(--display-bold); font-size: 1.1rem; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.mod-card .back a:hover { color: var(--accent); }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
ol.steps { list-style: none; padding-left: 0; counter-reset: step; }
ol.steps li { counter-increment: step; position: relative; padding-left: 28px; }
ol.steps li::before { content: counter(step) "."; position: absolute; left: 0; top: -3px; font-family: var(--display-bold);
  font-size: 1.4rem; color: var(--accent); }
.download-button { display: block; text-align: center; padding: 13px 16px; }

/* ---------- waypoint (own marker, right click / long press) ---------- */
.waypoint-pin .flag { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 22'%3E%3Cpath d='M3 1v20' stroke='%23f2e6c9' stroke-width='2'/%3E%3Cpath d='M4 2h10l-3 4 3 4H4z' fill='%23dd6119' stroke='%23040f10' stroke-width='1'/%3E%3C/svg%3E");
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.8)); }
.buttons button[aria-pressed="true"] { background-color: var(--accent-2); }
.buttons[hidden] { display: none; }

/* ---------- portal links and player trails ---------- */
.portal-link { stroke: #ffb45e; stroke-opacity: .6; }
.portal-link:hover { stroke-opacity: 1; }
.trail { stroke: #f2e6c9; stroke-opacity: .55; stroke-linecap: round; stroke-linejoin: round; }
.trail.me { stroke: var(--accent); stroke-opacity: .8; }
.leaflet-tooltip.link-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line); font: 13px var(--body); }
.leaflet-tooltip.link-tip::before { display: none; }

/* ---------- search ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 0;
  background: var(--bg); color: var(--text); font: 15px var(--body); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.search .small { margin: 4px 0 0; font-size: 13px; }
.search .small:empty { display: none; }

/* ---------- scale + coordinates on the map ---------- */
.map-info { font: 12px var(--body); color: var(--text); text-shadow: 0 1px 2px #000; pointer-events: none; }
.map-info .scale { box-sizing: border-box; border: 2px solid var(--text); border-top: 0; height: 9px; line-height: 0;
  padding: 0 0 0 4px; margin-bottom: 14px; font-size: 11px; white-space: nowrap; transition: width .2s; }
.map-info .coords { background: rgba(4,15,16,.75); padding: 2px 6px; display: inline-block; }
@media (hover: none) { .map-info .coords { display: none; } }
/* zoomed far out: names of graves and portals hidden, players and the marker keep theirs */
#map.far .grave-pin .label, #map.far .portal-pin .label { display: none; }

/* ---------- ruler ---------- */
.ruler { stroke: #fff; stroke-dasharray: 2 7; stroke-linecap: round; }
.ruler-dot { stroke: #fff; fill: var(--accent); fill-opacity: 1; }
#map.measuring { cursor: crosshair; }

/* ---------- tips ---------- */
.help { margin: 0; padding-left: 18px; display: grid; gap: 10px; max-width: 62ch; }
.help b { color: var(--heading); font-weight: 600; }
kbd { font: 13px var(--body); padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--bg); }
.dialog { box-sizing: border-box; }
.list li.warn .sub { color: var(--danger); }

/* ---------- progress to the next point, health in the player list ---------- */
.progress { height: 4px; background: rgba(255,255,255,.08); margin: 6px 0 4px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s; }
#players li { position: relative; }
#players .hp { position: absolute; left: 8px; bottom: 2px; height: 2px; background: var(--ok); opacity: .8; }
#players .hp.low { background: var(--danger); }

/* ---------- shared pins ---------- */
.shared-pin .badge { width: 24px; height: 24px; left: -4px; top: -4px; border-radius: 50%; display: grid; place-items: center;
  font: 13px/1 system-ui, sans-serif; background: #f2e6c9; border: 2px solid #17110c; box-shadow: 0 1px 3px rgba(0,0,0,.7); }
.shared-pin.kind-erz .badge { background: #c9d2db; }
.shared-pin.kind-hoehle .badge { background: #b9a58c; }
.shared-pin.kind-gefahr .badge { background: #ffb45e; }
.shared-pin.kind-basis .badge { background: #a8d08d; }
.shared-pin.kind-boss .badge { background: #e06c5a; }
.shared-pin.kind-handel .badge { background: #e8cf6a; }
.shared-pin.mine .badge { border-color: var(--accent); }
.pin-popup .small-button, .detail-facts .small-button { font-size: .95rem; padding: 5px 12px; margin-top: 8px; }
.pin-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.pin-kinds label { cursor: pointer; }
.pin-kinds input { position: absolute; opacity: 0; }
.pin-kinds span { display: inline-block; padding: 5px 10px; border: 1px solid var(--line); background: var(--bg); }
.pin-kinds input:checked + span { border-color: var(--accent); color: #fff; background: var(--panel-2); }
.pin-kinds input:focus-visible + span { outline: 2px solid var(--accent); }
.pin-text { display: grid; gap: 4px; }
.pin-text input { padding: 8px 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: 15px var(--body); border-radius: 0; }

/* ---------- last deaths ---------- */
.death-pin .skull { width: 22px; height: 22px; left: -3px; top: -3px; display: grid; place-items: center; font: 16px/1 system-ui, sans-serif;
  color: #f2e6c9; background: #3a1414; border: 2px solid #17110c; border-radius: 50%; }

/* ---------- news feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; max-height: 65vh; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; align-items: baseline; padding: 8px 4px;
  border-bottom: 1px solid var(--line); }
.feed li.new { background: rgba(221, 97, 25, .1); border-left: 2px solid var(--accent); }
.feed .feed-icon { grid-row: span 2; text-align: center; font: 16px system-ui, sans-serif; }
.feed .feed-time { grid-column: 2; font-size: .8rem; }
.feed .small-link { grid-column: 3; grid-row: 1 / span 2; font-size: .95rem; align-self: center; }
#open-feed .count { margin-left: 2px; vertical-align: 2px; }

/* ---------- statistics: sorting + details ---------- */
#stats-table th.sortable { cursor: pointer; }
#stats-table th.sortable:hover, #stats-table th.sorted { color: var(--accent); }
#stats-table th.sorted::after { content: " ▾"; }
#stats-table tr.clickable { cursor: pointer; }
#stats-table tr.detail td { background: var(--bg); white-space: normal; text-align: left; }
.detail-wrap { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; padding: 6px 2px; }
.detail-wrap h3 { margin: 0 0 8px; font: 400 1.1rem var(--display-bold); text-transform: uppercase; color: var(--heading); }
.detail-wrap p { margin: 2px 0; }
.bar-line { display: grid; grid-template-columns: 110px 1fr 130px; gap: 10px; align-items: center; margin: 3px 0; }
.bar-track { height: 8px; background: rgba(255,255,255,.06); }
.bar-track .bar { display: block; height: 100%; }
.bar-value { font-size: .8rem; text-align: right; }
@media (max-width: 760px) {
  .detail-wrap { grid-template-columns: 1fr; }
  .bar-line { grid-template-columns: 80px 1fr; }
  .bar-value { grid-column: 2; text-align: left; }
}

/* ---------- desktop: fold the panel away ---------- */
@media (min-width: 761px) {
  .panel-toggle { display: inline-block; }
  body.panel-folded .panel { display: none; }
}
