/* base reset and fonts */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cream: #FFF8F0;
  --orange: #F4845F;
  --teal: #7EC8B8;
  --yellow: #FFD166;
  --brown: #5C3D2E;
  --red: #E07A5F;
  --shadow: rgba(92,61,46,0.15);
  --shadow-strong: rgba(92,61,46,0.25);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Patrick Hand', cursive;
  background: var(--cream);
  color: var(--brown);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* screens */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* start screen */
.start-content {
  text-align: center;
  padding: 2rem;
}
.game-title {
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--orange);
  transform: rotate(-3deg);
  text-shadow: 3px 3px 0 var(--shadow);
  line-height: 1;
  margin-bottom: 1rem;
}
.alarm-clock-svg {
  margin: 1.5rem auto;
  animation: bobble 2s ease-in-out infinite;
}
.start-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--brown);
  margin-bottom: 2rem;
  line-height: 1.5;
}
.btn-wake-up {
  font-family: 'Patrick Hand', cursive;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  background: var(--orange);
  color: var(--cream);
  border: 3px solid var(--brown);
  border-radius: 16px;
  padding: 0.8rem 2.5rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-strong);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-wake-up:hover {
  transform: scale(1.06) rotate(1deg);
  box-shadow: 5px 5px 0 var(--shadow-strong);
}
.btn-wake-up:active {
  transform: scale(0.96);
  box-shadow: 2px 2px 0 var(--shadow-strong);
}

/* timer */
.timer-display {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--cream);
  border: 2.5px solid var(--brown);
  border-radius: 14px;
  padding: 0.4rem 0.8rem;
  box-shadow: 3px 3px 0 var(--shadow);
  font-size: 1.5rem;
  font-weight: bold;
}
.timer-display.warning {
  border-color: var(--orange);
  color: var(--orange);
}
.timer-display.danger {
  border-color: var(--red);
  color: var(--red);
}

/* vignette */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  transition: opacity 0.5s ease;
  box-shadow: inset 0 0 120px 40px rgba(224,122,95,0.5);
}
.vignette.active {
  opacity: 1;
}

/* room container - fixed viewport so objects stay cozy */
.room-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, 800px);
  height: min(calc(100vh - 80px), 550px);
  overflow: hidden;
  border-radius: 20px;
  border: 3px solid var(--brown);
  box-shadow: 6px 6px 0 var(--shadow);
}

/* room label */
.room-label {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 1.2rem;
  color: var(--brown);
  opacity: 0.5;
  z-index: 15;
  pointer-events: none;
}

/* individual rooms */
.room {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}
.room.active {
  display: block;
}

/* room backgrounds */
.room-bedroom {
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0, transparent 38px,
      rgba(244,132,95,0.07) 38px, rgba(244,132,95,0.07) 40px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0, transparent 38px,
      rgba(244,132,95,0.07) 38px, rgba(244,132,95,0.07) 40px
    ),
    linear-gradient(to bottom, #FFECD2 0%, #FFECD2 60%, #D4A574 60%, #C4956A 61%, #D4A574 61%, #D4A574 100%);
}

.room-hallway {
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0, transparent 58px,
      rgba(92,61,46,0.06) 58px, rgba(92,61,46,0.06) 60px
    ),
    linear-gradient(to bottom, #F5E6D3 0%, #F5E6D3 65%, #B8906F 65%, #A8805F 66%, #B8906F 66%, #B8906F 100%);
}

.room-kitchen {
  background:
    repeating-conic-gradient(
      rgba(92,61,46,0.04) 0% 25%, transparent 0% 50%
    ) 0 0 / 30px 30px,
    linear-gradient(to bottom, #FFF3D6 0%, #FFF3D6 55%, #D4C4A8 55%, #C4B498 56%, #D4C4A8 56%, #D4C4A8 100%);
}

.room-bathroom {
  background:
    repeating-conic-gradient(
      rgba(126,200,184,0.12) 0% 25%, transparent 0% 50%
    ) 0 0 / 24px 24px,
    linear-gradient(to bottom, #E8F4F0 0%, #E8F4F0 55%, #D6EAE4 55%, #C6DAD4 56%, #D6EAE4 56%, #D6EAE4 100%);
}

.room-livingroom {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0, transparent 8px,
      rgba(92,61,46,0.03) 8px, rgba(92,61,46,0.03) 10px
    ),
    linear-gradient(to bottom, #FFF8F0 0%, #FFF8F0 55%, #C4A882 55%, #B89872 56%, #C4A882 56%, #C4A882 100%);
}

/* game objects */
.game-object {
  position: absolute;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  z-index: 10;
}
.game-object:hover {
  transform: scale(1.08);
  filter: brightness(1.05);
  z-index: 20;
}
.game-object:active {
  transform: scale(1.02) scaleY(0.92);
}
.game-object.non-interactive {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}
.game-object.hidden {
  display: none;
}
.game-object.collected {
  pointer-events: none;
  opacity: 0;
  transform: translateY(-60px) scale(0.3);
  transition: all 0.5s ease-in;
}

/* common object shapes */
.obj-box {
  border-radius: 14px;
  box-shadow: 3px 4px 0 var(--shadow);
  border: 2.5px solid var(--brown);
}

/* door styling */
.door-obj {
  width: 70px;
  height: 130px;
  background: #B8906F;
  border-radius: 8px 8px 0 0;
  border: 2.5px solid var(--brown);
  box-shadow: 3px 4px 0 var(--shadow);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
}
.door-obj::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  border: 2px solid var(--brown);
}
.door-label {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: var(--cream);
  border: 2px solid var(--brown);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: 2px 2px 0 var(--shadow);
}

/* dialogue bubble */
.dialogue-bubble {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(85vw, 500px);
  background: var(--cream);
  color: var(--brown);
  border: 3px solid var(--brown);
  border-radius: 20px 20px 20px 4px;
  padding: 1rem 1.4rem;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  line-height: 1.5;
  z-index: 200;
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
}
.dialogue-bubble.hidden {
  display: none;
}
.dialogue-bubble::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 14px solid var(--brown);
  border-right: 6px solid transparent;
  border-top: 14px solid var(--cream);
}

/* inventory bar - snug, matches game container width */
.inventory-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 800px);
  height: 80px;
  background: var(--brown);
  border-radius: 16px 16px 0 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  box-shadow: 0 -3px 12px var(--shadow);
}
.inventory-items {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  width: 100%;
  padding: 0.4rem 0;
  scrollbar-width: none;
}
.inventory-items::-webkit-scrollbar { display: none; }

.inv-item {
  flex-shrink: 0;
  width: 58px;
  height: 62px;
  background: rgba(255,248,240,0.15);
  border: 2.5px solid rgba(255,248,240,0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 4px;
}
.inv-item:hover {
  transform: scale(1.08);
}
.inv-item.selected {
  border-color: var(--yellow);
  box-shadow: 0 0 10px rgba(255,209,102,0.5);
}
.inv-item svg {
  width: 30px;
  height: 30px;
}
.inv-item-label {
  font-size: 0.6rem;
  color: var(--cream);
  text-align: center;
  line-height: 1.1;
  margin-top: 2px;
}

/* particles */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
}
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

/* end screens */
.end-content {
  text-align: center;
  padding: 2rem;
}
.end-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--orange);
  margin: 1rem 0;
}
.end-message {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  margin-bottom: 2rem;
  line-height: 1.6;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* running scene */
.running-scene {
  width: 100%;
  height: 120px;
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
  border-bottom: 4px solid var(--brown);
  background: linear-gradient(to bottom, #FFD166 0%, #FFF8F0 100%);
}
.runner {
  position: absolute;
  bottom: 10px;
}

.lose-scene {
  margin-bottom: 1rem;
}

/* screen shake */
.shake {
  animation: screenShake 0.4s ease;
}

/* room nav hint */
.room-nav {
  position: absolute;
  font-size: 0.9rem;
  color: var(--brown);
  opacity: 0.6;
  z-index: 5;
}

/* hidden utility */
.hidden { display: none; }
