/* ゴジラずかん - 写真メインのギャラリー */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Maru Gothic ProN", "ヒラギノ丸ゴ ProN", "Hiragino Sans", sans-serif;
  background: #000;
  color: #fff;
  overscroll-behavior: none;
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: #000;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen.active {
  display: flex;
}

/* === トップ === */
.top-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(180deg, #1a0000 0%, #000 100%);
  border-bottom: 2px solid #ff2222;
  flex-shrink: 0;
}

.title {
  font-size: 30px;
  font-weight: 900;
  color: #ff2222;
  text-shadow: 0 0 16px rgba(255, 34, 34, 0.7);
  letter-spacing: 4px;
}

.gallery {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-card {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 260px;
  flex-shrink: 0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #1a1a1a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s;
}

.gallery-card:active {
  transform: scale(0.97);
}

.gallery-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  font-size: 50px;
  color: rgba(255, 255, 255, 0.35);
  z-index: 0;
}

.gallery-card-placeholder::after {
  content: "じゅんびちゅう...";
  font-size: 13px;
  margin-top: 6px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
}

.gallery-card-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 16px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.95));
}

.gallery-card-name {
  font-size: 22px;
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  margin-bottom: 2px;
  color: #fff;
}

.gallery-card-year {
  font-size: 15px;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

/* === 詳細 === */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
  position: absolute;
  top: env(safe-area-inset-top);
  left: 0;
  right: 0;
  z-index: 10;
}

.back-btn {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  color: #fff;
  font-size: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-btn:active { transform: scale(0.9); }

.detail-counter {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.detail-hero {
  width: 100%;
  aspect-ratio: 1 / 1;
  position: relative;
  background: #1a1a1a;
  overflow: hidden;
}

.detail-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-hero-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 100px;
  color: rgba(255, 255, 255, 0.2);
}

.detail-info {
  padding: 24px 22px 12px;
  background: linear-gradient(180deg, transparent, #000 80px);
  margin-top: -80px;
  position: relative;
  z-index: 2;
}

.detail-name {
  font-size: 38px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 6px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.9);
  line-height: 1.15;
}

.detail-fullname {
  font-size: 16px;
  text-align: center;
  color: #ccc;
  margin-bottom: 8px;
}

.detail-year {
  font-size: 22px;
  text-align: center;
  color: #ffd700;
  font-weight: 900;
  margin-bottom: 18px;
}

.speak-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #ff2222, #aa0000);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(255, 34, 34, 0.4);
}

.speak-btn:active { transform: scale(0.97); }

.speak-btn.playing {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 34, 34, 0.4); }
  50% { box-shadow: 0 4px 28px rgba(255, 34, 34, 0.9); }
}

.detail-desc {
  text-align: center;
  font-size: 17px;
  line-height: 1.6;
  color: #ddd;
  padding: 0 8px 20px;
}

/* 追加写真ギャラリー */
.extra-images {
  padding: 4px 12px 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.extra-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
  cursor: pointer;
}

.extra-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.extra-img-wrap:active { transform: scale(0.98); }

/* スワイプヒント */
.swipe-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.swipe-arrow.left { left: 8px; }
.swipe-arrow.right { right: 8px; }

#screen-detail.active .swipe-arrow { opacity: 0.4; }

/* 全画面ビューア */
.fullimg-screen {
  background: #000;
  align-items: center;
  justify-content: center;
}

#fullimg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.fullimg-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 10;
}
