/* Mines: styles (linked from index.php) */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #111; color: #eee;
	font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .35; cursor: default; }
img { display: block; width: 100%; height: 100%; pointer-events: none; user-select: none; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }

/* top bar */
#hud { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 6px 10px; background: #000; border-bottom: 1px solid #333; }
#hud > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 600; }
#hud img { width: 22px; height: 22px; }
#hudHp { color: #f66; }
#hudHp.low { animation: blink 1s infinite; }
#hudMsg { flex: 1 1 100%; font-weight: 400 !important; white-space: normal !important; min-height: 1.35em; color: #ccc; }
@keyframes blink { 50% { opacity: .35; } }

/* board */
#boardWrap { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; position: relative; }
#board { display: grid; gap: 0; position: relative; touch-action: none; }   /* pinch zooms the board, not the page */
#zoomBar { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; z-index: 3; }
#zoomBar button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #555; background: rgba(20, 20, 20, .85); font-size: 20px; line-height: 1; padding: 0; }
/* other worlds: the whole board is lit in the world's colour (white turns to the tint, black stays black) */
#boardWrap[class^="theme-"]:not(.theme-home) #board::after { content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
.theme-ice #board::after   { background: #9fd4ff; }
.theme-lava #board::after  { background: #ffa070; }
.theme-alien #board::after { background: #b6ffa0; }
.wname { font-weight: 400; color: #bbb; }
.cell { padding: calc(var(--cell, 48px) * .06); border: 1px solid #222; background: #000; position: relative; border-radius: 0; }
.cell.unknown { background: #050505; border-color: #0b0b0b; cursor: default; }
/* a hidden glyph nearby: a twinkle in the dark (or a glow on the glyph stone / the monster carrying it) */
.cell.glint::after { content: ''; position: absolute; inset: 0; pointer-events: none;
	background: radial-gradient(circle at 50% 50%, rgba(140, 220, 255, .9) 0 6%, rgba(102, 204, 255, .35) 14%, transparent 40%);
	animation: twinkle 1.6s ease-in-out infinite; }
.cell.glint:not(.unknown) { box-shadow: inset 0 0 12px #6cf; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1); } }
.cell.walk img { opacity: .25; }
.cell.way img { opacity: 1; }   /* ladders, holes and shafts: drawn bright, they're the ways up and down */
.cell.way { background: #14301a; }
.cell.item { background: #2a2205; }
.cell.monster { background: #3a0b0b; }
.cell.gate { background: #0b2a3a; box-shadow: inset 0 0 14px #6cf; animation: hum 2s infinite; }
.cell.gate img { opacity: 1; }
@keyframes hum { 50% { box-shadow: inset 0 0 4px #6cf; } }
.cell.player { background: #2e8b2e; border-color: #6c6; }
.cell.player img { opacity: 1; }
/* The icons are white on a black square: 'screen' drops the black, so the cell's colour shows behind the icon
   (green: you, yellow: gold and ore, dark green: ladders and holes, red: monsters, blue: the stargate, brown: webs). */
.cell > img { mix-blend-mode: screen; }
.cell.loot { background: #8a6d00; }
.cell .under { position: absolute; right: 1px; bottom: 1px; width: 40%; height: 40%; }
/* hits left on a cracked wall: a white pill, above the world tint (z-index) so it stays readable */
.cell .badge { position: absolute; right: 2px; bottom: 2px; z-index: 2; --b: clamp(11px, calc(var(--cell, 48px) * .3), 16px);
	min-width: var(--b); padding: 0 3px; border-radius: var(--b); background: #fff; color: #000;
	font-size: calc(var(--b) * .7); font-weight: 700; line-height: var(--b); text-align: center; box-shadow: 0 0 2px #000; }
.cell.inrange { box-shadow: inset 0 0 0 2px rgba(255, 200, 0, .25); }
.cell.hot { background: #a00 !important; }
@media (hover: hover) { .cell:not(.unknown):hover { outline: 2px solid #fc0; outline-offset: -2px; z-index: 1; } }

/* bottom controls */
#controls { background: #000; border-top: 1px solid #333; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
#bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
#tools, #tabs, .row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tool, .tab, .go, .row button, .lvl { width: 52px; padding: 4px; background: #000; border: 1px solid #444; border-radius: 8px; }
.tool img, .tab img, .go img, .row img, .lvl img { width: 40px; height: 40px; margin: 0 auto; }
.tool small, .go small, .row small { display: block; font-size: 11px; text-align: center; }
.selected { border-color: #fc0 !important; background: #332800 !important; }
.tool.empty { opacity: .4; }
.go { border-color: #6c6; background: #143814; }

#panel { max-height: 40vh; overflow: auto; padding: 4px 8px 10px; border-bottom: 1px solid #333; margin-bottom: 6px; }
#panel h3 { margin: 4px 0 8px; font-size: 16px; }
#panel p { margin: 4px 0; }
.hint { color: #999; font-size: 13px; }
#panel .item { width: 76px; text-align: center; }   /* bag items (not the board's .cell.item tiles) */
#panel .item img { width: 40px; height: 40px; margin: 0 auto; }
.recipe { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid #222; flex-wrap: wrap; }
.recipe > img { width: 32px; height: 32px; }
.recipe .cost { display: flex; gap: 8px; flex: 0 0 auto; }
.recipe button { margin-left: auto; }
.recipe button + button { margin-left: 0; }   /* "Full" sits right before "Craft" */
.recipe b { flex: 1; min-width: 0; }   /* the name wraps before the buttons do (narrow phones) */
.recipe .cost span { display: inline-flex; align-items: center; gap: 2px; }
.recipe .cost img { width: 20px; height: 20px; }
.need { color: #f66; }
.have { color: #6c6; }
.recipe button, .overlay-box > button, #titleButtons button { padding: 8px 14px; border-radius: 8px; border: 1px solid #fc0; background: #332800; }
button.danger { border-color: #f66; background: #3a0b0b; }
button.secondary { border-color: #666; background: #222; }
.savebox { display: flex; flex-wrap: wrap; gap: 6px; }
.savebox input { flex: 1 1 12em; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid #555; background: #111; color: #eee; font: inherit; font-size: 16px; /* 16px stops iOS zooming in */ }
.savebox button { padding: 8px 12px; border-radius: 8px; border: 1px solid #fc0; background: #332800; }
.savebox button.secondary { border-color: #666; background: #222; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); display: grid; place-items: center; z-index: 10; padding: 16px; }
.overlay-box { background: #181818; border: 1px solid #444; border-radius: 12px; padding: 16px; width: min(440px, 100%); text-align: center; }
.overlay-box h2 { margin: 0 0 8px; }
#title .overlay-box { background: none; border: 0; }
#title .logo { width: 140px; height: 140px; margin: 0 auto 10px; }
#title h1 { margin: 0 0 4px; letter-spacing: 4px; }
#title { z-index: 20; }
#dialog .gate { width: 120px; height: 120px; margin: 0 auto 8px; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.avatars button { width: 48px; height: 48px; padding: 3px; background: #000; border: 1px solid #444; border-radius: 8px; }
.glyphs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.glyph { width: 52px; text-align: center; padding: 4px; border: 1px dashed #444; border-radius: 8px; color: #666; }
.glyph img { width: 36px; height: 36px; margin: 0 auto; }
.glyph span { display: block; height: 36px; line-height: 36px; font-size: 20px; }
.glyph small { display: block; font-size: 10px; }
.glyph.found { border: 1px solid #6cf; color: #8cf; }
#dial .gate { width: 90px; height: 90px; margin: 0 auto 6px; }
.slots, .address { display: flex; justify-content: center; gap: 8px; margin: 8px 0; }
.slot { width: 56px; height: 56px; padding: 6px; border: 2px dashed #555; border-radius: 50%; background: #000; }
.slot.full { border: 2px solid #6cf; box-shadow: 0 0 10px #6cf; }
.address img { width: 40px; height: 40px; }
#dial .row button { width: 64px; }
/* star chart */
#chart .overlay-box { width: min(460px, 100%); }
.starmap { width: 100%; max-width: 360px; background: radial-gradient(circle, #10183a, #04050c 70%); border-radius: 50%; display: block; margin: 0 auto; }
.starmap text { fill: #ccc; font-size: 9px; }
.starmap .star { cursor: pointer; }
.starmap { touch-action: none; cursor: grab; }   /* drag / pinch is handled by the game */
.zoombar { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.zoombar button { width: 40px; height: 32px; border-radius: 8px; border: 1px solid #555; background: #222; font-size: 18px; line-height: 1; }
#chart .overlay-box { max-height: 100%; overflow: auto; }
.worldlist { text-align: left; margin: 8px 0; }
.worldlist summary { cursor: pointer; color: #8cf; }
.worldlist input { width: 100%; margin: 6px 0; padding: 6px 8px; border-radius: 8px; border: 1px solid #555; background: #111; color: inherit; font: inherit; }
#chartList { max-height: 220px; overflow: auto; }
.wrow { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; padding: 5px 6px; background: none; border: 0; border-bottom: 1px solid #222; }
.wrow i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.wrow small { color: #999; margin-left: auto; text-align: right; }
.chartinfo { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 10px 0; text-align: left; }
.chartinfo > img, .chartinfo .unknown { width: 56px; height: 56px; flex: none; }
.chartinfo .unknown { display: grid; place-items: center; border: 1px dashed #555; border-radius: 50%; font-size: 24px; color: #888; }
.address.small { justify-content: flex-start; margin: 4px 0 0; }
.address.small img { width: 26px; height: 26px; }
.address .unk { width: 40px; height: 40px; display: grid; place-items: center; border: 1px dashed #555; border-radius: 6px; color: #888; }
.address.small .unk { width: 26px; height: 26px; font-size: 12px; }
.address .ag { display: flex; flex-direction: column; align-items: center; width: 52px; }
.address .ag small { font-size: 10px; color: #bbb; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address.small .ag { width: 44px; }
.address.small .ag small { font-size: 9px; }
.address.wrap { flex-wrap: wrap; justify-content: center; gap: 4px; }
/* home camp */
#dialog .overlay-box { max-height: 100%; overflow: auto; }
#dialogBody h2 img { display: inline-block; width: 28px; height: 28px; vertical-align: -5px; }
#dialog p > button, .camp .gear button, .camptable button { padding: 8px 14px; border-radius: 8px; border: 1px solid #fc0; background: #332800; }
#dialog p > button.secondary { border-color: #666; background: #222; }
#dialog p > button img { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; }
.camptable button { padding: 4px 8px; margin: 2px 0; font-size: 13px; }
.amt { white-space: nowrap; }
.amt img { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; }
.camptabs { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.camptabs button { display: flex; flex-direction: column; align-items: center; padding: 6px 10px; border-radius: 8px; border: 1px solid #444; background: #000; min-width: 72px; }
.camptabs img { width: 32px; height: 32px; }
.camptabs small { font-size: 11px; }
.camptable { width: 100%; border-collapse: collapse; font-size: 14px; }
.camptable td, .camptable th { padding: 6px 4px; border-bottom: 1px solid #333; text-align: left; }
.camptable td:first-child { white-space: nowrap; }
.camptable img { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; }
.gear { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #333; text-align: left; }
.gear > img { width: 40px; height: 40px; flex: none; }
.gear > div { flex: 1; min-width: 0; }
.gear small { color: #bbb; }
.gear small.next { color: #8cf; }
.gear .tier { color: #fc6; margin-left: 6px; letter-spacing: 1px; }
.gear button { flex: none; }
.camplog { min-height: 1.2em; color: #fc6; }
.quirks { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.dialog .quirks, #dialogBody .quirks { justify-content: center; }
.quirk { font-size: 11px; padding: 1px 7px; border: 1px solid #6a5; border-radius: 10px; color: #bfa; cursor: help; }
#chart p > button, .chartbtn { padding: 8px 14px; border-radius: 8px; border: 1px solid #6cf; background: #0b2a3a; }
#chart p > button.secondary { border-color: #666; background: #222; }
.chartbtn { display: inline-flex; align-items: center; gap: 6px; }
.chartbtn img { width: 22px; height: 22px; }
#dial p > button { margin: 2px; }
/* postcard */
#dialogBody.postcard { padding-top: 0; overflow: hidden; }
.sky { margin: 0 -16px 10px; height: 170px; position: relative; overflow: hidden; }
.sky .planet { position: absolute; width: 90px; height: 90px; right: 24px; top: 18px; mix-blend-mode: screen; }
.sky .crowd { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 6px; }
.sky .crowd img { width: 54px; height: 54px; mix-blend-mode: screen; opacity: .9; }
.sky .crowd img.me { width: 72px; height: 72px; }
.trips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0; }
.trip { width: 64px; text-align: center; }
.trip img, .trip span { width: 40px; height: 40px; margin: 0 auto; display: block; }
.trip span { line-height: 40px; border: 1px dashed #555; border-radius: 50%; color: #888; }
.trip small { display: block; font-size: 10px; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dial p > button { padding: 8px 16px; border-radius: 8px; border: 1px solid #6cf; background: #0b2a3a; }
#dial p > button.secondary { border-color: #666; background: #222; }
.diffs { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 6px 0; }
.diffs button { text-align: left; padding: 8px 12px; border-radius: 8px; border: 1px solid #555; background: #1a1a1a; }
.diffs button b { display: block; }
.diffs button small { color: #aaa; }
.credits { margin-top: 28px; font-size: 12px; color: #888; }
.credits a { color: #bbb; }
.version { margin-top: 6px; font-size: 11px; color: #555; }
#titleButtons { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.fighters { display: flex; align-items: center; justify-content: space-around; gap: 8px; }
.fighters > div { width: 40%; }
.fighters img { width: 72px; height: 72px; margin: 0 auto 4px; }
.fighters .vs { width: auto; font-weight: 800; color: #fc0; }
.bar { height: 8px; background: #400; border-radius: 4px; overflow: hidden; margin: 4px 0 2px; }
.bar > div { height: 100%; background: #e33; transition: width .3s; }
.combatLog { min-height: 2.7em; color: #ccc; }
#combat .row button { width: 76px; }

/* where you just picked something up: a short yellow flash (the board re-centres on you) */
.cell.flash::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; border: 3px solid #fc0;
	background: rgba(255, 204, 0, .35); animation: pickflash .8s ease-out forwards; }
@keyframes pickflash { from { opacity: 1; } to { opacity: 0; } }

/* map of the levels (full size / stacked) */
#mapview { grid-template-columns: minmax(0, 1fr); }   /* a big map scrolls inside the box instead of widening it */
#mapview .overlay-box { width: min(1100px, 100%); min-width: 0; max-height: 100%; display: flex; flex-direction: column; justify-self: center; }
.maptabs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 8px; }
.maptabs button { min-width: 36px; padding: 6px 8px; border-radius: 6px; border: 1px solid #444; background: #000; }
.maptabs button.selected { border-color: #fc0; background: #332800; }
.mapscroll { overflow: auto; max-width: 100%; flex: 1; min-height: 0; max-height: 70vh; background: #050505; border: 1px solid #333; border-radius: 6px; }
.mapscroll canvas { display: block; }
.mapbar button { padding: 8px 14px; border-radius: 8px; border: 1px solid #fc0; background: #332800; min-width: 40px; }
.mapbar button.secondary { border-color: #666; background: #222; }
.chartbtn img { width: 22px; height: 22px; vertical-align: -5px; display: inline-block; }

/* the Atlas: worlds found by all players */
#atlas .overlay-box { width: min(720px, 100%); max-height: 100%; overflow: auto; text-align: left; }
#atlas h2 { text-align: center; }
#atlas h2 img { display: inline-block; width: 28px; height: 28px; vertical-align: -5px; }
.atlasbar { display: flex; gap: 6px; margin: 8px 0; }
.atlasbar input { flex: 1; min-width: 0; padding: 6px 8px; border-radius: 8px; border: 1px solid #555; background: #111; color: inherit; font: inherit; }
.atlasbar select { padding: 6px; border-radius: 8px; border: 1px solid #555; background: #111; color: inherit; font: inherit; }
.aworld { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #2a2a2a; }
.aworld > i { width: 12px; height: 12px; border-radius: 50%; flex: none; align-self: flex-start; margin-top: 5px; }
.aworld > div { flex: 1; min-width: 0; }
.aworld small { color: #aaa; }
.aworld .you { color: #8f8; }
.aworld.home { border-bottom: 1px solid #554400; }
.aworld.current { background: rgba(255, 216, 107, .08); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.aworld .here { color: #ffd86b; font-weight: bold; }
.aworld .hint { display: block; margin: 2px 0 0; }
#atlas p > button { padding: 8px 14px; border-radius: 8px; border: 1px solid #666; background: #222; }
.aworld > button { flex: none; padding: 8px 14px; border-radius: 8px; border: 1px solid #fc0; background: #332800; }
