:root {
  --title-font: "MunmakHaebanche", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

@font-face {
  font-family: "MunmakHaebanche";
  src: url("../assets/MUNMAK_HAEBANCHE.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #607078;
  --paper: #fff9ef;
  --mint: #95d7c8;
  --teal: #2a9d8f;
  --coral: #ef7b6d;
  --sun: #f5c451;
  --violet: #a894d6;
  --desk: #efc37d;
  --desk-dark: #c98f52;
  --shadow: rgba(43, 35, 27, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #d8f0ed 0%, #f8efe0 60%, #f4dfc3 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 0 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.topbar,
.controlbar,
.side-panel {
  background: rgba(255, 249, 239, 0.9);
  border: 2px solid rgba(38, 50, 56, 0.08);
  box-shadow: 0 12px 30px rgba(56, 45, 38, 0.1);
  backdrop-filter: blur(8px);
}

.topbar {
  min-height: 82px;
  padding: 12px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 190px 1fr 116px;
  gap: 14px;
  align-items: center;
}

.brand {
  display: grid;
  gap: 2px;
}

.brand__eyebrow,
.mini-label,
.timer span,
.meter span,
.result-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.brand strong {
  font-family: var(--title-font);
  font-size: 1.45rem;
  line-height: 1.05;
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.meter {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr 42px;
  gap: 8px;
  align-items: center;
}

.meter__track {
  height: 15px;
  background: #edf0e9;
  border: 2px solid rgba(38, 50, 56, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.meter__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 140ms linear, background 180ms ease;
}

.meter--work .meter__fill {
  background: linear-gradient(90deg, var(--teal), #80cfa9);
}

.meter--attention .meter__fill {
  background: linear-gradient(90deg, var(--sun), var(--coral));
}

.meter--stability .meter__fill {
  background: linear-gradient(90deg, var(--violet), #71b7d5);
}

.meter b {
  font-size: 0.92rem;
  text-align: right;
}

.timer {
  justify-self: stretch;
  display: grid;
  justify-items: end;
  gap: 2px;
}

.timer strong {
  font-size: 1.7rem;
  line-height: 1;
  color: #27475a;
}

.game-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: stretch;
}

.play-column {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, auto) auto;
  gap: 10px;
}

.desk {
  position: relative;
  min-height: 440px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  border: 8px solid #b9784a;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.1), rgba(255,255,255,0) 22%),
    repeating-linear-gradient(0deg, rgba(125, 78, 42, 0.1) 0 2px, transparent 2px 44px),
    linear-gradient(135deg, #f3cf91 0%, var(--desk) 54%, #d8a463 100%);
  box-shadow: 0 22px 42px var(--shadow), inset 0 0 0 2px rgba(255,255,255,0.22);
  touch-action: none;
}

.desk::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(91, 55, 35, 0.1);
  border-radius: 6px;
  pointer-events: none;
}

.desk__grain {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(111, 68, 37, 0.06) 12% 13%, transparent 13% 36%, rgba(111, 68, 37, 0.05) 36% 37%, transparent 37% 100%);
  pointer-events: none;
}

.safe-zone {
  position: absolute;
  left: 29%;
  top: 23%;
  width: 42%;
  height: 54%;
  border: 2px dashed rgba(42, 157, 143, 0.62);
  border-radius: 8px;
  background: rgba(194, 238, 216, 0.22);
  display: grid;
  place-items: start end;
  padding: 8px;
  pointer-events: none;
}

.safe-zone span {
  color: rgba(32, 110, 103, 0.62);
  font-size: 0.72rem;
  font-weight: 900;
}

.floor-zone {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 4%;
  height: 18%;
  border-top: 2px dashed rgba(91, 55, 35, 0.22);
  background: rgba(85, 58, 39, 0.08);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6px 8px 14px;
  color: rgba(78, 50, 32, 0.58);
  font-size: 0.74rem;
  font-weight: 900;
  pointer-events: none;
  z-index: 1;
}

.items-layer,
.effects-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.game-object {
  position: absolute;
  width: var(--w);
  height: var(--h);
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg));
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border-radius: 8px;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transition: filter 120ms ease, box-shadow 120ms ease;
  z-index: 6;
}

.game-object:active {
  cursor: grabbing;
}

.game-object[data-safe="true"] {
  filter: drop-shadow(0 5px 0 rgba(42, 157, 143, 0.22));
}

.game-object[data-stage="wobbling"] {
  animation: itemWiggle 520ms infinite;
}

.game-object[data-stage="edge"] {
  animation: itemWiggle 340ms infinite;
  filter: drop-shadow(0 0 7px rgba(245, 196, 81, 0.78));
}

.game-object[data-stage="critical"] {
  animation: criticalPulse 220ms infinite;
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.95));
}

.game-object[data-danger="true"] {
  animation: itemWiggle 260ms infinite;
  filter: drop-shadow(0 0 8px rgba(239, 123, 109, 0.7));
}

.game-object.is-held {
  z-index: 28;
  filter: drop-shadow(0 14px 12px rgba(38, 50, 56, 0.26));
}

.game-object.is-move-locked {
  cursor: not-allowed;
}

.game-object.is-falling {
  pointer-events: none;
  animation: fallAway 780ms ease-in forwards;
  z-index: 4;
}

.game-object.is-on-floor {
  cursor: pointer;
  z-index: 22;
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.9);
  filter: drop-shadow(0 8px 6px rgba(38, 50, 56, 0.18)) grayscale(0.08);
}

.game-object.is-on-floor::after {
  content: "길게 눌러 수습";
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  width: max-content;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(38, 50, 56, 0.72);
  font-size: 0.68rem;
  font-weight: 900;
}

.game-object.is-on-floor.is-cleaning::after {
  content: "수습 중";
  background: rgba(42, 157, 143, 0.9);
}

.game-object.is-keyboard {
  cursor: default;
  z-index: 3;
}

.danger-meter {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -8px;
  height: 5px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 120ms ease;
}

.danger-meter span {
  display: block;
  height: 100%;
  width: calc(var(--danger, 0) * 100%);
  background: var(--coral);
}

.game-object[data-danger="true"] .danger-meter {
  opacity: 1;
}

.game-object[data-stage="edge"] .danger-meter,
.game-object[data-stage="critical"] .danger-meter,
.game-object.is-on-floor .danger-meter {
  opacity: 1;
}

.cat {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 94px;
  aspect-ratio: 1.12 / 1;
  transform: translate(-50%, -50%) scaleX(var(--facing, 1));
  z-index: 18;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
  outline: none;
}

.cat__sprite {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 12px 8px rgba(45, 33, 23, 0.18));
}

.cat:focus-visible .cat__sprite {
  outline: 3px solid rgba(42, 157, 143, 0.8);
  outline-offset: 3px;
  border-radius: 8px;
}

.cat[data-state="idle"] .cat__sprite {
  animation: catIdle 1.6s ease-in-out infinite;
}

.cat[data-state="walk"] .cat__sprite,
.cat[data-state="targetObject"] .cat__sprite {
  animation: catWalk 420ms ease-in-out infinite;
}

.cat[data-state="pushObject"] .cat__sprite {
  animation: catPush 260ms ease-in-out infinite;
}

.cat[data-state="deskNuisance"] .cat__sprite {
  animation: catPush 300ms ease-in-out infinite;
}

.cat[data-state="sitOnKeyboard"] .cat__sprite {
  animation: catKeyboard 1s ease-in-out infinite;
}

.cat[data-state="zoomies"] .cat__sprite {
  animation: catZoomies 160ms linear infinite;
}

.cat.is-petted .cat__sprite {
  filter: drop-shadow(0 12px 8px rgba(45, 33, 23, 0.18)) saturate(1.16);
}

.cat__bubble {
  position: absolute;
  left: 50%;
  bottom: 88%;
  width: max-content;
  max-width: 170px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #fffdf6;
  border: 2px solid rgba(38, 50, 56, 0.08);
  box-shadow: 0 8px 18px rgba(38, 50, 56, 0.12);
  transform: translateX(-50%) scaleX(var(--facing, 1));
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.toy-lure {
  position: absolute;
  left: 84%;
  top: 78%;
  width: 64px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  z-index: 7;
  animation: toyBounce 560ms ease-in-out infinite;
  pointer-events: none;
}

.toy-lure__spark {
  position: absolute;
  right: -8px;
  top: 2px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--coral);
  font-weight: 900;
}

.effect {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  font-weight: 900;
  pointer-events: none;
  animation: floatUp 900ms ease-out forwards;
  z-index: 34;
}

.effect--heart {
  color: #e95f85;
  font-size: 1.5rem;
}

.effect--text {
  color: #fff;
  background: rgba(38, 50, 56, 0.72);
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.cleanup-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 112px;
  min-height: 46px;
  padding: 7px 9px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: rgba(239, 123, 109, 0.92);
  box-shadow: 0 10px 20px rgba(56, 31, 26, 0.22), inset 0 -4px 0 rgba(101, 35, 29, 0.18);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  z-index: 24;
  touch-action: none;
}

.cleanup-marker::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.36);
}

.cleanup-marker::before {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 6px;
  width: calc(var(--cleanup, 0) * (100% - 16px));
  height: 5px;
  border-radius: 999px;
  background: #fff7c7;
  z-index: 1;
}

.cleanup-marker.is-cleaning {
  animation: itemWiggle 260ms infinite;
  filter: brightness(1.06);
}

.spilled {
  position: absolute;
  width: 15%;
  aspect-ratio: 1.8 / 1;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) rotate(-8deg);
  border-radius: 50%;
  background: rgba(123, 208, 218, 0.44);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.18);
  z-index: 2;
  pointer-events: none;
}

.pause-badge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(38, 50, 56, 0.28);
  font-size: 2rem;
  font-weight: 900;
  z-index: 60;
  pointer-events: none;
}

.pause-badge[hidden] {
  display: none;
}

.side-panel {
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  min-height: 0;
}

.cat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cat-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.35rem;
}

.mood-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(149, 215, 200, 0.32);
  color: #17675f;
  padding: 6px 9px;
  font-size: 0.82rem;
  font-weight: 900;
}

.status-text {
  min-height: 66px;
  margin: 0;
  padding: 11px;
  border-radius: 8px;
  background: #fffaf0;
  border: 2px solid rgba(38, 50, 56, 0.06);
  line-height: 1.4;
  font-weight: 800;
  overflow: hidden;
}

.keyboard-jam {
  padding: 10px;
  border-radius: 8px;
  color: #27475a;
  background: #e7f0ff;
  border: 2px dashed rgba(39, 71, 90, 0.25);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.object-list {
  display: grid;
  align-content: start;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.object-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  border: 2px solid rgba(38, 50, 56, 0.06);
  font-size: 0.86rem;
  font-weight: 800;
}

.object-status span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
}

.object-status.is-danger span:last-child {
  color: var(--coral);
}

.object-status.is-safe span:last-child {
  color: var(--teal);
}

.controlbar {
  min-height: 68px;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-button,
.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.control-button:hover,
.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.control-button:active,
.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.control-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.control-button {
  min-width: 132px;
  min-height: 46px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.control-button--toy {
  background: var(--sun);
  box-shadow: inset 0 -4px 0 rgba(116, 75, 16, 0.12);
}

.control-button--work {
  background: var(--teal);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(18, 92, 83, 0.18);
}

.control-button--work.is-working {
  animation: workButtonPulse 420ms ease-in-out infinite;
}

.control-button--focus {
  background: #ef7b6d;
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(116, 41, 34, 0.18);
}

.control-button--focus.is-active {
  animation: focusButtonPulse 520ms ease-in-out infinite;
}

.cooldown-status {
  min-height: 46px;
  min-width: 156px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  align-content: center;
  border-radius: 8px;
  background: #fff4df;
  color: #765327;
  font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(118, 83, 39, 0.08);
}

.cooldown-status.is-ready {
  background: rgba(149, 215, 200, 0.42);
  color: #17675f;
}

.cooldown-status.is-focus-locked {
  background: rgba(239, 123, 109, 0.24);
  color: #a93c32;
}

.cooldown-status__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.cooldown-status__bar span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  transition: width 120ms linear;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
}

.pet-hint {
  min-height: 46px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #6c4a58;
  font-weight: 800;
}

.controlbar__spacer {
  flex: 1 1 auto;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: #fffdf6;
  box-shadow: inset 0 -4px 0 rgba(38, 50, 56, 0.06);
  font-size: 1.1rem;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38, 50, 56, 0.38);
}

.overlay[hidden] {
  display: none;
}

.modal {
  width: min(560px, 100%);
  border-radius: 8px;
  padding: 28px;
  background: var(--paper);
  border: 2px solid rgba(38, 50, 56, 0.08);
  box-shadow: 0 24px 70px rgba(38, 50, 56, 0.24);
  text-align: center;
}

.modal--start {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal__eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal h1,
.modal h2 {
  margin: 0;
  font-size: 2.4rem;
  line-height: 1.08;
}

.modal h1 {
  font-family: var(--title-font);
}

.modal p {
  margin: 14px auto 0;
  max-width: 36rem;
  line-height: 1.55;
  color: #435159;
  font-weight: 700;
}

.modal--start .primary-button {
  margin-top: 26px;
}

.modal__tips {
  margin: 20px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.modal__tips span {
  padding: 8px 10px;
  border-radius: 999px;
  background: #e8f3ef;
  color: #296e67;
  font-size: 0.86rem;
  font-weight: 900;
}

.primary-button {
  min-height: 48px;
  padding: 0 22px;
  background: var(--coral);
  color: #fff;
  box-shadow: inset 0 -4px 0 rgba(102, 32, 25, 0.18);
}

.secondary-button {
  min-height: 48px;
  padding: 0 20px;
  background: #fffdf6;
  color: #42525a;
  border: 2px solid rgba(38, 50, 56, 0.14);
  box-shadow: inset 0 -4px 0 rgba(38, 50, 56, 0.06);
}

.modal__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.result-grid {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.result-grid div {
  min-height: 74px;
  padding: 10px;
  display: grid;
  gap: 4px;
  place-items: center;
  border-radius: 8px;
  background: #fffdf6;
  border: 2px solid rgba(38, 50, 56, 0.06);
}

.result-grid strong {
  font-size: 1.45rem;
}

.app[data-phase="playing"].high-attention .desk {
  animation: anxiousDesk 800ms ease-in-out infinite;
}

.app[data-phase="playing"].mid-attention .meter--attention .meter__track {
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.2);
}

.app[data-phase="playing"].high-attention .meter--attention {
  animation: attentionPulse 620ms ease-in-out infinite;
}

@keyframes catIdle {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes catWalk {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes catPush {
  0%, 100% { transform: translateX(0) rotate(-5deg) scaleY(0.98); }
  50% { transform: translateX(7px) rotate(3deg) scaleY(1.03); }
}

@keyframes catKeyboard {
  0%, 100% { transform: translateY(0) scale(1.03); }
  50% { transform: translateY(3px) scale(0.98); }
}

@keyframes catZoomies {
  0% { transform: translate(0, 0) rotate(-8deg); }
  25% { transform: translate(4px, -2px) rotate(7deg); }
  50% { transform: translate(-3px, 3px) rotate(-4deg); }
  75% { transform: translate(2px, 2px) rotate(9deg); }
  100% { transform: translate(0, 0) rotate(-8deg); }
}

@keyframes itemWiggle {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)); }
  50% { transform: translate(-50%, -50%) rotate(calc(var(--rot, 0deg) + 4deg)); }
}

@keyframes criticalPulse {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(calc(var(--rot, 0deg) + 6deg)) scale(1.07); }
}

@keyframes workButtonPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

@keyframes focusButtonPulse {
  0%, 100% {
    filter: brightness(1);
    box-shadow: inset 0 -4px 0 rgba(116, 41, 34, 0.18), 0 0 0 rgba(239, 123, 109, 0);
  }
  50% {
    filter: brightness(1.12);
    box-shadow: inset 0 -4px 0 rgba(116, 41, 34, 0.18), 0 0 14px rgba(239, 123, 109, 0.45);
  }
}

@keyframes fallAway {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--fall-x, 80px)), calc(-50% + 150px)) rotate(80deg) scale(0.55); }
}

@keyframes toyBounce {
  0%, 100% { transform: translate(-50%, -50%) rotate(-8deg); }
  50% { transform: translate(-50%, calc(-50% - 9px)) rotate(10deg); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.9); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1.08); }
}

@keyframes anxiousDesk {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.2) contrast(1.04); }
}

@keyframes attentionPulse {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50% { transform: translateY(-1px); filter: brightness(1.14); }
}

@media (max-width: 920px) {
  .app {
    width: min(100vw - 18px, 760px);
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .brand {
    grid-column: 1 / -1;
  }

  .meters {
    grid-template-columns: 1fr;
  }

  .game-shell {
    grid-template-columns: 1fr;
  }

  .desk {
    min-height: auto;
  }

  .side-panel {
    grid-template-rows: auto auto auto;
  }

  .object-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
  }

  .app {
    width: calc(100vw - 12px);
    height: 100svh;
    min-height: 100svh;
    padding: 6px 0;
    gap: 6px;
  }

  .topbar {
    min-height: auto;
    grid-template-columns: 1fr auto;
    gap: 6px;
    padding: 8px;
  }

  .brand strong {
    font-size: 1.28rem;
  }

  .meters {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .timer {
    justify-items: end;
  }

  .timer span {
    font-size: 0.68rem;
  }

  .timer strong {
    font-size: 1.28rem;
  }

  .meter {
    grid-template-columns: 76px 1fr 34px;
    gap: 5px;
  }

  .meter__track {
    height: 11px;
  }

  .game-shell {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
  }

  .side-panel {
    order: -1;
    position: relative;
    height: 96px;
    padding: 8px;
    gap: 6px;
    grid-template-rows: 28px 44px;
    overflow: hidden;
  }

  .cat-card {
    min-height: 0;
    height: 28px;
  }

  .cat-card strong {
    font-size: 1.05rem;
    line-height: 1;
  }

  .mood-pill {
    padding: 4px 7px;
    font-size: 0.72rem;
  }

  .status-text {
    min-height: 0;
    height: 44px;
    padding: 6px 8px;
    font-size: 0.82rem;
    line-height: 1.28;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .keyboard-jam {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 30px;
    padding: 5px 8px;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
    box-shadow: 0 8px 16px rgba(38, 50, 56, 0.12);
  }

  .object-list {
    display: none;
  }

  .play-column {
    min-height: 0;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 6px;
  }

  .desk {
    min-height: 0;
    height: clamp(188px, 42svh, 280px);
    aspect-ratio: auto;
    border-width: 6px;
  }

  .floor-zone {
    bottom: 5%;
    height: 18%;
    font-size: 0.62rem;
    padding: 5px 7px 12px;
  }

  .game-object.is-on-floor::after {
    top: -15px;
    padding: 2px 5px;
    font-size: 0.58rem;
  }

  .cat {
    width: 66px;
  }

  .controlbar {
    min-height: 0;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .control-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
    gap: 5px;
    font-size: 0.84rem;
  }

  .control-button--work {
    grid-column: 1 / 3;
  }

  .control-button--toy {
    grid-column: 3 / 5;
  }

  .control-button--focus {
    grid-column: 1 / 3;
  }

  .cooldown-status {
    grid-column: 3 / 5;
    min-width: 0;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .pet-hint {
    display: none;
  }

  .controlbar__spacer {
    display: none;
  }

  .icon-button {
    width: auto;
    height: 36px;
    min-width: 0;
  }

  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal {
    padding: 22px;
  }

  .modal--start {
    min-height: 250px;
  }

  .modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .secondary-button {
    min-width: 0;
    padding: 0 14px;
  }

  .modal h1,
  .modal h2 {
    font-size: 2rem;
  }
}
