/* ==========================================================================
   Public collection page
   ========================================================================== */

.home { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; padding: 28px 0 20px; }
.small { font-size: 0.85rem; }

/* ---- hero ------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: center; min-height: 440px; }
.hero-value {
  font-size: clamp(3rem, 8.5vw, 6rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  margin: 4px 0 12px;
  background: linear-gradient(120deg, var(--taro-deep) 10%, var(--taro) 55%, #d18fd8 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--taro) 30%, transparent));
  width: fit-content; max-width: 100%;
}
.hero-value.flash-up { animation: value-flash-up 1.6s ease; }
.hero-value.flash-down { animation: value-flash-down 1.6s ease; }
@keyframes value-flash-up { 30% { filter: drop-shadow(0 0 22px color-mix(in srgb, var(--up) 70%, transparent)); transform: scale(1.02); } }
@keyframes value-flash-down { 30% { filter: drop-shadow(0 0 22px color-mix(in srgb, var(--down) 70%, transparent)); transform: scale(0.99); } }
.tagline { font-size: 1.12rem; color: var(--ink-soft); max-width: 46ch; margin: 0 0 18px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.hero-chips .chip { font-size: 0.88rem; padding: 5px 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; margin: 0; max-width: 620px; }
.stats > div {
  padding: 12px 16px; border-radius: 18px;
  background: var(--surface-glass); border: 1px solid var(--line);
}
.stats dt { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.stats dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 600; }
.stats dd.up { color: var(--up); }
.stats dd.down { color: var(--down); }

.hero-cup { display: grid; justify-items: center; position: relative; padding-top: 64px; }
.cup-stage { width: min(290px, 70vw); color: var(--ink); }
.cup-stage .cup { width: 100%; height: auto; display: block; overflow: visible; }
.cup-caption { margin: 8px 0 0; text-align: center; font-weight: 700; color: var(--ink-soft); font-size: 0.92rem; }
.cup-caption strong { color: var(--taro-deep); }

.cup .cup-wave { animation: wave 3.2s linear infinite; }
@keyframes wave { to { transform: translateX(100px); } }
.cup .cup-liquid { transition: transform 1.4s cubic-bezier(.3, .8, .3, 1); }
.cup-stage .cup-ditto { cursor: pointer; transform-box: fill-box; transform-origin: 50% 100%; transition: transform .2s; outline: none; }
.cup-stage .cup-ditto:hover { transform: scale(1.06) rotate(-3deg); }
.cup-stage .cup-ditto:focus-visible { transform: scale(1.06); filter: drop-shadow(0 0 6px var(--taro)); }
.cup.is-full .cup-straw { animation: straw-wiggle 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes straw-wiggle { 50% { transform: rotate(4deg) translateY(-4px); } }

.ditto-speech {
  position: absolute; top: -6px; left: 50%; transform: translate(-50%, 0) scale(.8); z-index: 2;
  margin: 0; padding: 10px 16px; border-radius: 18px; white-space: nowrap;
  background: var(--ink); color: var(--bg); font-weight: 800; font-size: 0.9rem;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s cubic-bezier(.2, .9, .3, 1.4);
}
.ditto-speech::after { content: ""; position: absolute; left: 50%; bottom: -7px; border: 8px solid transparent; border-top-color: var(--ink); border-bottom: 0; transform: translateX(-50%); }
.ditto-speech.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.ditto.is-transformed .ditto-skin { opacity: 1; transition: opacity .3s .15s; }
.ditto.is-transformed .ditto-body { fill: #fff; }
/* Ditto always keeps its derpy face, no matter what it copies */
.ditto.is-transformed .ditto-eyes ellipse { stroke: #fff; stroke-width: 2; paint-order: stroke; transform: scale(1.25); transform-box: fill-box; transform-origin: center; }
.ditto.is-transformed .ditto-mouth { stroke-width: 3.4; filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff); }
.ditto.is-squishing .ditto-body-wrap { animation: ditto-squish .45s ease-in-out; }
@keyframes ditto-squish {
  30% { transform: scale(1.25, 0.7); }
  60% { transform: scale(0.85, 1.2); }
  100% { transform: scale(1, 1); }
}

/* ---- chart -------------------------------------------------------------------- */
.chart-panel { padding: 22px 24px 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { font-size: 1.35rem; }
.panel-head p { margin: 2px 0 0; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  font-weight: 800; font-size: 0.82rem; color: var(--ink-soft);
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--taro-deep); box-shadow: var(--shadow-sm); }

.chart { position: relative; min-height: 220px; min-width: 0; }
.chart-svg { display: block; overflow: visible; touch-action: pan-y; max-width: 100%; }
.chart-line { fill: none; stroke: var(--taro-deep); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-stop-top { stop-color: var(--taro); stop-opacity: 0.42; }
.chart-stop-bottom { stop-color: var(--taro); stop-opacity: 0; }
.chart-grid { stroke: var(--line); stroke-dasharray: 3 6; }
.chart-label { fill: var(--ink-faint); font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.chart-cursor { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0; }
.chart-dot { fill: var(--surface); stroke: var(--taro-deep); stroke-width: 3; opacity: 0; }
.chart-svg.is-hovering .chart-cursor, .chart-svg.is-hovering .chart-dot { opacity: 1; }
.chart-tip[hidden] { display: none; }
.chart-end { fill: var(--taro-deep); }
.chart-tip {
  position: absolute; pointer-events: none; display: grid; gap: 1px; text-align: center;
  padding: 7px 12px; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-size: 0.8rem; white-space: nowrap; box-shadow: var(--shadow);
}
.chart-tip strong { font-family: var(--font-display); font-size: 1rem; }
.chart-empty {
  height: 200px; display: grid; place-items: center; text-align: center; padding: 20px;
  border: 2px dashed var(--line-strong); border-radius: 18px; color: var(--ink-soft); font-weight: 600;
}

/* ---- sections ------------------------------------------------------------------ */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
.section-head p { margin: 0; }
.count { font-size: 0.9rem; font-weight: 700; color: var(--ink-faint); font-family: var(--font-body); margin-left: 6px; }

.showcase-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 26px; }
.top-card { position: relative; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: inherit; }
.top-card:focus-visible { outline: 3px solid var(--taro); outline-offset: 6px; border-radius: 12px; }
.rank {
  position: absolute; z-index: 5; top: -12px; left: -10px;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 1.05rem;
  background: radial-gradient(circle at 35% 30%, #8f6f76 0 12%, #3d2a31 50%, #1e1418);
  box-shadow: 0 6px 12px -4px rgba(0, 0, 0, .5);
}
.top-card:first-child .rank { background: radial-gradient(circle at 35% 30%, #fff3c4 0 12%, #e8b04e 50%, #a8741c); color: #3a2400; }
.top-card .meta { margin-top: 12px; }
.top-card .meta h3 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-card .meta strong { font-family: var(--font-display); font-size: 1.25rem; color: var(--taro-deep); }

.movers { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; }
.mover {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: 18px;
  background: var(--surface-glass); border: 1px solid var(--line); cursor: pointer; text-align: left; color: inherit;
  transition: transform .15s, border-color .15s;
}
.mover:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.mover img { width: 48px; border-radius: 5px; box-shadow: var(--shadow-sm); }
.mover .grow { flex: 1; min-width: 0; }
.mover .grow strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mover .grow span { font-size: 0.82rem; color: var(--ink-soft); }
.mover .right { text-align: right; display: grid; gap: 2px; justify-items: end; }

/* ---- binder grid ---------------------------------------------------------------- */
.binder-head { align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .select { width: auto; min-width: 150px; }
.search-box { position: relative; display: block; }
.search-box .input { padding-left: 40px; width: 240px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-faint); pointer-events: none; }
.search-icon svg { width: 100%; height: 100%; }
.fav-toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--honey) 22%, var(--surface)); border-color: var(--honey); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 30px 22px; }
.tile { position: relative; cursor: pointer; outline: none; border-radius: 12px; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.grid:not(.no-anim) .tile { animation: rise .6s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(min(var(--i), 24) * 35ms); }
.tile:hover { transform: translateY(-5px); }
.tile:focus-visible .holo { outline: 3px solid var(--taro); outline-offset: 4px; }
.tile-art { position: relative; }
.tile-badges { position: absolute; z-index: 5; bottom: 8px; left: 8px; right: 8px; display: flex; gap: 6px; pointer-events: none; }
.tile-badges .qty, .tile-badges .fav, .tile-badges .ditto-badge {
  padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 800; box-shadow: 0 3px 8px -2px rgba(0, 0, 0, .35);
}
.tile-badges .qty { background: var(--ink); color: var(--bg); }
.tile-badges .fav { background: var(--honey); color: #3a2400; margin-left: auto; }
.tile-badges .ditto-badge { background: linear-gradient(135deg, #e7c3f5, #b98ad3); color: #3b1f52; }
.tile-meta { padding: 12px 2px 0; }
.tile-meta h3 { font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-set { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0 6px; }
.tile-price { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile-price strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; border-radius: 8px; padding: 0 4px; margin-left: -4px; }
.tile.flash-up .tile-price strong { animation: price-up 2.2s ease; }
.tile.flash-down .tile-price strong { animation: price-down 2.2s ease; }
@keyframes price-up { 15% { background: var(--up-bg); color: var(--up); } 70% { background: var(--up-bg); color: var(--up); } }
@keyframes price-down { 15% { background: var(--down-bg); color: var(--down); } 70% { background: var(--down-bg); color: var(--down); } }

.card-back { width: 100%; height: 100%; display: block; }

.empty { text-align: center; padding: 40px 20px; border: 2px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-soft); }
.empty .ditto { width: 130px; margin: 0 auto 10px; display: block; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---- reveal-on-load (held back while the intro plays) ------------------------------ */
.reveal { animation: rise .8s cubic-bezier(.2, .8, .2, 1) both; }
.reveal:nth-child(2) { animation-delay: .08s; }
.reveal:nth-child(3) { animation-delay: .16s; }
.reveal:nth-child(4) { animation-delay: .24s; }
.reveal:nth-child(5) { animation-delay: .32s; }
html.play-intro .reveal, html.play-intro .grid .tile { animation-name: none; opacity: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* ---- card details sheet ------------------------------------------------------------ */
.card-sheet { padding: 34px; }
.card-sheet-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 36px; align-items: start; }
.card-sheet-art { display: grid; gap: 16px; justify-items: center; position: sticky; top: 0; }
.card-sheet-art .holo { width: min(360px, 100%); }
.sheet-nav { display: flex; gap: 10px; }
.card-sheet-info h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-sheet-info .fav-star { color: var(--honey); width: 26px; height: 26px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.price-cell { padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.price-cell span { display: block; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); }
.price-cell strong { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; }
.price-cell.hero-cell { background: linear-gradient(135deg, var(--taro-light), var(--surface-2)); }
.price-cell.hero-cell strong { font-size: 1.9rem; color: var(--taro-deep); }
.price-cell .chip { margin-top: 4px; }
.market-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 16px; }
.market-row b { color: var(--ink); }
.mini-chart { margin: 4px 0 18px; }
.mini-chart .chart { min-height: 150px; }
.mini-chart .chart-empty { height: 130px; font-size: 0.9rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0 0 18px; font-size: 0.92rem; }
.facts dt { color: var(--ink-faint); font-weight: 700; }
.facts dd { margin: 0; }
.note { margin: 0 0 18px; padding: 12px 16px; border-left: 4px solid var(--taro); background: var(--surface-2); border-radius: 0 14px 14px 0; font-style: italic; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sheet-actions svg { width: 16px; height: 16px; }

/* ---- intro ----------------------------------------------------------------------- */
.intro {
  display: none; position: fixed; inset: 0; z-index: 200;
  place-items: center; align-content: center; gap: 14px;
  background:
    radial-gradient(circle at 50% 42%, var(--surface) 0%, var(--bg-2) 45%, var(--bg) 100%);
  cursor: pointer;
}
html.play-intro .intro { display: grid; }
html.play-intro body { overflow: hidden; }
.intro.is-leaving { animation: intro-out .7s cubic-bezier(.6, 0, .4, 1) forwards; }
@keyframes intro-out { to { opacity: 0; transform: scale(1.06); visibility: hidden; } }
.intro-stage { position: relative; width: 240px; height: 380px; }
.intro-cup { position: absolute; inset: 20px 0 0; color: var(--ink); animation: pop-in .7s cubic-bezier(.2, .9, .3, 1.4) both; }
.intro-cup .cup { width: 100%; height: auto; overflow: visible; }
@keyframes pop-in { from { opacity: 0; transform: scale(.4) translateY(40px); } }
.intro .pearl { animation: pearl-drop .8s cubic-bezier(.3, 1.35, .5, 1) both; animation-delay: calc(350ms + var(--i) * 45ms); }
@keyframes pearl-drop { from { transform: translateY(-340px); opacity: 0; } 30% { opacity: 1; } }
.intro .cup-liquid { transition: transform 1.3s cubic-bezier(.3, .8, .3, 1); }
.intro .cup-ditto { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(0); }
.intro.ditto-in .cup-ditto { animation: ditto-pop .7s cubic-bezier(.2, .9, .3, 1.6) forwards; }
.intro.ditto-squish .cup-ditto { animation: ditto-charge .6s ease-in forwards; }
@keyframes ditto-pop { from { transform: scale(0) translateY(30px); } to { transform: scale(1); } }
@keyframes ditto-charge { 0% { transform: scale(1); } 40% { transform: scale(1.3, .6); } 100% { transform: scale(.2, 2.2) translateY(-20px); opacity: 0; } }
.intro.card-in .intro-cup { animation: cup-out .5s ease-in forwards; }
@keyframes cup-out { to { opacity: 0; transform: translateY(60px) scale(.8); } }
.intro-burst {
  position: absolute; left: 50%; top: 32%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 20%, color-mix(in srgb, var(--taro) 70%, #fff) 40%, transparent 70%);
  opacity: 0; transform: scale(0); pointer-events: none;
}
.intro.card-in .intro-burst { animation: burst .8s ease-out forwards; }
@keyframes burst { 0% { opacity: 1; transform: scale(0); } 100% { opacity: 0; transform: scale(9); } }
.intro-card { position: absolute; left: 50%; top: 50%; width: 200px; aspect-ratio: 245 / 342; transform: translate(-50%, -50%) scale(0); opacity: 0; perspective: 1200px; }
.intro.card-in .intro-card { animation: card-in .8s cubic-bezier(.2, .9, .3, 1.3) forwards; }
@keyframes card-in { from { transform: translate(-50%, -30%) scale(.1) rotate(-20deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.intro-flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, .7, .3, 1); }
.intro.card-flip .intro-flip { transform: rotateY(180deg); }
.intro-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 4.6% / 3.3%; overflow: hidden; box-shadow: var(--shadow-lg); }
.intro-face img { width: 100%; height: 100%; object-fit: cover; }
.intro-front { transform: rotateY(180deg); }
.intro-text { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; color: var(--taro-deep); min-height: 1.6em; text-align: center; padding: 0 16px; }
.intro-text.pop { animation: text-pop .45s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes text-pop { from { transform: scale(.85); opacity: 0; } }
.intro-skip { position: fixed; bottom: 24px; right: 24px; }

/* ---- responsive --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; text-align: center; gap: 12px; }
  .hero-copy { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; min-width: 0; }
  .hero-chips { justify-content: center; }
  .stats { width: 100%; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .hero-cup { order: -1; margin-top: 30px; }
  .cup-stage { width: min(210px, 56vw); }
  .card-sheet-grid { grid-template-columns: minmax(0, 1fr); }
  .card-sheet-art { position: static; }
  .card-sheet-art .holo { width: min(300px, 80%); }
}
@media (max-width: 640px) {
  .home { gap: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 14px; }
  .toolbar { width: 100%; }
  .search-box { flex: 1 1 100%; }
  .search-box .input { width: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .fav-toggle { flex: none; }
  .card-sheet { padding: 22px 18px; }
  .chart-panel { padding: 18px 14px 12px; }
  .showcase-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro-skip { right: 50%; transform: translateX(50%); }
}
