.health-panel {
  --health-panel-width: 220px;
  --health-panel-height: 46px;
  --health-panel-blink-count: 5;
  flex: 0 0 auto;
  width: min(var(--health-panel-width, 250px), 100%);
  min-height: var(--health-panel-height, 46px);
  padding: 0.35rem 0.85rem;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.8);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.health-panel__body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  min-width: 0;
}

.health-panel__icon {
  width: 42px;
  height: 42px;
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), rgba(226,232,240,0.6));
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.8), inset 0 -2px 6px rgba(15,23,42,0.1);
}

.health-icon {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.health-panel[data-active-icon="eye"] .health-icon-eye,
.health-panel[data-active-icon="stand"] .health-icon-stand {
  opacity: 1;
}

.health-icon-eye {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}

.health-icon-eye .eye-shape {
  width: 100%;
  height: 68%;
  border: 2px solid currentColor;
  border-radius: 70% 70% 70% 70% / 60%;
  position: relative;
  display: block;
}

.health-icon-eye .eye-pupil {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.45);
}

.health-panel[data-state="active"] .health-icon-eye .eye-pupil,
.health-panel[data-state="confirm"] .health-icon-eye .eye-pupil {
  animation: eye-look 6s ease-in-out infinite;
}

.health-icon-eye .eye-lid {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #f8fafc;
  transform-origin: top center;
  transform: scaleY(0);
  opacity: 0;
}

.health-panel__icon.is-blinking .eye-lid {
  animation: eye-blink 0.6s ease-in-out var(--health-panel-blink-count, 5);
}

.health-icon-stand {
  position: relative;
  color: #0f172a;
}

.health-icon-stand span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: block;
  background: currentColor;
}

.stand-head {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  top: 2px;
}

.stand-torso {
  width: 4px;
  height: 18px;
  top: 16px;
  border-radius: 2px;
  box-shadow: 0 4px 6px rgba(15, 23, 42, 0.15);
}

.health-panel[data-state="active"][data-active-icon="stand"] .stand-torso,
.health-panel[data-state="confirm"][data-active-icon="stand"] .stand-torso {
  animation: stand-bounce 2.4s ease-in-out infinite;
}

.stand-arm {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  top: 18px;
  transform-origin: top center;
}

.stand-arm-left {
  transform: translateX(-50%) rotate(35deg);
}

.stand-arm-right {
  transform: translateX(-50%) rotate(-35deg);
}

.stand-leg {
  width: 4px;
  height: 16px;
  bottom: 2px;
  border-radius: 2px;
  transform-origin: top center;
}

.stand-leg-left {
  transform: translateX(-50%) rotate(12deg);
}

.stand-leg-right {
  transform: translateX(-50%) rotate(-10deg);
}

.health-panel[data-state="active"][data-active-icon="stand"] .health-icon-stand,
.health-panel[data-state="confirm"][data-active-icon="stand"] .health-icon-stand {
  animation: stand-wave 2.2s ease-in-out infinite;
}

.health-panel__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.2;
  min-width: 0;
}

.health-panel__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.health-panel__message {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-panel__countdown {
  font-size: 0.68rem;
  color: #64748b;
}

.health-panel__confirm {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  padding-left: 0.6rem;
  border-left: 1px dashed rgba(148, 163, 184, 0.6);
}

.health-panel__confirm[hidden] {
  display: none !important;
}

.health-panel__checkbox {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #0f172a;
  white-space: nowrap;
}

.health-panel__checkbox input {
  width: 0.9rem;
  height: 0.9rem;
}

.health-panel[data-state="active"] {
  border-color: #60a5fa;
  background: #eff6ff;
}

.health-panel[data-state="confirm"] {
  border-color: #22c55e;
  background: #ecfdf5;
}

.health-panel[data-anim-enabled="0"] .eye-pupil,
.health-panel[data-anim-enabled="0"] .stand-torso,
.health-panel[data-anim-enabled="0"] .stand-arm,
.health-panel[data-anim-enabled="0"] .stand-leg,
.health-panel[data-anim-enabled="0"] .eye-lid {
  animation: none !important;
}

.health-panel[data-anim-style="minimal"] {
  background: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.6);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.8);
}

.health-panel[data-anim-style="minimal"] .health-panel__icon {
  background: #e2e8f0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.7);
}

.health-panel__exercise {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: min(320px, 92vw);
  z-index: 40;
  display: none;
}

.health-panel__exercise:not([hidden]) {
  display: block;
}

.health-panel__exercise[hidden] {
  display: none !important;
}

.health-panel__exercise-card {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.health-panel__exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.health-panel__exercise-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f172a;
}

.health-panel__exercise-close {
  border: none;
  background: #f1f5f9;
  color: #0f172a;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.health-panel__exercise-media img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #f8fafc;
}

.health-panel__exercise-steps {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.4;
}

.health-panel__exercise-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.health-panel__exercise-next {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #ffffff;
  color: #0f172a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.health-panel__exercise-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
  text-decoration: none;
}

.health-panel__exercise-note {
  margin: 0;
  font-size: 0.7rem;
  color: #64748b;
}

.health-panel[data-state="confirm"] .health-panel__exercise {
  display: none !important;
}

@media (max-width: 720px) {
  .health-panel__exercise {
    left: 50%;
    transform: translateX(-50%);
  }
}

.health-panel[data-anim-style="minimal"] .health-panel__message {
  color: #334155;
}

.health-panel[data-anim-style="gif"] .health-icon::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(59,130,246,0.7), rgba(99,102,241,0.6), rgba(59,130,246,0.7));
  animation: gif-spin 2s linear infinite;
  opacity: 0.65;
}

.health-panel[data-anim-style="gif"] .health-icon-eye,
.health-panel[data-anim-style="gif"] .health-icon-stand {
  opacity: 0.35;
}

@keyframes eye-look {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  25% {
    transform: translate(-35%, -55%);
  }
  50% {
    transform: translate(-50%, -40%);
  }
  75% {
    transform: translate(-65%, -55%);
  }
}

@keyframes eye-blink {
  0%,
  100% {
    transform: scaleY(0);
    opacity: 0;
  }
  40% {
    transform: scaleY(1);
    opacity: 1;
  }
  60% {
    transform: scaleY(0);
    opacity: 0;
  }
}

@keyframes stand-bounce {
  0%,
  100% {
    transform: translate(-50%, 0);
  }
  50% {
    transform: translate(-50%, -2px);
  }
}

@keyframes stand-wave {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes gif-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .health-panel {
    width: 100%;
    flex-wrap: wrap;
    border-radius: 1rem;
  }
  .health-panel__confirm {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px dashed rgba(148, 163, 184, 0.6);
    padding-top: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .health-panel,
  .health-icon {
    transition: none !important;
  }
  .health-panel .eye-pupil,
  .health-panel .stand-torso,
  .health-panel .stand-arm,
  .health-panel .stand-leg,
  .health-panel .health-icon-stand,
  .health-panel .eye-lid,
  .health-panel .health-icon::after {
    animation: none !important;
  }
}
