:root {
  --bg: #fdf3f5;
  --bg-2: #f9dfe6;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --ink: #3b2a30;
  --ink-soft: #7a6168;
  --pink: #e58aa3;
  --pink-deep: #c2526f;
  --pink-pale: #fbe3ea;
  --line: rgba(194, 82, 111, 0.18);
  --green: #4f8a5b;
  --shadow: 0 10px 30px -12px rgba(160, 60, 90, 0.35);
  --radius: 18px;
  --display: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  --halo: rgba(253, 243, 245, 0.9);
  --body: 'Zen Maru Gothic', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Yozakura: cherry blossoms at night */
    --bg: #1b1420;
    --bg-2: #2a1a2c;
    --surface: rgba(48, 34, 50, 0.86);
    --surface-solid: #2c1f2f;
    --ink: #f6e9ee;
    --ink-soft: #c5a9b4;
    --pink: #f0a3b9;
    --pink-deep: #f5b7c9;
    --pink-pale: #4a2f40;
    --line: rgba(240, 163, 185, 0.22);
    --green: #8fcb9b;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
    --halo: rgba(27, 20, 32, 0.9);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 60vh) fixed var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

#sakura {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.scene img {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: min(80vh, 62vw); min-height: 360px;
  object-fit: cover; object-position: center bottom;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 16%);
}

.hero, main, footer { position: relative; z-index: 1; }
.hero-intro, .section-title, footer p { text-shadow: 0 0 6px var(--halo), 0 0 14px var(--halo), 0 0 22px var(--halo); }

main, .hero { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.25; margin: 0; }

a { color: var(--pink-deep); }

/* Hero */
.hero { text-align: center; padding-top: 72px; padding-bottom: 40px; }
.hero-jp {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: 0.6em;
  margin: 0 -0.6em 8px 0;
  color: var(--pink-deep);
}
.hero h1 { font-size: clamp(2.6rem, 9vw, 5rem); letter-spacing: 0.02em; }
.hero-intro { max-width: 620px; margin: 20px auto 0; color: var(--ink-soft); font-size: 1.08rem; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 28px 0 0; }
.hero-meta span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 500;
}

.section-title {
  font-size: 1.7rem;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters:empty { display: none; }
.chip {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
}
.chip:hover { border-color: var(--pink); }
.chip.is-active { background: var(--pink-deep); border-color: var(--pink-deep); color: var(--surface-solid); }

/* Grid and cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--ink-soft); padding: 48px 0; }

.card {
  background: var(--surface);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  scroll-margin-top: 16px;
}
.card:hover { transform: translateY(-4px); }
.card[hidden] { display: none; }

.card-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--pink-pale);
  cursor: zoom-in;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-nophoto { font-size: 3rem; display: grid; place-items: center; height: 100%; }
.card-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(30, 15, 22, 0.7); color: #fff;
  font: 500 0.75rem var(--body);
  padding: 2px 10px; border-radius: 999px;
}
/* diagonal corner banner for reserved / sold */
.ribbon {
  position: absolute; left: -58px; top: 26px; width: 210px;
  transform: rotate(-45deg);
  text-align: center;
  font: 700 0.85rem var(--body);
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 7px 0; color: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.ribbon-reserved { background: #b7791f; }
.ribbon-sold { background: #5b4a50; }
.status-sold .card-media img { filter: grayscale(1); opacity: 0.6; }
.status-sold .price { text-decoration: line-through; color: var(--ink-soft); }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-category {
  margin: 0 0 2px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--pink-deep);
}
.card h3 { font-size: 1.2rem; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { color: var(--pink-deep); }
.price { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin: 6px 0 0; }
.card-history { margin: 0; font-size: 0.82rem; color: var(--ink-soft); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 6px; }
.facts div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--pink-pale); min-width: 0; }
.facts dt { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-family: var(--display); font-weight: 700; font-size: 1.15rem; overflow-wrap: anywhere; }
.facts dd.is-unknown { font-family: var(--body); font-weight: 400; font-size: 0.9rem; color: var(--ink-soft); }
.facts .facts-sell { background: var(--pink-deep); border-color: var(--pink-deep); }
.facts .facts-sell dt, .facts .facts-sell dd { color: var(--surface-solid); }
[hidden] { display: none !important; }
.avail { margin: 4px 0 0; font-size: 0.92rem; font-weight: 500; color: var(--ink-soft); }
.avail::before { content: '◷ '; }
.avail-now { color: var(--green); }
.avail-now::before { content: '● '; }
.card-extras { margin: 4px 0 0; font-size: 0.85rem; color: var(--ink-soft); }
.card-extras::before { content: '📎 '; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 0.92rem var(--body);
  color: var(--surface-solid);
  background: var(--pink-deep);
  border: 1px solid var(--pink-deep);
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--pink-deep); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--pink-deep); filter: none; }
.btn-disabled { background: transparent; color: var(--ink-soft); border-color: var(--line); cursor: default; }
.btn-disabled:hover { filter: none; }

:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* Pickup */
.pickup { margin-top: 56px; }
.pickup-inner {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px;
  background: var(--surface);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.pickup-text p:first-child { margin-top: 0; }
.map { min-height: 340px; border-radius: 12px; overflow: hidden; z-index: 0; background: var(--pink-pale); }

/* What's new */
.hero-meta a { color: inherit; text-decoration: none; }
.hero-meta a:hover { text-decoration: underline; }
.whats-new { margin-top: 56px; scroll-margin-top: 16px; }
.whats-new-inner {
  background: var(--surface);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.whats-new-updated { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.9rem; font-weight: 500; }
.changelog { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.changelog > li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 16px; }
.changelog time { font-weight: 700; white-space: nowrap; }
.changelog-body > :first-child { margin-top: 0; }
.changelog-body > :last-child { margin-bottom: 0; }
.changelog-body ul { margin: 0; padding-left: 1.2em; }
@media (max-width: 560px) { .changelog > li { grid-template-columns: 1fr; gap: 4px; } }

footer { text-align: center; padding: 48px 16px 56px; color: var(--ink-soft); font-family: var(--display); }

/* Item dialog */
dialog {
  width: min(1040px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  overflow: auto;
}
dialog::backdrop { background: rgba(40, 18, 28, 0.6); backdrop-filter: blur(4px); }
.dlg-close {
  position: sticky; top: 10px; float: right; margin: 10px 10px -46px 0; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-solid); color: var(--ink);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.dlg-layout { display: grid; grid-template-columns: 1.25fr 1fr; }
.gallery { padding: 16px; min-width: 0; }
.gallery.is-empty { display: none; }
.gallery-stage {
  position: relative; aspect-ratio: 4 / 3;
  background: var(--pink-pale); border-radius: 12px; overflow: hidden;
  touch-action: pan-y;
}
.gallery-stage img, .gallery-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-stage [hidden] { display: none; }
.gallery-stage.is-video { background: #000; }
.gallery-stage.is-video .gallery-counter { top: 10px; bottom: auto; }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.85); color: #3b2a30;
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }
.gallery-counter {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(30, 15, 22, 0.7); color: #fff;
  font-size: 0.75rem; font-weight: 500; padding: 2px 10px; border-radius: 999px;
}
.gallery.is-single .gallery-nav, .gallery.is-single .gallery-counter, .gallery.is-single .gallery-thumbs { display: none; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button {
  flex: 0 0 72px; height: 54px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; background: var(--pink-pale); cursor: pointer; opacity: 0.65;
}
.gallery-thumbs button[aria-current='true'] { border-color: var(--pink-deep); opacity: 1; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumbs button.is-video { position: relative; }
.gallery-thumbs button.is-video::after {
  content: '▶'; position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 1.1rem; background: rgba(30, 15, 22, 0.35);
}

.dlg-info { padding: 24px 24px 24px 8px; min-width: 0; }
.gallery.is-empty + .dlg-info { grid-column: 1 / -1; padding-left: 24px; }
.dlg-info h2 { font-size: 1.6rem; padding-right: 40px; }
.dlg-desc { margin-top: 16px; overflow-wrap: anywhere; }
.dlg-desc p { margin: 0 0 12px; }
.dlg-desc ul, .dlg-desc ol { margin: 0 0 12px; padding-left: 20px; }
.dlg-desc img { max-width: 100%; }

.attachments { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.attachments-title { font: 700 0.75rem var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink-deep); margin: 20px 0 0; }
.attachments a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: var(--ink); background: var(--pink-pale);
}
.attachments a:hover { border-color: var(--pink-deep); }
.att-type {
  flex: none; min-width: 44px; text-align: center;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 4px 6px; border-radius: 6px; background: var(--pink-deep); color: var(--surface-solid);
}
.att-label { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.att-size { flex: none; font-size: 0.8rem; color: var(--ink-soft); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

@media (max-width: 760px) {
  .hero { padding-top: 48px; }
  .pickup-inner { grid-template-columns: 1fr; padding: 16px; }
  .map { min-height: 280px; }
  .dlg-layout { grid-template-columns: 1fr; }
  .gallery { padding: 12px 12px 0; }
  .dlg-info { padding: 16px; }
  .dlg-info h2 { padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .card-media img { transition: none; }
  .card:hover, .card:hover .card-media img { transform: none; }
}
