:root {
  --pink: #ff7fb2;
  --pink-2: #ffa8cc;
  --pink-3: #ffd9e8;
  --purple: #a98dfa;
  --purple-2: #c9b8ff;
  --sky: #8ecdf7;
  --ink: #4a3b52;
  --ink-2: #8a7a92;
  --ink-3: #b6a9bd;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(255, 150, 200, 0.26);
  --shadow: 0 12px 32px -14px rgba(255, 110, 170, 0.45);
  --radius: 20px;
  --radius-sm: 14px;
  --grad-main: linear-gradient(120deg, #ff8fbe, #c08bfa 60%, #8ecdf7);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: #fff5fa;
  background-image:
    linear-gradient(180deg, rgba(255, 240, 247, 0.82), rgba(240, 244, 255, 0.88)),
    url("../assets/Umamusume.jpg");
  background-size: cover, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  overflow-x: hidden;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -6vh;
  background: radial-gradient(circle at 30% 30%, #ffe3ef, #ffb6d3 70%);
  border-radius: 100% 0 100% 0;
  opacity: 0.75;
  filter: drop-shadow(0 2px 3px rgba(255, 140, 190, 0.25));
  animation: petal-fall linear infinite;
}

@keyframes petal-fall {
  0% {
    transform: translate3d(0, -6vh, 0) rotate(0deg);
  }
  25% {
    transform: translate3d(22px, 24vh, 0) rotate(140deg);
  }
  50% {
    transform: translate3d(-14px, 52vh, 0) rotate(280deg);
  }
  75% {
    transform: translate3d(18px, 78vh, 0) rotate(430deg);
  }
  100% {
    transform: translate3d(-6px, 108vh, 0) rotate(560deg);
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px calc(12px + 0px);
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-mark {
  width: 40px;
  height: 40px;
  flex: none;
  animation: logo-float 4s ease-in-out infinite;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(8deg); }
}

.logo-text {
  min-width: 0;
}

.logo-text h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #ff6fa8, #a06bf5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-text p {
  margin: 1px 0 0;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-btn {
  flex: none;
  appearance: none;
  font: inherit;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #7a5a8c;
  border: 1px solid rgba(255, 170, 210, 0.5);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.account-btn:active {
  transform: scale(0.95);
}

.quota-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}

.quota-hint.is-low {
  color: #c07a2c;
}

.quota-hint.is-empty {
  color: #e0537e;
}

.app-main {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 10px;
}

.view {
  display: none;
  animation: view-in 0.28s ease;
}

.view.is-active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.card-head h2,
.adv-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 1px;
}

.card-head h2::before,
.adv-head h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--grad-main);
  transform: rotate(45deg) translateY(-1px);
}

.hint {
  font-size: 11px;
  color: var(--ink-3);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 10%, rgba(255, 200, 230, 0.65), transparent 55%),
    radial-gradient(circle at 8% 92%, rgba(190, 210, 255, 0.6), transparent 55%),
    var(--card);
}

.hero-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hero-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.hero-sparkles i {
  position: absolute;
  width: 6px;
  height: 6px;
  background: linear-gradient(120deg, #ffb6d3, #c9b8ff);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 2.4s ease-in-out infinite;
}

.hero-sparkles i:nth-child(1) { top: 18px; right: 26px; animation-delay: 0s; }
.hero-sparkles i:nth-child(2) { top: 42px; right: 58px; animation-delay: 0.8s; transform: scale(0.7); }
.hero-sparkles i:nth-child(3) { bottom: 16px; right: 96px; animation-delay: 1.5s; transform: scale(0.55); }

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.7) rotate(0); }
  50% { opacity: 1; transform: scale(1.15) rotate(45deg); }
}

.model-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.model-list::-webkit-scrollbar {
  display: none;
}

.model-item {
  flex: none;
  width: 148px;
  border: 1.6px solid rgba(255, 170, 210, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
  padding: 12px 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.model-item:active {
  transform: scale(0.97);
}

.model-item.is-active {
  border-color: transparent;
  background:
    linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)) padding-box,
    var(--grad-main) border-box;
  border: 2px solid transparent;
  box-shadow: 0 8px 22px -10px rgba(200, 120, 250, 0.55);
}

.model-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
  margin-bottom: 8px;
  box-shadow: inset 0 -6px 12px rgba(0, 0, 0, 0.08);
}

.model-avatar.theme-purple { background: linear-gradient(140deg, #b18cfa, #8f6cf0); }
.model-avatar.theme-pink { background: linear-gradient(140deg, #ff9ec7, #ff6fa8); }
.model-avatar.theme-sky { background: linear-gradient(140deg, #8ecdf7, #5fa8e8); }

.model-name {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.model-tag {
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 999px;
}

.model-desc {
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-2);
  line-height: 1.45;
}

.mini-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.mini-btn:active {
  transform: scale(0.95);
}

.mini-btn.accent {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(120deg, #ff8fbe, #a98dfa);
  box-shadow: 0 6px 16px -8px rgba(220, 120, 220, 0.8);
}

.mini-btn.danger {
  color: #e0537e;
  border-color: rgba(255, 120, 160, 0.4);
}

textarea,
input[type="text"],
input[type="search"] {
  width: 100%;
  border: 1.6px solid rgba(255, 170, 210, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 11px 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="search"]:focus {
  border-color: var(--pink-2);
  box-shadow: 0 0 0 4px rgba(255, 160, 205, 0.18);
}

.dict-search {
  position: relative;
  margin-bottom: 10px;
}

.dict-search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: #c9b3d1;
  pointer-events: none;
}

.dict-search input {
  padding-left: 33px;
}

.dict-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, transparent 0 2px, #e3cede 2px 100%);
  cursor: pointer;
}

.tag-cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.tag-cats::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex: none;
  appearance: none;
  font: inherit;
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
}

.cat-pill.is-active {
  background: linear-gradient(120deg, #ffd9e8, #e6dcff);
  color: #a3538a;
  border-color: transparent;
  font-weight: 700;
}

.cat-pill[data-target="negative"].is-active {
  background: linear-gradient(120deg, #ffe3e3, #ffd9e8);
  color: #c4576f;
}

.tag-subs {
  padding-bottom: 6px;
  flex-wrap: wrap;
  overflow-x: visible;
}

.tag-subs .cat-pill {
  font-size: 11px;
  padding: 4px 10px;
}

.tag-subs .cat-pill:not(.is-active) {
  background: #fdfafd;
  color: #8d7a95;
}

.tag-subs .sub-break {
  flex-basis: 100%;
  height: 0;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  align-content: flex-start;
}

.chip-group-title {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: #a58bab;
  margin: 8px 0 0;
}

.chip-group-title:first-child {
  margin-top: 0;
}

.chip-group-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--grad-main);
  transform: rotate(45deg);
}

.tag-chip {
  appearance: none;
  font: inherit;
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(200, 170, 255, 0.5);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.tag-chip .tag-en {
  color: #77569b;
  font-weight: 600;
}

.tag-chip .tag-zh {
  font-size: 10px;
  color: #b3a2ba;
}

.tag-chip::after {
  content: "✓";
  width: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 10px;
  font-weight: 700;
  color: #e0559b;
  transition: width 0.16s ease, opacity 0.16s ease;
}

.tag-chip:active {
  transform: scale(0.94);
}

.tag-chip.is-negative {
  border-color: rgba(255, 150, 180, 0.55);
}

.tag-chip.is-negative .tag-en {
  color: #b0526a;
}

.tag-chip.is-selected {
  background: linear-gradient(120deg, #ffe3f0, #ece1ff);
  border-color: rgba(255, 140, 200, 0.9);
  box-shadow: 0 4px 12px -6px rgba(210, 120, 210, 0.75);
}

.tag-chip.is-selected .tag-en {
  color: #a0338a;
  font-weight: 700;
}

.tag-chip.is-selected .tag-zh {
  color: #c06aae;
}

.tag-chip.is-selected::after {
  width: 11px;
  opacity: 1;
}

.tag-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 160, 205, 0.35);
  font-size: 11px;
  color: var(--ink-3);
}

.ratios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ratio-item {
  appearance: none;
  font: inherit;
  width: 52px;
  padding: 8px 0 6px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.ratio-item:active {
  transform: scale(0.94);
}

.ratio-item.is-active {
  border-color: transparent;
  background:
    linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)) padding-box,
    var(--grad-main) border-box;
  border: 2px solid transparent;
  color: #a3538a;
  font-weight: 700;
}

.ratio-box {
  border: 2px solid currentColor;
  border-radius: 4px;
  opacity: 0.75;
}

.ratio-item.is-active .ratio-box {
  opacity: 1;
  border-color: #c77bd8;
}

.ratio-label {
  font-size: 10px;
}

.field-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.field {
  flex: 1;
  min-width: 150px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 7px;
}

.neg-label {
  margin-top: 12px;
}

.field-note {
  display: block;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.segment {
  display: flex;
  background: rgba(255, 225, 240, 0.55);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
  border: 1px solid rgba(255, 170, 210, 0.35);
}

.seg-item {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12px;
  padding: 7px 6px;
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

.seg-item.is-active {
  background: #fff;
  color: #b0568c;
  font-weight: 700;
  box-shadow: 0 3px 10px -4px rgba(220, 120, 190, 0.6);
}

.adv-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.chevron {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  transition: transform 0.25s ease;
}

.adv-head[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.adv-body {
  margin-top: 14px;
  animation: view-in 0.22s ease;
}

.seed-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #eadcec;
  transition: background 0.2s ease;
  cursor: pointer;
}

.switch .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(180, 120, 180, 0.4);
  transition: transform 0.22s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(120deg, #ff9ec7, #a98dfa);
}

.switch input:checked + .slider::after {
  transform: translateX(20px);
}

.generate-btn {
  position: relative;
  width: 100%;
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 6px;
  text-indent: 6px;
  color: #fff;
  background: var(--grad-main);
  background-size: 180% 180%;
  box-shadow: 0 16px 34px -14px rgba(255, 110, 190, 0.85);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: grad-flow 5s ease infinite;
}

@keyframes grad-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.generate-btn:active {
  transform: scale(0.98);
}

.generate-btn:disabled {
  filter: grayscale(0.35) brightness(1.05);
  cursor: not-allowed;
  animation: none;
}

.gen-shine {
  position: absolute;
  top: 0;
  left: -40%;
  width: 30%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: shine 3.4s ease-in-out infinite;
}

@keyframes shine {
  0% { left: -40%; }
  55% { left: 130%; }
  100% { left: 130%; }
}

.cost-note {
  margin: 10px 4px 16px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: center;
}

.task-card {
  scroll-margin-top: 70px;
}

.task-steps {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 160, 205, 0.6);
  background: #fff;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.step-dot.is-done {
  background: linear-gradient(120deg, #ff8fbe, #a98dfa);
  border-color: transparent;
  box-shadow: 0 0 0 4px rgba(255, 160, 205, 0.25);
}

.step-dot.is-current {
  animation: dot-pulse 1.2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 160, 205, 0.2); }
  50% { box-shadow: 0 0 0 7px rgba(255, 160, 205, 0.35); }
}

.step-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 160, 205, 0.5), rgba(170, 150, 255, 0.5));
  border-radius: 2px;
}

.task-text {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-2);
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 225, 240, 0.8);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9ec7, #a98dfa, #8ecdf7);
  background-size: 200% 100%;
  transition: width 0.5s ease;
  animation: grad-flow 2.5s linear infinite;
}

.task-error {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #d1476f;
  background: rgba(255, 225, 235, 0.75);
  border: 1px solid rgba(255, 140, 180, 0.4);
  border-radius: 12px;
  padding: 10px 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 4px;
}

.result-grid.multi {
  grid-template-columns: 1fr 1fr;
}

.img-card {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px -14px rgba(200, 110, 190, 0.55);
  animation: view-in 0.4s ease;
}

.img-wrap {
  position: relative;
  background:
    linear-gradient(110deg, #ffe8f2 8%, #fff 18%, #ffe8f2 33%);
  background-size: 200% 100%;
  animation: skeleton 1.4s linear infinite;
}

.img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  animation: img-in 0.5s ease;
}

@keyframes skeleton {
  to { background-position-x: -200%; }
}

@keyframes img-in {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.img-actions {
  display: flex;
  gap: 8px;
  padding: 9px 10px;
}

.img-actions .mini-btn {
  flex: 1;
  justify-content: center;
}

.result-meta {
  margin-top: 12px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
  word-break: break-all;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.g-item {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px -14px rgba(200, 110, 190, 0.5);
  display: flex;
  flex-direction: column;
}

.g-thumb {
  appearance: none;
  border: none;
  padding: 0;
  cursor: zoom-in;
  background: #ffeef6;
  display: block;
}

.g-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.g-body {
  padding: 8px 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.g-prompt {
  margin: 0;
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.g-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 9.5px;
  color: var(--ink-3);
}

.g-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.g-actions .mini-btn {
  flex: 1;
  justify-content: center;
  font-size: 10.5px;
  padding: 5px 4px;
}

.empty {
  text-align: center;
  padding: 34px 10px 26px;
}

.empty-mascot {
  width: 120px;
  max-width: 60%;
  margin-bottom: 12px;
  animation: logo-float 5s ease-in-out infinite;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.empty-sub {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--ink-3);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  z-index: 30;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
}

.tab {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.is-active {
  color: #fff;
  background: var(--grad-main);
  box-shadow: 0 10px 22px -10px rgba(255, 110, 190, 0.9);
  font-weight: 700;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(50, 30, 55, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 52px 16px calc(20px + env(safe-area-inset-bottom));
  animation: view-in 0.22s ease;
}

.lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.lb-close svg {
  width: 20px;
  height: 20px;
}

.lb-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}

.lb-info {
  margin: 12px 0;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  line-height: 1.7;
  max-width: 520px;
  word-break: break-all;
  white-space: pre-line;
}

.lb-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.toasts {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 86vw;
}

.toast {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(160, 90, 170, 0.5);
  animation: toast-in 0.28s ease;
  max-width: 100%;
}

.toast.error {
  background: rgba(255, 236, 242, 0.97);
  border-color: rgba(255, 130, 170, 0.5);
  color: #c4456e;
}

.toast.is-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

@media (min-width: 720px) {
  .app-main {
    max-width: 680px;
    padding-top: 20px;
  }

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

  .tabbar {
    width: min(680px, 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .petal {
    display: none;
  }
}
