/**
 * Merkat - Main Stylesheet
 * Portrait-first responsive layout, glassmorphic UI, dynamic sky backdrops,
 * detailed indoor room with scenic weather window, and accessible design.
 */

:root {
  --primary-color: #ff9800;
  --accent-color: #e91e63;
  --bg-dawn: linear-gradient(180deg, #ff9a9e 0%, #fecfef 45%, #fef9d7 100%);
  --bg-day: linear-gradient(180deg, #60b2e5 0%, #a2d2ff 55%, #dff4ff 100%);
  --bg-sunset: linear-gradient(180deg, #f37335 0%, #fdc830 60%, #fad0c4 100%);
  --bg-night: linear-gradient(180deg, #09121d 0%, #152238 50%, #203a43 100%);

  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(255, 255, 255, 0.6);
  --text-main: #263238;
  --text-muted: #607d8b;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.14);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: #12151e;
}

/* Desktop Centering Wrapper */
.desktop-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e2433 0%, #0a0c13 100%);
}

/* Main App Container (Portrait Oriented) */
#merkat-app {
  width: 100%;
  height: 100%;
  max-width: 440px;
  max-height: 880px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  transition: background 1.2s ease;
}

@media (min-width: 480px) {
  #merkat-app {
    border-radius: 36px;
    height: 95vh;
    border: 8px solid #2e3440;
  }
}

/* Sky Themes for Outdoor View & Window */
.theme-dawn { background: var(--bg-dawn); }
.theme-day { background: var(--bg-day); }
.theme-sunset { background: var(--bg-sunset); }
.theme-night { background: var(--bg-night); color: #eceff1; }
.theme-cloudy { background: linear-gradient(180deg, #90a4ae 0%, #b0bec5 60%, #cfd8dc 100%); }
.theme-haze { background: linear-gradient(180deg, #d7ccc8 0%, #ffcc80 50%, #ffe0b2 100%); }

.outdoor-layer.weather-haze { filter: sepia(0.35) contrast(0.9) brightness(1.02); }
.outdoor-layer.weather-cloudy { filter: brightness(0.92) contrast(0.95); }

.theme-night .card,
.theme-night .hud-pill,
.theme-night .action-btn {
  background: rgba(26, 32, 44, 0.9);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.15);
}

.theme-night .text-muted {
  color: #94a3b8;
}

/* Environment Stage Layer */
#environment-stage {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

/* Outdoor Scene Elements */
.outdoor-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: opacity 0.5s ease;
}

.outdoor-celestial {
  position: absolute;
  top: 65px;
  right: 40px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 12px rgba(255, 235, 59, 0.5));
}

.outdoor-sun {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff9c4 20%, #fbc02d 70%, #f57f17 100%);
  box-shadow: 0 0 35px rgba(255, 193, 7, 0.8), 0 0 60px rgba(255, 152, 0, 0.4);
  animation: sunPulse 4s ease-in-out infinite alternate;
}

@keyframes sunPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.outdoor-stars {
  position: absolute;
  top: 0; left: 0; right: 0; height: 65%;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 100px 60px, #ffffff, transparent),
    radial-gradient(2px 2px at 180px 25px, #ffffff, transparent),
    radial-gradient(1px 1px at 260px 75px, #ffffff, transparent),
    radial-gradient(2px 2px at 320px 40px, #ffffff, transparent),
    radial-gradient(1.5px 1.5px at 380px 90px, #ffffff, transparent),
    radial-gradient(1px 1px at 50px 120px, #ffffff, transparent),
    radial-gradient(2px 2px at 220px 140px, #ffffff, transparent);
  opacity: 0.85;
  animation: starTwinkle 3s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.6; }
  100% { opacity: 0.95; }
}

/* Outdoor Ground Hills */
.outdoor-ground {
  position: absolute;
  bottom: 60px;
  left: -20px;
  right: -20px;
  height: 180px;
  z-index: 3;
}

/* =========================================
   INDOOR SCENE & SCENIC WINDOW
   ========================================= */
.indoor-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ecd9c6;
  z-index: 4;
  overflow: hidden;
  transition: opacity 0.5s ease;
}

/* Indoor Wall Pinstripe Wallpaper */
.indoor-wall {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 170px;
  background: linear-gradient(90deg, #f5ede4 0px, #f5ede4 24px, #eee3d5 24px, #eee3d5 25px);
  background-size: 25px 100%;
}

/* Baseboard Moulding */
.indoor-baseboard {
  position: absolute;
  bottom: 155px;
  left: 0; right: 0;
  height: 15px;
  background: #d7ccc8;
  border-top: 2px solid #bcaaa4;
  border-bottom: 2px solid #8d6e63;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Parquet Wooden Floor */
.indoor-floor {
  position: absolute;
  bottom: 60px;
  left: 0; right: 0;
  height: 105px;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0, rgba(0,0,0,0.03) 12px, transparent 12px, transparent 24px),
    linear-gradient(180deg, #c79261 0%, #ab7342 50%, #8d5528 100%);
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* Cozy Woven Rug under Merkat */
.indoor-rug {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, #80cbc4 30%, #4db6ac 65%, #00897b 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  border: 3px dashed #b2dfdb;
}

/* Indoor Houseplant on Side Stool */
.indoor-plant {
  position: absolute;
  bottom: 125px;
  left: 20px;
  width: 46px;
  height: 70px;
}

/* The Scenic Window on Indoor Wall (Comfortably lowered below status HUD) */
.scenic-window-frame {
  position: absolute;
  top: 155px;
  left: 50%;
  transform: translateX(-50%);
  width: 215px;
  height: 145px;
  background: #8d6e63;
  border-radius: 20px 20px 6px 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.28), inset 0 2px 5px rgba(255, 255, 255, 0.4);
  padding: 8px 8px 14px 8px;
  z-index: 5;
}

/* Wooden Window Sill */
.scenic-window-sill {
  position: absolute;
  bottom: -6px;
  left: -12px;
  right: -12px;
  height: 14px;
  background: #6d4c41;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
}

/* Window Sky Viewport (Shows live weather and sky through glass!) */
.scenic-window-viewport {
  width: 100%;
  height: 100%;
  border-radius: 14px 14px 2px 2px;
  overflow: hidden;
  position: relative;
  border: 3px solid #5d4037;
  transition: background 1.2s ease;
}

/* Window Panes Grid (Cross Mullions) */
.window-mullions {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mullion-v {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  background: #8d6e63;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.mullion-h {
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  background: #8d6e63;
  box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Glass Reflection Sheen */
.window-glass-sheen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.05) 45%, transparent 60%);
  pointer-events: none;
  z-index: 9;
}

/* Window Weather Rain Overlay (Water Streaks on glass!) */
.window-rain-glass {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 7;
  background-image:
    radial-gradient(1.5px 3px at 30px 40px, #64b5f6, transparent),
    radial-gradient(2px 5px at 80px 90px, #64b5f6, transparent),
    radial-gradient(1.5px 4px at 140px 60px, #64b5f6, transparent),
    radial-gradient(2px 6px at 190px 110px, #64b5f6, transparent),
    radial-gradient(1.5px 3px at 70px 130px, #64b5f6, transparent),
    radial-gradient(2px 4px at 160px 30px, #64b5f6, transparent);
  animation: glassRainTrickle 2s linear infinite;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.window-rain-glass.active {
  opacity: 0.9;
}

@keyframes glassRainTrickle {
  0% { transform: translateY(-10px); }
  100% { transform: translateY(15px); }
}

/* Sun / Moon inside the scenic window */
.window-celestial-container {
  position: absolute;
  top: 14px;
  right: 20px;
  z-index: 4;
}

/* Canvas FX Layer */
#fx-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* Top App Header / Bar */
.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

.pet-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.pet-name-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.pet-age-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 8px;
  border-radius: 12px;
}

.header-controls {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.2s ease;
}

.icon-btn:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.95);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Sub-header Pills (Mood, Weather, Indoors) */
.hud-pills-row {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
  gap: 6px;
}

.hud-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-pill {
  cursor: pointer;
  border: 1px solid #81c784;
  background: rgba(232, 245, 233, 0.9);
  transition: transform 0.15s ease;
}

.btn-pill:hover {
  transform: scale(1.04);
}

/* Centered Top Mood Row */
.hud-top-row {
  justify-content: center;
  padding: 0 16px 6px;
}

/* Bottom Environment & Weather Info Bar (Center Bottom before Action Dock) */
.bottom-info-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px 6px;
  margin: 0 auto;
  max-width: 100%;
}

.bottom-info-bar .hud-pill {
  font-size: 0.74rem;
  padding: 5px 12px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
}

.bottom-info-bar .env-toggle-pill {
  flex-shrink: 0;
  cursor: pointer;
  border-color: #81c784;
  background: rgba(232, 245, 233, 0.95);
  color: #2e7d32;
  font-weight: 700;
}

.bottom-info-bar .weather-badge-pill {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.bottom-info-bar .weather-badge-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

#merkat-app.theme-night .bottom-info-bar .hud-pill,
.theme-night .bottom-info-bar .hud-pill {
  background: rgba(26, 32, 44, 0.92) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

#merkat-app.theme-night .bottom-info-bar .weather-badge-pill,
#merkat-app.theme-night .bottom-info-bar .weather-badge-pill span,
.theme-night .bottom-info-bar .weather-badge-pill,
.theme-night .bottom-info-bar .weather-badge-pill span {
  color: #f1f5f9 !important;
}

#merkat-app.theme-night .bottom-info-bar .env-toggle-pill,
.theme-night .bottom-info-bar .env-toggle-pill {
  background: rgba(46, 125, 50, 0.4) !important;
  border-color: #66bb6a !important;
  color: #e8f5e9 !important;
}

/* Status Need Bars HUD */
.status-hud {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  margin: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.need-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.need-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.need-title-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease, background-color 0.4s ease;
}

.bar-critical-pulse {
  animation: pulseBar 1s infinite alternate;
}

@keyframes pulseBar {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* Unconscious Emergency Banner */
.unconscious-banner {
  position: relative;
  z-index: 25;
  background: linear-gradient(90deg, #7b1fa2, #ba68c8);
  color: #fff;
  padding: 8px 16px;
  margin: 6px 16px 0;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unconscious-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 800;
}

.unconscious-track {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  overflow: hidden;
}

.unconscious-fill {
  height: 100%;
  background: #00e676;
  width: 0%;
  transition: width 0.5s linear;
}

/* Central Interactive Pet Stage */
.pet-stage-container {
  position: relative;
  z-index: 15;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 25px;
  cursor: grab;
  touch-action: none;
}

.pet-stage-container:active {
  cursor: grabbing;
}

.drop-target-active {
  background: rgba(255, 235, 59, 0.2);
  border: 2px dashed #fbc02d;
  border-radius: var(--radius-lg);
}

/* Bottom Care Controls Action Dock */
.action-dock {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 14px 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--card-border);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease;
  min-width: 58px;
}

.action-btn:hover:not([disabled]) {
  transform: translateY(-3px);
  background: #fff;
}

.action-btn:active:not([disabled]) {
  transform: translateY(1px);
}

.action-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

/* Modals and Drawers */
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.25s ease;
}

.modal-card {
  width: 100%;
  max-height: 85vh;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eceff1;
  padding-bottom: 10px;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close-btn,
.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}

/* Sliding Drawer from Bottom */
.drawer-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  max-height: 78vh;
  background: #ffffff;
  border-radius: 28px 28px 0 0;
  padding: 16px 20px 24px;
  z-index: 40;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.drawer-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.drawer-content {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

/* Food & Medicine Cards */
.cards-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.food-card, .medicine-card {
  background: #fbfbfb;
  border: 1px solid #eceff1;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.food-card:hover, .medicine-card:hover {
  border-color: #cfd8dc;
  transform: translateY(-2px);
}

.food-header, .med-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.food-icon-box, .med-icon-box {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fff3e0;
}

.med-icon-box {
  background: #e0f7fa;
}

.food-title-col h4, .med-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.food-desc, .med-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.food-tradeoff {
  font-size: 0.75rem;
  color: #c62828;
  background: #ffebee;
  padding: 4px 8px;
  border-radius: 6px;
}

.med-hint {
  font-size: 0.78rem;
  color: #2e7d32;
  background: #e8f5e9;
  padding: 4px 8px;
  border-radius: 6px;
}

.food-effects-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.effect-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  background: #e0f2f1;
  color: #00796b;
}

.med-use-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #5c6bc0;
}

/* Badges */
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}
.badge-fresh { background: #e8f5e9; color: #2e7d32; }
.badge-warn { background: #fff8e1; color: #f57f17; }
.badge-tired { background: #fbe9e7; color: #d84315; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}
.btn-primary:hover {
  background: #f57c00;
}

.btn-secondary {
  background: #00bcd4;
  color: #fff;
}
.btn-secondary:hover {
  background: #0097a7;
}

.btn-danger {
  background: #f44336;
  color: #fff;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Settings Form Controls */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 14px;
}

.settings-group h4 {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-main);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  gap: 8px;
}

.setting-row input[type="text"],
.setting-row select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cfd8dc;
  font-size: 0.82rem;
}

.setting-row input[type="range"] {
  flex: 1;
  max-width: 160px;
}

/* Bouncing Ball Minigame Container */
#minigame-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(238, 242, 246, 0.96);
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.minigame-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid #cfd8dc;
}

.minigame-score-box {
  font-size: 1.1rem;
  font-weight: 800;
  color: #e91e63;
}

.minigame-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#minigame-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Toast Alerts */
#toast-container {
  position: absolute;
  top: 70px;
  left: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(38, 50, 56, 0.95);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideInToast 0.3s ease;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.toast-warning {
  background: rgba(198, 40, 40, 0.95);
}

.toast-fade-out {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

@keyframes slideInToast {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dev Modal Log Table */
.dev-log-container {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
  background: #fdfdfd;
  font-size: 0.72rem;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

.log-time {
  color: var(--text-muted);
  margin-right: 6px;
}

.dev-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* Reduced Motion Mode */
@media (prefers-reduced-motion: reduce), (update: slow) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.reduced-motion * {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}


/* Indoor Wall Picture Frame */
.indoor-wall-picture {
  position: absolute;
  top: 165px;
  left: 18px;
  width: 44px;
  height: 52px;
  background: #fff;
  border: 3px solid #8d6e63;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 5;
}

/* Indoor Wall Clock */
.indoor-wall-clock {
  position: absolute;
  top: 165px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid #8d6e63;
  box-shadow: 0 4px 8px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.clock-center {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #212121;
  position: relative;
}

.clock-hand-hour {
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 2px;
  height: 11px;
  background: #212121;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(75deg);
}

.clock-hand-min {
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 1.5px;
  height: 16px;
  background: #c62828;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(220deg);
}

/* Colorful Play Ball on Floor */
.indoor-floor-ball {
  position: absolute;
  bottom: 85px;
  right: 32px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff5252 20%, #d50000 65%, #8b0000 100%);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
  z-index: 6;
  border: 1.5px solid rgba(0,0,0,0.15);
  animation: gentleRoll 6s ease-in-out infinite alternate;
}

@keyframes gentleRoll {
  0% { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(-8px) rotate(-45deg); }
}

/* Interactive Indoor Room Heater (Elevated Appliance with Direct Hit Target & Guidance Badge) */
.indoor-heater {
  position: absolute;
  bottom: 126px;
  left: 16px;
  width: 72px;
  height: 88px;
  background: linear-gradient(135deg, #eceff1 0%, #cfd8dc 100%);
  border: 2.5px solid #607d8b;
  border-radius: 12px 12px 6px 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  z-index: 25;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  padding: 5px;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.3s ease;
}

@media (max-height: 660px) {
  .indoor-heater {
    bottom: 116px;
    width: 64px;
    height: 78px;
  }
}

.indoor-heater:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
  border-color: #ff9800;
}

.indoor-heater:active {
  transform: scale(0.96);
}

.indoor-heater:focus-visible {
  outline: 3px solid #ff9800;
  outline-offset: 4px;
}

/* Prompt Badge Floating Over Room Heater */
.heater-badge {
  position: absolute;
  top: -27px;
  left: 50%;
  transform: translateX(-50%);
  background: #37474f;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  border: 1.5px solid #78909c;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 30;
}

.heater-badge .badge-icon {
  font-size: 0.72rem;
  line-height: 1;
}

.heater-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.heater-top-grill {
  display: flex;
  justify-content: space-evenly;
  padding: 1px 4px;
}

.vent-slot {
  width: 14px;
  height: 2.5px;
  background: #78909c;
  border-radius: 2px;
}

.heater-grill {
  flex: 1;
  background: #212121;
  border-radius: 5px;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
}

.heater-coils {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.heater-coils .coil {
  height: 5px;
  border-radius: 2.5px;
  background: #455a64;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.heater-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 3px 1px;
}

.heater-led {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #78909c;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.heater-dial {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b0bec5;
  border: 1px solid #546e7a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.heater-brand {
  font-size: 0.46rem;
  font-weight: 900;
  color: #78909c;
  letter-spacing: 0.3px;
}

.heater-stand {
  position: absolute;
  bottom: -6px;
  left: 6px;
  right: 6px;
  height: 6px;
  background: #455a64;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.35);
}

/* Heater Heatwaves Rising */
.heater-heatwaves {
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.heatwave {
  color: #ff5722;
  font-size: 17px;
  font-weight: 900;
  animation: heatwaveShimmer 1.5s ease-in-out infinite alternate;
}

.hw-2 { animation-delay: 0.35s; }
.hw-3 { animation-delay: 0.7s; }

@keyframes heatwaveShimmer {
  0% { transform: translateY(2px) scaleX(0.85); opacity: 0.3; }
  100% { transform: translateY(-8px) scaleX(1.25); opacity: 0.95; }
}

/* Active Room Heater Glowing State */
.indoor-heater.active {
  box-shadow: 0 0 24px rgba(255, 87, 34, 0.6), 0 10px 22px rgba(0, 0, 0, 0.28);
  border-color: #ff7043;
}

.indoor-heater.active .heater-coils .coil {
  background: #ff3d00;
  box-shadow: 0 0 9px #ff5722, 0 0 16px #ff9800;
  animation: coilGlow 1.8s ease-in-out infinite alternate;
}

.indoor-heater.active .heater-led {
  background: #00e676;
  box-shadow: 0 0 7px #00e676;
}

.indoor-heater.active .heater-badge {
  background: #e65100;
  border-color: #ff9800;
  box-shadow: 0 0 14px rgba(255, 87, 34, 0.7);
}

.indoor-heater.active .heater-heatwaves {
  opacity: 1;
}

/* Pulsing Hint when Pet is Cold or Wet */
.indoor-heater.heater-pulsing-hint {
  animation: heaterPulseAttention 1.5s ease-in-out infinite;
}

.indoor-heater.heater-pulsing-hint .heater-badge {
  background: #d84315;
  border-color: #ffb74d;
  box-shadow: 0 0 15px rgba(255, 87, 34, 0.85);
  animation: badgePulseAttention 1.5s ease-in-out infinite;
}

@keyframes heaterPulseAttention {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7), 0 8px 20px rgba(0, 0, 0, 0.28);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 152, 0, 0), 0 0 26px rgba(255, 87, 34, 0.75), 0 8px 20px rgba(0, 0, 0, 0.28);
    transform: translateY(-3px);
  }
}

@keyframes badgePulseAttention {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}

@keyframes coilGlow {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.35); }
}

/* Reunion Inquisitive Dialogue Modal / Overlay */
.reunion-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.reunion-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reunion-opt-btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #ffb74d;
  background: #fff8e1;
  color: #e65100;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reunion-opt-btn:hover {
  background: #ffe082;
  transform: translateY(-2px);
}

/* App Footer Copyright Attribution */
.app-footer {
  position: relative;
  z-index: 20;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.theme-night .app-footer {
  background: rgba(18, 24, 38, 0.65);
  color: #90a4ae;
}

.app-footer a {
  color: inherit;
  text-decoration: underline;
}

/* Status HUD Pill label truncation for long location names */
.hud-pill span:last-child {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

