:root {
  --pet-blue: #70d6ff;
  --pet-blue-deep: #397dc7;
  --pet-ink: #edf6ff;
  --pet-muted: #a7bfd7;
  --pet-card: rgba(13, 26, 45, 0.82);
}

.pet-viewer-page {
  background: transparent;
}

.pet-info-button {
  border: 0;
  padding: 0 0 0 4px;
  color: var(--pet-muted);
  background: transparent;
  cursor: pointer;
}

.pet-info-button:hover,
.pet-info-button[aria-expanded="true"] {
  color: var(--pet-blue);
}

.pet-inline-hint {
  display: block;
  margin-top: 4px;
}

.pet-viewer-page [hidden] {
  display: none !important;
}

.pet-viewer-main {
  min-width: 0;
  padding: 24px;
}

.pet-viewer-wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.pet-stage-card {
  overflow: hidden;
  border: 1px solid rgba(170, 214, 255, 0.20);
  border-radius: 26px;
  background: rgba(13, 26, 45, 0.70);
  box-shadow: 0 26px 64px rgba(2, 8, 20, 0.42);
  backdrop-filter: blur(18px);
}

.pet-stage-heading {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px 14px;
  color: var(--pet-ink);
  background: rgba(18, 36, 60, 0.90);
}

.pet-stage-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--pet-blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.pet-stage-heading h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.08;
}

.pet-stage-heading p {
  margin: 5px 0 0;
  color: var(--pet-muted);
  font-size: 13px;
}

.pet-stage-badge {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  color: #071b2d;
  background: linear-gradient(135deg, var(--pet-blue), #8cf7d2);
  font-size: 13px;
  font-weight: 800;
}

.pet-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 73%, rgba(255, 255, 255, 0.72), transparent 27%),
    linear-gradient(180deg, #65a8e2 0%, #83bdec 68%, #78afe0 100%);
}

.pet-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 27%;
  background: linear-gradient(180deg, rgba(128, 183, 230, 0), rgba(112, 168, 217, 0.84));
  pointer-events: none;
}

.pet-stage-pattern {
  position: absolute;
  z-index: -2;
  inset: -16% -12% 12%;
  opacity: 0.24;
  transform: rotate(-8deg) scale(1.1);
  background-image:
    radial-gradient(circle at 18% 32%, rgba(255,255,255,.88) 0 2.5%, transparent 2.7%),
    radial-gradient(circle at 68% 18%, rgba(255,255,255,.62) 0 3%, transparent 3.2%),
    radial-gradient(circle at 83% 70%, rgba(255,255,255,.72) 0 2%, transparent 2.2%),
    repeating-linear-gradient(128deg, transparent 0 56px, rgba(255,255,255,.44) 58px 62px, transparent 64px 118px);
  background-size: 270px 210px, 310px 230px, 230px 260px, 210px 210px;
  animation: pet-pattern-drift 18s linear infinite;
}

@keyframes pet-pattern-drift {
  to { background-position: 270px -210px, -310px 230px, 230px 260px, 210px -210px; }
}

.pet-stage-emblem {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(47vw, 390px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: translate(-50%, -51%);
  border: 3px solid rgba(255, 255, 255, 0.17);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.18);
  font-size: min(20vw, 170px);
  box-shadow: 0 0 0 22px rgba(255, 255, 255, 0.055);
}

#petCanvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#petCanvas:active { cursor: grabbing; }

.pet-stage-loading {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  color: #fff;
  text-align: center;
  background: rgba(70, 133, 188, 0.35);
  backdrop-filter: blur(5px);
  transition: opacity .25s ease, visibility .25s ease;
}

.pet-stage-loading.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pet-stage-loading small { opacity: .82; }

.pet-loading-progress {
  width: min(320px, 72vw);
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(8, 28, 52, .38);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.18);
}

.pet-loading-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #70d6ff, #8cf7d2);
  transition: width .24s ease;
}

.pet-stage-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pet-spin .8s linear infinite;
}

@keyframes pet-spin { to { transform: rotate(360deg); } }

.pet-stage-tip {
  position: absolute;
  z-index: 3;
  right: 15px;
  bottom: 14px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: rgba(255,255,255,.94);
  background: rgba(40, 92, 137, .38);
  font-size: 12px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.pet-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 18px 0 42px;
}

.pet-control-card {
  padding: 18px;
  border: 1px solid rgba(170, 214, 255, .16);
  border-radius: 20px;
  background: var(--pet-card);
  box-shadow: 0 18px 36px rgba(2, 8, 20, .22);
  backdrop-filter: blur(16px);
}

.pet-control-card-main { grid-row: span 2; }

.pet-control-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--pet-ink);
}

.pet-control-title span { display: block; font-weight: 850; }
.pet-control-title small { display: block; margin-top: 3px; color: var(--pet-muted); }

.pet-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--pet-muted);
  background: rgba(255,255,255,.08);
  cursor: pointer;
}

.pet-switch span {
  position: relative;
  width: 33px;
  height: 19px;
  border-radius: 99px;
  background: #aebcc8;
  transition: background .2s ease;
}

.pet-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.pet-switch[aria-checked="true"] { color: #071b2d; background: #70d6ff; }
.pet-switch[aria-checked="true"] span { background: #5ca3df; }
.pet-switch[aria-checked="true"] span::after { transform: translateX(14px); }

.pet-stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-top: 19px;
  padding: 13px;
  border-radius: 17px;
  background: rgba(255,255,255,.07);
  text-align: center;
}

.pet-stepper button,
.pet-segmented button,
.pet-action-row button {
  border: 0;
  color: #dceeff;
  background: rgba(255,255,255,.10);
  cursor: pointer;
}

.pet-stepper button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  box-shadow: 0 5px 15px rgba(48, 96, 134, .1);
}

.pet-stepper strong { color: #edf6ff; font-size: 17px; }
.pet-stepper small { display: block; margin-top: 2px; color: var(--pet-muted); }

.pet-segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 15px;
}

.pet-segmented button {
  min-height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  font-weight: 800;
}

.pet-segmented button.is-active { color: #071b2d; background: linear-gradient(135deg, #70d6ff, #8cf7d2); }

.pet-action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 15px;
}

.pet-action-row button {
  min-height: 43px;
  border-radius: 13px;
  background: rgba(255,255,255,.08);
  font-weight: 800;
}

.pet-action-row button i { margin-right: 7px; }

.pet-action-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 15px;
}

.pet-action-picker button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  color: #071b2d;
  background: linear-gradient(135deg, #70d6ff, #8cf7d2);
  font-weight: 850;
  cursor: pointer;
}

.pet-action-picker button i { margin-right: 7px; }

.pet-action-picker button:disabled {
  opacity: .5;
  cursor: default;
}

.pet-action-note {
  margin-top: 12px;
  color: var(--pet-muted);
  font-size: 12px;
}

.pet-action-note summary {
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: #dceeff;
  background: rgba(255,255,255,.08);
  font-weight: 750;
  cursor: pointer;
  list-style: none;
}

.pet-action-note summary::-webkit-details-marker { display: none; }
.pet-action-note summary i { margin-right: 5px; }

.pet-action-note p {
  margin: 9px 0 0;
  line-height: 1.7;
}

.pet-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.pet-select-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--pet-muted);
  font-size: 12px;
  font-weight: 750;
}

.pet-select-field select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid rgba(170, 214, 255, .17);
  border-radius: 12px;
  color: #edf6ff;
  background: rgba(255,255,255,.08);
  outline: none;
}

.pet-select-field select option { color: #12233a; background: #edf6ff; }
.pet-select-field select optgroup { color: #31506f; background: #edf6ff; }

#particleOptions {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 12px;
  border: 1px solid rgba(170, 214, 255, .17);
  border-radius: 12px;
  color: #edf6ff;
  background-color: rgba(255,255,255,.08);
  outline: none;
  color-scheme: dark;
}

#particleOptions:focus,
.pet-select-field select:focus {
  border-color: rgba(112, 214, 255, .72);
  box-shadow: 0 0 0 3px rgba(112, 214, 255, .13);
}

#particleOptions option { color: #12233a; background: #edf6ff; }

[data-feature].is-feature-hidden { display: none !important; }

@media (max-width: 820px) {
  .pet-viewer-main { padding: 0 13px; }
  .pet-viewer-wrap { padding-top: 10px; }
  .pet-stage-shell {
    position: sticky;
    z-index: 20;
    top: 64px;
    padding-bottom: 8px;
    background: none;
  }
  .pet-stage-card { border-radius: 20px; box-shadow: 0 14px 34px rgba(38, 83, 120, .14); }
  .pet-stage-heading { padding: 12px 15px 10px; }
  .pet-stage-heading h1 { font-size: 23px; }
  .pet-stage-heading p { font-size: 11px; }
  .pet-stage-kicker { display: none; }
  .pet-stage-badge { padding: 6px 10px; font-size: 11px; }
  .pet-stage { min-height: 0; height: min(43svh, 390px); }
  .pet-stage-emblem { width: 48vw; font-size: 21vw; }
  .pet-stage-tip { right: 9px; bottom: 8px; font-size: 10px; }
  .pet-controls { display: block; padding-top: 4px; }
  .pet-control-card { margin-top: 11px; padding: 15px; border-radius: 17px; }
  .pet-select-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .pet-viewer-main { padding-inline: 8px; }
  .pet-stage-shell { top: 60px; }
  .pet-stage-heading p { max-width: 190px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pet-stage { height: 39svh; min-height: 285px; }
  .pet-stage-tip { display: none; }
  .pet-switch strong { font-size: 12px; }
  .pet-action-picker { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .pet-stage-pattern, .pet-stage-spinner { animation: none; }
}
.pet-control-card.is-particle-hidden {
  display: none;
}
