.app { --pet-row: clamp(56px, calc(clamp(72px, 11dvh, 98px) * var(--pet-size, 1)), 138px); }
.grok-pet-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: var(--pet-row);
  padding-inline-end: 4px;
  pointer-events: none;
}
.grok-pet {
  width: var(--pet-row);
  height: var(--pet-row);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: grab;
  position: relative;
  translate: var(--drag-x, 0px) var(--drag-y, 0px);
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}
.grok-pet:focus-visible { outline: 2px solid #31558f; outline-offset: 1px; }
.grok-pet [data-pet], .grok-pet svg { display: block; width: 100%; height: 100%; }

.grok-pet.is-grabbed,.grok-pet.is-flung { z-index: 12; cursor: grabbing; }
.grok-pet [data-part="sphere"], .grok-pet [data-part="thought"] { fill: var(--pet-color, #1084fe); }
.grok-pet [data-part="sphere"], .pet-preview__art circle { stroke: color-mix(in srgb, var(--pet-color, #1084fe) 68%, #203149); stroke-width: 1.9; }
.grok-pet [data-part="particles"] { color: var(--pet-color, #1084fe); }

#expPage .xp__scroll[hidden] { display: none; }
#spPetBtn .sp-item__ic { color: var(--ink); }

.pet-custom {
  --pet-paper: #fff;
  --pet-ink: #192333;
  --pet-muted: #526277;
  --pet-line: #e4eaf1;
  --pet-select: #edf4ff;
  --pet-select-ink: #154a97;
  padding-inline: clamp(17px, 5vw, 42px);
}
.pet-custom__inner { width: min(100%, 780px); margin-inline: auto; }
.pet-custom h1 {
  margin: clamp(16px, 3.2dvh, 29px) 0 16px;
  font: 680 clamp(29px, 5.6vw, 43px)/1.12 var(--brand);
  letter-spacing: -.045em;
  color: var(--ink);
}
.pet-custom h1:focus-visible { outline: none; }
.pet-custom__heading { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
#petFeelingsJump { flex: 0 0 auto; min-height: 36px; padding: 0 9px; border: 1px solid #d6e1ee; border-radius: 9px; background: #ffffffbc; color: #294f80; font: 620 12px/1 var(--sans,system-ui); cursor: pointer; }
.pet-custom__layout { display: grid; gap: 12px; }
.pet-preview {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 190px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d9e6fa;
  border-radius: 24px;
  background: #eaf2ff;
  background: color-mix(in srgb, var(--pet-color, #1084fe) 15%, white);
  color: #425a7c;
  cursor: pointer;
}
.pet-preview::before {
  content: "";
  position: absolute;
  width: 142px;
  aspect-ratio: 1;
  border: 1px solid #cfdef6;
  border-color: color-mix(in srgb, var(--pet-color, #1084fe) 25%, white);
  border-radius: 50%;
  box-shadow: 0 0 0 16px color-mix(in srgb, var(--pet-color, #1084fe) 20%, white);
}
.pet-preview__art {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%,-50%);
  display: block;
  width: calc(162px * var(--pet-size, 1));
  aspect-ratio: 1;
  pointer-events: none;
}
.pet-preview__art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.pet-preview__art circle { fill: var(--pet-color, #1084fe); }
.pet-preview__art path { fill: var(--pet-eye, #fff); }
.pet-preview__label, .pet-preview__hint { position: absolute; font: 600 11px/1 var(--sans, system-ui); }
.pet-preview__label { top: 14px; left: 15px; }
.pet-preview__hint { bottom: 13px; right: 15px; }
.pet-controls {
  background: var(--pet-paper);
  color: var(--pet-ink);
  border: 1px solid var(--pet-line);
  border-radius: 22px;
  padding-inline: clamp(14px, 4vw, 23px);
}
.pet-control { padding-block: 14px; }
.pet-control + .pet-control { border-top: 1px solid var(--pet-line); }
.pet-control__head, .pet-control__ends { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pet-control__head label, .pet-control__head h2 { margin: 0; font: 650 14px/1.4 var(--sans, system-ui); }
.pet-control__head output, .pet-control__ends { color: var(--pet-muted); font: 500 11px/1.2 var(--sans, system-ui); font-variant-numeric: tabular-nums; }
#petSize {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 32px;
  margin: 2px 0 0;
  background: none;
  cursor: pointer;
}
#petSize::-webkit-slider-runnable-track { height: 4px; border-radius: 8px; background: linear-gradient(90deg,#2374d9 var(--size-progress,38.46%),#e4eaf1 0); }
#petSize::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 19px; height: 19px; margin-top: -7.5px; border: 1px solid #cdd9e6; border-radius: 50%; background: white; box-shadow: 0 1px 3px #27374a36; }
#petSize::-moz-range-track { height: 4px; border-radius: 8px; background: #e4eaf1; }
#petSize::-moz-range-progress { height: 4px; border-radius: 8px; background: #2374d9; }
#petSize::-moz-range-thumb { width: 17px; height: 17px; border: 1px solid #cdd9e6; border-radius: 50%; background: white; }
.pet-colors { display: flex; flex-wrap: wrap; gap: 3px; margin: 6px -4px -3px; }
.pet-colors button {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 43px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.pet-colors button::before { content: ""; width: 28px; height: 28px; border-radius: 50%; background: var(--swatch); }
.pet-colors button[aria-pressed="true"]::before { outline: 2px solid var(--swatch); outline-offset: 3px; }
.pet-colors .pet-color-theme { --swatch: var(--pet-theme,#a9c7ff); }
.pet-color-theme svg { position: absolute; width: 16px; height: 16px; color: #192333; pointer-events: none; }
.pet-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pet-actions button {
  padding: 3px 10px;
  min-height: 36px;
  border: 1px solid var(--pet-line);
  border-radius: 9px;
  background: var(--pet-paper);
  color: var(--pet-muted);
  font: 620 12px/1 var(--sans, system-ui);
  cursor: pointer;
}
.pet-actions button[aria-pressed="true"] { border-color: #b5d2f7; background: var(--pet-select); color: var(--pet-select-ink); }
.pet-custom :is(button,input,summary):focus-visible { outline: 2px solid #2374d9; outline-offset: 3px; }
.pet-feelings { margin-top: 12px; padding: 14px clamp(14px,4vw,23px); border: 1px solid var(--pet-line); border-radius: 22px; background: var(--pet-paper); color: var(--pet-ink); }
.pet-feelings__status { color: #256951; font: 600 11px/1.3 var(--sans,system-ui); }
.pet-feelings p, .pet-example-result { margin: 5px 0 0; color: var(--pet-muted); font: 500 12px/1.5 var(--sans,system-ui); }
.pet-example-result:not(:empty) { display: block; }
.pet-demo { display: flex; align-items: center; gap: 12px; min-height: 76px; margin-top: 8px; }
.pet-demo svg { flex: 0 0 72px; width: 72px; height: 72px; overflow: visible; }
.pet-demo circle { fill: var(--pet-color,#a9c7ff); stroke: color-mix(in srgb, var(--pet-color,#a9c7ff) 68%, #203149); stroke-width: 1.9; }
.pet-demo path, .grok-pet [data-part="face"] { fill: var(--pet-eye, #fff); }
@media (min-width: 860px) {
  .pet-custom__layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .pet-preview { min-height: 259px; }
  .pet-preview__art { width: calc(194px * var(--pet-size, 1)); }
  .pet-preview::before { width: 177px; }
}
@media (max-width: 350px) {
  .pet-colors button::before { width: 23px; height: 23px; }
}

@media (max-width: 470px) {
  .pet-colors { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; }
  .pet-colors button { width: 100%; min-width: 0; }
}
