/* Family House: bright harbour-town merge look. Board, orders, dock, house and dialogue are ours;
   the shared .pz-* chrome from puzzle.css (chips, sheets, buy rows, toasts) is restyled here. Art lives in art.js. */
:root {
  --bg: #86d3ea; --bg2: #f3dfb8; --ink: #22385a; --muted: #8a7660; --panel: #fffdf7;
  --accent: #ff9f1c; --accent-ink: #fff; --good: #4cbb17; --blue: #3a78c2; --blue-d: #24548e;
  --rim: #e2b979; --rim-d: #c99a55; --cream: #fffaf0;
}
body {
  color: var(--ink);
  background:
    radial-gradient(60% 90px at 18% 64px, #ffffff8c, transparent 70%),
    radial-gradient(50% 70px at 86% 40px, #ffffff73, transparent 70%),
    linear-gradient(#78cbe6 0, #b6e6f0 168px, #f8eacd 169px, #f3dfb8 70%, #ecd2a2 100%);
}
#app { gap: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
.fh-ui, .fh-art, .fh-av { display: block; overflow: visible; }
.fh-in { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.17em; margin-right: 2px; flex: none; }

/* ---- HUD: white pills with blue rims, icon over the left edge, green + on the right ---- */
.fh-top { gap: 4px; min-height: 46px; justify-content: flex-start; flex: none; }
.fh-top .fh-pill { position: relative; isolation: isolate; flex: 1 1 0; min-width: 0; height: 46px; padding: 0 22px 0 30px; background: none; border-radius: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1; color: var(--ink);
  font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.fh-pill::before { content: ''; position: absolute; inset: 8px 4px 8px 12px; z-index: -1; border-radius: 99px;
  background: linear-gradient(#fff 45%, #e3f1fb); border: 2px solid var(--blue); box-shadow: inset 0 -3px 0 #c9e0f3, 0 2px 0 var(--blue-d), 0 4px 6px #1d3b5c33; }
.fh-pill small { font-size: 9px; font-weight: 800; color: var(--blue); margin-top: 1px; opacity: 1; }
.fh-pill-ico { position: absolute; left: 0; top: 50%; width: 32px; height: 32px; transform: translateY(-50%); filter: drop-shadow(0 2px 0 #0003); }
.fh-plus { position: absolute; right: 0; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); filter: drop-shadow(0 1px 0 #0003); }
.fh-pill:active::before, .fh-cart:active svg { transform: translateY(1px); }
.fh-cart { width: 44px; height: 46px; flex: none; background: none; padding: 0; display: grid; place-items: center; }
.fh-cart svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 0 #1d5f9e66); }

/* ---- Orders: cream cards, portrait circle, item bubbles, green check ---- */
.fh-orders { display: flex; gap: 8px; height: 112px; flex: none; padding: 2px 1px 10px; }
.fh-order { position: relative; flex: 1; min-width: 0; padding: 5px 5px 6px; border-radius: 16px; text-align: left;
  background: linear-gradient(#fffef9, #fff0d2); border: 2.5px solid #fff; box-shadow: 0 0 0 2px var(--rim), 0 4px 0 2px var(--rim-d), 0 7px 10px #5a382533;
  display: flex; flex-direction: column; gap: 5px; color: var(--ink); }
.fh-order.ready { background: linear-gradient(#f3ffe9, #d9f7c4); box-shadow: 0 0 0 2px var(--good), 0 4px 0 2px #2f8f12, 0 7px 10px #2f8f1244; animation: fhready 1.6s ease-in-out infinite; }
.fh-order-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.fh-face { width: 46px; height: 46px; flex: none; border-radius: 50%; overflow: hidden; border: 2.5px solid #fff; box-shadow: 0 0 0 2px var(--who), 0 2px 4px #0003; background: var(--who); }
.fh-face svg { width: 100%; height: 100%; }
.fh-pay { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 13px; font-weight: 900; color: #5a3825; font-variant-numeric: tabular-nums; }
.fh-pay > span { display: flex; align-items: center; background: #fff; border-radius: 99px; padding: 1px 6px 1px 3px; box-shadow: inset 0 0 0 1.5px #f0dcb6; }
.fh-pay .fh-in { width: 14px; height: 14px; }
.fh-wants { display: flex; gap: 3px; justify-content: center; align-items: center; flex: 1; }
.fh-want { position: relative; width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #f4fbf9, #cfeee7); box-shadow: inset 0 2px 3px #2a6f6a2e, 0 1px 0 #fff; }
.fh-want .fh-art { width: 27px; height: 27px; filter: drop-shadow(0 1px 0 #0002); }
.fh-want .fh-ok { position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; filter: drop-shadow(0 1px 1px #0004); }
.fh-deliver { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); padding: 3px 12px; border-radius: 99px; white-space: nowrap;
  background: linear-gradient(#8be65a, #4cbb17); color: #fff; font-weight: 900; font-size: 13px; border: 2px solid #fff; box-shadow: 0 2px 0 #2f8f12; text-shadow: 0 1px 0 #2f8f12; }

/* ---- Board: cream frame, mint tile wells, chunky items ---- */
.fh-boardwrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.fh-grid { width: min(100cqw, 100cqh * 7 / 9); aspect-ratio: 7 / 9; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(9, 1fr); gap: 3px;
  padding: 7px; border-radius: 22px; background: linear-gradient(#fffaf0, #f6e4bf);
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 3px var(--rim), 0 6px 0 3px var(--rim-d), 0 12px 20px #5a382540; touch-action: none; container-type: inline-size; }
.fh-cell { position: relative; border-radius: 11px; background: #cdeee6; display: grid; place-items: center; min-width: 0; min-height: 0;
  box-shadow: inset 0 2px 0 #2a6f6a14, inset 0 -2px 0 #ffffff99; }
.fh-cell:nth-child(odd) { background: #dcf5ef; }
.fh-cell.gen { background: radial-gradient(circle at 50% 45%, #fffbe6, #ffe8a8 80%); box-shadow: inset 0 0 0 2px #ffd166, inset 0 -2px 0 #ffffffaa; }
.fh-cell.sel { box-shadow: inset 0 0 0 3px #fff, 0 0 0 2.5px #ffb703; z-index: 1; }
.fh-cell.over { background: #fff; box-shadow: inset 0 0 0 3px var(--good); }
.fh-item { position: relative; width: 86%; height: 86%; display: grid; place-items: center; pointer-events: none; }
.fh-item > .fh-art { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 #5a38252e); }
.fh-cell.sel .fh-item { animation: fhbob 1.1s ease-in-out infinite; }
.fh-bolt { position: absolute; left: -9%; top: -9%; width: 38%; height: 38%; filter: drop-shadow(0 1px 0 #0003); }
.fh-cell > .fh-ok { position: absolute; right: 2%; bottom: 2%; width: 34%; height: 34%; pointer-events: none; filter: drop-shadow(0 1px 1px #0004); }
.fh-item.web > .fh-art { filter: grayscale(.75) brightness(.95) opacity(.7); }
.fh-web { position: absolute; inset: -8%; width: 116%; height: 116%; pointer-events: none; }
.fh-item.box { width: 92%; height: 92%; }
.fh-item.pop { animation: fhpop .32s cubic-bezier(.3, 1.6, .5, 1); }
.fh-item.lifted { opacity: .25; }
.fh-ghost { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; }
.fh-ghost > .fh-art { filter: drop-shadow(0 8px 6px #5a382555); }

/* ---- Dock: round buttons either side of the item bar ---- */
.fh-dock { display: flex; align-items: center; gap: 8px; height: 62px; flex: none; }
.fh-round { position: relative; width: 56px; height: 56px; flex: none; padding: 0; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 30%, #fff, #d4ecfa 75%); border: 3px solid var(--blue); box-shadow: inset 0 -3px 0 #b6d6ef, 0 3px 0 var(--blue-d), 0 6px 10px #1d3b5c40; }
.fh-round svg { width: 36px; height: 36px; filter: drop-shadow(0 1px 0 #0002); }
.fh-round:active { transform: translateY(2px); }
.fh-round.hot { animation: fhpulse 1.4s ease-in-out infinite; }
.fh-badge { position: absolute; top: -5px; right: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; display: grid; place-items: center;
  background: #e63946; color: #fff; font-size: 13px; font-weight: 900; border: 2px solid #fff; box-shadow: 0 1px 2px #0004; }
.fh-info { flex: 1; min-width: 0; height: 56px; display: flex; align-items: center; gap: 6px; padding: 4px 5px 4px 5px; border-radius: 16px;
  background: var(--panel); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--rim), 0 3px 0 2px var(--rim-d); color: var(--muted); }
.fh-info-ico { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: #dcf5ef; box-shadow: inset 0 2px 0 #2a6f6a14; }
.fh-info-ico svg { width: 34px; height: 34px; }
.fh-info-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.15; }
.fh-info-txt b { font-size: 14px; font-weight: 900; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-info-txt small { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-act { flex: none; min-height: 44px; padding: 0 10px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(#8be65a, #4cbb17); color: #fff; font-weight: 900; font-size: 14px; white-space: nowrap;
  border: 2px solid #fff; box-shadow: 0 3px 0 #2f8f12, 0 0 0 1.5px #2f8f12; text-shadow: 0 1px 0 #2f8f12; }
.fh-act .fh-in { width: 16px; height: 16px; margin: 0 1px 0 3px; }
.fh-act.sell { background: linear-gradient(#ffe08a, #ffb703); color: #6a3d00; box-shadow: 0 3px 0 #c77d00, 0 0 0 1.5px #c77d00; text-shadow: none; }
.fh-act:active { transform: translateY(2px); box-shadow: 0 1px 0 #2f8f12, 0 0 0 1.5px #2f8f12; }

/* ---- House ---- */
#app[data-screen='house'] { gap: 8px; }
.fh-house { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 6px; }
.pz-level-head b { font-size: 19px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--blue-d), 0 0 6px #24548e66; }
.pz-x { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: linear-gradient(#5a9be0, var(--blue)); border: 3px solid #fff; box-shadow: 0 3px 0 var(--blue-d); }
.pz-x svg { width: 22px; height: 22px; }
.fh-rooms { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px; }
.fh-room { min-height: 36px; background: #fff; color: var(--ink); border-radius: 99px; padding: 6px 12px; font-weight: 800; font-size: 13px; white-space: nowrap;
  box-shadow: inset 0 0 0 2px #b9d7f0, 0 2px 0 #b9d7f0; display: inline-flex; align-items: center; }
.fh-room.on { background: linear-gradient(#ffc15e, var(--accent)); color: #fff; text-shadow: 0 1px 0 #c45e00; box-shadow: inset 0 0 0 2px #fff, 0 2px 0 #c45e00; }
.fh-scene { position: relative; height: 172px; border-radius: 20px; overflow: hidden; flex: none; background: #8ecae6; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--rim), 0 5px 0 3px var(--rim-d); }
.fh-wall { position: absolute; inset: 0 0 34% 0; background: var(--wall, #f1e3c6); }
.fh-floor { position: absolute; inset: 66% 0 0 0; background: var(--floor, #b08968); box-shadow: inset 0 3px 0 #0002; }
.fh-scene.room-yard { --wall: linear-gradient(#8ecae6, #cde8f3); --floor: repeating-linear-gradient(90deg, #6a994e 0 18px, #5c8a43 18px 36px); }
.fh-scene.room-yard .fh-wall::after { content: ''; position: absolute; left: 30%; right: 30%; bottom: 0; height: 70%; background: #e9d8a6; border-radius: 6px 6px 0 0; box-shadow: inset 0 18px 0 #bc6c25; }
.fh-scene.room-parlour { --wall: #f1e3c6; --floor: repeating-linear-gradient(90deg, #9c6644 0 26px, #8a5a3b 26px 28px); }
.fh-scene.room-kitchen { --wall: repeating-linear-gradient(0deg, #e0f2f1 0 20px, #cfe6e4 20px 21px), #e0f2f1; --floor: repeating-conic-gradient(#ddd 0 25%, #999 0 50%) 0 0 / 28px 28px; }
.fh-scene.room-bedroom { --wall: #e8d5f2; --floor: #a47148; }
.fh-scene.room-rooftop { background: linear-gradient(#f4a261, #2a9d8f); --wall: linear-gradient(#ffb703aa, #fb850066); --floor: repeating-linear-gradient(90deg, #6c757d 0 30px, #5c656d 30px 32px); }
.fh-dust { position: absolute; inset: 0; pointer-events: none; opacity: var(--dust, 0); background:
  radial-gradient(circle at 20% 30%, #6b5a40aa 0 8%, transparent 9%), radial-gradient(circle at 70% 60%, #6b5a40aa 0 10%, transparent 11%),
  repeating-linear-gradient(35deg, #4a3b2a66 0 3px, transparent 3px 14px), #5b4a3355; transition: opacity .6s; }
/* Task hotspots: navy discs with a gold ring, greyed until done. */
.fh-prop { position: absolute; transform: translate(-50%, -50%); width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-size: 26px;
  background: radial-gradient(circle at 50% 35%, #3f6797, #1f3557); border: 3px solid #ffd166; box-shadow: 0 0 0 2px #1f3557, 0 5px 8px #0006; transition: filter .4s; filter: grayscale(1) brightness(.85); }
.fh-prop.done { filter: none; animation: fhpropin .4s cubic-bezier(.3, 1.6, .5, 1); }
.fh-progress { position: relative; height: 28px; border-radius: 99px; overflow: hidden; flex: none; background: #fff; border: 2.5px solid var(--blue); box-shadow: inset 0 2px 3px #24548e33, 0 2px 0 var(--blue-d); }
.fh-progress i { position: absolute; inset: 2px auto 2px 2px; border-radius: 99px; background: linear-gradient(#7cc4ff, #2f7fe0); box-shadow: inset 0 3px 0 #ffffff66; transition: width .5s; }
.fh-progress span { position: relative; display: block; text-align: center; line-height: 23px; font-weight: 900; font-size: 13px; color: var(--ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.fh-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fh-task { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 14px; padding: 4px 6px 4px 8px; min-height: 52px; color: var(--ink);
  border: 2px solid #fff; box-shadow: 0 0 0 1.5px #f0dcb6, 0 2px 0 1.5px #e2c48f; }
.fh-task.next { box-shadow: 0 0 0 2px var(--accent), 0 2px 0 2px #c45e00; }
.fh-task.done { background: #f1f8ec; }
.fh-task.done .fh-task-name { text-decoration: line-through; color: var(--muted); }
.fh-task-ico { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 20px; background: #dcf5ef; }
.fh-task-name { flex: 1; font-weight: 800; font-size: 14px; }
.fh-cost { color: var(--muted); font-weight: 900; font-size: 14px; display: inline-flex; align-items: center; padding-right: 6px; }
.fh-replay { min-width: 44px; min-height: 44px; background: none; display: inline-flex; align-items: center; gap: 2px; padding: 0 4px; }
.fh-replay .fh-in { width: 22px; height: 22px; }
.pz-play { background: linear-gradient(#8be65a, #4cbb17); color: #fff; text-shadow: 0 2px 0 #2f8f12; border: 3px solid #fff; box-shadow: 0 0 0 2px #2f8f12, 0 5px 0 2px #2f8f12; flex: none; font-size: 20px; padding: 13px; }
.pz-play:active { box-shadow: 0 0 0 2px #2f8f12, 0 2px 0 2px #2f8f12; }
.pz-note { color: var(--muted); font-weight: 600; }

/* ---- Story: large character card ---- */
.fh-talk { position: fixed; inset: 0; z-index: 55; display: flex; align-items: flex-end; justify-content: center; padding: 0 12px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(#1a2b3d00 25%, #1a2b3dcc); animation: pzfade .2s; }
.fh-card { position: relative; width: min(100%, 456px); padding-top: 96px; animation: fhrise .3s cubic-bezier(.3, 1.4, .5, 1); }
.fh-portrait { position: absolute; left: 4px; top: 0; z-index: 2; width: 136px; height: 136px; border-radius: 50%; overflow: hidden;
  border: 5px solid #fff; background: var(--who); box-shadow: 0 0 0 3px var(--who), 0 10px 18px #0006; }
.fh-portrait svg { width: 100%; height: 100%; }
.fh-name { position: absolute; left: 128px; top: 64px; z-index: 1; padding: 6px 18px 6px 20px; border-radius: 0 14px 14px 0; background: var(--who);
  color: #fff; font-size: 19px; font-weight: 900; border: 3px solid #fff; border-left: 0; box-shadow: 0 3px 0 #0003; text-shadow: 0 1px 2px #0007, 0 0 1px #000a; }
.fh-bubble { position: relative; min-height: 136px; padding: 48px 20px 26px; border-radius: 24px; background: var(--cream); color: #2a1d12;
  border: 3px solid #fff; box-shadow: 0 0 0 3px var(--rim), 0 5px 0 3px var(--rim-d), 0 14px 28px #0006; }
.fh-bubble p { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 600; }
.fh-next { position: absolute; right: 16px; bottom: 8px; width: 22px; height: 22px; animation: fhnudge 1s ease-in-out infinite; }

/* ---- Shared chrome restyled: sheets, buy rows, toasts ---- */
.pz-modal { background: #1a2b3d99; }
.pz-sheet { background: linear-gradient(#fffaf0, #fbefd6); color: var(--ink); border: 3px solid #fff; border-bottom: 0; box-shadow: 0 -3px 0 var(--rim), 0 -10px 30px #0004; }
.pz-sheet h2 { font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 4px; }
.pz-sheet h2 .fh-in { width: 28px; height: 28px; }
.pz-sheet p { color: var(--muted); }
.pz-buy { background: #fff; color: var(--ink); border: 2px solid #f0dcb6; box-shadow: 0 2px 0 #e2c48f; min-height: 56px; }
.pz-buy small { color: var(--muted); }
.pz-buy b { display: inline-flex; align-items: center; background: linear-gradient(#8be65a, #4cbb17); color: #fff; text-shadow: 0 1px 0 #2f8f12; box-shadow: 0 2px 0 #2f8f12; }
.pz-buy b .fh-in { width: 16px; height: 16px; }
.pz-ghost { background: #e3f1fb; color: var(--blue-d); border: 2px solid #b9d7f0; font-weight: 800; min-height: 46px; }
.pz-toast { background: #22385aee; color: #fff; font-weight: 800; border: 2px solid #fff; box-shadow: 0 4px 12px #0004; text-align: center; max-width: calc(100% - 24px); }

@keyframes fhpop { 0% { transform: scale(.4) } 60% { transform: scale(1.18) } 100% { transform: scale(1) } }
@keyframes fhpropin { 0% { transform: translate(-50%, -50%) scale(.4) } 60% { transform: translate(-50%, -50%) scale(1.2) } 100% { transform: translate(-50%, -50%) scale(1) } }
@keyframes fhbob { 50% { transform: translateY(-6%) scale(1.04) } }
@keyframes fhpulse { 50% { transform: scale(1.07); box-shadow: inset 0 -3px 0 #b6d6ef, 0 3px 0 var(--blue-d), 0 0 0 6px #ff9f1c55 } }
@keyframes fhready { 50% { transform: translateY(-2px) } }
@keyframes fhrise { from { transform: translateY(40px); opacity: 0 } }
@keyframes fhnudge { 50% { transform: translateY(3px) } }
