/* hoard: pixel RPG UI over the lair canvas */
:root {
  --ink: #07050b; --cream: #f6ead0; --muted: #a99b84; --gold: #f2c14e; --gold-d: #b8701e; --gold-dd: #5e3510;
  --jade: #55c4a2; --red: #ff7a5c; --panel: rgba(12, 8, 19, .92); --line: #40334f;
  --px: 3px;
}
* { box-sizing: border-box; margin: 0; }
/* Pixelify Sans draws "fi" as a broken glyph; !important because every `font:` shorthand resets this */
*, *::before, *::after { font-variant-ligatures: none !important; }
html, body { height: 100%; background: var(--ink); overflow: hidden; color: var(--cream);
  font-family: 'IBM Plex Mono', ui-monospace, monospace; -webkit-font-smoothing: antialiased; }
#lair { position: fixed; left: 0; top: 0; z-index: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* pixel border: four offset shadows leave the corners empty, which reads as a notched pixel box */
.px { box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--b), 0 var(--px) 0 0 var(--b),
                  calc(-1 * var(--px)) 0 0 0 var(--b), var(--px) 0 0 0 var(--b); margin: var(--px); }

/* ---------- top bar ---------- */
.hd-top { position: fixed; inset: 0 0 auto 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px; pointer-events: none; }
.hd-top > * { pointer-events: auto; }
.hd-mark { display: flex; align-items: center; gap: 8px; height: 42px; font-family: 'Pixelify Sans'; font-weight: 700; font-size: 30px;
  line-height: 1; color: var(--cream); text-shadow: 3px 3px 0 var(--gold-dd); }
.hd-side { display: grid; gap: 4px; min-width: 0; }
.hd-logo { width: 32px; height: 32px; image-rendering: pixelated; flex: none; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.55)); }
.hd-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; height: 42px; }
.hd-vault { --b: var(--line); background: var(--panel); border: 0; padding: 5px 9px; text-align: right; line-height: 1.15; cursor: pointer; white-space: nowrap; flex: none; }
.hd-vault small { display: block; font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.hd-vault b { font: 600 15px 'IBM Plex Mono'; color: var(--gold); font-variant-numeric: tabular-nums; }
.hd-vault i { font-style: normal; font-size: 11px; color: var(--muted); }
.hd-vault.bump b { color: #fff3c4; }
.hd-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; font: 600 15px 'Pixelify Sans'; color: var(--ink); background: var(--cream);
  border: 0; padding: 0 12px; cursor: pointer; box-shadow: inset -3px -3px 0 #c8b68c, 3px 3px 0 rgba(0,0,0,.5); white-space: nowrap; max-width: 46vw; }
.hd-btn.me { background: var(--jade); box-shadow: inset -3px -3px 0 #2f8a6e, 3px 3px 0 rgba(0,0,0,.5); padding-left: 6px; }
.hd-btn .av { width: 24px; height: 24px; flex: none; image-rendering: pixelated; background: #2f8a6e; box-shadow: 0 0 0 2px var(--ink); }
.hd-btn .h { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hd-btn .n { font: 400 10px 'Press Start 2P'; }

.hd-stage { --b: var(--line); background: var(--panel); padding: 5px 9px 6px; margin: 3px 0 3px 3px;
  display: grid; grid-template-columns: auto minmax(40px, 1fr); align-items: center; gap: 2px 10px; }
.hd-stage #stageName { font: 600 15px 'Pixelify Sans'; color: var(--jade); }
.hd-bar { height: 8px; background: #241b30; box-shadow: inset 0 0 0 1px #3a2e48; }
.hd-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 5px, var(--gold-d) 5px 6px); }
.hd-stage small { grid-column: 1 / -1; font: 500 10px 'IBM Plex Mono'; letter-spacing: .6px; color: var(--muted); text-align: right; }

/* ---------- dock ---------- */
.hd-dock { position: fixed; left: 0; right: 0; bottom: 0; margin-inline: auto; z-index: 2; width: min(640px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0 14px calc(14px + env(safe-area-inset-bottom)); }
.hd-dialog { --b: var(--gold); position: relative; background: var(--panel); padding: 20px 16px 18px; margin-top: 16px; }
.hd-dialog::after { content: ''; position: absolute; inset: auto -3px -9px -3px; height: 6px; background: rgba(0,0,0,.35); }
.hd-name { --b: var(--gold-dd); position: absolute; top: -17px; left: 12px; font: 600 14px 'Pixelify Sans'; color: var(--ink);
  background: var(--gold); padding: 3px 9px; }
.hd-name.you { background: var(--jade); --b: #2f8a6e; }
#say { font-family: 'Pixelify Sans'; font-size: 19px; line-height: 1.35; min-height: 2.7em; color: var(--cream); overflow-wrap: anywhere; }
/* where the dialog's top sits at its minimum height: the lair puts the gold pile there (lair.js reads [data-dock]) */
.hd-anchor { position: absolute; left: 0; width: 0; height: 0; font-size: 19px; bottom: calc(38px + 2.7em); }
.hd-caret { position: absolute; right: 12px; bottom: 7px; color: var(--gold); font-size: 11px; visibility: hidden; }
.hd-caret.on { visibility: visible; }

.hd-ask { display: flex; gap: 8px; }
.hd-ask input { --b: var(--line); flex: 1; min-width: 0; font: 16px 'IBM Plex Mono'; color: var(--cream); background: rgba(7,5,11,.92);
  border: 0; padding: 12px 12px; outline: none; }
.hd-ask input::placeholder { color: #7d7088; }
.hd-ask input:focus { --b: var(--gold); }
.hd-ask button { --b: var(--gold-dd); font: 600 16px 'Pixelify Sans'; color: var(--ink); background: var(--gold); border: 0;
  padding: 0 16px; cursor: pointer; }
.hd-ask button:disabled { opacity: .6; cursor: wait; }
.hd-chips { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.hd-chips::-webkit-scrollbar { display: none; }
.hd-chips button { --b: rgba(246,234,208,.22); --px: 2px; flex: none; white-space: nowrap; font: 500 13px 'IBM Plex Mono'; color: var(--cream);
  background: rgba(12,8,19,.78); border: 0; padding: 9px 10px; cursor: pointer; min-height: 38px; }
.hd-chips button:hover, .hd-chips button:focus-visible { color: var(--ink); background: var(--gold); --b: var(--gold-dd); }
.hd-fine { font-size: 11px; line-height: 1.4; color: var(--muted); text-align: center; }
.hd-fine a { color: var(--gold); }
body.has-card .hd-fine { display: none; }

/* ---------- cards (sign-in, tasks, profile, board) ---------- */
.hd-cards { --card-max: min(46vh, 440px); display: grid; grid-template-columns: minmax(0, 1fr); padding: 3px; }
.hd-cards:empty { display: none; }
.hd-card { --b: var(--line); position: relative; display: flex; flex-direction: column; max-height: var(--card-max); min-height: 0;
  background: var(--panel); padding: 10px 14px 0; }
.hd-card > header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(246,234,208,.1); }
.hd-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 14px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.hd-card::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; pointer-events: none; opacity: 0;
  background: linear-gradient(rgba(12,8,19,0), rgba(12,8,19,.95)); transition: opacity .2s; }
.hd-card.more::after { opacity: 1; }
.hd-card h3 { font: 600 18px 'Pixelify Sans'; color: var(--gold); }
.hd-x { border: 0; background: none; color: var(--muted); font: 600 22px 'Pixelify Sans'; line-height: 1; width: 36px; height: 36px; cursor: pointer; }
.hd-x:hover { color: var(--cream); }
.hd-p { font-size: 13px; line-height: 1.5; color: var(--cream); }
.hd-p.muted, .hd-muted { color: var(--muted); }
.hd-err { font-size: 13px; line-height: 1.45; color: var(--red); min-height: 0; }
.hd-err:empty { display: none; }
.hd-step { display: grid; gap: 8px; padding: 8px 0; }
/* the drop bar: fills with the bonding curve */
.hd-fillamt { margin-top: -3px; font: 500 11px 'IBM Plex Mono'; color: var(--muted); text-align: right; }
.hd-fill { display: block; height: 10px; background: #241b30; box-shadow: inset 0 0 0 1px #3a2e48; }
.hd-fill i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 5px, var(--gold-d) 5px 6px); }
.hd-p.hd-ok { color: var(--jade); }
.hd-p.hd-warn { color: var(--red); }
.hd-step + .hd-step { border-top: 1px dashed rgba(246,234,208,.14); }
.hd-step > b { font: 600 15px 'Pixelify Sans'; color: var(--cream); }
.hd-field { display: flex; gap: 8px; align-items: stretch; }
/* 16px: iOS zooms the whole page into any focused input below 16px, and stays zoomed */
.hd-field input { --b: var(--line); --px: 2px; flex: 1; min-width: 0; font: 16px 'IBM Plex Mono'; color: var(--cream); background: #07050b;
  border: 0; padding: 10px; outline: none; }
.hd-field input:focus { --b: var(--gold); }
.hd-field .at { display: grid; place-items: center; padding: 0 2px 0 6px; color: var(--muted); }
.hd-quote { font: 14px/1.5 'IBM Plex Mono'; background: #07050b; padding: 10px 12px; color: var(--cream); overflow-wrap: anywhere; user-select: all; }
.hd-quote b { color: var(--gold); font-weight: 600; }

.hd-mini { --b: var(--gold-dd); --px: 2px; display: inline-grid; place-items: center; font: 600 14px 'Pixelify Sans'; color: var(--ink); background: var(--gold);
  border: 0; padding: 0 12px; min-height: 40px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.hd-mini:hover { background: #ffe08a; }
.hd-mini.ghost { --b: rgba(246,234,208,.3); background: transparent; color: var(--cream); }
.hd-mini.ghost:hover { background: rgba(246,234,208,.08); }
.hd-mini:disabled { opacity: .55; cursor: default; }
.hd-mini.wait { --b: var(--line); background: #241b30; color: var(--muted); }

.hd-task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; }
.hd-task + .hd-task { border-top: 1px dashed rgba(246,234,208,.12); }
.hd-task .t b { display: block; font: 500 14px 'IBM Plex Mono'; color: var(--cream); }
.hd-task .t small { display: block; font-size: 11px; line-height: 1.4; color: var(--muted); }
.hd-task .pts { font: 400 10px 'Press Start 2P'; color: var(--gold); white-space: nowrap; }
.hd-task .acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hd-task .acts .hd-field { flex: 1 1 100%; }
.hd-task.done .t b { color: var(--muted); }
.hd-ok { font: 600 13px 'IBM Plex Mono'; color: var(--jade); }

.hd-me { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 10px; }
.hd-me img, .hd-ava { width: 40px; height: 40px; image-rendering: pixelated; background: #241b30; }
.hd-me b { font: 600 17px 'Pixelify Sans'; overflow-wrap: anywhere; }
.hd-me small { display: block; color: var(--muted); font-size: 12px; }
.hd-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 6px; }
.hd-stat { background: #07050b; padding: 8px 9px; min-width: 0; }
.hd-stat.wide { grid-column: span 2; }
.hd-stat small { display: block; font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.hd-stat b { font: 400 12px 'Press Start 2P'; color: var(--gold); overflow-wrap: anywhere; line-height: 1.4; }
.hd-addr { font: 13px 'IBM Plex Mono'; color: var(--cream); }

.hd-board { list-style: none; padding: 0; display: grid; }
.hd-board li { display: grid; grid-template-columns: 34px 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; }
.hd-board li + li { border-top: 1px dashed rgba(246,234,208,.1); }
.hd-board .r { font: 400 10px 'Press Start 2P'; color: var(--muted); }
.hd-board li:nth-child(-n+3) .r { color: var(--gold); }
.hd-board .h { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-board .p { font: 400 10px 'Press Start 2P'; color: var(--gold); }
.hd-board .ava { width: 28px; height: 28px; image-rendering: pixelated; background: #241b30; }
.hd-board li.you .h { color: var(--jade); }

/* ---------- toast ---------- */
.hd-toast { position: fixed; z-index: 3; transform: translate(-50%, 0); pointer-events: none; opacity: 0; white-space: nowrap;
  font: 400 20px 'Press Start 2P'; color: var(--gold); text-shadow: 3px 3px 0 var(--gold-dd), 0 0 18px rgba(242,193,78,.45); }
.hd-toast small { display: block; margin-top: 8px; font: 500 11px 'IBM Plex Mono'; color: var(--cream); text-shadow: 2px 2px 0 #000; text-align: center; }

/* wide screens: cards become a side panel so the creature stays in view */
@media (min-width: 1100px) {
  :root { --pw: 380px; }
  .hd-cards { position: fixed; z-index: 2; right: 16px; top: calc(112px + env(safe-area-inset-top)); width: var(--pw);
    --card-max: calc(100vh - 136px - env(safe-area-inset-top)); }
  body.has-card .hd-fine { display: block; }
  /* the dock moves left just enough to clear the panel. Not with transform: a transformed dock would become the
     containing block of the position:fixed panel inside it. Centred in [0, 100vw - R], R = max(0, 2*pw + 680px - 100vw). */
  .hd-dock { transition: right .25s ease; }
  body.has-card .hd-dock { right: max(0px, calc(2 * var(--pw) + 680px - 100vw)); }
}

@media (max-width: 430px) {
  .hd-mark { font-size: 26px; }
  #say { font-size: 17px; min-height: 4.05em; }
  .hd-anchor { font-size: 17px; bottom: calc(38px + 4.05em); }
  .hd-top { padding-left: 12px; padding-right: 12px; }
  /* phones: the account button is the avatar + pending amount; the handle is in "my share" */
  .hd-btn .h { display: none; }
  .hd-chips button { font-size: 12px; padding: 8px 8px; }
}
@media (max-width: 370px) {
  .hd-mark { font-size: 22px; gap: 6px; }
  .hd-logo { width: 26px; height: 26px; }
  .hd-right { gap: 8px; }
}
@media (max-height: 700px) {
  .hd-cards { --card-max: 40vh; }
}
[hidden] { display: none !important; }
