/* ============ Whisker World - styles ============ */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, #fdf3e7 0%, #fbe8d8 55%, #f6dccb 100%);
  min-height: 100vh;
  color: #5c4a3a;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px 4px;
  max-width: 1240px;
  margin: 0 auto;
}

.brand { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.brand b { color: #e0762e; }

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 6px 14px;
  border-radius: 99px;
  box-shadow: 0 6px 16px rgba(90, 60, 40, .1);
}

.identity-name { font-weight: 800; font-size: 15px; }

.level-chip {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: #e0762e;
  padding: 3px 9px;
  border-radius: 99px;
}

.xpbar { width: 90px; height: 8px; background: #f3ece4; border-radius: 99px; overflow: hidden; }
.xpfill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd27a, #e0762e);
  border-radius: 99px;
  transition: width .5s ease;
}

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.clock { font-weight: 700; font-size: 14px; color: #7a6455; font-variant-numeric: tabular-nums; }

.icon-btn {
  border: none;
  background: #fff;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(90, 60, 40, .1);
  transition: transform .12s ease, box-shadow .12s ease;
}

.icon-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(90, 60, 40, .14); }
.icon-btn:active { transform: scale(.94); }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  padding: 10px 22px 26px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* ---------- scene ---------- */

.scene {
  position: relative;
  height: min(58vh, 540px);
  min-height: 440px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #fdf3e6 0%, #f8e9d4 62%, #f4e2c8 100%);
  box-shadow: inset 0 0 60px rgba(120, 80, 40, .06), 0 20px 50px rgba(90, 60, 40, .16);
}

.window {
  position: absolute;
  top: 7%;
  left: 50%;
  transform: translateX(-50%);
  width: min(46%, 420px);
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  border: 10px solid #c89a6e;
  box-shadow: 0 8px 20px rgba(90, 60, 40, .12), inset 0 0 0 3px #b2825a;
  z-index: 2;
}

.sky { position: absolute; inset: 0; transition: background 2.5s ease; background: linear-gradient(180deg, #8ed0f5, #d7f0fd); }

.scene[data-tod="day"] .sky { background: linear-gradient(180deg, #8ed0f5, #d7f0fd); }
.scene[data-tod="dawn"] .sky { background: linear-gradient(180deg, #ffb26b, #ffd9a0); }
.scene[data-tod="dusk"] .sky { background: linear-gradient(180deg, #f5826b, #c471b5); }
.scene[data-tod="night"] .sky { background: linear-gradient(180deg, #1d2a55, #3d4f86); }

.celestial { position: absolute; font-size: 34px; left: 72%; top: 12%; transition: all 2.5s ease; }

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, .9);
  border-radius: 18px;
  height: 16px;
  width: 56px;
  box-shadow: 16px -8px 0 2px rgba(255, 255, 255, .9), -14px -4px 0 -2px rgba(255, 255, 255, .85);
  animation: drift 34s linear infinite;
  transition: opacity 2s ease;
}

.cloud.c1 { top: 22%; }
.cloud.c2 { top: 50%; transform: scale(.75); animation-duration: 48s; animation-delay: -20s; }
.scene[data-tod="night"] .cloud { opacity: 0; }

.sky-stars { position: absolute; inset: 0; opacity: 0; transition: opacity 2s ease; }
.scene[data-tod="night"] .sky-stars { opacity: 1; }
.sky-stars span { position: absolute; width: 3px; height: 3px; background: #fff; border-radius: 50%; animation: twinkle 2.6s ease-in-out infinite; }

.window-cross { position: absolute; background: #c89a6e; z-index: 2; }
.window-cross.h { left: 0; right: 0; top: 50%; height: 8px; margin-top: -4px; }
.window-cross.v { top: 0; bottom: 0; left: 50%; width: 8px; margin-left: -4px; }

.picture {
  position: absolute;
  top: 10%;
  left: 7%;
  width: 62px;
  height: 72px;
  background: #fffdf8;
  border: 6px solid #c89a6e;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 30px;
  transform: rotate(-3deg);
  z-index: 2;
  box-shadow: 0 6px 12px rgba(90, 60, 40, .12);
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 33%;
  background: repeating-linear-gradient(90deg, rgba(120, 80, 40, .07) 0 2px, transparent 2px 92px), linear-gradient(180deg, #e0b78f, #cfa070);
  box-shadow: inset 0 8px 14px rgba(120, 80, 40, .12);
  z-index: 1;
}


.rug {
  position: absolute;
  bottom: 3%;
  left: 31%;
  width: 38%;
  height: 12%;
  background: radial-gradient(ellipse at center, #f4a7b9 0%, #e887a1 70%, #dd7590 100%);
  border-radius: 50%;
  opacity: .9;
  z-index: 2;
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .35);
}

.bed { position: absolute; bottom: 5.5%; left: 4%; width: 168px; height: 68px; z-index: 3; }
.bed::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #a55e6f;
  border-radius: 50% 50% 42% 42% / 80% 80% 55% 55%;
  box-shadow: 0 10px 14px rgba(90, 60, 40, .18);
}

.bed::after {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  top: 14px;
  bottom: 16px;
  background: #e8a7b3;
  border-radius: 50%;
}

.bowl { position: absolute; bottom: 5.5%; right: 5%; width: 88px; height: 38px; z-index: 3; }
.bowl::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #6fa8cd, #4f88ad);
  border-radius: 6px 6px 40px 40px;
  box-shadow: 0 8px 10px rgba(90, 60, 40, .16);
}

.bowl::after {
  content: "";
  position: absolute;
  top: -5px;
  left: -3px;
  right: -3px;
  height: 14px;
  background: #8cc0e2;
  border-radius: 10px;
}

.food-item { position: absolute; bottom: 14%; font-size: 34px; z-index: 18; pointer-events: none; }

.laser {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: #ff2d2d;
  border-radius: 50%;
  box-shadow: 0 0 14px 5px rgba(255, 45, 45, .75), 0 0 34px 12px rgba(255, 45, 45, .3);
  z-index: 42;
  pointer-events: none;
}


/* ---------- particles and toasts ---------- */

#particles { position: absolute; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }

.particle {
  position: absolute;
  font-size: 22px;
  animation: floatUp var(--dur, 1.6s) ease-out forwards;
  will-change: transform, opacity;
}

.toasts {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  background: rgba(60, 42, 32, .88);
  color: #fff;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
  animation: toastIn .3s ease;
  transition: opacity .4s ease;
}

.toast.out { opacity: 0; }

.ambient { position: absolute; inset: 0; pointer-events: none; z-index: 45; transition: background 2.5s ease; }

/* ---------- the cat ---------- */

.cat {
  position: absolute;
  bottom: 12%;
  left: 46%;
  width: 190px;
  z-index: 20;
  cursor: pointer;
  --fur: #f5a25d;
  --fur-dark: #d97f35;
  --belly: #fde8d2;
  --ear: #f7b6c8;
  --whisker: #fff;
  filter: drop-shadow(0 10px 8px rgba(90, 60, 40, .2));
}

.cat-svg { width: 100%; height: auto; display: block; overflow: visible; }

#tailG { transform-origin: 160px 160px; animation: tailSwish 3s ease-in-out infinite; }
#headG { transform-origin: 104px 118px; transition: transform .5s ease; }
#headTilt { transform-origin: 104px 116px; transition: transform .25s ease; }
#bodyG { transform-origin: 104px 190px; }
#eyeScale { transform-origin: 104px 80px; transition: transform .09s ease; }
#earL { transform-origin: 78px 58px; transition: transform .35s ease; }
#earR { transform-origin: 130px 58px; transition: transform .35s ease; }

.face-hidden { display: none; }
.blush { opacity: 0; transition: opacity .4s ease; }

/* mood faces */

.cat[data-mood="sad"] #mouthHappy, .cat[data-mood="sick"] #mouthHappy, .cat[data-mood="stinky"] #mouthHappy { display: none; }
.cat[data-mood="sad"] #mouthSad, .cat[data-mood="sick"] #mouthSad { display: block; }
.cat[data-mood="sad"] #earL { transform: rotate(12deg); }
.cat[data-mood="sad"] #earR { transform: rotate(-12deg); }

.cat[data-mood="sleepy"] #eyeScale { transform: scaleY(.45); }
.cat[data-mood="sleeping"] #eyesOpen, .cat[data-mood="fainted"] #eyesOpen { display: none; }
.cat[data-mood="sleeping"] #eyesClosed { display: block; }
.cat[data-mood="fainted"] #eyesX { display: block; }

.cat[data-mood="ecstatic"] #eyesOpen, .cat.petted #eyesOpen { display: none; }
.cat[data-mood="ecstatic"] #eyesHappy, .cat.petted #eyesHappy { display: block; }
.cat[data-mood="ecstatic"] .blush, .cat.petted .blush { opacity: .9; }

.cat.blink #eyeScale { transform: scaleY(.06); }

.cat[data-mood="sick"] #sweat { display: block; }
.cat[data-mood="sick"] #bandage { display: block; }

.cat[data-mood="sleeping"] #headG { transform: rotate(6deg) translateY(4px); }
.cat[data-mood="sleeping"] #tailG { animation: none; transform: rotate(28deg); }
.cat[data-mood="sleeping"] #bodyG { animation: breathe 3.4s ease-in-out infinite; }

.cat[data-mood="fainted"] .cat-svg { transform: rotate(5deg); }

/* eating and actions */

.cat.eating #mouthHappy { display: none; }
.cat.eating #mouthOpen { display: block; animation: chomp .3s ease-in-out infinite; transform-origin: 104px 105px; }
.cat.eating #headG { animation: chew .3s ease-in-out infinite; }

.cat.dizzy .cat-svg { animation: wobble .9s ease-in-out infinite; }
.cat.zoomie .cat-svg { animation: zoomBob .22s ease-in-out infinite; }
.cat.walking .cat-svg { animation: walkBobR .4s ease-in-out infinite; }
.cat.walking.flip .cat-svg { animation: walkBobL .4s ease-in-out infinite; }
.cat.pounce .cat-svg { animation: pounceA .45s ease; }
.cat.bounce .cat-svg { animation: bigBounce .9s ease; }
.cat.stretch #bodyG { animation: stretchA 1.2s ease; }

/* speech bubble and alerts */

.bubble {
  position: absolute;
  top: -44px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 14px;
  padding: 8px 13px;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(90, 60, 40, .16);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 11px;
  height: 11px;
  background: #fff;
}

.bubble.show { opacity: 1; }

.alert-ico {
  position: absolute;
  top: -56px;
  right: 4px;
  font-size: 26px;
  display: none;
  animation: bobAlert 1s ease-in-out infinite;
  z-index: 29;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25));
}

.cat.needs-attention .alert-ico { display: block; }

.dizzy-orbit { position: absolute; top: 4%; left: 50%; width: 0; height: 0; display: none; z-index: 25; }
.cat[data-mood="fainted"] .dizzy-orbit { display: block; animation: orbit 1.6s linear infinite; }
.dizzy-orbit span { position: absolute; font-size: 15px; }
.dizzy-orbit span:nth-child(1) { transform: rotate(0deg) translateX(58px); }
.dizzy-orbit span:nth-child(2) { transform: rotate(120deg) translateX(58px); }
.dizzy-orbit span:nth-child(3) { transform: rotate(240deg) translateX(58px); }

.flies { position: absolute; top: 0; left: 50%; width: 0; height: 0; display: none; z-index: 25; }
.cat[data-mood="stinky"] .flies { display: block; animation: orbit 2.6s linear infinite; }
.flies span { position: absolute; font-size: 14px; }
.flies span:nth-child(1) { transform: rotate(45deg) translateX(66px); }
.flies span:nth-child(2) { transform: rotate(225deg) translateX(66px); }


/* ---------- keyframes ---------- */

@keyframes tailSwish { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(16deg); } }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.045); } }
@keyframes walkBobR { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes walkBobL { 0%, 100% { transform: translateY(0) scaleX(-1); } 50% { transform: translateY(-7px) scaleX(-1); } }
@keyframes zoomBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes chew { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }
@keyframes chomp { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes pounceA { 0% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(6px) scale(1.12, .85); } 70% { transform: translateY(-14px) scale(.95, 1.1); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes bigBounce { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-34px); } 55% { transform: translateY(0); } 75% { transform: translateY(-12px); } }
@keyframes stretchA { 0%, 100% { transform: scale(1, 1); } 40% { transform: scale(1.08, .9); } }

@keyframes floatUp { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 0px), -110px) scale(1.25); } }
@keyframes bobAlert { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drift { from { transform: translateX(-40px); } to { transform: translateX(200px); } }
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes lowPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- side panel ---------- */

.panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.panel-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(90, 60, 40, .09);
}

.panel-card h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #a08b78; margin: 0 0 12px; }

.stat { margin-bottom: 13px; }
.stat:last-child { margin-bottom: 2px; }

.stat-top { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.stat-ico { display: inline-block; font-size: 16px; }
.stat-val { margin-left: auto; font-variant-numeric: tabular-nums; color: #8a7462; }

.bar { height: 14px; background: #f3ece4; border-radius: 99px; overflow: hidden; }

.fill { height: 100%; width: 0%; border-radius: 99px; transition: width .6s ease; }
.f-hunger { background: linear-gradient(90deg, #ffc38a, #f59e4c); }
.f-happy { background: linear-gradient(90deg, #ffb3c7, #f27ba0); }
.f-energy { background: linear-gradient(90deg, #b9e48c, #8bc34a); }
.f-clean { background: linear-gradient(90deg, #a8e0f5, #5bc0eb); }
.f-health { background: linear-gradient(90deg, #ff9b9b, #e05656); }

.stat.low .stat-ico { animation: wiggle .8s ease-in-out infinite; }
.stat.low .fill { animation: lowPulse 1s ease-in-out infinite; }

/* actions */

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.action {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff7ee;
  border: 2px solid #f0dcc8;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.action:hover:not(.disabled) { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(120, 80, 40, .14); border-color: #e4b98d; }
.action:active:not(.disabled) { transform: scale(.97); }
.action.disabled { opacity: .45; cursor: not-allowed; }

.a-emoji { font-size: 26px; line-height: 1; }
.a-text b { display: block; font-size: 14px; }
.a-text i { display: block; font-style: normal; font-size: 11px; color: #a5907c; }


/* food tray */

.food-tray { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

.food-btn {
  background: #fff;
  border: 2px solid #efe0d0;
  border-radius: 12px;
  padding: 8px 6px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.food-btn:hover { border-color: #f5a25d; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(120, 80, 40, .12); }
.f-emoji { font-size: 26px; display: block; line-height: 1.2; }
.f-name { font-size: 12px; font-weight: 800; display: block; }
.f-eff { font-size: 10px; color: #a5907c; display: block; }

/* journal */

.journal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.j-item { background: #fff7ee; border-radius: 12px; padding: 10px 4px; }
.j-item span { display: block; font-size: 20px; font-weight: 800; color: #b9772e; }
.j-item label { font-size: 11px; color: #a5907c; }

.hint { font-size: 12px; color: #a08b78; text-align: center; margin: 12px 0 0; }

/* ---------- adoption overlay ---------- */

.overlay { position: fixed; inset: 0; background: rgba(60, 40, 30, .45); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 20px; }
.overlay.hidden { display: none; }

.adopt-card {
  background: #fffaf4;
  border-radius: 24px;
  padding: 26px 28px;
  width: min(560px, 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  text-align: center;
  max-height: 94vh;
  overflow-y: auto;
}

.adopt-card h1 { margin: 0; font-size: 26px; }
.adopt-sub { color: #a5907c; margin: 6px 0 10px; font-size: 14px; }

.adopt-stage { position: relative; height: 190px; margin: 0 auto 4px; }
.adopt-stage .cat { position: static; bottom: auto; left: auto; width: 200px; margin: 0 auto; cursor: default; filter: none; }

.adopt-label { display: block; text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #a08b78; margin: 16px 0 7px; }

#nameInput {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 2px solid #f0dcc8;
  border-radius: 12px;
  background: #fff;
  color: #5c4a3a;
  outline: none;
}

#nameInput:focus { border-color: #e0762e; }

.swatches { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, .14), 0 4px 8px rgba(0, 0, 0, .12);
  transition: transform .12s ease, outline .1s ease;
  outline: 3px solid transparent;
  outline-offset: 3px;
}

.swatch:hover { transform: scale(1.1); }
.swatch.sel { outline-color: #e0762e; transform: scale(1.1); }

.personas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; text-align: left; }

.persona { border: 2px solid #f0dcc8; background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; font-family: inherit; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.persona b { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.persona p { font-size: 11px; color: #a5907c; margin: 5px 0 0; line-height: 1.4; }
.persona:hover { transform: translateY(-2px); }
.persona.sel { border-color: #e0762e; background: #fff3e6; }

.adopt-btn {
  margin-top: 22px;
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #f59e4c, #e0603e);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(224, 96, 62, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}

.adopt-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(224, 96, 62, .45); }
.adopt-btn:active { transform: scale(.98); }

/* ---------- responsive ---------- */

@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; padding: 8px 14px 20px; }
  .topbar { flex-wrap: wrap; padding: 12px 14px 2px; }
  .scene { height: 440px; min-height: 400px; }
  .cat { width: 160px; }
}

@media (max-width: 520px) {
  .actions { grid-template-columns: 1fr; }
  .scene { height: 380px; min-height: 340px; }
  .picture { display: none; }
}

