/* Animal Doctor styles */

:root {
  --clinic-bg: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 40%, #ecfdf5 40%, #d1fae5 100%);
  --tool-bg: radial-gradient(circle at 50% 30%, #ffffff 0%, #f0fdf4 75%, #dcfce7 100%);
  --tool-border: #10b981;
}

.clinic-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  flex: 1 1 auto;
  width: 100%;
  max-width: 680px;
  max-height: 100%;
  margin: 0 auto;
  padding: 0.5rem 1rem 1rem;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Examination Room */
.clinic-room {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 230px;
  background: var(--clinic-bg);
  border: 4px solid #ffffff;
  border-radius: 1.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  box-sizing: border-box;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

/* Steps Tracker */
.treatment-tracker {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(4px);
}

.step-badge {
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-badge.done {
  transform: scale(1.2);
  filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.45));
}

/* Patient Area */
.patient-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  height: 155px;
}

.patient-bubble {
  position: absolute;
  top: 6px;
  left: calc(50% + 36px);
  font-size: 2rem;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
  animation: bubble-float 1.8s ease-in-out infinite alternate;
  z-index: 10;
}

@keyframes bubble-float {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

.patient-chair {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border: 3px solid #10b981;
  border-radius: 1.5rem;
  padding: 0.6rem 1.4rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.patient-chair.cured {
  border-color: #f59e0b;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.45);
  animation: happy-dance 0.6s ease-in-out infinite alternate;
}

@keyframes happy-dance {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-8px) rotate(3deg); }
}

.patient-avatar {
  font-size: 4.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
  animation: patient-breathe 2.5s ease-in-out infinite alternate;
}

@keyframes patient-breathe {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.03); }
}

.patient-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #065f46;
  margin-top: 0.25rem;
}

/* Treatment FX */
.treatment-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  z-index: 20;
}

.fx-pulse {
  animation: fx-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fx-pop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}

/* Tools Tray */
.tray-section {
  width: 100%;
  max-width: 540px;
}

.tools-tray {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.medical-tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.25rem;
  background: var(--tool-bg);
  border: 3px solid var(--tool-border);
  border-radius: 1.25rem;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.16);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease, opacity 0.2s ease;
  min-height: 95px;
  box-sizing: border-box;
}

.medical-tool-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.25);
}

.medical-tool-btn:active {
  transform: translateY(1px) scale(0.96);
}

.medical-tool-btn:focus-visible,
.action-pill-btn:focus-visible {
  outline: 4px solid var(--game-focus, #ffb300);
  outline-offset: 3px;
}

.medical-tool-btn:disabled,
.medical-tool-btn.used {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
  filter: grayscale(0.8);
}

.medical-tool-btn.wobble {
  animation: gentle-wobble 0.4s ease-in-out;
  border-color: #ef4444;
}

@keyframes gentle-wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.tool-icon {
  font-size: 2.8rem;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.tool-name {
  font-size: 0.76rem;
  font-weight: 800;
  color: #065f46;
  margin-top: 0.35rem;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Action Controls Bar */
.action-bar {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
  min-height: 48px;
}

.action-pill-btn {
  padding: 0.65rem 1.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pop-btn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action-pill-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.action-pill-btn:active {
  transform: translateY(1px) scale(0.98);
}

.again-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

@keyframes pop-btn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Sparks & Celebration */
.sparks-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.sparkle {
  position: absolute;
  font-size: 1.5rem;
  animation: burst 0.85s ease-out forwards;
}

@keyframes burst {
  0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.35); opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .clinic-room {
    height: 200px;
    padding: 0.5rem 0.6rem;
  }
  .patient-avatar {
    font-size: 3.8rem;
  }
  .patient-bubble {
    width: 36px;
    height: 36px;
    font-size: 1.6rem;
    left: calc(50% + 28px);
    top: 4px;
  }
  .medical-tool-btn {
    min-height: 80px;
    padding: 0.5rem 0.2rem;
  }
  .tool-icon {
    font-size: 2.2rem;
  }
  .tool-name {
    font-size: 0.68rem;
  }
}

@media (max-height: 600px) {
  .clinic-field {
    padding: 0.25rem 0.5rem 0.5rem;
    justify-content: flex-start;
  }
  .clinic-room {
    height: 165px;
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.8rem;
  }
  .patient-area {
    height: 115px;
  }
  .patient-avatar {
    font-size: 3.2rem;
  }
  .patient-chair {
    padding: 0.35rem 1rem;
  }
  .patient-name {
    font-size: 0.82rem;
  }
  .patient-bubble {
    width: 32px;
    height: 32px;
    font-size: 1.4rem;
    left: calc(50% + 24px);
    top: 2px;
  }
  .medical-tool-btn {
    min-height: 70px;
    padding: 0.3rem 0.2rem;
  }
  .tool-icon {
    font-size: 1.8rem;
  }
  .tool-name {
    font-size: 0.64rem;
  }
  .action-bar {
    margin-top: 0.35rem;
    min-height: 38px;
  }
  .action-pill-btn {
    padding: 0.4rem 1.2rem;
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .patient-avatar,
  .patient-bubble,
  .action-pill-btn,
  .patient-chair.cured,
  .fx-pulse,
  .sparkle {
    animation: none !important;
    transition: none !important;
  }
}
