/* Purr Palace — game shell. Everything sits over one full-window canvas, styled as in-game UI. */
:root {
  --bg: #1b1524;
  --panel-a: #3b2d52;
  --panel-b: #281f38;
  --edge: #5a4780;
  --edge-dark: #17111f;
  --ink: #fbf4ea;
  --muted: #bcaed0;
  --butter: #ffd36b;
  --butter-dark: #b9822a;
  --mint: #7fdcb4;
  --coral: #ff8d7a;
  --lilac: #b9a8ff;
  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --dock-h: 128px;
  color-scheme: dark;
  --paw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='%23fff3df' stroke='%232a1d33' stroke-width='1.6'%3E%3Cellipse cx='14' cy='17' rx='6' ry='5'/%3E%3Cellipse cx='7' cy='10' rx='2.6' ry='3.2'/%3E%3Cellipse cx='12' cy='6.5' rx='2.6' ry='3.2'/%3E%3Cellipse cx='17.5' cy='6.5' rx='2.6' ry='3.2'/%3E%3Cellipse cx='22' cy='10.5' rx='2.6' ry='3.2'/%3E%3C/g%3E%3C/svg%3E") 6 4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.4;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  cursor: var(--paw), default;
}
button, a, .catcard, .item, [data-tip] { cursor: var(--paw), pointer; }
#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }
#game.grab { cursor: grabbing; }
#game.build { cursor: crosshair; }
kbd { font: 800 .68rem var(--body); color: var(--muted); background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.14); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
h2, h3 { font-family: var(--display); margin: 0; line-height: 1.1; }

/* ---------- shared chrome ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b));
  border: 2px solid var(--edge); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -2px 0 rgba(0,0,0,.25), 0 8px 22px rgba(6,3,10,.55);
}
.btn {
  font: 700 .9rem var(--display); color: var(--ink); letter-spacing: .01em;
  background: linear-gradient(180deg, #4d3d6c, #382b50); border: 2px solid #64508d; border-radius: 12px;
  box-shadow: 0 3px 0 var(--edge-dark), inset 0 1px 0 rgba(255,255,255,.16);
  padding: 7px 14px; transition: transform .06s, box-shadow .06s, filter .12s;
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-dark), inset 0 1px 0 rgba(255,255,255,.16); }
.btn:disabled { opacity: .45; filter: saturate(.4); }
.btn.primary { color: #3b2508; background: linear-gradient(180deg, #ffe08a, #f2b744); border-color: #ffe7a3; box-shadow: 0 3px 0 var(--butter-dark), inset 0 1px 0 rgba(255,255,255,.5); }
.btn.danger:hover:not(:disabled) { border-color: var(--coral); color: #ffd9d2; }
.btn.big { font-size: 1.15rem; padding: 11px 22px; border-radius: 14px; min-width: 260px; }
.btn.tiny { padding: 0 8px; font-size: .85rem; border-radius: 8px; box-shadow: 0 2px 0 var(--edge-dark); }
.btn.icon { width: 44px; height: 44px; padding: 0; font-size: 1.3rem; display: grid; place-items: center; }
button:focus-visible { outline: 2px solid var(--butter); outline-offset: 2px; }
button { font-family: inherit; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
body.on-title #hud { display: none; }

#hud-time { position: absolute; top: 14px; left: 14px; display: flex; gap: 14px; padding: 10px 14px 10px 16px; align-items: center; }
.clockface { text-align: left; min-width: 108px; }
.t-day { font: 800 .78rem var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.t-time { font: 800 1.75rem/1 var(--display); color: var(--butter); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0,0,0,.35); margin: 2px 0; }
.t-week { font-size: .75rem; color: var(--muted); font-weight: 700; }
.time-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.status { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; font-size: .82rem; padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12); }
.status.home { color: var(--mint); } .status.work { color: var(--butter); } .status.asleep { color: var(--lilac); }
.speeds { display: flex; gap: 4px; }
.spd { font: 800 .72rem var(--body); letter-spacing: -1px; width: 38px; height: 30px; color: var(--muted); background: rgba(0,0,0,.28); border: 2px solid rgba(255,255,255,.1); border-radius: 9px; }
.spd:hover { color: var(--ink); }
.spd.on { color: #3b2508; background: linear-gradient(180deg, #ffe08a, #f2b744); border-color: #ffe7a3; }

#hud-stats { position: absolute; top: 14px; right: 14px; display: flex; gap: 18px; padding: 10px 12px 10px 18px; align-items: center; }
.stat { display: flex; align-items: center; gap: 7px; }
.stat .ic { font-size: 1.25rem; }
.stat b { font: 800 1.35rem/1 var(--display); font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-weight: 700; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.stat.money b { color: var(--mint); }
.stat.purrs b { color: #ffb4cf; }
.stat.rating { flex-direction: column; gap: 0; align-items: flex-start; }
.stars { color: var(--butter); font-size: 1.15rem; letter-spacing: 1px; line-height: 1; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.stars .off { color: #5d4d78; }
.stat.bump b { animation: bump .45s ease-out; }
@keyframes bump { 30% { transform: scale(1.22); } }

.away { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-weight: 800; font-size: .9rem; padding: 8px 18px; border-radius: 99px; background: rgba(27,21,36,.88); border: 2px solid var(--edge); box-shadow: 0 6px 16px rgba(0,0,0,.4); white-space: nowrap; }
.away.work { color: var(--butter); } .away.asleep { color: var(--lilac); }

/* cat rail */
#cat-rail { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; }
.catcard { position: relative; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 0; color: var(--ink); }
.catcard .ring { width: 70px; height: 70px; border-radius: 50%; padding: 4px; background: conic-gradient(var(--mc) calc(var(--m) * 1%), rgba(255,255,255,.12) 0); box-shadow: 0 6px 16px rgba(0,0,0,.45); transition: transform .12s; }
.catcard:hover .ring { transform: scale(1.06); }
.catcard.sel .ring { box-shadow: 0 0 0 3px var(--butter), 0 6px 16px rgba(0,0,0,.45); }
.catcard canvas { width: 62px; height: 62px; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #5a4780, #2a2039); display: block; }
.catcard .nm { font: 800 .85rem var(--display); text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.catcard .warn { position: absolute; top: -4px; right: 0; font-size: 1rem; background: #2a1d33; border: 2px solid var(--coral); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

/* goals */
#goals { position: absolute; right: 14px; top: 92px; width: 270px; padding: 10px 12px; }
#goals header { display: flex; justify-content: space-between; align-items: center; font: 800 .95rem var(--display); }
#goals ol { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#goals.collapsed ol { display: none; }
#goals li { display: flex; gap: 8px; font-size: .82rem; line-height: 1.3; }
#goals li i { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--edge); display: grid; place-items: center; font-style: normal; font-size: .7rem; margin-top: 1px; }
#goals li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.3); }
#goals li.done i { background: var(--mint); border-color: var(--mint); color: #12301f; }
#goals li small { color: var(--mint); font-weight: 800; margin-left: 4px; }

/* inspector */
#inspector { position: absolute; left: 104px; bottom: calc(var(--dock-h) + 26px); width: 320px; max-height: calc(100vh - var(--dock-h) - 150px); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
#inspector header { display: flex; gap: 10px; align-items: flex-start; }
#inspector header canvas { width: 54px; height: 54px; border-radius: 12px; background: radial-gradient(circle at 50% 60%, #5a4780, #2a2039); flex: none; }
#inspector header > div { flex: 1; min-width: 0; }
#inspector h3 { font-size: 1.25rem; }
#inspector .sub { color: var(--muted); font-size: .82rem; }
#inspector .x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; padding: 0 2px; }
#inspector .x:hover { color: var(--ink); }
.traits { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.traits span { font-size: .7rem; font-weight: 800; color: var(--muted); border: 1px solid rgba(255,255,255,.18); border-radius: 99px; padding: 0 7px; }
.needs { display: grid; grid-template-columns: 22px 64px 1fr; gap: 5px 6px; align-items: center; font-size: .8rem; font-weight: 800; }
.needs .nl { color: var(--muted); }
.meter { height: 10px; border-radius: 99px; background: rgba(0,0,0,.35); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.meter i { display: block; height: 100%; border-radius: 99px; transition: width .25s linear; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts .btn { font-size: .82rem; padding: 6px 11px; }
.moodline { font-weight: 800; }

/* dock */
#dock { position: absolute; left: 14px; right: 14px; bottom: 14px; height: var(--dock-h); display: flex; gap: 12px; align-items: stretch; }
#modes { display: flex; flex-direction: column; gap: 8px; padding: 10px; justify-content: center; }
.mode { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: center; width: 118px; font: 800 1rem var(--display); color: var(--muted); background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.1); border-radius: 12px; padding: 7px 10px; text-align: left; }
.mode .mi { font-size: 1.2rem; }
.mode:hover { color: var(--ink); }
.mode.on { color: #3b2508; background: linear-gradient(180deg, #ffe08a, #f2b744); border-color: #ffe7a3; }
.mode.on kbd { color: #6b4a12; background: rgba(255,255,255,.35); border-color: rgba(0,0,0,.15); }
#dock-center { flex: 1; min-width: 0; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; }
.live-hint { color: var(--muted); text-align: center; font-weight: 700; }
#catalog { display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 0; }
#cat-tabs { display: flex; gap: 6px; }
.ctab { font: 800 .8rem var(--display); color: var(--muted); background: rgba(0,0,0,.22); border: 2px solid transparent; border-radius: 9px; padding: 1px 12px; }
.ctab.on { color: var(--ink); border-color: var(--edge); background: rgba(255,255,255,.06); }
#cat-items { flex: 1; min-height: 0; display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: thin; }
.item { position: relative; flex: none; width: 104px; display: flex; flex-direction: column; align-items: center; gap: 0; background: rgba(0,0,0,.22); border: 2px solid rgba(255,255,255,.08); border-radius: 12px; padding: 3px 4px 5px; color: var(--ink); font: inherit; }
.item:hover:not(.locked) { border-color: var(--butter); background: rgba(255,211,107,.08); }
.item.active { border-color: var(--butter); box-shadow: 0 0 0 2px rgba(255,211,107,.35); }
.item canvas { width: 72px; height: 54px; display: block; }
.item b { font: 700 .78rem/1.1 var(--display); text-align: center; }
.item .price { font: 800 .82rem var(--display); color: var(--mint); }
.item .price.no { color: var(--coral); }
.item .dots { position: absolute; top: 5px; left: 6px; display: flex; gap: 3px; }
.item .dots i { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(0,0,0,.4); }
.item.locked canvas { filter: grayscale(1) brightness(.55); }
.item .lock { position: absolute; inset: 0; border-radius: 10px; display: grid; place-items: center; text-align: center; font: 800 .72rem/1.2 var(--body); background: rgba(20,14,28,.62); padding: 6px; }
#chores { display: flex; gap: 8px; padding: 10px; align-items: center; }
.chore { position: relative; width: 74px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 800 .82rem var(--display); color: var(--ink); background: rgba(0,0,0,.22); border: 2px solid rgba(255,255,255,.1); border-radius: 12px; }
.chore .ci { font-size: 1.7rem; }
.chore:hover:not(:disabled) { border-color: var(--butter); }
.chore:disabled { opacity: .4; }
.badge { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: var(--coral); color: #2a1010; font: 800 .75rem/22px var(--body); font-style: normal; text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.35); }

/* toasts + tooltip */
#toasts { position: absolute; right: 14px; bottom: calc(var(--dock-h) + 26px); display: flex; flex-direction: column-reverse; gap: 8px; align-items: flex-end; pointer-events: none !important; }
.toast { display: flex; gap: 10px; align-items: center; max-width: 380px; padding: 9px 14px; font-weight: 700; font-size: .88rem; border-radius: 14px; background: linear-gradient(180deg, rgba(59,45,82,.96), rgba(40,31,56,.96)); border: 2px solid var(--edge); box-shadow: 0 8px 20px rgba(0,0,0,.45); animation: tin .3s cubic-bezier(.2,1.4,.4,1); }
.toast .ti { font-size: 1.3rem; }
.toast.good { border-color: var(--mint); } .toast.bad { border-color: var(--coral); }
.toast.out { opacity: 0; transform: translateX(20px); transition: opacity .3s, transform .3s; }
@keyframes tin { from { opacity: 0; transform: translateX(30px) scale(.95); } }
#tooltip { position: fixed; z-index: 50; max-width: 260px; padding: 8px 11px; font-size: .82rem; font-weight: 700; border-radius: 10px; background: rgba(20,14,28,.96); border: 2px solid var(--edge); box-shadow: 0 6px 16px rgba(0,0,0,.5); pointer-events: none; }
#tooltip b { font-family: var(--display); font-size: .95rem; }
#tooltip .tdesc { color: var(--muted); margin-top: 2px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(27,21,36,.35), rgba(15,10,20,.82)); animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } }
#title { background: linear-gradient(90deg, rgba(15,10,22,.92) 0%, rgba(15,10,22,.55) 45%, rgba(15,10,22,0) 75%); place-items: center start; padding-left: max(6vw, 24px); }
.title-card { display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.logo { font-family: var(--display); font-weight: 800; line-height: .82; display: flex; flex-direction: column; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.logo .l1 { font-size: clamp(3.4rem, 9vw, 6.5rem); color: var(--ink); }
.logo .l2 { font-size: clamp(3.4rem, 9vw, 6.5rem); color: var(--butter); margin-left: .5em; }
.tagline { margin: 0; color: var(--muted); font-size: 1.1rem; font-weight: 700; max-width: 30ch; }
.menu { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.saveinfo { color: var(--muted); font-size: .82rem; margin: 0; min-height: 1.2em; }
.back { position: absolute; left: max(6vw, 24px); bottom: 22px; color: var(--muted); font-weight: 700; text-decoration: none; font-size: .85rem; }
.back:hover { color: var(--ink); }
.dialog { padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; max-width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; animation: pop .22s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.dialog h2 { font-size: 1.9rem; text-align: center; }
#pause .menu { align-items: center; }
.dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog p b { color: var(--ink); }
.dialog .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.howto { display: grid; grid-template-columns: 34px 1fr; gap: 10px 12px; align-items: start; }
.howto .hi { font-size: 1.5rem; text-align: center; }
.howto h3 { font-size: 1.05rem; }
.howto p { font-size: .9rem; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: .88rem; color: var(--muted); }
.setting { display: grid; grid-template-columns: 120px 1fr 44px; gap: 12px; align-items: center; font-weight: 800; }
.setting output { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--butter); }

@media (max-width: 900px) {
  :root { --dock-h: 112px; }
  #goals { display: none; }
  #inspector { left: 14px; width: min(320px, calc(100vw - 28px)); }
  #cat-rail { top: auto; bottom: calc(var(--dock-h) + 28px); transform: none; flex-direction: row; }
  #chores span:not(.ci) { display: none; }
  .chore { width: 52px; }
  .mode { width: 86px; } .mode kbd { display: none; }
  #hud-stats { gap: 10px; } .stat small { display: none; }
  .live-hint { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
