/* Cozy House - look of the menus and the on-screen display */

:root {
	--ink: #3b3340;
	--paper: #fffaf2;
	--paper2: #f6ecdc;
	--pink: #f277ad;
	--pinkDark: #d85a92;
	--teal: #35b8a6;
	--yellow: #f7d23e;
	--shadow: 0 6px 24px rgba(40, 20, 50, 0.28);
	--font: "Baloo 2", "Nunito", "Quicksand", "Varela Round", "Arial Rounded MT Bold", "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd0f5; font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.35); }

#topLeft { position: absolute; left: 14px; top: 12px; display: flex; flex-direction: column; gap: 8px; }
#clock, #needs, #goals, #modeBadge, #carry, #prompt, #hints, #actBar, .toast { background: rgba(255, 250, 242, 0.92); border-radius: 16px; box-shadow: 0 3px 12px rgba(40, 20, 50, 0.22); }
#clock { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; font-weight: 800; font-size: 17px; }
#clockIcon { width: 26px; height: 26px; border-radius: 50%; background: #ffd34d; box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.08); }
#clockIcon.night { background: #cfd6f5; box-shadow: inset -8px -3px 0 #6a73b8; }
#clockDay { opacity: 0.6; font-size: 14px; }
body[data-mode="build"] #clockTime::after { content: "  (paused)"; font-size: 12px; opacity: 0.6; }

#needs { padding: 8px 12px 9px; width: 214px; }
body[data-mode="build"] #needs { opacity: 0.45; }
.need { display: flex; align-items: center; gap: 7px; height: 22px; font-size: 13px; font-weight: 700; }
.need svg { width: 17px; height: 17px; flex: none; }
.need .nm { width: 66px; }
.need .track { flex: 1; height: 10px; background: #e6dccb; border-radius: 6px; overflow: hidden; }
.need .fill { height: 100%; width: 50%; border-radius: 6px; background: #5fc15f; transition: width 0.3s, background 0.3s; }
#moodRow { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 800; font-size: 14px; }
#moodFace svg { width: 26px; height: 26px; display: block; }

#topRight { position: absolute; right: 14px; top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#modeBadge { padding: 6px 14px; font-weight: 800; font-size: 15px; color: #fff; background: var(--pink); }
body[data-mode="build"] #modeBadge { background: var(--teal); }
#modeBadge small { font-weight: 600; opacity: 0.9; margin-left: 6px; }
#goals { padding: 9px 13px; font-size: 13px; max-width: 280px; }
#goals h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.6; }
.goal { display: flex; gap: 7px; align-items: baseline; line-height: 1.35; }
.goal .box { width: 12px; height: 12px; flex: none; border-radius: 4px; border: 2px solid #b9a98f; transform: translateY(2px); }
.goal.done { opacity: 0.5; text-decoration: line-through; }
.goal.done .box { background: #5fc15f; border-color: #4aa64a; }

#prompt { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); padding: 6px 15px; font-weight: 800; font-size: 16px; white-space: nowrap; opacity: 0; transition: opacity 0.12s; }
#prompt.show { opacity: 1; }
#prompt.disabled { color: #8a7f88; font-weight: 700; }
#prompt.shake { animation: shake 0.25s; }
#prompt kbd { margin-right: 6px; }
@keyframes shake { 25% { transform: translateX(calc(-50% - 6px)); } 75% { transform: translateX(calc(-50% + 6px)); } }

#actBar { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); padding: 8px 14px 10px; min-width: 240px; text-align: center; font-weight: 800; display: none; }
#actBar.show { display: block; }
#actTrack { height: 10px; background: #e6dccb; border-radius: 6px; overflow: hidden; margin-top: 5px; }
#actFill { height: 100%; width: 0; background: var(--pink); border-radius: 6px; }

#carry { position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); padding: 7px 16px; font-weight: 700; font-size: 15px; white-space: nowrap; display: none; }
#carry.show { display: block; }
#carry b { color: var(--pinkDark); }
body[data-mode="build"] #carry { display: none !important; }

#hotbarWrap { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); display: none; flex-direction: column; align-items: center; gap: 6px; }
body[data-mode="build"] #hotbarWrap { display: flex; }
#hotbarLabel { background: rgba(59, 51, 64, 0.82); color: #fff; padding: 3px 12px; border-radius: 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
#hotbar, #catHotbar { display: flex; gap: 6px; padding: 6px; background: rgba(255, 250, 242, 0.92); border-radius: 18px; box-shadow: 0 3px 12px rgba(40, 20, 50, 0.22); }
.slot { position: relative; width: 58px; height: 58px; border-radius: 13px; background: var(--paper2); border: 3px solid transparent; }
.slot img { width: 100%; height: 100%; display: block; pointer-events: none; }
.slot .num { position: absolute; left: 4px; top: 1px; font-size: 11px; font-weight: 800; opacity: 0.55; }
.slot.sel { border-color: var(--pink); background: #fff; transform: translateY(-3px); box-shadow: 0 4px 10px rgba(242, 119, 173, 0.45); }

#hints { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 3px 14px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: rgba(59, 51, 64, 0.62); color: #fff; box-shadow: none; }
#hints b { color: #ffe08a; font-weight: 800; }

#toasts { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { padding: 7px 18px; font-weight: 800; font-size: 16px; animation: toastIn 0.25s; transition: opacity 0.4s, transform 0.4s; }
.toast.good { background: #e3f8d9; }
.toast.warn { background: #ffe9c7; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.95); } }

kbd { display: inline-block; min-width: 22px; padding: 0 6px; margin: 0 1px; text-align: center; font-family: inherit; font-size: 0.86em; font-weight: 800; background: #fff; border: 2px solid #d9cbb5; border-bottom-width: 4px; border-radius: 7px; }

/* ---- sleeping ---- */
#sleepOverlay { position: fixed; inset: 0; background: #0b0d26; opacity: 0; pointer-events: none; transition: opacity 1.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #dfe4ff; }
#sleepOverlay.on { opacity: 0.88; }
#zzz { font-size: 64px; font-weight: 800; letter-spacing: 0.1em; animation: float 2.4s ease-in-out infinite; }
#sleepText { font-size: 17px; opacity: 0.75; margin-top: 16px; }
@keyframes float { 50% { transform: translateY(-14px); opacity: 0.6; } }

#clickToPlay { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(59, 51, 64, 0.85); color: #fff; font-weight: 800; font-size: 22px; padding: 16px 30px; border-radius: 20px; pointer-events: none; }

/* ---- panels ---- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(60, 40, 80, 0.38); backdrop-filter: blur(3px); }
#menu { background: rgba(60, 40, 80, 0.12); backdrop-filter: none; justify-content: flex-start; padding-left: 7vw; }
@media (max-width: 900px) { #menu { justify-content: center; padding-left: 0; } }
.panel { background: var(--paper); border-radius: 28px; box-shadow: var(--shadow); padding: 26px 34px 24px; width: min(480px, 94vw); max-height: 94vh; overflow: auto; text-align: center; }
.panel.wide { width: min(980px, 96vw); text-align: left; padding: 20px 24px; }
h1#title { margin: 0; font-size: 54px; line-height: 1.05; color: var(--pink); text-shadow: 0 3px 0 #fff, 0 6px 0 rgba(242, 119, 173, 0.25); }
.by { margin: 4px 0 18px; font-weight: 700; opacity: 0.6; }
.tip { margin: 16px 0 0; font-size: 14px; opacity: 0.7; }
#menuButtons { display: flex; flex-direction: column; gap: 10px; }
#menuButtons .row { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
button { font-family: inherit; font-weight: 800; color: var(--ink); background: #fff; border: 3px solid #e3d5bf; border-bottom-width: 6px; border-radius: 16px; cursor: pointer; padding: 10px 18px; font-size: 17px; }
button:hover { background: #fff6e3; border-color: var(--pink); }
button:active { transform: translateY(2px); border-bottom-width: 4px; }
button.primary { background: var(--pink); color: #fff; border-color: var(--pinkDark); }
button.primary:hover { background: #f58cba; }
button.small { font-size: 13.5px; padding: 6px 12px; border-radius: 12px; border-width: 2px; border-bottom-width: 4px; }

.panelHead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.panelHead h2 { margin: 0; font-size: 28px; color: var(--pink); }
.panelHead .sub { flex: 1; opacity: 0.65; font-weight: 600; }
.panelHead button { margin-left: auto; }

.catBody { display: grid; grid-template-columns: 168px 1fr 250px; gap: 14px; height: min(440px, 60vh); }
#catTabs { display: flex; flex-direction: column; gap: 5px; overflow: auto; }
#catTabs button { text-align: left; font-size: 13.5px; padding: 3px 11px; border-radius: 11px; border-width: 2px; border-bottom-width: 4px; }
#catTabs button.sel { background: var(--teal); border-color: #2a9a8b; color: #fff; }
#catItems, #catLooksGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-content: start; overflow: auto; padding: 2px; }
#catLooks { background: var(--paper2); border-radius: 18px; padding: 10px 12px; display: flex; flex-direction: column; min-height: 0; }
#catLooks h3 { margin: 0 0 8px; font-size: 16px; }
#catLooksGrid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); flex: 1; }
.card { background: #fff; border: 3px solid #eadfcd; border-radius: 16px; padding: 4px 4px 6px; text-align: center; cursor: pointer; font-size: 12.5px; font-weight: 700; line-height: 1.15; }
.card:hover { border-color: var(--pink); }
.card.sel { border-color: var(--pink); background: #fff0f6; }
.card img { width: 72px; height: 72px; display: block; margin: 0 auto; }
#catLooksGrid .card img { width: 52px; height: 52px; }
#catLooksGrid .card { font-size: 11px; border-radius: 13px; }
#catHotbar { margin: 14px auto 0; width: fit-content; box-shadow: none; background: var(--paper2); }
#catHotbar .slot { cursor: pointer; background: #fff; }

.helpCols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.helpCols h3 { margin: 10px 0 6px; color: var(--teal); }
.helpCols table { border-collapse: collapse; font-size: 14.5px; }
.helpCols td { padding: 3px 12px 3px 0; vertical-align: middle; }
.helpCols td:first-child { white-space: nowrap; font-weight: 700; }
.note { font-size: 13.5px; opacity: 0.75; line-height: 1.4; }

#errorBox { position: fixed; left: 10px; bottom: 10px; max-width: 70vw; background: #ffe1e1; color: #8a1f1f; border: 2px solid #e99; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; z-index: 99; }

@media (max-width: 760px) {
	.catBody { grid-template-columns: 120px 1fr; }
	#catLooks { grid-column: 1 / 3; }
	.helpCols { grid-template-columns: 1fr; }
	#goals { display: none; }
}
