/* Wildwood: the main screen (Phase 2 §6), palette and type from the wireframes. */
@font-face { font-family: 'Pixelify Sans'; font-weight: 400; font-display: block; src: url('/fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Pixelify Sans'; font-weight: 600; font-display: block; src: url('/fonts/pixelify-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: block; src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: block; src: url('/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); }

:root {
  --bg: #0E0F0B; --strip: #14160F; --panel: #17190F; --line: #2A2D20; --cell: #23261A;
  --ink: #ECE7D4; --dim: #A9A58F; --gold: #F2B84B;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: 'Pixelify Sans', system-ui, sans-serif; font-size: 14px;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.mono { font-family: 'JetBrains Mono', monospace; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.grow { flex-grow: 1; }
.boot { height: 100dvh; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--dim); }
.fatal { height: 100dvh; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; padding: 24px; text-align: center; }

.app { position: relative; display: flex; flex-direction: column; height: 100dvh; max-width: 480px; margin: 0 auto; overflow: hidden; }
.safe-top { flex: none; height: env(safe-area-inset-top); background: var(--strip); }
.safe-bottom { flex: none; height: env(safe-area-inset-bottom); background: var(--strip); }

.status { flex: none; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 4px 0 12px; background: var(--strip); border-bottom: 1px solid var(--line); }
.meter { width: 66px; display: flex; flex-direction: column; gap: 4px; }
.meter-top { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.meter-bar { display: block; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter-bar > span { display: block; height: 6px; }
.clock { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.icon { width: 44px; height: 44px; background: none; border: 0; display: flex; align-items: center; justify-content: center; }

.world { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); }
.world canvas { position: absolute; left: 0; top: 0; display: block; image-rendering: pixelated; }
.world canvas { touch-action: none; }
.card { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
        background: rgba(20, 22, 15, 0.94); border: 1px solid #3A3D2C; border-radius: 10px; font-size: 13px; line-height: 1.35; }
.card strong { font-size: 15px; font-weight: 600; }
.card .btn { align-self: flex-end; }
.minimap { position: absolute; top: 10px; right: 10px; width: 64px; height: 64px; padding: 0; z-index: 2; background: #14160F;
           border: 1px solid #3A3D2C; border-radius: 8px; overflow: hidden; }
.minimap canvas, .map-local canvas { position: static; width: 100%; height: 100%; image-rendering: pixelated; }
.toasts { position: absolute; left: 12px; right: 86px; top: 10px; z-index: 2; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { align-self: flex-start; padding: 7px 11px; background: rgba(20, 22, 15, 0.94); border: 1px solid #3A3D2C; border-radius: 8px; font-size: 13px; }
.toast.warn { border-color: #8A5A3A; color: #FFD9B8; }
.paused { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center;
          background: rgba(5, 6, 8, 0.55); border: 0; font-size: 15px; }
.paused strong { font-size: 22px; font-weight: 600; }
.slowed { flex: none; }

.quick { flex: none; height: 50px; padding: 4px 12px 0; background: var(--strip); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.quick-row { display: flex; gap: 7px; }
.quick-slot { flex: 1; height: 38px; background: none; border: 1px dashed #3A3D2C; border-radius: 8px; }
.quick-dots { display: flex; justify-content: center; gap: 5px; }
.quick-dots span { width: 5px; height: 5px; border-radius: 50%; background: #4A4D3A; }
.quick-dots span.on { background: var(--ink); }

.panel { flex: none; height: 208px; background: var(--panel); overflow-y: auto; }
.inventory { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 52px; padding: 0 13px; }
.inv-slot { border: 1px solid var(--cell); }
.empty-tab { padding: 20px 16px; color: var(--dim); }
.menu-panel { padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.map-panel { height: 100%; display: flex; gap: 14px; padding: 12px 16px; }
.map-local { flex: none; width: 184px; height: 184px; padding: 0; background: #14160F; border: 1px solid #3A3D2C; border-radius: 8px; overflow: hidden; }
.map-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.map-side .btn { margin-top: auto; align-self: flex-start; }
.menu-panel .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }

.btn { min-height: 36px; padding: 0 14px; white-space: nowrap; background: #23261A; border: 1px solid #3A3D2C; border-radius: 8px; }
.btn.primary { background: var(--gold); color: #14160F; border-color: var(--gold); font-weight: 600; }
.btn:disabled { opacity: 0.6; }

.tabs { flex: none; height: 50px; display: flex; background: var(--strip); border-top: 1px solid var(--line); }
.tab { position: relative; flex: 1; height: 50px; padding: 0; background: none; border: 0; color: var(--dim); font-size: 11px;
       display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.tab .tab-bar { position: absolute; top: 0; left: 14px; right: 14px; height: 2px; background: transparent; }
.tab.active { color: var(--gold); }
.tab.active .tab-bar { background: var(--gold); }

.rotate { display: none; position: fixed; inset: 0; z-index: 10; background: var(--bg); flex-direction: column; gap: 14px;
          align-items: center; justify-content: center; text-align: center; padding: 24px; font-size: 16px; }
body.landscape .rotate { display: flex; }

/* full-screen overlays (Phase 2 §3.3) */
.overlay { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #121309; }
.overlay .safe-top, .overlay .safe-bottom { background: transparent; }
.overlay-head { flex: none; height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; }
.overlay-head h1 { margin: 0; font-size: 22px; font-weight: 600; }
.wm-box { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.wm-box canvas { position: absolute; left: 0; top: 0; display: block; }
.wm-label { position: absolute; transform: translate(-50%, -50%); font-size: 11px; color: #ECE7D4; white-space: nowrap; pointer-events: none;
            text-shadow: 0 0 3px #121309, 0 0 3px #121309; }
.wm-label.dim { color: #8D8A78; }
.wm-label.left { transform: translate(-12px, -50%); }
.wm-label.right { transform: translate(calc(-100% + 12px), -50%); }
.wm-you { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #F2B84B;
          box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.35); pointer-events: none; }
.wm-you.static { position: static; display: inline-block; margin: 0 8px 0 0; vertical-align: middle; }
.wm-north { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: #CFCAB5; pointer-events: none; }
.wm-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.wm-zoom .btn { width: 44px; min-height: 44px; padding: 0; font-size: 20px; }
.wm-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }
.legend { display: flex; align-items: center; font-size: 12px; color: #CFCAB5; }

/* the action sheet: rises from the bottom, in thumb reach (Phase 2 §5) */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
         padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: #1F2216; border-top: 1px solid #3A3D2C; border-radius: 14px 14px 0 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 16px; }
.sheet-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.sheet-row .btn { min-height: 44px; padding: 0 20px; }
