:root {
  --pink: #ff8fab;
  --pink-deep: #f4709a;
  --cream: #fff7f3;
  --ink: #4a3f43;
  --muted: #8a7d82;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(244, 112, 154, 0.15);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Zen Maru Gothic", "Kosugi Maru", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #ffd1dc 0%, #ffb3c6 45%, #ff8fab 100%);
  color: #fff;
  text-align: center;
  padding: 72px 20px 88px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "🌸🌷🌸🌷🌸🌷🌸🌷🌸🌷🌸🌷";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  font-size: 22px;
  letter-spacing: 6px;
  opacity: 0.55;
  white-space: nowrap;
}
/* ヒーロー背景画像（設定時のみ表示） */
.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  display: none;
}
.hero--has-image .hero__bg { display: block; }
/* 画像の上に重ねて文字を読みやすくする */
.hero--has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(160deg, rgba(244, 112, 154, 0.55), rgba(40, 25, 30, 0.55));
}
.hero__inner { max-width: 720px; margin: 0 auto; position: relative; z-index: 2; }
.hero__eyebrow {
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin: 0 0 12px;
  opacity: 0.95;
}
.hero__title {
  font-size: clamp(2rem, 6vw, 3.2rem);
  margin: 0 0 18px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.hero__lead { font-size: 1.05rem; margin: 0 0 28px; }
.hero__cta {
  display: inline-block;
  background: #fff;
  color: var(--pink-deep);
  font-weight: 700;
  text-decoration: none;
  padding: 14px 34px;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hero__cta:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2); }

/* Layout */
.container {
  max-width: 980px;
  margin: -48px auto 0;
  padding: 0 18px 60px;
  position: relative;
  z-index: 2;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.section-title {
  font-size: 1.35rem;
  margin: 0 0 20px;
}

/* Upload form */
.upload { margin-bottom: 48px; }
.upload__form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-weight: 700; font-size: 0.95rem; }
.field input[type="text"],
.field textarea,
.field input[type="file"] {
  font: inherit;
  padding: 12px 14px;
  border: 2px solid #ffe0e8;
  border-radius: 12px;
  background: #fffafc;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--pink);
}
.field textarea { resize: vertical; }

.preview {
  border-radius: 12px;
  overflow: hidden;
  max-width: 280px;
}
.preview img { width: 100%; display: block; }

.btn {
  align-self: flex-start;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--pink-deep);
  border: none;
  padding: 13px 40px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(244, 112, 154, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--sub {
  background: #fff;
  color: var(--pink-deep);
  border: 2px solid var(--pink);
  box-shadow: none;
}

/* ヒーロー画像の設定セクション */
.hero-setter { margin-bottom: 48px; }
.hero-setter__note { margin: 0 0 18px; color: var(--muted); font-size: 0.92rem; }

.upload__hint { margin: -6px 0 0; font-size: 0.85rem; color: var(--muted); }

.form-status { margin: 0; font-size: 0.95rem; min-height: 1.2em; }
.form-status.ok { color: #2e9e6b; }
.form-status.err { color: #e0556e; }

/* Gallery */
.count { font-size: 1rem; color: var(--muted); font-weight: 500; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.gallery__loading,
.gallery__empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}
.tile {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(244, 112, 154, 0.25); }
.tile__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #ffeef3;
  display: block;
}
.tile__body { padding: 12px 14px 16px; }
.tile__name { font-weight: 700; font-size: 0.95rem; margin: 0 0 4px; }
.tile__msg {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile__date { font-size: 0.75rem; color: #bbaeb3; margin: 8px 0 0; }

/* メッセージのみの投稿（写真なし） */
.tile--text { text-align: left; }
.tile__quote {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #fff0f4, #ffe3ec);
  padding: 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
}
.tile__quote::before { content: "“"; margin-right: 2px; color: var(--pink); font-size: 1.4em; }

/* Lightbox */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(40, 25, 30, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.lightbox__figure {
  margin: 0;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox__figure img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.lightbox__caption {
  color: #fff;
  margin-top: 14px;
  text-align: center;
  font-size: 0.95rem;
}
.lightbox__close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 2.6rem;
  line-height: 1;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

/* ライトボックス内の いいね・コメント（読み取り専用） */
.lightbox__meta {
  width: 100%;
  max-width: 560px;
  margin-top: 12px;
  color: #fff;
  max-height: 22vh;
  overflow-y: auto;
}
.lightbox__likes { margin: 0 0 8px; font-weight: 700; }
.lightbox__comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lightbox__comments li {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.88rem;
  word-break: break-word;
}
.lightbox__cname { font-weight: 700; }
.lightbox--playing .lightbox__meta { display: none; }
.lightbox__img[hidden] { display: none; }
.lightbox--text .lightbox__caption {
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.8;
  max-width: 640px;
  background: rgba(255, 255, 255, 0.1);
  padding: 28px 26px;
  border-radius: 16px;
  white-space: pre-wrap;
}

/* すーさん用ページ */
.hero--susan {
  background: linear-gradient(135deg, #ffe6a7 0%, #ffc3a0 45%, #ff9a8b 100%);
}

/* 合い言葉ゲート */
.gate {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #ffd1dc 0%, #ffb3c6 55%, #ff8fab 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.gate[hidden] { display: none; }
.gate__card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gate__emoji { font-size: 3rem; }
.gate__title { margin: 0; font-size: 1.8rem; }
.gate__lead { margin: 0; color: var(--muted); font-size: 0.95rem; }
.gate__input {
  font: inherit;
  text-align: center;
  padding: 14px 16px;
  border: 2px solid #ffe0e8;
  border-radius: 12px;
  background: #fffafc;
  color: var(--ink);
}
.gate__input:focus { outline: none; border-color: var(--pink); }
.gate__btn { align-self: stretch; }

/* タイルのいいね・コメント数 */
.tile__stats {
  display: flex;
  gap: 14px;
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.tile__stats .liked { color: var(--pink-deep); font-weight: 700; }

/* 詳細モーダル */
.detail {
  position: fixed;
  inset: 0;
  background: rgba(40, 25, 30, 0.85);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  z-index: 60;
  overflow-y: auto;
}
.detail[hidden] { display: none; }
.detail__panel {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  margin: auto;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.detail__img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #2a1c20;
  display: block;
}
.detail__img[hidden] { display: none; }
.detail__msg { font-size: 1.05rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.detail__body { padding: 20px 22px 24px; }
.detail__name { font-weight: 700; margin: 0 0 4px; }
.detail__msg { margin: 0 0 16px; color: var(--ink); }
.detail__close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 61;
}
.detail__actions { margin-bottom: 18px; }

/* いいねボタン */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  background: #fff5f8;
  color: var(--pink-deep);
  border: 2px solid var(--pink);
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.like-btn:hover:not(:disabled) { transform: translateY(-1px); }
.like-btn.liked { background: var(--pink); color: #fff; }
.like-btn__heart { font-size: 1.2rem; line-height: 1; }
.like-btn:disabled { opacity: 0.6; cursor: default; }

/* コメント */
.comments { border-top: 1px solid #ffe0e8; padding-top: 16px; }
.comments__title { font-size: 1.05rem; margin: 0 0 12px; }
.comments__list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comments__empty { color: var(--muted); font-size: 0.9rem; }
.comment { background: #fff7f3; border-radius: 12px; padding: 10px 14px; }
.comment__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.comment__name { font-weight: 700; font-size: 0.9rem; }
.comment__date { font-size: 0.72rem; color: #bbaeb3; }
.comment__text { margin: 0; font-size: 0.92rem; white-space: pre-wrap; word-break: break-word; }
.comments__form { display: flex; flex-direction: column; gap: 10px; }
.comments__form input {
  font: inherit;
  padding: 11px 14px;
  border: 2px solid #ffe0e8;
  border-radius: 12px;
  background: #fffafc;
  color: var(--ink);
}
.comments__form input:focus { outline: none; border-color: var(--pink); }
.comments__row { display: flex; gap: 8px; }
.comments__row input { flex: 1; min-width: 0; }
.btn--sm { padding: 11px 20px; white-space: nowrap; }

/* Footer */
.footer {
  text-align: center;
  padding: 36px 20px 48px;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 540px) {
  .card { padding: 20px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
