:root {
  color-scheme: dark;
  background: #00162c;
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { background: #00162c; }

.screen-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #00162c;
}

.screen-stage {
  position: relative;
  width: min(100vw, calc(100vh * 3840 / 2194));
  height: min(100vh, calc(100vw * 2194 / 3840));
  overflow: hidden;
  background: #00162c;
}

.screen-canvas {
  position: absolute;
  inset: 0 auto auto 0;
  width: 3840px;
  height: 2194px;
  transform: scale(var(--design-scale, 1));
  transform-origin: left top;
  overflow: hidden;
  perspective: 2400px;
}

.screen-background {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.text-layer {
  position: absolute;
  display: flex;
  align-items: flex-start;
  white-space: pre;
  overflow: hidden;
  line-height: 1;
  text-shadow: 0 0 8px currentColor, 0 0 18px rgb(0 197 255 / 30%);
  pointer-events: none;
}

.text-layer[data-align="center"] { justify-content: center; }
.text-layer[data-align="right"] { justify-content: flex-end; }

.screen-canvas::after {
  content: "";
  position: absolute;
  inset: 5% 1.5% 31%;
  background: linear-gradient(105deg, transparent 42%, rgb(76 209 255 / 6%) 49%, transparent 56%);
  transform: translateX(-130%);
  animation: soft-scan 12s ease-in-out infinite;
  pointer-events: none;
  z-index: 8;
}

.interactive-region {
  --rotate-x: 0deg;
  --rotate-y: 0deg;
  --shine-x: 50%;
  --shine-y: 50%;
  position: absolute;
  z-index: 4;
  cursor: pointer;
  perspective: 1400px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.screen-canvas.assets-loading .interactive-region { pointer-events: none; }
.screen-canvas.assets-loading .region-face { opacity: 0; }

.region-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: .035;
  border: 2px solid rgb(67 221 255 / 0%);
  border-radius: 10px;
  background-repeat: no-repeat;
  transform: translateZ(0);
  transform-origin: center;
  transform-style: preserve-3d;
  transition: opacity 180ms ease, transform 240ms cubic-bezier(.2,.75,.2,1),
    filter 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
  animation: module-depth 6.5s ease-in-out var(--module-delay, 0s) infinite;
  will-change: transform, opacity;
}

.region-face::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgb(120 235 255 / 20%), transparent 34%);
  transition: opacity 220ms ease;
  pointer-events: none;
}

.interactive-region:hover .region-face,
.interactive-region:focus-visible .region-face,
.interactive-region.is-active .region-face {
  opacity: 1;
  border-color: rgb(76 226 255 / 72%);
  filter: brightness(1.09) saturate(1.08);
  transform: translate3d(0, -8px, 38px) scale(1.012) rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
  box-shadow: 0 30px 65px rgb(0 3 18 / 68%), 0 0 38px rgb(0 205 255 / 34%), inset 0 0 28px rgb(49 214 255 / 12%);
  animation-play-state: paused;
}

.interactive-region:hover .region-face::after,
.interactive-region:focus-visible .region-face::after,
.interactive-region.is-active .region-face::after { opacity: 1; }

.interactive-region.is-active .region-face {
  border-color: #7cf1ff;
  box-shadow: 0 34px 78px rgb(0 3 18 / 76%), 0 0 52px rgb(0 213 255 / 45%), inset 0 0 36px rgb(49 214 255 / 16%);
}

.region-text-copy { z-index: 3; }

.interaction-ripple {
  position: absolute;
  z-index: 9;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid #8cf7ff;
  border-radius: 50%;
  box-shadow: 0 0 22px #20dcff;
  pointer-events: none;
  animation: interaction-ripple 720ms ease-out forwards;
}

.interaction-status {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(760px, calc(100vw - 40px));
  padding: 10px 18px;
  border: 1px solid rgb(75 224 255 / 58%);
  border-radius: 4px;
  color: #cef7ff;
  background: rgb(0 20 45 / 88%);
  box-shadow: 0 0 28px rgb(0 193 255 / 24%);
  font-size: 14px;
  pointer-events: none;
}

.interaction-status[hidden] { display: none; }
.interaction-status strong { color: #fff; font-size: 16px; }
.interaction-status span { color: #81dff3; }
.interaction-status.is-active { border-color: #74efff; }

.back-button {
  position: fixed;
  z-index: 5;
  top: 16px;
  right: 18px;
  border: 1px solid rgb(71 215 255 / 45%);
  border-radius: 4px;
  padding: 7px 13px;
  color: #bdeeff;
  background: rgb(0 22 44 / 72%);
  font: 14px/1 "Source Han Sans SC", sans-serif;
  opacity: 0.22;
  cursor: pointer;
  transition: opacity 200ms ease, box-shadow 200ms ease;
}

.back-button:hover, .back-button:focus-visible {
  opacity: 1;
  box-shadow: 0 0 16px rgb(0 201 255 / 35%);
}

.gallery {
  min-height: 100vh;
  display: grid;
  place-content: center;
  padding: clamp(18px, 2vw, 42px);
  overflow: auto;
  background: radial-gradient(circle at 50% 0%, rgb(0 99 170 / 24%), transparent 46%), #001225;
}

.gallery-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  max-width: 1800px;
  margin: 0 auto clamp(16px, 2vh, 30px);
  color: #e5f8ff;
}

.gallery-header h1 { margin: 0; font-size: clamp(24px, 2vw, 42px); }
.gallery-header p { margin: 0 0 5px; color: #72cce9; font-size: clamp(12px, 1vw, 18px); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.5vw, 26px);
  width: min(1800px, calc(100vw - 36px));
  max-width: 1800px;
  margin: auto;
}

.gallery-card {
  position: relative;
  display: block;
  aspect-ratio: 3840 / 2194;
  overflow: hidden;
  border: 1px solid rgb(29 196 255 / 48%);
  clip-path: polygon(2% 0, 98% 0, 100% 5%, 100% 95%, 98% 100%, 2% 100%, 0 95%, 0 5%);
  background: #00152b;
  box-shadow: 0 0 22px rgb(0 127 255 / 12%);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.gallery-card:hover, .gallery-card:focus-visible {
  transform: translateY(-3px);
  border-color: #4ee8ff;
  box-shadow: 0 0 28px rgb(0 196 255 / 30%);
  outline: none;
}

.gallery-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-stage { width: 100%; height: 100%; }
.gallery-stage .screen-canvas::after { display: none; }
.gallery-card span {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 5px 11px;
  color: #dffaff;
  background: rgb(0 15 34 / 78%);
  border-left: 3px solid #24dfff;
  font-size: clamp(12px, 1vw, 18px);
}

.loading-state { display: grid; min-height: 100vh; place-items: center; color: #79ddff; }

@keyframes soft-scan {
  0%, 18% { transform: translateX(-130%); opacity: 0; }
  34%, 58% { opacity: 1; }
  76%, 100% { transform: translateX(130%); opacity: 0; }
}

@keyframes interaction-ripple {
  from { opacity: 1; transform: scale(.5); }
  to { opacity: 0; transform: scale(5); }
}

@keyframes module-depth {
  0%, 100% { opacity: .025; filter: brightness(1); }
  50% { opacity: .075; filter: brightness(1.06); }
}

@media (max-width: 1000px) { .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-header { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .interactive-region:hover .region-face,
  .interactive-region:focus-visible .region-face,
  .interactive-region.is-active .region-face { transform: none; }
}
