:root {
  --cream: #fff8f0;
  --cream-deep: #fdecd9;
  --pink: #ffd6e8;
  --pink-deep: #ff9ec4;
  --pink-hot: #ff5c8a;
  --leaf: #9fd67d;
  --leaf-deep: #5a9216;
  --gold: #ffd166;
  --text: #5a3a4a;
  --text-soft: #8a6a78;
  --white: #ffffff;
  --shadow: 0 8px 24px rgba(255, 92, 138, 0.18);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%);
  color: var(--text);
  font-family: "Segoe UI", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  overflow-x: hidden;
}

/* ---------- floating particles ---------- */
.particle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.particle {
  position: absolute;
  top: -10%;
  opacity: 0.75;
  animation: float-down linear infinite;
  filter: drop-shadow(0 2px 4px rgba(255, 92, 138, 0.25));
}
@keyframes float-down {
  0% { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { transform: translateY(110vh) translateX(30px) rotate(360deg); opacity: 0; }
}

/* ---------- banner ---------- */
.banner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 38px 20px 30px;
  background: radial-gradient(ellipse at top, var(--pink) 0%, var(--pink-deep) 70%, var(--pink-hot) 100%);
  border-radius: 0 0 48px 48px;
  box-shadow: var(--shadow);
  overflow: visible;
}
.banner-crown {
  font-size: 2rem;
  margin-bottom: -6px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
  animation: bob 3s ease-in-out infinite;
}
.banner-charm {
  position: absolute;
  top: 30%;
  font-size: 1.8rem;
  animation: bob 2.4s ease-in-out infinite;
}
.charm-left { left: 8%; animation-delay: .3s; }
.charm-right { right: 8%; animation-delay: .7s; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(4deg); }
}
.banner-title {
  margin: 6px 0 0;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 800;
  color: var(--white);
  text-shadow: 0 3px 0 var(--pink-hot), 0 6px 14px rgba(255,92,138,0.4);
  letter-spacing: 1px;
}
.banner-sub {
  margin: 6px 0 0;
  color: var(--white);
  font-size: 1rem;
  opacity: 0.95;
}

/* ---------- mood strip ---------- */
.mood-strip {
  position: relative;
  z-index: 2;
  margin: -18px auto 0;
  max-width: 560px;
  background: var(--white);
  border-radius: 999px;
  padding: 12px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow);
  font-weight: 600;
}
.mood-icon { font-size: 1.4rem; }

/* ---------- layout ---------- */
.app-main {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 18px 60px;
}
.corner-section { margin-bottom: 46px; }
.section-title {
  font-size: 1.4rem;
  margin: 0 0 14px;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-soft);
}
.mini-title {
  display: block;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 600;
}

/* ---------- search ---------- */
.search-section { margin-bottom: 40px; }
.search-form {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto 16px;
}
.search-input {
  flex: 1;
  padding: 12px 20px;
  border-radius: 999px;
  border: 2px solid var(--pink-deep);
  background: var(--white);
  font-size: 1rem;
  color: var(--text);
  outline: none;
}
.search-input:focus { border-color: var(--pink-hot); }
.search-btn {
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: var(--pink-hot);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.search-btn:hover { transform: translateY(-2px); }
.hidden { display: none !important; }

/* ---------- shelves / grids ---------- */
.card-shelf {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 4px 18px;
  scroll-snap-type: x proximity;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.set-shelf {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 4px 14px;
}
.set-chip {
  flex: 0 0 auto;
  background: var(--white);
  border: 2px solid var(--leaf);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--leaf-deep);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.set-chip.active { background: var(--leaf); color: var(--white); }

/* ---------- card tile ---------- */
.card-tile {
  flex: 0 0 150px;
  scroll-snap-align: start;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 12px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  text-align: center;
}
.card-grid .card-tile { flex-basis: auto; }
.card-tile:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 14px 30px rgba(255, 92, 138, 0.3);
}
.card-tile .rank-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  background: var(--gold);
  color: var(--text);
  font-weight: 800;
  font-size: 0.75rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.card-image-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--cream-deep);
  margin-bottom: 8px;
}
.card-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-image-frame.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
/* holo shimmer sweep */
.card-image-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.55) 45%, rgba(255,214,232,0.5) 50%, transparent 65%);
  background-size: 250% 250%;
  background-position: -100% -100%;
  transition: background-position .8s ease;
  pointer-events: none;
}
.card-tile:hover .card-image-frame::after { background-position: 100% 100%; }

.card-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin: 0 0 4px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-sub {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin: 0 0 6px;
}
.card-price {
  font-weight: 800;
  color: var(--pink-hot);
  font-size: 0.95rem;
}
.card-metric {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  display: inline-block;
  margin-top: 4px;
}
.card-metric.up { background: #e4f7d8; color: var(--leaf-deep); }
.card-metric.down { background: #fde3ec; color: var(--pink-hot); }

.shimmer-shelf .card-tile { border: 2px solid var(--pink); }

/* ---------- featured card ---------- */
.featured-wrap { display: flex; justify-content: center; }
.featured-card {
  display: flex;
  gap: 26px;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  cursor: pointer;
}
.featured-card .card-image-frame { width: 150px; flex: 0 0 150px; margin-bottom: 0; }
.featured-text h3 { margin: 0 0 6px; font-size: 1.3rem; }
.featured-text p { margin: 2px 0; color: var(--text-soft); }
.featured-price { font-size: 1.4rem; font-weight: 800; color: var(--pink-hot); }

/* ---------- loading / empty ---------- */
.loading-puff, .empty-puff {
  padding: 20px;
  color: var(--text-soft);
  font-style: italic;
}

/* ---------- coming soon ---------- */
.coming-soon-tile {
  background: var(--white);
  border: 2px dashed var(--pink-deep);
  border-radius: var(--radius-md);
  padding: 26px;
  text-align: center;
  color: var(--text-soft);
  max-width: 480px;
  margin: 0 auto;
}
.coming-soon-icon { font-size: 2rem; display: block; margin-bottom: 8px; }

/* ---------- tech corner ---------- */
.tile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 16px 22px;
  flex: 1 1 160px;
  text-align: center;
}
.stat-tile .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--pink-hot); display: block; }
.stat-tile .stat-label { font-size: 0.78rem; color: var(--text-soft); }
.tech-chart-wrap { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 18px; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; }
.bar-fill { width: 70%; background: linear-gradient(180deg, var(--pink-deep), var(--pink-hot)); border-radius: 8px 8px 0 0; min-height: 4px; }
.bar-label { font-size: 0.65rem; color: var(--text-soft); margin-top: 6px; text-align: center; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(90, 58, 74, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--cream);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 26px;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--pink);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
}
.modal-body { display: flex; gap: 22px; flex-wrap: wrap; }
.modal-image-wrap { flex: 0 0 200px; }
.modal-image {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.modal-info { flex: 1 1 260px; min-width: 220px; }
.modal-name { margin: 0 0 4px; font-size: 1.3rem; }
.modal-set { color: var(--text-soft); margin: 0 0 14px; }
.modal-prices { display: flex; gap: 12px; margin-bottom: 16px; }
.price-box {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  flex: 1;
}
.price-label { display: block; font-size: 0.7rem; color: var(--text-soft); }
.price-value { font-size: 1.1rem; font-weight: 800; color: var(--pink-hot); }
.modal-sparkline-wrap { margin-bottom: 18px; }
.collection-btn {
  background: var(--leaf);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  cursor: pointer;
}
.collection-btn:hover { background: var(--leaf-deep); }
.collection-status { font-size: 0.8rem; color: var(--text-soft); margin-top: 8px; }

/* ---------- footer ---------- */
.app-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  color: var(--text-soft);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .featured-card { flex-direction: column; text-align: center; }
}
