:root {
  --bg-0: #edf4ff;
  --bg-1: #dce9ff;
  --bg-2: #d4fff6;
  --ink-0: #03203a;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(4, 45, 76, 0.18);
  --card-0: #072742;
  --card-1: #0b3a60;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--ink-0);
  font-family: "Chakra Petch", sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(0, 213, 255, 0.22), transparent 40%),
    radial-gradient(circle at 90% 15%, rgba(255, 138, 61, 0.26), transparent 42%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 44%, var(--bg-2));
}

.grid-mask {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), transparent 20%),
    repeating-linear-gradient(90deg, rgba(5, 40, 70, 0.05) 0, rgba(5, 40, 70, 0.05) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(0deg, rgba(5, 40, 70, 0.05) 0, rgba(5, 40, 70, 0.05) 1px, transparent 1px, transparent 48px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 3vw, 48px);
  backdrop-filter: blur(8px);
  background: rgba(237, 246, 255, 0.75);
  border-bottom: 1px solid rgba(0, 38, 73, 0.13);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-kicker {
  font-family: "Orbitron", sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #2c628f;
}

.brand strong {
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  letter-spacing: 0.03em;
}

.top-link {
  text-decoration: none;
  color: var(--ink-0);
  border: 1px solid rgba(1, 53, 92, 0.25);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  transition: 0.2s ease;
}

.top-link:hover {
  border-color: rgba(1, 53, 92, 0.6);
  transform: translateY(-1px);
}

.layout {
  width: min(1280px, calc(100% - 32px));
  margin: 22px auto 60px;
  display: grid;
  gap: 14px;
}

.panel,
.hero {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(14, 41, 73, 0.08);
}

.hero {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 20px;
  padding: 20px;
  animation: reveal-up 0.7s ease both;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 12px;
}

.hero-date {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  color: #246999;
  letter-spacing: 0.13em;
  font-size: 13px;
}

#heroTitle {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1.12;
  font-family: "Orbitron", sans-serif;
}

#heroCopyright {
  margin: 0;
  color: #204667;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions a {
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 14px;
  color: #03213b;
  border: 1px solid rgba(1, 63, 103, 0.25);
  font-weight: 600;
  transition: 0.2s ease;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(224, 244, 255, 0.95));
}

.hero-actions a:hover {
  transform: translateY(-1px);
  border-color: rgba(1, 63, 103, 0.52);
}

.hero-visual {
  border-radius: 14px;
  overflow: hidden;
  min-height: 240px;
  border: 1px solid rgba(0, 208, 255, 0.46);
  background: #093151;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  animation: hero-float 14s linear infinite;
}

.controls {
  display: grid;
  gap: 10px;
  padding: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.controls label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #305777;
  font-weight: 600;
}

.controls input,
.controls select,
.controls button {
  border: 1px solid rgba(1, 53, 92, 0.2);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 14px;
  font-family: "Chakra Petch", sans-serif;
  color: var(--ink-0);
  background: rgba(255, 255, 255, 0.78);
}

.controls button {
  align-self: end;
  font-weight: 700;
  background: linear-gradient(130deg, rgba(0, 213, 255, 0.24), rgba(255, 138, 61, 0.26));
  cursor: pointer;
}

.stats {
  padding: 10px 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: #245a82;
  font-size: 14px;
}

.content-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 12px;
  align-items: start;
}

.month-panel {
  position: sticky;
  top: 78px;
  padding: 14px 10px;
  max-height: calc(100vh - 92px);
  overflow: auto;
}

.month-nav {
  display: grid;
  gap: 6px;
}

.month-btn {
  border: 1px solid rgba(1, 53, 92, 0.2);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  color: var(--ink-0);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  font-family: "Chakra Petch", sans-serif;
}

.month-btn:hover,
.month-btn.active {
  border-color: rgba(0, 160, 205, 0.9);
  background: linear-gradient(130deg, rgba(0, 213, 255, 0.18), rgba(255, 138, 61, 0.19));
}

.gallery-panel {
  min-width: 0;
}

.gallery {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  display: grid;
  border-radius: 16px;
  overflow: hidden;
  color: #dff6ff;
  background: linear-gradient(165deg, var(--card-0), var(--card-1));
  border: 1px solid rgba(0, 213, 255, 0.33);
  box-shadow: 0 12px 26px rgba(4, 23, 42, 0.27);
  transform: translateY(10px);
  opacity: 0;
  animation: card-in 0.48s ease forwards;
  animation-delay: calc(var(--index, 0) * 18ms);
  scroll-margin-top: 90px;
}

.card-image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.25s ease;
}

.card:hover .card-image-wrap img {
  transform: scale(1.08);
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.card-date {
  margin: 0;
  letter-spacing: 0.1em;
  color: #8be8ff;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
}

.card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.card-copyright {
  margin: 0;
  color: #b6ddf3;
  font-size: 13px;
  line-height: 1.35;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.btn-ghost {
  text-decoration: none;
  color: #e8fbff;
  border: 1px solid rgba(147, 231, 255, 0.45);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.btn-ghost:hover {
  border-color: rgba(255, 159, 94, 0.92);
  color: #ffd6b5;
}

.load-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

#loadMoreBtn {
  border: 1px solid rgba(1, 55, 97, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink-0);
  font-family: "Orbitron", sans-serif;
  font-size: 13px;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
}

#loadMoreBtn[hidden] {
  display: none;
}

.empty {
  padding: 28px 20px;
  text-align: center;
  color: #264f70;
  border: 1px dashed rgba(2, 63, 104, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 110;
}

.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 18, 0.94);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.viewer.open .viewer-backdrop {
  opacity: 1;
}

.viewer-stage {
  position: fixed;
  z-index: 1;
  overflow: hidden;
  background: rgba(1, 5, 10, 0.96);
  border: 1px solid rgba(144, 211, 242, 0.18);
  border-radius: 12px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.5);
  transition:
    top 0.32s ease,
    left 0.32s ease,
    width 0.32s ease,
    height 0.32s ease,
    border-radius 0.32s ease,
    opacity 0.2s ease,
    transform 0.2s ease;
  cursor: zoom-out;
}

.viewer.open .viewer-stage {
  border-radius: 18px;
}

.viewer.slide-next .viewer-stage {
  animation: viewer-fade-in 0.16s ease-out;
}

.viewer.slide-prev .viewer-stage {
  animation: viewer-fade-in 0.16s ease-out;
}

.viewer-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.viewer-high {
  opacity: 0;
  clip-path: inset(0 0 100% 0);
}

.viewer-high.reveal {
  opacity: 1;
  animation: waterfall-reveal 0.58s ease forwards;
}

.viewer-upgrade-fx {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(145, 224, 255, 0.42), rgba(145, 224, 255, 0) 65%),
    repeating-linear-gradient(
      90deg,
      rgba(186, 236, 255, 0.22) 0,
      rgba(186, 236, 255, 0.22) 2px,
      transparent 2px,
      transparent 10px
    );
  mix-blend-mode: screen;
  transform: translateY(-100%);
}

.viewer-upgrade-fx.active {
  animation: waterfall-fx 0.58s ease;
}

.viewer.quality-switch .viewer-res-btn.active {
  animation: quality-pulse 0.58s ease;
}

.viewer-toolbar {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.viewer-res-btn {
  border: 1px solid rgba(180, 232, 255, 0.42);
  color: #d8f2ff;
  background: rgba(13, 34, 53, 0.34);
  backdrop-filter: blur(5px);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-family: "Orbitron", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewer-res-btn.active {
  border-color: rgba(255, 180, 117, 0.9);
  color: #ffd5b2;
  background: rgba(52, 24, 12, 0.42);
}

.viewer-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 62px;
  border-radius: 12px;
  border: 1px solid rgba(166, 227, 255, 0.42);
  background: rgba(7, 24, 40, 0.33);
  color: #d7f2ff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.viewer-nav-btn:hover {
  border-color: rgba(255, 171, 97, 0.88);
  color: #ffd2a8;
  background: rgba(48, 24, 13, 0.42);
}

.viewer-nav-btn.prev {
  left: 16px;
}

.viewer-nav-btn.next {
  right: 16px;
}

.viewer-nav-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.viewer-meta {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(920px, calc(100% - 120px));
  border: 1px solid rgba(165, 229, 255, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(5px);
  background: rgba(8, 26, 43, 0.4);
  color: #e7f7ff;
}

.viewer-meta-date {
  margin: 0 0 4px;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: #9edffb;
}

.viewer-meta-title {
  margin: 0 0 4px;
  font-size: 17px;
  line-height: 1.3;
}

.viewer-meta-copyright {
  margin: 0;
  font-size: 13px;
  color: #bdd9e8;
}

@media (max-width: 1080px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .month-panel {
    position: static;
    max-height: none;
  }

  .month-nav {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .layout {
    width: min(1280px, calc(100% - 20px));
  }

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

  .hero {
    padding: 14px;
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-float {
  0% {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  50% {
    transform: scale(1.04) translate3d(-4px, -4px, 0);
  }
  100% {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes waterfall-reveal {
  from {
    clip-path: inset(0 0 100% 0);
    opacity: 1;
  }
  to {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

@keyframes waterfall-fx {
  from {
    transform: translateY(-100%);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes viewer-swipe-next {
  0% {
    transform: translateX(34px);
    opacity: 1;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes viewer-swipe-prev {
  0% {
    transform: translateX(-34px);
    opacity: 1;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes viewer-fade-in {
  from {
    opacity: 0.96;
  }
  to {
    opacity: 1;
  }
}

@keyframes quality-pulse {
  0% {
    box-shadow: 0 0 0 rgba(255, 187, 127, 0);
  }
  30% {
    box-shadow: 0 0 22px rgba(255, 187, 127, 0.45);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 187, 127, 0);
  }
}
