* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  background: transparent !important;
  overflow: hidden;
  user-select: none;
  width: 100%;
  height: 100%;
}

/* 外层包裹，撑满窗口，靠右对齐 */
#pet-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 20px;
}

/* 展开时靠右对齐 */
#pet-wrapper.layout-expanded {
  justify-content: flex-end;
}

#pet-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 14px;
  border-radius: 28px;
  background: rgba(30, 30, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: border-radius 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s ease,
              border-color 0.4s ease,
              background 0.3s ease,
              height 0.3s ease;
  width: 100%;
  height: 100%;
  gap: 8px;
  overflow: visible;
}

/* 展开状态：圆角矩形 */
#pet-container.shape-expanded {
  border-radius: 28px;
  width: 100%;
  height: 100%;
  padding: 8px 14px;
  gap: 8px;
  justify-content: flex-start;
}

#pet-container:hover {
  background: rgba(30, 30, 40, 0.97);
  border-color: rgba(255, 255, 255, 0.22);
}

#pet-container.notify-done {
  border-color: rgba(80, 220, 100, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 20px rgba(80, 220, 100, 0.15);
}

#pet-container.notify-waiting {
  border-color: rgba(255, 200, 50, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 200, 50, 0.15);
}

#pet-container.notify-error {
  border-color: rgba(255, 80, 80, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 20px rgba(255, 80, 80, 0.15);
}

/* Quota Ring - circular progress, replaces pixel pet */
#quota-ring {
  image-rendering: pixelated;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

#quota-ring:hover {
  transform: scale(1.1);
}

/* Status Dot */
.status-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s ease;
  z-index: 2;
}

.status-dot.idle {
  background: #666;
}

.status-dot.running {
  background: #50dc64;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.waiting {
  background: #ffc832;
  animation: pulse 1s ease-in-out infinite;
}

.status-dot.error {
  background: #ff5050;
  animation: pulse 0.8s ease-in-out infinite;
}

.status-dot.done {
  background: #50dc64;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Pixel Timer */
.pixel-timer {
  display: flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: left center;
  flex-shrink: 0;
}

.pixel-timer.hidden {
  width: 0;
  opacity: 0;
  overflow: hidden;
  transform: scale(0.7);
}

.pixel-timer.show {
  opacity: 1;
  transform: scale(1);
}

#timer-canvas {
  image-rendering: pixelated;
  width: 40px;
  height: 14px;
  flex-shrink: 0;
}

/* Multi-session panel */
.sessions-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  overflow-y: auto;
  max-height: 100px; /* ~5 rows, scroll beyond */
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Thin scrollbar for sessions overflow */
.sessions-panel::-webkit-scrollbar {
  width: 3px;
}
.sessions-panel::-webkit-scrollbar-track {
  background: transparent;
}
.sessions-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
.sessions-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

.sessions-panel.hidden {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.sessions-panel.show {
  opacity: 1;
  width: auto;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  white-space: nowrap;
  padding: 0 2px;
  border-radius: 4px;
  transition: background 0.2s;
}

.session-row.clickable {
  cursor: pointer;
}

.session-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

.session-row.clickable:hover {
  background: rgba(255, 200, 50, 0.12);
}

.session-row.clickable:active {
  background: rgba(255, 200, 50, 0.2);
  transform: scale(0.98);
}

.session-label {
  color: rgba(255, 255, 255, 0.75);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9.5px;
}

.client-icon {
  vertical-align: middle;
  margin-right: 2px;
  flex-shrink: 0;
}

.session-time {
  color: #ffc832;
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  flex-shrink: 0;
}

.session-status {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Pixel status icons ── */
.status-icon {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 10px;
}

/* Running: 3 bars animating like equalizer */
.icon-running span {
  display: block;
  width: 2px;
  background: #ffc832;
  border-radius: 0;
  image-rendering: pixelated;
  animation: barBounce 0.8s ease-in-out infinite;
}
.icon-running span:nth-child(1) { height: 4px; animation-delay: 0s; }
.icon-running span:nth-child(2) { height: 7px; animation-delay: 0.15s; }
.icon-running span:nth-child(3) { height: 5px; animation-delay: 0.3s; }

@keyframes barBounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* Waiting approval: pulsing pause icon (two bars, orange blink) */
.icon-approval {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 10px;
  animation: approvalBlink 1s ease-in-out infinite;
}
.icon-approval span {
  display: block;
  width: 2px;
  height: 8px;
  background: #ffa040;
  border-radius: 0;
  image-rendering: pixelated;
}
@keyframes approvalBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Done: checkmark made of 2 pixel lines */
.icon-done {
  position: relative;
  width: 10px;
  height: 10px;
}
.icon-done span {
  position: absolute;
  background: #50dc64;
  image-rendering: pixelated;
  border-radius: 0;
}
.icon-done span:nth-child(1) {
  width: 2px;
  height: 5px;
  bottom: 2px;
  left: 2px;
  transform: rotate(-45deg);
}
.icon-done span:nth-child(2) {
  width: 2px;
  height: 8px;
  bottom: 2px;
  left: 5px;
  transform: rotate(35deg);
}

.session-status.running {}
.session-status.waiting_approval {}
.session-status.done {}

/* Daily stats (idle state, T count only) */
.daily-stats {
  display: flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: left center;
  flex-shrink: 0;
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.daily-stats.show {
  opacity: 1;
  width: auto;
  overflow: visible;
}

.daily-stats.hidden {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

#daily-canvas {
  image-rendering: pixelated;
  width: 40px;
  height: 14px;
  flex-shrink: 0;
}

/* Top todos: hidden in main window (displayed in separate preview window) */
.top-todos {
  display: none;
}
.top-todo-item {
  display: none;
}

/* Waiting state: yellow pulsing border */
#pet-container.state-waiting {
  border-color: rgba(255, 200, 50, 0.5);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 16px rgba(255, 200, 50, 0.1);
  animation: waitingPulse 2s ease-in-out infinite;
}

@keyframes waitingPulse {
  0%, 100% { border-color: rgba(255, 200, 50, 0.3); }
  50% { border-color: rgba(255, 200, 50, 0.65); }
}

/* Waiting for user approval: orange pulsing */
#pet-container.state-approval {
  border-color: rgba(255, 149, 0, 0.6);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 16px rgba(255, 149, 0, 0.15);
  animation: approvalPulse 1s ease-in-out infinite;
}

@keyframes approvalPulse {
  0%, 100% { border-color: rgba(255, 149, 0, 0.3); }
  50% { border-color: rgba(255, 149, 0, 0.7); }
}

/* Notification Bubble */
.bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 300px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: left center;
}

.bubble.hidden {
  max-width: 0;
  opacity: 0;
  padding: 0;
  transform: scale(0.8);
}

.bubble.show {
  opacity: 1;
  transform: scale(1);
}

.bubble-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

.bubble-message {
  font-size: 10.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.75);
  white-space: normal;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

/* Pet bounce animation on notification */
@keyframes petBounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px); }
}

.pet-bounce #quota-ring {
  animation: petBounce 0.6s ease;
}

/* Egg hatch animation (gacha-style) */
@keyframes eggWobble {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}

@keyframes petPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.35); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Rarity glow effects */
@keyframes ssrGlow {
  0%, 100% { filter: drop-shadow(0 0 4px #FFD700); }
  50% { filter: drop-shadow(0 0 12px #FFD700) brightness(1.15); }
}

@keyframes urGlow {
  0%, 100% { filter: drop-shadow(0 0 6px #FF4500); }
  50% { filter: drop-shadow(0 0 16px #FF4500) brightness(1.2); }
}

.glow-ssr #quota-ring {
  animation: ssrGlow 2s ease-in-out infinite;
}

.glow-ur #quota-ring {
  animation: urGlow 1.5s ease-in-out infinite;
}

/* ── Pixel particle burst on task complete ── */
#particle-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-app-region: no-drag;
  overflow: visible;
  z-index: 10;
}

.pixel-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  image-rendering: pixelated;
  border-radius: 0;
  opacity: 0;
  will-change: transform, opacity;
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  60% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(var(--px), var(--py)) scale(0.3);
  }
}

/* ── Sparkle idle animation ── */
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

.sparkle-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #ffc832;
  border-radius: 0;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

.sparkle-dot.active {
  animation: sparkle 1.8s ease-in-out infinite;
}

/* ── Mood indicator ── */
#mood-emoji {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  -webkit-app-region: no-drag;
  z-index: 12;
}

#mood-emoji.show {
  opacity: 1;
  animation: floatUp 2s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ── Touch reaction: hearts/stars ── */
#touch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 11;
}

.touch-heart {
  position: absolute;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation: heartFloat 1s ease-out forwards;
}

@keyframes heartFloat {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  50% { opacity: 1; transform: translate(var(--hx), var(--hy)) scale(1.2); }
  100% { opacity: 0; transform: translate(var(--hx), calc(var(--hy) - 15px)) scale(0.8); }
}

/* Touch squish effect */
@keyframes petSquish {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.15, 0.88); }
  50% { transform: scale(0.92, 1.1); }
  70% { transform: scale(1.05, 0.96); }
  100% { transform: scale(1, 1); }
}

.pet-squish #quota-ring {
  animation: petSquish 0.4s ease !important;
}

/* ── Unlock toast ── */
.unlock-toast {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(40, 35, 55, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(200, 160, 255, 0.3);
  border-radius: 12px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(120, 80, 200, 0.3);
  white-space: nowrap;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.unlock-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.unlock-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

.unlock-icon {
  font-size: 16px;
}

.unlock-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

@keyframes unlockGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(120, 80, 200, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(200, 160, 255, 0.6); }
}

.unlock-toast.show {
  animation: unlockGlow 1.5s ease-in-out 2;
}

/* ── Mood indicator (bottom-left corner, hover to show) ── */
.mood-indicator {
  position: absolute;
  bottom: 3px;
  left: 8px;
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s ease;
}

#pet-container:hover .mood-indicator {
  opacity: 0.8;
}

/* ── Online counter removed ── */
