/* Layout: full-screen WebGL canvas with a translucent HUD; modal "field note" cards styled like a naturalist's notebook. */
:root {
  --paper: #f6f0e1; --paper-2: #ebe2cc; --ink: #2b2a22; --ink-soft: #5d584a; --rule: #d8cdb0;
  --moss: #4f7a3a; --moss-deep: #355a27; --clay: #b85c38; --sun: #e3a62b; --sky: #8fc4ea; --water: #3a7ac8;
  --hud-bg: rgba(20, 28, 18, 0.62); --hud-fg: #f3efe2;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif; --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #0e140c; color: var(--ink); font-family: var(--font-ui); font-size: 15px; -webkit-text-size-adjust: 100%; }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
[hidden] { display: none !important; }
h2, h3 { font-family: var(--font-display); font-weight: 600; text-wrap: balance; margin: 0; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; color: var(--hud-fg); padding-top: env(safe-area-inset-top, 0px); }
#hud > * { pointer-events: auto; }
#topbar { position: absolute; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; pointer-events: none; }
.pill { background: var(--hud-bg); backdrop-filter: blur(6px); border-radius: 10px; padding: 7px 12px; line-height: 1.25; }
#biome-pill { max-width: 46%; min-width: 0; }
#biome-pill b { display: block; font-family: var(--font-display); font-size: 16px; }
#biome-pill span { display: block; font-size: 11.5px; opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clock { text-align: center; font-variant-numeric: tabular-nums; }
#clock span { display: block; } #weather { font-size: 11.5px; opacity: 0.8; } #weather.rain { color: #9fd0ff; opacity: 1; }
#score { text-align: right; } #level { display: block; font-family: var(--font-display); font-size: 15px; } #points { font-size: 12px; opacity: 0.85; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: rgba(255,255,255,0.85); mix-blend-mode: difference; }
#crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; } #crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
#target { position: absolute; left: 50%; top: calc(50% + 22px); transform: translateX(-50%); background: var(--hud-bg); backdrop-filter: blur(6px); border-radius: 10px; padding: 7px 12px; text-align: center; max-width: min(92vw, 420px); pointer-events: none; }
#target b { display: block; font-family: var(--font-display); font-size: 16px; } #target i { display: block; font-size: 12px; opacity: 0.8; } #target span { display: block; font-size: 12px; color: #cfe6a8; margin-top: 2px; }
#toasts { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--hud-bg); backdrop-filter: blur(6px); border-left: 4px solid var(--sun); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; line-height: 1.3; animation: toastin .3s ease-out; max-width: 100%; }
.toast.good { border-color: #8fd36a; } .toast.bad { border-color: #e06a4a; } .toast.out { opacity: 0; transition: opacity .4s; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }
#hotbar-wrap { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(96vw, 620px); display: flex; flex-direction: column; align-items: center; gap: 4px; }
#item-name { font-size: 13px; background: var(--hud-bg); padding: 3px 10px; border-radius: 6px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hotbar { display: flex; gap: 4px; padding: 4px; background: var(--hud-bg); backdrop-filter: blur(6px); border-radius: 12px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
#hotbar::-webkit-scrollbar { display: none; }
.slot { position: relative; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.25); display: grid; place-items: center; cursor: pointer; }
.slot.sel { border-color: var(--sun); background: rgba(227,166,43,0.2); }
.slot canvas { image-rendering: pixelated; width: 40px; height: 40px; }
.slot .count { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot .key { position: absolute; left: 4px; top: 1px; font-size: 10px; opacity: 0.6; }
#side-buttons { position: absolute; right: 12px; top: calc(70px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; gap: 6px; }
#side-buttons button { background: var(--hud-bg); backdrop-filter: blur(6px); color: var(--hud-fg); border: 1px solid rgba(255,255,255,0.15); border-radius: 10px; padding: 8px 12px; font-size: 13px; min-width: 84px; text-align: left; }
#side-buttons button small { opacity: 0.55; font-size: 11px; margin-left: 4px; }
#quest-tracker { position: absolute; left: 12px; top: calc(70px + env(safe-area-inset-top, 0px)); width: min(260px, 44vw); background: var(--hud-bg); backdrop-filter: blur(6px); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; line-height: 1.3; pointer-events: none; }
#quest-tracker small { opacity: 0.6; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; } #quest-tracker b { display: block; font-family: var(--font-display); font-size: 15px; } #quest-tracker span { display: block; opacity: 0.9; }
.bar { height: 6px; background: rgba(255,255,255,0.18); border-radius: 3px; overflow: hidden; margin-top: 6px; } .bar i { display: block; height: 100%; background: #8fd36a; border-radius: 3px; transition: width .4s; }
#ff { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--sun); color: #2b2a22; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }
#lock-hint { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: var(--hud-bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; pointer-events: none; }
#touch-ui { display: none; }
body.touch #touch-ui { display: block; }
body.touch #lock-hint { display: none; }
/* Touch layout, like holding a controller: joystick bottom-left, menu stack top-right, Run and Jump bottom-right. */
#joystick { position: absolute; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.3); left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); pointer-events: none; opacity: 0.55; }
#joystick.active { opacity: 1; } #joystick .knob { position: absolute; left: 30px; top: 30px; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,0.55); }
#btn-jump, #btn-sprint { position: absolute; right: 14px; border-radius: 50%; background: rgba(255,255,255,0.14); border: 2px solid rgba(255,255,255,0.3); color: #fff; font-weight: 700; font-size: 13px; }
#btn-jump { width: 64px; height: 64px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
#btn-ride { position: absolute; right: 14px; width: 64px; height: 64px; border-radius: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); background: rgba(227,166,43,0.55); border: 2px solid rgba(255,230,160,0.8); color: #fff; font-weight: 700; font-size: 14px; } #btn-ride[hidden] { display: none; }
#btn-sprint { width: 54px; height: 54px; right: 19px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } #btn-sprint.on { background: rgba(227,166,43,0.5); }
body.touch #side-buttons { top: calc(56px + env(safe-area-inset-top, 0px)); right: 10px; gap: 5px; }
body.touch #side-buttons button { min-width: 0; padding: 6px 10px; font-size: 12px; } body.touch #side-buttons button small { display: none; }
body.touch #quest-tracker { width: min(220px, 40vw); font-size: 11.5px; top: calc(56px + env(safe-area-inset-top, 0px)); }
body.touch #hotbar-wrap { width: clamp(220px, calc(100vw - 330px), 520px); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
body.touch .slot { width: 46px; height: 46px; } body.touch .slot canvas { width: 36px; height: 36px; }
body.touch #toasts { bottom: 118px; width: min(60vw, 420px); }
body.touch #target { top: calc(50% + 18px); }
@media (max-height: 460px) { body.touch #biome-pill span, body.touch #quest-tracker span { display: none; } body.touch #quest-tracker { padding: 6px 10px; } body.touch #topbar .pill { padding: 5px 10px; } body.touch #clock { font-size: 13px; } }
@media (max-width: 640px) { #biome-pill span { display: none; } #score { display: none; } #quest-tracker { top: calc(66px + env(safe-area-inset-top, 0px)); } }

/* ---------- Start screen ---------- */
.screen { position: absolute; inset: 0; overflow: auto; background: radial-gradient(ellipse at 50% 0%, #2e5a27 0%, #142316 55%, #0e140c 100%); color: var(--paper); padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.screen .inner { max-width: 860px; margin: 0 auto; }
.screen h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(38px, 8vw, 68px); margin: 10px 0 0; letter-spacing: -0.01em; line-height: 1; }
.screen h1 small { display: block; font-size: 15px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; opacity: 0.7; margin-bottom: 10px; }
.screen .lede { font-size: clamp(15px, 2.2vw, 18px); max-width: 60ch; opacity: 0.92; line-height: 1.45; }
.screen h2 { font-size: 20px; margin: 26px 0 10px; }
#regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.region { text-align: left; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); color: inherit; border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 54px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
.region:hover, .region:focus-visible { background: rgba(255,255,255,0.14); outline: 2px solid var(--sun); }
.region b { font-family: var(--font-display); font-size: 16px; } .region span { font-size: 12px; opacity: 0.75; grid-column: 2; line-height: 1.3; }
.swatch { grid-row: 1 / 3; width: 54px; height: 54px; border-radius: 8px; position: relative; overflow: hidden; } .swatch i { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; }
#continue-wrap { margin: 18px 0 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.primary { background: var(--sun); color: #2b2a22; border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 700; font-size: 16px; }
.ghost { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,0.3); border-radius: 10px; padding: 11px 16px; }
.screen .foot { font-size: 12.5px; opacity: 0.6; margin-top: 26px; line-height: 1.4; }

/* ---------- Modal cards ---------- */
#modal { position: absolute; inset: 0; background: rgba(10, 14, 8, 0.55); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 10; }
.card { position: relative; background: var(--paper); color: var(--ink); width: min(100%, 640px); max-height: calc(100% - 8px); overflow: auto; border-radius: 14px; padding: 20px 22px 22px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); line-height: 1.45; background-image: linear-gradient(transparent 0, transparent 100%); }
.card.journal { width: min(100%, 760px); }
.card .close { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--paper-2); color: var(--ink); font-size: 22px; line-height: 1; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--clay); font-weight: 700; margin-bottom: 6px; }
.card h2 { font-size: 26px; line-height: 1.1; } .card h3 { font-size: 15px; margin: 18px 0 6px; color: var(--moss-deep); text-transform: uppercase; letter-spacing: .08em; }
.head { display: flex; gap: 16px; align-items: flex-start; padding-right: 36px; } .head > div:last-child { min-width: 0; }
.art { flex: 0 0 auto; width: 96px; height: 96px; border-radius: 12px; background: var(--paper-2); display: grid; place-items: center; overflow: hidden; }
.art canvas { width: 88px; height: 88px; image-rendering: pixelated; } .art.q { font-family: var(--font-display); font-size: 40px; color: var(--rule); }
.sci { font-style: italic; color: var(--ink-soft); margin: 4px 0 0; font-size: 14px; }
.teach { font-family: var(--font-display); font-size: 17px; line-height: 1.4; margin: 14px 0 0; padding: 12px 14px; background: var(--paper-2); border-left: 4px solid var(--moss); border-radius: 0 10px 10px 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--rule); color: var(--ink); }
.tag.n { background: #d7e8c8; color: #2d5a1e; } .tag.p { background: #f6e2b8; color: #7a4e07; } .tag.bad { background: #f3cfc4; color: #7a2a12; } .tag.e { background: #dcd8f0; color: #3f3570; } .tag.w { background: #cfe3f3; color: #1a4d7a; }
table.req { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; } table.req th { text-align: left; width: 34%; color: var(--ink-soft); font-weight: 600; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; } table.req td { padding: 6px 0; border-bottom: 1px solid var(--rule); }
ul.facts { margin: 0; padding-left: 18px; } ul.facts li { margin: 6px 0; font-size: 14.5px; }
.seedline { font-size: 13px; color: var(--ink-soft); margin: 14px 0 0; }
.status { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #e6eedb; } .status.mid { background: #f6ecc9; } .status.bad { background: #f3d9d0; }
.status .row { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; } .status .bar { background: rgba(0,0,0,0.1); } .status .bar i { background: var(--moss); }
ul.diag { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 5px; font-size: 13.5px; } ul.diag li { padding-left: 22px; position: relative; } ul.diag li b { display: inline-block; min-width: 64px; }
ul.diag li::before { content: '✓'; position: absolute; left: 0; font-weight: 700; color: #2d7a1e; } ul.diag li.warn::before { content: '!'; color: #b07a07; } ul.diag li.no::before { content: '✕'; color: #b32d12; }
.fit { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: #e6eedb; font-size: 14px; } .fit p { margin: 8px 0 0; font-weight: 700; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; font-size: 13px; } .meters label { font-weight: 700; display: block; } .meters small { color: var(--ink-soft); font-size: 11.5px; }
.ph { position: relative; height: 10px; border-radius: 5px; margin: 6px 0 2px; background: linear-gradient(90deg, #e04a2a 0%, #f0a030 25%, #e8e03a 40%, #6fc04a 50%, #3aa0c8 65%, #4a3ab8 85%, #2a1a6a 100%); } .ph i { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.meters .bar { background: rgba(0,0,0,0.1); margin: 6px 0 2px; height: 10px; } .bar.blue i { background: var(--water); } .bar.sun i { background: var(--sun); }
ol.horizons { list-style: none; padding: 0; margin: 0; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; } ol.horizons li { display: flex; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--rule); font-size: 13.5px; align-items: flex-start; } ol.horizons li:last-child { border-bottom: 0; }
ol.horizons li b { font-family: var(--font-display); font-size: 18px; min-width: 28px; color: var(--clay); } ol.horizons li.here { background: #e6eedb; } ol.horizons li.here b::after { content: ' ◀'; font-size: 11px; }
nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; } nav.tabs button { border: 1px solid var(--rule); background: transparent; color: var(--ink); border-radius: 20px; padding: 6px 12px; } nav.tabs button.on { background: var(--moss); color: #fff; border-color: var(--moss); } nav.tabs small { opacity: 0.7; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.entry { border: 1px solid var(--rule); background: #fff8; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); font-size: 12.5px; text-align: center; } .entry .art { width: 72px; height: 72px; } .entry .art canvas { width: 64px; height: 64px; } .entry.locked { opacity: 0.55; cursor: default; } .entry:not(.locked):hover { border-color: var(--moss); }
ol.quests { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; } ol.quests li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rule); font-size: 14px; } ol.quests li.cur { border-color: var(--moss); background: #e6eedb; } ol.quests li.done { opacity: 0.8; }
ol.quests .n { width: 30px; height: 30px; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); } ol.quests li.done .n { background: var(--moss); color: #fff; }
ol.quests b { display: block; font-family: var(--font-display); font-size: 16px; } ol.quests span { display: block; color: var(--ink-soft); } ol.quests em { display: block; font-size: 13px; margin-top: 4px; } ol.quests small { color: var(--ink-soft); white-space: nowrap; } ol.quests .bar { background: rgba(0,0,0,0.1); } ol.quests .bar i { background: var(--moss); }
.q { font-size: 17px; font-weight: 700; margin: 6px 0 10px; } .opts { display: grid; gap: 8px; } .opts button { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--rule); background: #fff8; color: var(--ink); } .opts button:hover:not(:disabled) { border-color: var(--moss); } .opts button.right { background: #d7e8c8; border-color: #2d7a1e; } .opts button.wrong { background: #f3cfc4; border-color: #b32d12; }
.explain { margin-top: 14px; padding: 12px 14px; background: var(--paper-2); border-radius: 10px; font-size: 14.5px; } .explain .primary { margin-top: 10px; }
.menu { display: grid; gap: 8px; margin-top: 14px; } .menu button { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rule); background: #fff8; color: var(--ink); font-weight: 600; } .menu button.primary { background: var(--sun); border-color: var(--sun); } .menu button.danger { color: #b32d12; }
.small { font-size: 12.5px; color: var(--ink-soft); }
.mapwrap { margin: 12px 0; background: #0e140c; border-radius: 10px; padding: 6px; display: flex; justify-content: center; } .mapwrap canvas { max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; }
ul.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; } ul.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .bar i { transition: none; } }
@media (max-width: 480px) { .card { padding: 16px 14px 18px; } .head { flex-direction: row; } .art { width: 72px; height: 72px; } .art canvas { width: 64px; height: 64px; } .card h2 { font-size: 22px; } }

/* ---------- Shared worlds ---------- */
.small-lede { font-size: 14.5px; opacity: 0.85; }
.shared-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 14px; margin-top: 4px; }
.shared-form label { display: grid; gap: 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; opacity: 0.85; min-width: 0; }
.shared-form input, .shared-form select { font: inherit; font-size: 15px; padding: 9px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.3); color: var(--paper); min-width: 0; width: 100%; text-transform: none; letter-spacing: 0; }
.shared-form input:focus, .shared-form select:focus { outline: 2px solid var(--sun); border-color: transparent; }
.shared-form .row { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.status-line, .error-line { grid-column: 1 / -1; font-size: 14px; padding: 8px 10px; border-radius: 8px; }
.status-line { background: rgba(227,166,43,0.18); } .error-line { background: rgba(224,106,74,0.25); }
#rejoin-wrap { margin: 18px 0 4px; }
#shared-pill { position: absolute; left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top, 0px)); max-width: min(60vw, 420px); text-align: center; pointer-events: none; }
#shared-pill b { display: block; font-size: 13px; font-family: var(--font-display); } #shared-pill span { display: block; font-size: 11.5px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch #shared-pill { top: calc(60px + env(safe-area-inset-top, 0px)); max-width: 44vw; }

/* ---------- Logo ---------- */
.hero { display: block; width: min(96vw, 1320px); max-width: none; height: auto; border-radius: 18px; box-shadow: 0 22px 60px rgba(0,0,0,0.5); margin: 0 0 10px; position: relative; left: 50%; transform: translateX(-50%); } /* the title picture breaks out of the text column so it fills the screen */
.tagline { font-family: var(--font-display); font-size: 15px; letter-spacing: .14em; text-transform: uppercase; opacity: 0.75; margin: 16px 0 6px; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (orientation: portrait) and (max-width: 600px) { body.touch #hotbar-wrap { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: 94vw; } body.touch #toasts { bottom: 250px; width: 92vw; } }
@media (max-width: 640px) { body.touch #quest-tracker { top: calc(100px + env(safe-area-inset-top, 0px)); } body.touch #side-buttons { top: calc(78px + env(safe-area-inset-top, 0px)); } }
#shared-pill.live span { color: #9fe39a; } #shared-pill.down span { color: #ffb3a3; white-space: normal; } #shared-pill.wait span { color: #f0d08a; }
#side-buttons button.exit { margin-top: 6px; border-color: rgba(255,170,150,0.45); color: #ffd9cf; }

/* ---------- Characters: colours, compass ---------- */
.swatches { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 2px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--sun); }
#compass { position: absolute; left: 50%; transform: translateX(-50%); top: calc(118px + env(safe-area-inset-top, 0px)); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; pointer-events: none; max-width: 70vw; }
#compass .peer { display: flex; align-items: center; gap: 8px; background: var(--hud-bg); backdrop-filter: blur(6px); border-radius: 20px; padding: 4px 12px 4px 6px; font-size: 13px; color: var(--hud-fg); font-variant-numeric: tabular-nums; }
#compass .peer i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #111; font-style: normal; font-weight: 800; font-size: 18px; line-height: 1; }
#compass .peer i span { display: block; transform-origin: 50% 50%; }
#compass .peer b { font-family: var(--font-display); }
body.touch #compass { top: calc(104px + env(safe-area-inset-top, 0px)); } @media (max-height: 460px) { body.touch #compass { top: calc(96px + env(safe-area-inset-top, 0px)); } }
#shared-pill i, .menu .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---------- World lists on the title screen ---------- */
.screen h3 { font-family: var(--font-display); font-size: 16px; margin: 14px 0 8px; font-weight: 600; } .screen h3 small { font-weight: 400; opacity: 0.6; font-size: 12px; margin-left: 6px; }
.world-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.world-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.world-card b { font-family: var(--font-display); font-size: 16px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .world-card span { display: block; font-size: 12px; opacity: 0.75; grid-column: 1; }
.world-card .acts { grid-row: 1 / 3; display: flex; gap: 6px; align-items: center; }
.world-card .join { background: var(--sun); color: #2b2a22; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 700; } .world-card .join.ghost { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,0.3); }
.world-card .forget { background: transparent; color: inherit; border: 0; opacity: 0.6; font-size: 18px; padding: 4px 6px; } .world-card .forget:hover { opacity: 1; }
.world-card i.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.world-list .empty { font-size: 13px; opacity: 0.7; }

/* ---------- Bag & crafting ---------- */
.slot.empty { background: rgba(0,0,0,0.12); border-style: dashed; }
#btn-bag em { font-style: normal; background: var(--sun); color: #2b2a22; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.inv-row, .inv-grid { display: flex; flex-wrap: wrap; gap: 6px; } .inv-row .slot, .inv-grid .slot { background: var(--paper-2); border-color: var(--rule); color: var(--ink); } .inv-row .slot.sel { border-color: var(--sun); background: #f6e2b8; } .inv-row .slot .count, .inv-grid .slot .count { text-shadow: 0 1px 2px #fff; color: var(--ink); } .inv-row .slot .key { color: var(--ink-soft); opacity: 1; }
.recipes { display: grid; gap: 8px; } .recipe { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; } .recipe.no { opacity: 0.7; }
.recipe .ico { width: 56px; height: 56px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; } .recipe .ico canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.recipe .txt { min-width: 0; } .recipe b { display: block; font-family: var(--font-display); font-size: 16px; } .recipe span { display: block; font-size: 13px; color: var(--ink-soft); } .recipe em { display: block; font-size: 13px; margin-top: 4px; }
.recipe .make { padding: 9px 14px; } .recipe .make:disabled { opacity: 0.45; cursor: default; }

.world-card .online { color: #9fe39a; font-weight: 700; } .world-card .online i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5fd35a; margin-right: 6px; box-shadow: 0 0 6px #5fd35a; } .world-card .offline { opacity: 0.6; }
.world-card.active { border-color: rgba(95,211,90,0.5); }
.world-card .here { font-style: normal; font-size: 12px; opacity: 0.8; }
.world-list.dark .world-card { background: var(--paper-2); border-color: var(--rule); } .world-list.dark .world-card .online { color: #2d7a1e; } .world-list.dark .world-card .join.ghost { color: var(--ink); border-color: var(--ink-soft); }
.world-card .acts { grid-row: 1 / 5; }

.pestbox { border: 1px solid #d9a07a; background: #fbe9dd; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; } .pestbox p { margin: 4px 0; } .pestbox.ok { border-color: #a8c89a; background: #e9f3e2; } .small-btn { margin-top: 6px; padding: 6px 10px; font-size: 13px; border-radius: 8px; border: 1px solid var(--rule); background: var(--paper-2); color: var(--ink); }
.bar.npk i { background: #b08a4a; }
.chest-grid { padding: 10px; border-radius: 10px; background: rgba(120,80,30,0.12); border: 1px solid var(--rule); min-height: 60px; }
.recipe .btns { display: flex; flex-direction: column; gap: 4px; } .recipe .btns button { padding: 6px 10px; font-size: 13px; }
#npc-answer { margin-top: 10px; }
#breath { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(118px + env(safe-area-inset-bottom, 0px)); width: 220px; background: var(--hud-bg); border-radius: 12px; padding: 6px 10px; color: #fff; font-size: 12px; pointer-events: none; } #breath .bar { height: 8px; margin-top: 4px; }
#fishbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: 260px; background: var(--hud-bg); border-radius: 12px; padding: 8px 12px; color: #fff; font-size: 13px; pointer-events: none; text-align: center; } #fishbar .bar { height: 10px; margin: 6px 0 4px; } #fishbar .bar i { transition: none; } #fishbar small { opacity: 0.8; }

/* ---------- quiet HUD on phones and small windows ---------- */
.menu.quick { display: flex; gap: 6px; margin-bottom: 8px; } .menu.quick button { flex: 1; }
body.touch #btn-journal, body.touch #btn-quests, body.touch #btn-map, body.touch #btn-exit { display: none; }
body.touch #quest-tracker { display: none; }
body.touch #score { display: none; }
body.touch #biome-pill span { display: none; } body.touch #biome-pill b { font-size: 14px; } body.touch #biome-pill { max-width: 38vw; }
body.touch #topbar .pill { padding: 5px 10px; opacity: 0.85; } body.touch #clock span { font-size: 12.5px; } body.touch #weather { font-size: 10.5px; }
body.touch #side-buttons { top: calc(54px + env(safe-area-inset-top, 0px)); gap: 6px; } body.touch #side-buttons button { padding: 7px 12px; font-size: 13px; opacity: 0.9; }
body.touch #btn-menu::before { content: '☰ '; }
body.touch #shared-pill { top: calc(50px + env(safe-area-inset-top, 0px)); max-width: 40vw; padding: 3px 10px; opacity: 0.85; } body.touch #shared-pill b { font-size: 11.5px; display: inline; } body.touch #shared-pill span { display: inline; font-size: 11px; margin-left: 6px; }
body.touch #compass { top: calc(78px + env(safe-area-inset-top, 0px)); opacity: 0.85; } body.touch #compass .peer { padding: 2px 9px 2px 3px; font-size: 11.5px; gap: 6px; } body.touch #compass .peer i { width: 20px; height: 20px; font-size: 14px; }
body.touch #item-name { font-size: 12px; opacity: 0.9; }
@media (max-width: 900px) { #quest-tracker { display: none; } #score { display: none; } #biome-pill span { display: none; } }
#underwater { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(40,110,190,0.28) 0%, rgba(20,70,140,0.5) 100%); mix-blend-mode: multiply; z-index: 1; }
#underwater::after { content: ''; position: absolute; inset: 0; background: rgba(60,140,220,0.22); }

/* character picker */
.chars { display: grid; gap: 10px; margin-top: 10px; } .char { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; background: #fff8; }
.char.on { border-color: var(--sun); box-shadow: 0 0 0 2px var(--sun) inset; } .char .pic { width: 96px; height: 96px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; } .char .pic canvas { width: 88px; height: 88px; image-rendering: pixelated; }
.char .txt b { display: block; font-family: var(--font-display); font-size: 17px; } .char .txt span { display: block; font-size: 13px; color: var(--ink-soft); margin: 2px 0 4px; } .char .txt ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink); } .char .txt li { margin: 1px 0; }
.char-edit { margin-top: 14px; } .char-edit .req th { width: 90px; } .opts .tag { cursor: pointer; border: 2px solid transparent; } .opts .tag.on { border-color: var(--sun); background: #fff; }
@media (max-width: 640px) { .char { grid-template-columns: 72px 1fr; } .char .pic { width: 72px; height: 72px; } .char .pic canvas { width: 64px; height: 64px; } .char .make { grid-column: 1 / 3; } }

.jsearch { margin: 6px 0 10px; } .jsearch input { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.18); background: rgba(255,255,255,0.75); } .jsearch input:focus { outline: 2px solid #5f9a3c; }
.entry small.where { display: block; font-size: 10px; opacity: 0.6; margin-top: 2px; }
