:root {
  --pet-fw-z: 2147482500;
  --pet-fw-ink: #2b2022;
  --pet-fw-panel: rgba(255, 252, 248, 0.82);
  --pet-fw-line: rgba(74, 34, 38, 0.12);
  --pet-fw-line-soft: rgba(74, 34, 38, 0.07);
  --pet-fw-accent: #b81932;
  --pet-fw-accent-soft: rgba(184, 25, 50, 0.10);
  --pet-fw-accent-glow: rgba(184, 25, 50, 0.18);
  --pet-fw-muted: #8a7e83;
  --pet-fw-shadow: 0 18px 48px rgba(39, 23, 25, 0.16), 0 2px 8px rgba(39, 23, 25, 0.06);
  --pet-fw-glass-border: rgba(255, 255, 255, 0.6);
  --pet-fw-input-bg: rgba(255, 255, 255, 0.82);
  --pet-fw-song-bg: rgba(255, 255, 255, 0.7);
  --pet-fw-song-bg-hover: rgba(184, 25, 50, 0.05);
}

[data-theme="dark"] {
  --pet-fw-ink: #f5ede8;
  --pet-fw-panel: rgba(26, 20, 22, 0.78);
  --pet-fw-line: rgba(255, 255, 255, 0.10);
  --pet-fw-line-soft: rgba(255, 255, 255, 0.06);
  --pet-fw-accent: #ff4d6a;
  --pet-fw-accent-soft: rgba(255, 77, 106, 0.14);
  --pet-fw-accent-glow: rgba(255, 77, 106, 0.28);
  --pet-fw-muted: #a89aa0;
  --pet-fw-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 77, 106, 0.04);
  --pet-fw-glass-border: rgba(255, 255, 255, 0.08);
  --pet-fw-input-bg: rgba(255, 255, 255, 0.06);
  --pet-fw-song-bg: rgba(255, 255, 255, 0.04);
  --pet-fw-song-bg-hover: rgba(255, 77, 106, 0.08);
}

.pet-fw {
  position: fixed;
  left: 0;
  bottom: 20px;
  z-index: var(--pet-fw-z);
  --pet-fw-pet-width: calc(var(--pet-fw-cell-width, 192px) * var(--pet-fw-scale, 0.72));
  --pet-fw-pet-center-x: calc(var(--pet-fw-stage-width, 164px) - (var(--pet-fw-pet-width) / 2));
  --pet-fw-hole-height: 30px;
  width: 282px;
  color: var(--pet-fw-ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
  transform: translate3d(calc(100vw - 306px), 0, 0);
  transition: filter 180ms ease;
}

.pet-fw *,
.pet-fw *::before,
.pet-fw *::after {
  box-sizing: border-box;
}

.pet-fw__bubble {
  position: absolute;
  left: var(--pet-fw-pet-center-x);
  bottom: calc(100% + 14px);
  max-width: min(248px, calc(100vw - 32px));
  padding: 9px 11px;
  border: 1px solid var(--pet-fw-line);
  border-radius: 8px;
  background: var(--pet-fw-panel);
  box-shadow: 0 10px 26px rgba(39, 23, 25, 0.12);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
  z-index: 4;
}

.pet-fw__bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--pet-fw-line);
  border-bottom: 1px solid var(--pet-fw-line);
  background: var(--pet-fw-panel);
  transform: translateX(-50%) rotate(45deg);
}

.pet-fw--speaking .pet-fw__bubble {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pet-fw__stage {
  position: relative;
  width: var(--pet-fw-stage-width, 164px);
  height: var(--pet-fw-stage-height, 204px);
  pointer-events: auto;
  cursor: pointer;
  transform-origin: 50% 100%;
  transition: transform 180ms ease;
}

.pet-fw--hover .pet-fw__stage {
  transform: translateY(-10px);
}


.pet-fw__move-canvas,
.pet-fw__move-canvas body {
  cursor: crosshair;
}

.pet-fw--move-mode .pet-fw__stage {
  cursor: crosshair;
}

.pet-fw--move-mode .pet-fw__sprite-shell {
  filter: drop-shadow(0 10px 16px rgba(184, 25, 50, 0.22));
}

.pet-fw__sprite-shell {
  position: absolute;
  inset: auto 0 56px auto;
  z-index: 1;
  width: calc(var(--pet-fw-cell-width, 192px) * var(--pet-fw-scale, 0.72));
  height: calc(var(--pet-fw-cell-height, 208px) * var(--pet-fw-scale, 0.72));
  transform-origin: 50% 82%;
}

.pet-fw--music .pet-fw__sprite-shell {
  animation: pet-fw-dance 1.5s linear infinite;
}

.pet-fw__sprite {
  width: var(--pet-fw-cell-width, 192px);
  height: var(--pet-fw-cell-height, 208px);
  background-repeat: no-repeat;
  background-size: 1536px 1872px;
  transform: scale(var(--pet-fw-scale, 0.72));
  transform-origin: left top;
  image-rendering: auto;
  user-select: none;
}

.pet-fw__toolbar {
  position: absolute;
  left: var(--pet-fw-pet-center-x);
  bottom: 0;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--pet-fw-line);
  border-radius: 8px;
  background: var(--pet-fw-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 22px rgba(39, 23, 25, 0.12);
  transform: translateX(-50%);
  transition: opacity 280ms ease;
  pointer-events: auto;
}

.pet-fw__icon-button,
.pet-fw__song-remove {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--pet-fw-ink);
  cursor: pointer;
}

.pet-fw__toolbar .pet-fw__icon-button {
  width: 28px;
  height: 28px;
}

.pet-fw__icon-button:hover,
.pet-fw__icon-button:focus-visible,
.pet-fw__song-remove:hover,
.pet-fw__song-remove:focus-visible {
  border-color: var(--pet-fw-accent-glow);
  background: var(--pet-fw-accent-soft);
  outline: none;
}

.pet-fw__icon-button svg,
.pet-fw__song-remove svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.pet-fw--music-playing .pet-fw__toolbar {
  display: flex;
}

.pet-fw--hiding .pet-fw__bubble,
.pet-fw--hiding .pet-fw__music-box,
.pet-fw--hiding .pet-fw__import-modal,
.pet-fw--hiding .pet-fw__memo-modal,
.pet-fw--hiding .pet-fw__settings-modal,
.pet-fw--hiding .pet-fw__music-info,
.pet-fw--showing .pet-fw__bubble,
.pet-fw--showing .pet-fw__music-box,
.pet-fw--showing .pet-fw__import-modal,
.pet-fw--showing .pet-fw__memo-modal,
.pet-fw--showing .pet-fw__settings-modal,
.pet-fw--showing .pet-fw__music-info {
  opacity: 0;
  pointer-events: none;
}

.pet-fw--hiding .pet-fw__toolbar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.pet-fw--showing .pet-fw__toolbar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

.pet-fw__hidden-toggle {
  position: absolute;
  left: var(--pet-fw-pet-center-x);
  bottom: 0;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--pet-fw-line);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.98), rgba(255, 246, 248, 0.96) 58%, rgba(255, 237, 241, 0.96)),
    var(--pet-fw-panel);
  color: var(--pet-fw-ink);
  box-shadow: 0 16px 34px rgba(39, 23, 25, 0.18), 0 0 0 6px rgba(255, 255, 255, 0.38);
  transform: translateX(-50%) scale(0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease, transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 280ms, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
  pointer-events: none;
  cursor: pointer;
}

.pet-fw__hidden-toggle::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(184, 25, 50, 0.14);
  border-radius: inherit;
  opacity: 0.74;
  pointer-events: none;
  animation: pet-fw-show-pulse 2.8s ease-in-out infinite;
}

.pet-fw--hidden .pet-fw__hidden-toggle:hover,
.pet-fw--hidden .pet-fw__hidden-toggle:focus-visible {
  border-color: rgba(184, 25, 50, 0.34);
  color: var(--pet-fw-accent);
  box-shadow: 0 20px 42px rgba(39, 23, 25, 0.22), 0 0 0 8px rgba(184, 25, 50, 0.08);
  outline: none;
  transform: translateX(-50%) translateY(-2px) scale(1.04);
}

.pet-fw__hidden-toggle svg {
  width: 25px;
  height: 25px;
  stroke: currentColor;
}

.pet-fw--hidden .pet-fw__bubble,
.pet-fw--hidden .pet-fw__music-box,
.pet-fw--hidden .pet-fw__import-modal,
.pet-fw--hidden .pet-fw__memo-modal,
.pet-fw--hidden .pet-fw__settings-modal,
.pet-fw--hidden .pet-fw__stage,
.pet-fw--hidden .pet-fw__audio {
  display: none;
}

.pet-fw--hidden .pet-fw__hidden-toggle {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
  transition: opacity 280ms ease 120ms, transform 280ms cubic-bezier(0.34, 1.56, 0.64, 1) 120ms, visibility 0s linear 0s, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.pet-fw--hiding .pet-fw__sprite-shell {
  animation: pet-fw-vanish 600ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

.pet-fw--showing .pet-fw__sprite-shell {
  animation: pet-fw-emerge 700ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.pet-fw__music-info {
  position: absolute;
  left: var(--pet-fw-pet-center-x);
  right: auto;
  top: auto;
  bottom: 3px;
  max-width: min(238px, calc(100vw - 24px));
  min-height: 38px;
  transform: translateX(-50%) translateY(6px);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--pet-fw-line);
  border-radius: 999px;
  background: var(--pet-fw-panel);
  box-shadow: 0 8px 22px rgba(39, 23, 25, 0.12);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 3;
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}

.pet-fw__music-info-title {
  max-width: min(164px, calc(100vw - 104px));
  overflow: hidden;
  color: var(--pet-fw-ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-fw__music-info .pet-fw__icon-button {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
}

.pet-fw--music-playing.pet-fw--hover .pet-fw__music-info {
  display: none;
  opacity: 0;
}

.pet-fw__music-box {
  position: absolute;
  right: 0;
  bottom: 214px;
  width: min(328px, calc(100vw - 36px));
  max-height: min(420px, calc(100vh - 230px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--pet-fw-glass-border);
  border-radius: 16px;
  background: var(--pet-fw-panel);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--pet-fw-shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1), transform 280ms cubic-bezier(0.16, 1, 0.3, 1), background 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.pet-fw--music-open .pet-fw__music-box {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pet-fw--music-open .pet-fw__bubble,
.pet-fw--import-open .pet-fw__bubble,
.pet-fw--memo-open .pet-fw__bubble,
.pet-fw--settings-open .pet-fw__bubble,
.pet-fw--import-open .pet-fw__music-box {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.pet-fw--memo-open .pet-fw__music-box,
.pet-fw--settings-open .pet-fw__music-box,
.pet-fw--settings-open .pet-fw__memo-modal,
.pet-fw--memo-open .pet-fw__settings-modal,
.pet-fw--memo-open .pet-fw__import-modal,
.pet-fw--settings-open .pet-fw__import-modal {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.pet-fw--music-style-compact .pet-fw__music-box {
  width: min(280px, calc(100vw - 36px));
  max-height: min(320px, calc(100vh - 230px));
}

.pet-fw--music-style-dock .pet-fw__music-box {
  right: auto;
  left: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 28px));
  max-height: min(270px, calc(100vh - 34px));
}

/* Viewport adaptation: flip horizontal alignment when pet is near a screen edge */
.pet-fw--music-flip-x .pet-fw__music-box {
  right: auto;
  left: 0;
}

/* Viewport adaptation: show music box below the pet when not enough space above */
.pet-fw--music-below .pet-fw__music-box {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateY(-12px) scale(0.96);
}

.pet-fw--music-open.pet-fw--music-below .pet-fw__music-box {
  transform: translateY(0) scale(1);
}

.pet-fw--music-style-compact .pet-fw__import-modal {
  width: min(224px, calc(100vw - 36px));
}

.pet-fw--music-style-dock .pet-fw__import-modal {
  right: auto;
  left: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 28px));
}

.pet-fw__music-head {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pet-fw-line-soft);
  flex-shrink: 0;
}

.pet-fw__music-title {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: visible;
  color: var(--pet-fw-ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
  word-break: keep-all;
}

.pet-fw__music-title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--pet-fw-accent);
  flex-shrink: 0;
}

.pet-fw__music-subtitle {
  overflow: visible;
  color: var(--pet-fw-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: clip;
  white-space: normal;
  word-break: keep-all;
}

.pet-fw__desktop-lyrics {
  position: fixed;
  left: 50%;
  bottom: 44px;
  z-index: calc(var(--pet-fw-z) - 1);
  display: grid;
  min-width: min(560px, calc(100vw - 32px));
  max-width: min(720px, calc(100vw - 32px));
  gap: 4px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(24, 18, 20, 0.64);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  color: #fff;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-50%, 12px, 0);
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.pet-fw__desktop-lyrics--visible {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.pet-fw__desktop-lyrics-line {
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.pet-fw__desktop-lyrics-translation {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-fw__music-marquee {
  min-width: 0;
  overflow: hidden;
  position: relative;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 calc(100% - 24px), transparent 100%);
}

.pet-fw__music-marquee-text {
  display: inline-block;
  min-width: 100%;
  padding-right: 0;
  color: var(--pet-fw-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  transform: translateX(0);
  will-change: transform;
}

.pet-fw__music-marquee--active .pet-fw__music-marquee-text {
  min-width: max-content;
  padding-left: 100%;
  padding-right: 32px;
  animation: pet-fw-marquee 10s linear infinite;
  color: var(--pet-fw-accent);
}

.pet-fw--music-summary .pet-fw__music-title,
.pet-fw--music-summary .pet-fw__music-subtitle,
.pet-fw--music-summary .pet-fw__song-list {
  display: none;
}

.pet-fw--music-summary .pet-fw__music-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.pet-fw--music-summary .pet-fw__music-marquee {
  min-height: 18px;
}

.pet-fw__song-list {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: var(--pet-fw-line) transparent;
  scrollbar-width: thin;
  padding-right: 2px;
}

.pet-fw__song-list::-webkit-scrollbar {
  width: 6px;
}

.pet-fw__song-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--pet-fw-line);
}

.pet-fw__song-list::-webkit-scrollbar-track {
  background: transparent;
}

.pet-fw__empty {
  padding: 9px 4px;
  color: var(--pet-fw-muted);
  font-size: 12px;
  line-height: 1.35;
}

.pet-fw__song-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--pet-fw-line);
}

.pet-fw--music-style-dock .pet-fw__song-form {
  grid-template-columns: 1fr auto;
}

.pet-fw--music-style-dock .pet-fw__song-input[name="title"] {
  grid-column: 1 / -1;
}

.pet-fw__song-input {
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid rgba(74, 34, 38, 0.12);
  border-radius: 7px;
  background: var(--pet-fw-input-bg);
  color: var(--pet-fw-ink);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.pet-fw__song-input:focus {
  border-color: rgba(184, 25, 50, 0.42);
  box-shadow: 0 0 0 2px var(--pet-fw-accent-glow);
}

.pet-fw__add-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border: 1px solid var(--pet-fw-accent-glow);
  border-radius: 7px;
  background: var(--pet-fw-accent-soft);
  color: var(--pet-fw-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pet-fw__add-button:hover,
.pet-fw__add-button:focus-visible {
  background: var(--pet-fw-accent-glow);
  outline: none;
}

.pet-fw__add-button svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.pet-fw__song {
  display: grid;
  grid-template-columns: 20px 1fr 24px;
  align-items: center;
  gap: 6px;
  position: relative;
}

.pet-fw__song-num {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--pet-fw-line-soft);
  color: var(--pet-fw-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all 160ms ease;
}

.pet-fw__song-select {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--pet-fw-ink);
  text-align: left;
  cursor: pointer;
  transition: all 160ms ease;
  position: relative;
}

.pet-fw__song-select:hover {
  background: var(--pet-fw-song-bg-hover);
  border-color: var(--pet-fw-line-soft);
}

.pet-fw__song-select[aria-current="true"] {
  background: var(--pet-fw-accent-soft);
  border-color: var(--pet-fw-accent-glow);
}

.pet-fw__song-select[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 2px 2px 0;
  background: var(--pet-fw-accent);
}

.pet-fw__song-title,
.pet-fw__song-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pet-fw__song-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.pet-fw__song-select[aria-current="true"] .pet-fw__song-title {
  color: var(--pet-fw-accent);
}

.pet-fw__song-artist {
  color: var(--pet-fw-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
}

.pet-fw__song-playing {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 18px;
  height: 18px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.pet-fw__song-playing span {
  width: 2.5px;
  height: 100%;
  border-radius: 2px;
  background: var(--pet-fw-accent);
  transform-origin: bottom;
}

.pet-fw__song-playing svg {
  display: none;
}

.pet-fw__song-playing--active {
  opacity: 1;
}

.pet-fw__song-playing--active span:nth-child(1) {
  animation: pet-fw-eq-bar 0.7s ease-in-out infinite;
  animation-delay: 0ms;
}

.pet-fw__song-playing--active span:nth-child(2) {
  animation: pet-fw-eq-bar 0.7s ease-in-out infinite;
  animation-delay: 150ms;
}

.pet-fw__song-playing--active span:nth-child(3) {
  animation: pet-fw-eq-bar 0.7s ease-in-out infinite;
  animation-delay: 300ms;
}

.pet-fw__song-remove {
  color: var(--pet-fw-muted);
}

.pet-fw__music-progress {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--pet-fw-line-soft);
  flex-shrink: 0;
}

.pet-fw__music-time {
  color: var(--pet-fw-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.pet-fw__progress-range {
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  accent-color: var(--pet-fw-accent);
  appearance: none;
  cursor: pointer;
}

.pet-fw__progress-range:disabled {
  cursor: default;
  opacity: 0.48;
}

.pet-fw__progress-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pet-fw-accent) var(--pet-fw-progress, 0%), rgba(74, 34, 38, 0.14) var(--pet-fw-progress, 0%));
}

.pet-fw__progress-range::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -4.5px;
  border: 2px solid var(--pet-fw-panel);
  border-radius: 50%;
  background: var(--pet-fw-accent);
  box-shadow: 0 2px 8px var(--pet-fw-accent-glow);
  appearance: none;
  transition: transform 160ms ease;
}

.pet-fw__progress-range:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.pet-fw__progress-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(74, 34, 38, 0.14);
}

.pet-fw__progress-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--pet-fw-accent);
}

.pet-fw__progress-range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid var(--pet-fw-panel);
  border-radius: 50%;
  background: var(--pet-fw-accent);
  box-shadow: 0 2px 8px var(--pet-fw-accent-glow);
}

.pet-fw__music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  flex-shrink: 0;
}

.pet-fw__music-controls .pet-fw__icon-button {
  width: 30px;
  height: 30px;
}

.pet-fw__ctrl-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--pet-fw-accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--pet-fw-accent-glow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pet-fw__ctrl-play:hover {
  transform: scale(1.06);
}

.pet-fw__icon-button[aria-pressed="true"] {
  border-color: var(--pet-fw-accent-glow);
  background: var(--pet-fw-accent-soft);
  color: var(--pet-fw-accent);
}

.pet-fw__import-modal,
.pet-fw__memo-modal,
.pet-fw__settings-modal {
  position: absolute;
  right: 0;
  bottom: 214px;
  z-index: 2;
  width: min(328px, calc(100vw - 36px));
  max-height: min(420px, calc(100vh - 230px));
  overflow-y: auto;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  scrollbar-color: var(--pet-fw-line) transparent;
  scrollbar-width: thin;
}

.pet-fw--import-open .pet-fw__import-modal,
.pet-fw--memo-open .pet-fw__memo-modal,
.pet-fw--settings-open .pet-fw__settings-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.pet-fw__import-form,
.pet-fw__memo-form,
.pet-fw__settings-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--pet-fw-line);
  border-radius: 12px;
  background: var(--pet-fw-panel);
  box-shadow: var(--pet-fw-shadow);
}

.pet-fw__import-head,
.pet-fw__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--pet-fw-ink);
  font-size: 13px;
  font-weight: 700;
}

.pet-fw__memo-list {
  display: grid;
  gap: 6px;
  padding: 8px 0 0;
}

.pet-fw__memo-item {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(74, 34, 38, 0.1);
  border-radius: 8px;
  background: var(--pet-fw-song-bg);
}

.pet-fw__memo-item strong,
.pet-fw__memo-item span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.pet-fw__memo-item strong {
  color: var(--pet-fw-ink);
  font-size: 12px;
  line-height: 1.35;
}

.pet-fw__memo-item span {
  margin-top: 3px;
  color: var(--pet-fw-muted);
  font-size: 11px;
}

.pet-fw__setting-row {
  display: grid;
  gap: 5px;
  color: var(--pet-fw-muted);
  font-size: 11px;
  font-weight: 700;
}

.pet-fw__panel-textarea {
  width: 100%;
  resize: vertical;
  min-height: 48px;
  border: 1px solid rgba(74, 34, 38, 0.14);
  border-radius: 8px;
  background: var(--pet-fw-input-bg);
  color: var(--pet-fw-ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  padding: 8px;
}

.pet-fw__panel-textarea:focus,
.pet-fw__song-input:focus {
  border-color: var(--pet-fw-accent-glow);
  outline: none;
}

.pet-fw__import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pet-fw__ghost-button {
  min-height: 32px;
  border: 1px solid rgba(74, 34, 38, 0.12);
  border-radius: 7px;
  background: var(--pet-fw-song-bg);
  color: var(--pet-fw-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pet-fw__ghost-button:hover,
.pet-fw__ghost-button:focus-visible {
  border-color: var(--pet-fw-accent-glow);
  color: var(--pet-fw-accent);
  outline: none;
}

.pet-fw__status {
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid transparent;
  color: var(--pet-fw-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  flex-shrink: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 220ms ease;
}

.pet-fw--music-playing .pet-fw__status {
  max-height: 24px;
  opacity: 1;
  margin-top: 8px;
  padding-top: 8px;
  border-top-color: var(--pet-fw-line-soft);
}

.pet-fw__audio {
  display: none;
}

@keyframes pet-fw-dance {
  0% { transform: translateY(0) rotate(0deg) scale(1); }
  12.5% { transform: translateY(-8px) rotate(6deg) scale(1.04); }
  25% { transform: translateY(-2px) rotate(12deg) scale(1.02); }
  37.5% { transform: translateY(-10px) rotate(0deg) scale(1.05); }
  50% { transform: translateY(0) rotate(-12deg) scale(1); }
  62.5% { transform: translateY(-6px) rotate(-6deg) scale(1.03); }
  75% { transform: translateY(-3px) rotate(0deg) scale(1.01); }
  87.5% { transform: translateY(-9px) rotate(8deg) scale(1.04); }
  100% { transform: translateY(0) rotate(0deg) scale(1); }
}

@keyframes pet-fw-marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

@keyframes pet-fw-play-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes pet-fw-eq-bar {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

@keyframes pet-fw-show-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.94); }
  45% { opacity: 0.82; transform: scale(1.08); }
}

@keyframes pet-fw-vanish {
  0% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
  35% { opacity: 0.9; transform: scale(0.85) translateY(3px); filter: blur(0.8px); }
  100% { opacity: 0; transform: scale(0.05) translateY(16px); filter: blur(4px); }
}

@keyframes pet-fw-emerge {
  0% { opacity: 0; transform: scale(0.1) translateY(-14px); filter: blur(4px); }
  45% { opacity: 1; transform: scale(1.08) translateY(0); filter: blur(0); }
  70% { opacity: 1; transform: scale(0.96) translateY(0); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

@media (max-width: 520px) {
  .pet-fw {
    width: min(252px, calc(100vw - 20px));
    bottom: 12px;
  }

  .pet-fw__music-box {
    right: 0;
    bottom: calc(var(--pet-fw-stage-height, 204px) - 6px);
  }

  .pet-fw__import-modal,
  .pet-fw__memo-modal,
  .pet-fw__settings-modal {
    right: 0;
    bottom: calc(var(--pet-fw-stage-height, 204px) - 6px);
    width: min(252px, calc(100vw - 20px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .pet-fw,
  .pet-fw *,
  .pet-fw *::before,
  .pet-fw *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
