/* gallery.css — ギャラリー・作品詳細専用スタイル */

/* =============================================================================
   ギャラリー一覧
   ============================================================================= */

.gallery-screen {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.gallery-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.gallery-header__back {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.gallery-header__back:hover { text-decoration: underline; }

.gallery-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

/* グリッド */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 作品カード */
.story-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.story-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.story-card__header {
  position: relative;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  min-height: 56px;
  flex-wrap: wrap;
}

.story-card__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
  flex-shrink: 0;
}

.story-card__char-name {
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
}

.story-card__novel-badge {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 2px 8px;
}

.story-card__body {
  padding: 12px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.story-card__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card__summary {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

.story-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.story-card__likes { color: #e57373; }

/* ページネーション */
.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

.gallery-pagination button {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition-fast);
}

.gallery-pagination button:hover:not(:disabled) { background: var(--color-bg); }
.gallery-pagination button:disabled { opacity: 0.4; cursor: default; }

.gallery-empty {
  text-align: center;
  color: var(--color-text-muted);
  padding: 48px 0;
}

.gallery-loading {
  text-align: center;
  color: var(--color-text-muted);
  padding: 48px 0;
}

/* =============================================================================
   作品詳細
   ============================================================================= */

.story-screen {
  max-width: 1024px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.story-header {
  padding: 20px;
  color: #fff;
}

.story-header__back {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
  display: block;
}

.story-header__back:hover { color: #fff; }

.story-header__title {
  font-size: 1.3rem;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.story-header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  opacity: 0.9;
}

.story-header__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.6);
}

/* タブ */
.story-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-surface);
}

.story-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.story-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* チャット表示 */
.story-messages {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-bg);
  min-height: 200px;
}

/* 小説表示 */
.story-novel {
  padding: 40px 24px 48px;
  background: #faf8f3;
}

.story-novel__inner {
  max-width: 480px;
  margin: 0 auto;
}

.story-novel__text {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "HG明朝E", serif;
  font-size: 1rem;
  line-height: 2.2;
  white-space: pre-wrap;
  color: #2c2c2c;
  margin: 0;
  word-break: break-all;
  letter-spacing: 0.03em;
}

/* 小説の区切り線 */
.story-novel__divider {
  border: none;
  border-top: 1px solid #d4c9b0;
  margin: 36px auto;
  width: 60%;
}

/* いいね */
.story-like-area {
  display: flex;
  justify-content: center;
  padding: 24px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.story-like-btn {
  background: transparent;
  border: 2px solid #e57373;
  border-radius: 24px;
  padding: 10px 28px;
  font-size: 1.1rem;
  color: #e57373;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 700;
}

.story-like-btn:hover,
.story-like-btn.liked {
  background: #e57373;
  color: #fff;
}

/* コメント */
.story-comments {
  padding: 20px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.story-comments__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 16px 0;
}

.story-comments__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.story-comment {
  background: var(--color-bg);
  border-radius: 8px;
  padding: 12px 14px;
}

.story-comment__body {
  font-size: 0.9rem;
  margin: 0 0 6px 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.story-comment__date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.story-comments__empty {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 16px 0;
}

.story-comments__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-comments__textarea {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition-fast);
}

.story-comments__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.story-comments__submit {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.story-comments__submit:hover:not(:disabled) { background: var(--color-primary-dark); }
.story-comments__submit:disabled { opacity: 0.5; cursor: default; }

.story-comments__error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin: 0 0 8px 0;
}

/* ── コメント削除ボタン ── */
.story-comment__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.story-comment__delete-btn {
  font-size: 0.75rem;
  color: #999;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  line-height: 1.6;
}
.story-comment__delete-btn:hover {
  color: #e53;
  border-color: #e53;
}

/* ── コメントフォーム：削除パス入力欄 ── */
.story-comments__password {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--color-input-bg, #fff);
  color: var(--color-text, #1c1c1e);
  box-sizing: border-box;
}

/* ── 削除確認モーダル ── */
.delete-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.delete-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px;
  width: min(360px, 90vw);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.delete-modal__title {
  font-weight: bold;
  margin-bottom: 10px;
}

.delete-modal__body {
  font-size: 0.9rem;
  color: #555;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
}

.delete-modal__input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.delete-modal__btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.delete-modal__cancel {
  padding: 8px 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.delete-modal__confirm {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #e53;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
}
.delete-modal__confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* ── ギャラリーカード・詳細ヘッダーのインフォボタン ── */
.story-card__info-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
  z-index: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.story-card__info-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}

/* 小説版：章タイトル */
.story-novel__heading {
  font-size: 1.25rem;
  font-weight: bold;
  margin: 2em 0 0.75em;
  padding-bottom: 0.3em;
  border-bottom: 2px solid currentColor;
  opacity: 0.85;
}
