:root {
  --ink: #102433;
  --ink-soft: #3a5566;
  --fog: #e8f2f4;
  --mist: #d3e6ea;
  --paper: #f4fafb;
  --glow: #1fb896;
  --glow-deep: #0e7a64;
  --amber: #e2a34a;
  --line: rgba(16, 36, 51, 0.1);
  --shadow: 0 18px 40px rgba(16, 36, 51, 0.14);
  --radius: 18px;
  --font-display: "ZCOOL XiaoWei", "Noto Sans SC", serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--paper);
  line-height: 1.5;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(31, 184, 150, 0.22), transparent 60%),
    radial-gradient(700px 420px at 92% 8%, rgba(226, 163, 74, 0.18), transparent 55%),
    linear-gradient(180deg, #dcecf0 0%, #f4fafb 42%, #eef6f4 100%);
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.04) translateY(-12px); }
}

.site-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 20px 12px;
  text-align: center;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-glyph {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background:
    linear-gradient(145deg, #16384a, #0f2a3a 55%, #1fb896);
  box-shadow: 0 10px 24px rgba(16, 36, 51, 0.22);
  position: relative;
}
.brand-glyph::after {
  content: "";
  position: absolute;
  inset: 10px 12px;
  border-radius: 7px;
  background: linear-gradient(180deg, #7ff0d0, #1fb896);
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.brand-text em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.tagline {
  margin: 18px auto 0;
  max-width: 28em;
  color: var(--ink-soft);
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 1200px;
  margin: 22px auto 8px;
  padding: 0 16px;
}

.filter {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.filter:hover {
  color: var(--ink);
  border-color: rgba(31, 184, 150, 0.45);
  transform: translateY(-1px);
}
.filter.is-active {
  background: var(--ink);
  color: #f4fafb;
  border-color: var(--ink);
}

.gallery-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 14px 64px;
}

.gallery {
  columns: 2;
  column-gap: 12px;
}
@media (min-width: 720px) {
  .gallery { columns: 3; column-gap: 16px; }
}
@media (min-width: 1100px) {
  .gallery { columns: 4; column-gap: 18px; }
}

.tile {
  break-inside: avoid;
  margin: 0 0 12px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #c9dde3;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
@media (min-width: 720px) {
  .tile { margin-bottom: 16px; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.tile-hit {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
  aspect-ratio: var(--ratio, 0.56);
}
.tile-hit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}
.tile:hover img { transform: scale(1.04); }

.tile-shade {
  position: absolute;
  inset: auto 0 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(10, 24, 34, 0.72));
  pointer-events: none;
}
.tile-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #f4fafb;
  font-size: 0.72rem;
  pointer-events: none;
}
.badge {
  background: rgba(31, 184, 150, 0.9);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}
.dims { opacity: 0.9; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 64px 16px;
}

.site-footer {
  text-align: center;
  padding: 0 16px 40px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}
.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 26, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lb-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(92vh, 960px);
  display: flex;
  flex-direction: column;
  background: #0f2430;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: pop 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.lb-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lb-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px 18px 8px;
  background:
    radial-gradient(circle at 50% 20%, rgba(31,184,150,0.18), transparent 55%),
    #0f2430;
}
.lb-stage img {
  max-width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  border-radius: 12px;
}
.lb-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 18px;
  color: #e8f2f4;
}
.lb-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lb-info strong {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}
.lb-info span {
  font-size: 0.82rem;
  opacity: 0.75;
}
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 1.1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--glow), var(--glow-deep));
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(31, 184, 150, 0.35);
}
.btn-download:hover { filter: brightness(1.06); }
.btn-download.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.save-sheet[hidden] { display: none; }
.save-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  padding: 0;
  background: rgba(8, 18, 26, 0.78);
  backdrop-filter: blur(8px);
}
.save-panel {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  background: #102433;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  color: #e8f2f4;
  position: relative;
  animation: sheet-up 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.save-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.save-tip {
  margin: 4px 44px 12px 4px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
}
.save-subtip {
  margin: 12px 4px 0;
  font-size: 0.8rem;
  opacity: 0.7;
  text-align: center;
}
.save-stage {
  display: grid;
  place-items: center;
  background: #0a1820;
  border-radius: 14px;
  padding: 10px;
  min-height: 240px;
  max-height: 62vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.save-stage img {
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 8px;
  /* Help iOS treat it as a savable image */
  -webkit-touch-callout: default;
  pointer-events: auto;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .atmosphere, .tile, .lb-panel, .lb-backdrop, .tile-hit img, .save-panel {
    animation: none !important;
    transition: none !important;
  }
}
