:root {
  --bg: #f7fbff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --text: #172033;
  --muted: #5b687e;
  --border: rgba(18, 30, 52, 0.08);
  --shadow: 0 20px 56px rgba(23, 32, 51, 0.08);
  --shadow-soft: 0 14px 30px rgba(23, 32, 51, 0.06);
  --accent: #6078f2;
  --accent-soft: rgba(96, 120, 242, 0.12);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 224, 236, 0.85), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(213, 237, 255, 0.95), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar,
.preview {
  padding: 24px;
}

.section-heading h1,
.preview-header h2,
.controls-heading h3 {
  margin: 0;
}

.section-heading p,
.preview-note,
.controls-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7c88a0;
}

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

.pet-card {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 228, 236, 0.9), transparent 26%),
    radial-gradient(circle at 74% 16%, rgba(219, 239, 255, 0.94), transparent 24%),
    linear-gradient(180deg, var(--surface-strong) 0%, rgba(248, 251, 255, 0.98) 100%);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
  box-shadow: var(--shadow-soft);
}

.pet-card:hover {
  transform: translateY(-3px);
}

.pet-card.is-active {
  border-color: rgba(96, 120, 242, 0.3);
  box-shadow: 0 18px 38px rgba(96, 120, 242, 0.12);
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 228, 236, 0.95), transparent 28%),
    radial-gradient(circle at 74% 16%, rgba(219, 239, 255, 0.98), transparent 26%),
    linear-gradient(180deg, #ffffff 0%, #f1f5ff 100%);
}

.pet-card canvas {
  width: 100%;
  height: 128px;
  display: block;
  border-radius: 20px;
}

.pet-card-name {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.preview-note {
  max-width: 220px;
  text-align: right;
}

.stage-surface {
  position: relative;
  height: 480px;
  margin-top: 20px;
  border-radius: 32px;
  border: 1px solid var(--border);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 227, 236, 0.95), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(219, 239, 255, 0.94), transparent 26%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  touch-action: none;
  cursor: grab;
}

.stage-surface:active {
  cursor: grabbing;
}

.stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage-glow {
  position: absolute;
  inset: auto;
  width: 280px;
  height: 280px;
  filter: blur(28px);
  opacity: 0.5;
  pointer-events: none;
}

.stage-glow-left {
  left: -72px;
  top: -72px;
  background: radial-gradient(circle, rgba(255, 187, 213, 0.74), transparent 65%);
}

.stage-glow-right {
  right: -88px;
  top: -80px;
  background: radial-gradient(circle, rgba(170, 224, 255, 0.74), transparent 65%);
}

.drag-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
}

.controls {
  margin-top: 20px;
}

.state-buttons {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.state-button {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f4f7fb;
  color: #415065;
  padding: 11px 12px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.state-button:hover {
  transform: translateY(-1px);
}

.state-button[aria-selected="true"] {
  border-color: rgba(96, 120, 242, 0.24);
  background: linear-gradient(180deg, #ffffff 0%, #edf2ff 100%);
  color: #2d467f;
  box-shadow: 0 10px 24px rgba(96, 120, 242, 0.08);
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .preview {
    order: -1;
  }

  .preview-header {
    flex-direction: column;
    gap: 10px;
  }

  .preview-note {
    max-width: none;
    text-align: left;
  }

  .stage-surface {
    height: 420px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin: 10px auto 24px;
    gap: 16px;
  }

  .sidebar,
  .preview {
    padding: 18px;
  }

  .pet-grid {
    grid-template-columns: 1fr 1fr;
  }

  .state-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-surface {
    height: 360px;
  }
}
