:root { --ink: #f2efe6; --dim: #b9b4a6; --panel: rgba(20, 18, 14, 0.72); --line: rgba(255, 255, 255, 0.14); --accent: #e7b75a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #111; color: var(--ink); font: 14px/1.4 system-ui, sans-serif; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; }
#view { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.bar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 12px; align-items: center; padding: 10px 16px; background: linear-gradient(var(--panel), transparent); pointer-events: none; }
.tag { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: #111; background: var(--accent); padding: 2px 8px; border-radius: 3px; }
.panel { position: absolute; top: 48px; right: 16px; width: min(300px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; max-height: calc(100vh - 130px); overflow: auto; }
.panel h2 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
#attention { margin: 0 0 10px; padding-left: 20px; }
#attention li { margin: 2px 0; }
#attention em { font-style: normal; margin-left: 6px; }
#attention b { font-weight: 500; font-size: 11px; padding: 0 5px; margin-right: 3px; border-radius: 3px; background: #333; }
.s-scent { color: #ffb000; } .s-sound { color: #40e0ff; } .s-sight { color: #e0e0e0; }
.feel { position: absolute; top: 44px; left: 16px; right: 340px; margin: 0; font-size: 22px; font-style: italic; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); pointer-events: none; }
#body { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center; margin-bottom: 10px; font-size: 12px; color: var(--dim); }
#body b { height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 3px; overflow: hidden; }
#body i { display: block; height: 100%; background: var(--accent); }
#body i.ar { background: #ff6a4d; }
#nose { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.remembered { display: grid; grid-template-columns: 1fr; gap: 4px; margin-bottom: 10px; }
.remembered div { display: flex; gap: 8px; align-items: center; line-height: 1.25; }
.remembered canvas { width: 40px; height: 40px; flex: none; border: 1px solid var(--line); image-rendering: pixelated; }
.remembered em { color: var(--dim); }
#nose i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
#legend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--dim); }
#legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
#legend i.ring { background: none; border: 2px solid #40e0ff; } #legend i.ultra { border-color: #ff40ff; }
.keys, #build, .credit { font-size: 12px; color: var(--dim); margin: 10px 0 0; }
.credit a { color: inherit; }
#controls { position: absolute; bottom: 16px; left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
#controls button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; cursor: pointer; }
#controls button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
@media (max-width: 600px) { .feel { right: 16px; font-size: 17px; } .panel { top: auto; bottom: 120px; max-height: 30vh; } .keys, #legend { display: none; } #controls button { padding: 8px 10px; } }
.panel.folded { display: none; }
.touch-only, .taps, .hint .taps-list { display: none; }
.hint { position: absolute; inset: 0; margin: auto; width: min(420px, calc(100vw - 32px)); height: fit-content; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; padding: 14px 18px; z-index: 5; }
.hint h2 { margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.hint ul { margin: 0 0 8px; padding-left: 18px; }
.hint p { margin: 0 0 10px; color: var(--dim); font-size: 13px; }
.hint button { font: inherit; color: #111; background: var(--accent); border: 0; border-radius: 4px; padding: 8px 18px; min-height: 40px; }
.rotate { display: none; }
/* Phones and tablets: touch controls, the dock and the hint. */
@media (pointer: coarse) {
  .touch-only, .taps { display: inline-block; }
  .hint .taps-list { display: block; }
  .hint .keys { display: none; }
  .keys { display: none; }
  #controls button { padding: 10px 12px; min-height: 40px; }
  /* The panel only shows; touches pass through to the yard. */
  .panel { pointer-events: none; }
}
/* A phone held sideways: a compact view that leaves the yard visible. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .bar { padding: 4px 10px; font-size: 11px; }
  .feel { top: 26px; left: 10px; right: 230px; font-size: 15px; }
  .panel { top: 30px; right: 8px; width: 210px; padding: 8px 10px; max-height: calc(100vh - 90px); font-size: 11px; }
  .panel h2 { font-size: 10px; margin-bottom: 3px; }
  #attention, #attention-title, #legend, #build { display: none; }
  #controls { bottom: 8px; left: 8px; right: 8px; gap: 6px; }
  #controls button { padding: 6px 9px; min-height: 34px; font-size: 12px; }
}
/* A phone held upright: ask for landscape. */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 600px) {
  .rotate { display: flex; position: absolute; inset: 0; z-index: 6; align-items: center; justify-content: center; background: rgba(10, 9, 7, 0.92); font-size: 18px; text-align: center; padding: 24px; }
}
/* hud=dials (render/flags.js): dials on the view, the rest in a sheet. */
.dials[hidden], .held[hidden], .sheet[hidden] { display: none; }
.hud-dials .bar { display: none; }
.hud-dials.debug .bar { display: flex; }
.hud-dials .feel { top: 12px; left: 16px; right: 150px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hud-dials.debug .feel { top: 40px; }
.dials button { font: inherit; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mood { position: absolute; top: 6px; right: 62px; width: auto; padding: 0; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mood svg { width: 72px; height: 72px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7)); }
.mood path { fill: #c9b48a; } .mood path.lead { fill: var(--accent); } .mood path.bg { fill: rgba(20, 18, 14, 0.55); }
.mood .rim-bg { fill: none; stroke: rgba(20, 18, 14, 0.55); stroke-width: 6; } .mood path.rim { fill: #ff6a4d; }
#mood-words { white-space: nowrap; font-size: 11px; line-height: 1.2; text-align: center; color: var(--ink); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); }
.menu { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; font-size: 24px !important; line-height: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 50%; }
.held { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 200px); display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; text-align: left; }
.held canvas { width: 36px; height: 36px; flex: none; border-radius: 50%; image-rendering: pixelated; border: 1px solid var(--line); }
.held canvas.mini { width: 24px; height: 24px; }
.held span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.held em { color: var(--dim); }
.memory { position: absolute; left: 12px; top: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; }
.memory[hidden] { display: none; }
.memory canvas { width: 30px; height: 30px; border-radius: 50%; image-rendering: pixelated; border: 2px solid var(--line); }
.memory canvas.known { border-color: var(--accent); }
.memory canvas.new { animation: met 1.6s ease-out; }
.memory b { font-size: 11px; color: var(--dim); font-weight: 500; }
@keyframes met { 0% { transform: scale(1.8); box-shadow: 0 0 0 6px rgba(231, 183, 90, 0.7); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 183, 90, 0); } }
@media (prefers-reduced-motion: reduce) { .memory canvas.new { animation: none; } }
.radial { position: absolute; right: 12px; bottom: 12px; width: 72px; height: 72px; }
.radial .hub { position: absolute; inset: 0; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); font-weight: 600; letter-spacing: 0.03em; }
.radial.open .hub { background: var(--accent); color: #111; }
.radial [data-do] { --r: 150px; position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: var(--panel); border: 1px solid var(--accent); font-size: 13px; font-weight: 600;
  transform: translate(0, 0) scale(0.4); opacity: 0; pointer-events: none; transition: transform 0.16s ease-out, opacity 0.16s; }
.radial.open [data-do] { transform: translate(calc(var(--dx) * var(--r)), calc(var(--dy) * var(--r))) scale(1); opacity: 1; pointer-events: auto; }
.radial [data-do].dim { opacity: 0.45; border-color: var(--line); }
.radial [data-do]:active { background: var(--accent); color: #111; }
@media (prefers-reduced-motion: reduce) { .radial [data-do] { transition: none; } }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 78vw); overflow: auto; background: rgba(20, 18, 14, 0.94); border-left: 1px solid var(--line); padding: 12px 14px 20px; z-index: 4; overscroll-behavior: contain; }
.sheet-close { position: sticky; top: 0; float: right; width: 40px; height: 40px; font-size: 24px !important; background: none; border: 0; }
.sheet .panel { position: static; width: auto; max-height: none; background: none; border: 0; padding: 0; overflow: visible; pointer-events: auto; font-size: 13px; }
.sheet .panel h2 { font-size: 12px; margin-top: 6px; }
.sheet #attention, .sheet #attention-title, .sheet #legend, .sheet #build { display: revert; }
.sheet #legend { display: flex; }
.sheet #controls { position: static; margin-top: 12px; }
.hud-dials [data-act="mind"], .hud-dials [data-act="bark"], .hud-dials [data-act="woof"], .hud-dials [data-act="dig"], .hud-dials [data-act="mark"], .hud-dials [data-act="bite"], .hud-dials [data-act="drop"] { display: none; }
/* A wide screen with a mouse: the open sheet is a side panel, and the dials move left of it. */
@media (pointer: fine) and (min-width: 900px) {
  .sheet-open .feel { right: 530px; } .sheet-open .mood { right: 444px; } .sheet-open .menu { right: 392px; } .sheet-open .radial { right: 392px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .memory { top: 62px; gap: 4px; padding: 4px; } .memory canvas { width: 26px; height: 26px; }
  .hud-dials .feel { top: 8px; left: 10px; right: 150px; font-size: 15px; }
  .radial { width: 60px; height: 60px; }
  .radial [data-do] { --r: 128px; width: 50px; height: 50px; margin: -25px 0 0 -25px; font-size: 12px; }
}
