/* Construction HUD geometry and palette are taken from the in-game build and placement screens. */
.cb-menu, .cb-title, .cb-detail-name, .cb-key-action, .cf-build-open { font-family: 'Cult Display', Georgia, serif; }
.cb-menu, .cb-placement { position: absolute; inset: 0; padding-bottom: var(--bottom-inset); }
.cb-menu { bottom: var(--bottom-inset); padding-bottom: 0; z-index: 20; pointer-events: auto; color: #f2e9d3; font-family: Georgia, serif; font-weight: 700; }
body[data-build-mode='menu'] #world { filter: grayscale(1) brightness(.55); }
body[data-build-mode='placement'] #world::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: #27157666; }
body[data-build-mode='menu'] .cf-heading, body[data-build-mode='menu'] .cf-back,
body[data-build-mode='menu'] .cf-build-open,
body[data-build-mode='placement'] .cf-heading, body[data-build-mode='placement'] .cf-back,
body[data-build-mode='placement'] .cf-build-open { visibility: hidden; }
.cb-ink { position: absolute; inset: 0 31% 0 0; background: url('../assets/hud/ink-edge.svg') left top / 100% 100% no-repeat; pointer-events: none; }
.cb-catalogue { position: absolute; top: 7.2%; left: 5.3%; width: 46.5%; height: 78%; }
.cb-title { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 0 0 5.5vh; color: #f2e9d3; font: 400 clamp(25px, 2.3vw, 38px)/1.2 'CultiVis Lapture', Georgia, serif; }
.cb-title::before, .cb-title::after { content: ''; width: 64px; height: 32px; background: url('../assets/hud/ornament.svg') 0 50% / 180px 34px no-repeat; opacity: .5; }
.cb-title::after { transform: scaleX(-1); }
.cb-tab-bar { display: flex; position: relative; gap: 8px; margin-bottom: 15px; }
.cb-tab-bar > .cb-key-action { flex: none; min-height: 38px; }
.cb-tab-bar > .cb-key-action > span { display: none; }
.cb-tabs { flex: 1; display: flex; align-items: stretch; gap: 5px; height: 38px; }
.cb-tab { position: relative; flex: 1; min-width: 0; border: 0; color: #09090b; background: #686769; font: 800 clamp(12px, 1.25vw, 19px)/1 'Nunito', sans-serif; padding: 8px 7px; clip-path: polygon(0 2%, 28% 0, 32% 8%, 36% 0, 76% 2%, 80% 11%, 83% 2%, 100% 0, 99% 100%, 0 98%); }
.cb-tab::before { content: ''; position: absolute; inset: 0; border-inline: 5px solid #1b171953; margin-inline: 8px; pointer-events: none; }
.cb-tab[aria-selected='true'] { color: #fff5df; background: #ff2819; }
.cb-tab:hover { filter: brightness(1.15); }
.cb-group { display: flex; justify-content: space-between; margin: 0 0 24px; color: #787575; font: 600 clamp(13px, 1.25vw, 19px)/1.2 'Nunito', sans-serif; }
.cb-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 24px 18px; align-content: start; max-height: calc(100% - 150px); overflow: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: #f32002 #333; }
.cb-paper-tile.cb-locked { background: #262625; box-shadow: inset 0 0 0 2px #4d4b46; display: grid; place-items: center; }
.cb-lock { flex: none; position: relative; display: block; width: 42px; height: 36px; margin-top: 15px; background: #f5f4ec; border-radius: 4px; }
.cb-lock::before { content: ''; position: absolute; width: 27px; height: 29px; border: 7px solid #f5f4ec; border-bottom: 0; border-radius: 20px 20px 0 0; left: 7px; top: -23px; }
.cb-lock::after { content: ''; position: absolute; inset: 10px 10px; background: #080808; -webkit-mask: url('../assets/hud/open-eye.png') center / contain no-repeat; mask: url('../assets/hud/open-eye.png') center / contain no-repeat; }
.cb-paper-tile { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 14px 7px 8px; border: 5px double #34312a; background: #e7d8b5; box-shadow: 0 0 0 2px #f7f3e0, 0 0 0 4px #3dcfba, inset 0 0 0 3px #c5b38a, inset 0 0 18px #9c814c42; }
.cb-paper-tile::before { content: ''; position: absolute; inset: 5px; border: 1px solid #6f6759; clip-path: polygon(0 0, 45% 0, 45% 1%, 48% 1%, 48% 0, 100% 0, 100% 43%, 98% 43%, 98% 47%, 100% 47%, 100% 100%, 0 100%); pointer-events: none; }
button.cb-paper-tile { transition: transform .1s ease; }
button.cb-paper-tile:not(:disabled):hover, button.cb-paper-tile:not(:disabled):focus-visible { transform: scale(1.06); outline: 3px solid #f8f6e6; outline-offset: 3px; }
button.cb-paper-tile:disabled { opacity: .4; filter: grayscale(1); cursor: default; box-shadow: inset 0 0 0 2px #4d4b46; }
.cb-bed-icon { display: block; width: 100%; height: 100%; object-fit: contain; overflow: visible; transform: rotate(-2deg); }
.cb-sleep-z { position: absolute; right: 12%; top: 3%; color: #19191a; font: 800 clamp(14px, 1.35vw, 22px)/1 'Nunito', sans-serif; }
.cb-sleep-z::before, .cb-sleep-z::after { content: 'z'; position: absolute; right: 8px; top: 12px; font-size: .8em; }
.cb-sleep-z::after { right: 12px; top: 23px; font-size: .6em; }
.cb-empty { color: #928e80; font: 600 15px 'Nunito', sans-serif; }
.cb-detail { position: absolute; top: 28%; left: 62%; width: 33.3%; min-height: 42%; padding: 28px 20px 25px; text-align: center; background: #242b25f5; box-shadow: 0 0 0 5px #22261fd9; clip-path: polygon(0 1%, 79% 1%, 81% 0, 82% 1%, 100% 1%, 100% 98%, 91% 98%, 90% 100%, 88% 98%, 0 98%); }
.cb-detail::before { content: ''; position: absolute; inset: 14px; pointer-events: none; border: 2px solid #62655752; border-radius: 9px 4px 11px 8px; }
.cb-detail-icon { width: clamp(70px, 6vw, 104px); margin: 8px auto 28px; }
.cb-detail-icon .cb-paper-tile { border-width: 4px; box-shadow: 0 0 0 2px #55cdb8, inset 0 0 0 2px #c5b38a, inset 0 0 16px #9c814c42; }
.cb-infinity { position: absolute; top: 18px; right: 22px; font: 700 clamp(35px, 3.5vw, 58px)/1 Georgia, serif; }
.cb-detail-name { margin: 0 0 28px; font: 400 clamp(20px, 1.7vw, 28px)/1.2 'CultiVis Lapture', Georgia, serif; }
.cb-description { position: relative; margin: 0 -3px; padding: 18px 14px 8px; min-height: 70px; text-align: center; color: #dfd5b8; background: #46503d25; font: 600 clamp(13px, 1.18vw, 19px)/1.55 'Nunito', sans-serif; }
.cb-red, .cb-cost > span { color: #c33321; }
.cb-cost { position: relative; padding: 8px 5px 10px; background: #46503d25; }
.cb-cost > span { display: block; margin-bottom: 12px; font: 700 clamp(14px, 1.1vw, 18px) 'Nunito', sans-serif; }
.cb-cost strong { font-size: clamp(16px, 1.5vw, 23px); }
.cb-menu-footer { position: absolute; left: 2.2%; bottom: 22px; display: flex; gap: 28px; }
.cb-key-action { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 3px 0; color: #f5ecd3; border: 0; background: transparent; font: 700 clamp(14px, 1.3vw, 21px)/1.2 Georgia, serif; -webkit-tap-highlight-color: transparent; }
.cb-key-action kbd { display: grid; place-items: center; min-width: 31px; height: 34px; padding: 0 8px; border-radius: 5px; color: #0b0c0b; background: #f2ecd5; box-shadow: inset 0 -2px 0 #c6bca4; font: 800 21px/1 Georgia, serif; }
.cb-key-action:hover { color: #f5db28; }
.cb-key-action:disabled { color: #8d8780; cursor: default; }
.cb-key-action:disabled kbd { background: #999184; }
.cb-placement { z-index: 12; pointer-events: none; }
.cb-placement-title { position: absolute; width: 230px; height: 48px; top: 22px; left: 50%; transform: translateX(-50%); }
.cb-placement-footer { position: absolute; bottom: calc(var(--bottom-inset) + 28px); left: 50%; transform: translateX(-50%); display: flex; justify-content: center; align-items: center; gap: 18px; max-width: calc(100% - 24px); padding: 7px 18px; background: #080709; clip-path: polygon(0 12%, 3% 8%, 0 5%, 10% 4%, 10% 0, 27% 4%, 65% 2%, 65% 6%, 95% 1%, 100% 9%, 99% 50%, 100% 88%, 98% 100%, 67% 96%, 66% 100%, 0 96%, 2% 83%, 0 80%); }
.cb-placement-footer .cb-key-action { white-space: nowrap; pointer-events: auto; }
.cb-place-action > span { color: #f4df28; }
.cb-placement-status { position: absolute; left: 50%; bottom: calc(var(--bottom-inset) + 106px); transform: translateX(-50%); margin: 0; padding: 8px 18px; color: #f7e5cf; background: #1a0b11e6; font: 800 14px 'Nunito', sans-serif; white-space: nowrap; }
.cb-placement-status:empty { display: none; }
.cb-build-context { position: absolute; z-index: 5; left: 50%; bottom: calc(var(--bottom-inset) + 23px); transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 8px 14px; color: #f5ecd3; background: #100b0de8; border: 1px solid #676150; pointer-events: auto; }
.cb-context-name { font: 700 14px 'Nunito', sans-serif; white-space: nowrap; }
.cb-build-context .cb-key-action { font-size: 14px; }
.cb-context-close { border: none; color: #e9ddc8; background: transparent; font-size: 24px; }
.cb-announcement { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.cf-build-open { position: absolute; bottom: calc(var(--bottom-inset) + 22px); right: 24px; z-index: 4; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 5px 14px 5px 7px; border: none; color: #f4ead3; background: #100c0ee8; font: 700 16px Georgia, serif; }
.cf-build-open kbd { display: grid; place-items: center; height: 31px; width: 29px; border-radius: 4px; color: #111; background: #f3ebd1; font: 700 19px Georgia, serif; }
#overlay:not([data-state='ready']) .cf-build-open { display: none; }
body[data-build-selection='true'] .cf-build-open { visibility: hidden; }
@media (max-width: 760px) {
 .cb-ink { right: -8%; opacity: .98; }
 .cb-catalogue { left: 20px; top: max(20px, env(safe-area-inset-top)); width: calc(100% - 40px); height: auto; }
 .cb-title { font-size: 27px; margin-bottom: 24px; }
 .cb-title::before, .cb-title::after { width: 48px; }
 .cb-tabs { height: 36px; margin-bottom: 12px; }
 .cb-tab { font-size: 12px; padding: 8px 3px; }
 .cb-group { font-size: 13px; margin-bottom: 18px; }
 .cb-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; padding-left: 2px; }
 .cb-paper-tile { max-width: 100px; }
 .cb-detail { top: 38%; left: 20px; width: calc(100% - 40px); min-height: 0; padding: 19px 18px 20px; }
 .cb-detail-icon { width: 70px; margin: 0 auto 17px; }
 .cb-detail-name { font-size: 21px; margin-bottom: 15px; }
 .cb-description { font-size: 13px; line-height: 1.5; padding: 12px 10px 4px; min-height: 0; }
 .cb-cost { padding: 7px 5px 8px; }
 .cb-cost > span { font-size: 13px; margin-bottom: 7px; }
 .cb-cost strong { font-size: 17px; }
 .cb-infinity { font-size: 38px; top: 20px; right: 20px; }
 .cb-menu-footer { left: 20px; bottom: 18px; gap: 28px; }
 .cb-menu-footer .cb-key-action { font-size: 17px; }
 .cb-placement-title { width: 180px; top: max(16px, env(safe-area-inset-top)); }
 .cb-placement-footer { bottom: calc(var(--bottom-inset) + 20px); width: calc(100% - 24px); padding: 8px 12px; flex-wrap: wrap; gap: 0 22px; }
 .cb-placement-footer .cb-key-action { font-size: 14px; gap: 8px; }
 .cb-placement-footer .cb-place-action { width: 100%; }
 .cb-placement-footer kbd { height: 28px; min-width: 28px; font-size: 18px; }
 .cb-placement-status { bottom: calc(var(--bottom-inset) + 132px); font-size: 12px; }
 .cb-build-context { left: auto; right: 12px; transform: none; bottom: calc(var(--bottom-inset) + 26px); flex-wrap: wrap; justify-content: center; gap: 3px 10px; max-width: calc(100% - 146px); padding: 6px 9px; }
 .cb-context-name { width: 100%; text-align: center; font-size: 12px; }
 .cb-build-context .cb-key-action { font-size: 12px; gap: 5px; }
 .cb-build-context kbd { min-width: 24px; height: 28px; font-size: 17px; }
 .cf-build-open { right: 16px; font-size: 14px; }
}
@media (max-height: 620px) and (min-aspect-ratio: 1/1) {
 .cb-catalogue { top: 7%; height: 75%; }
 .cb-title { font-size: 25px; margin-bottom: 22px; }
 .cb-tabs { height: 30px; margin-bottom: 10px; }
 .cb-group { font-size: 12px; margin-bottom: 17px; }
 .cb-tab { font-size: 13px; }
 .cb-detail { top: 18%; min-height: 0; padding: 12px 15px 17px; }
 .cb-detail-icon { width: 58px; margin: 7px auto 16px; }
 .cb-detail-name { font-size: 18px; margin-bottom: 13px; }
 .cb-description { min-height: 0; padding: 10px 5px 4px; font-size: 12px; }
 .cb-cost { padding: 5px; }
 .cb-cost > span { font-size: 12px; margin-bottom: 4px; }
 .cb-menu-footer { bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { .cb-paper-tile { transition: none; } }
.cb-title, .cb-detail-name, .cb-key-action, .cf-build-open, .cb-tab { font-family: 'CultiVis Lapture', Georgia, serif; }

@media (min-width: 761px) and (max-width: 1024px) and (orientation: portrait) {
 .cb-catalogue { left: 4%; width: 52%; }
 .cb-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 18px; }
 .cb-paper-tile { min-width: 0; }
 .cb-detail { left: 64%; width: 32%; padding: 24px 12px; }
 .cb-description { padding-inline: 4px; }
 .cb-placement-footer { flex-wrap: wrap; bottom: calc(var(--bottom-inset) + 20px); width: calc(100% - 32px); }
 .cb-placement-footer .cb-place-action { width: 100%; }
 .cb-placement-status { bottom: calc(var(--bottom-inset) + 144px); }
}
