/* =========================
   17_storage (00_TopPageのデザインを踏襲)
   ========================= */

* { box-sizing: border-box; }

@font-face {
  font-family: 'mihoyo-zenzero';
  src: url('font/mihoyo-zenzero.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body.portal-page {
  margin: 0;
  background: #f4f4f4;
  font-family: 'mihoyo-zenzero', sans-serif;
  overflow-x: hidden;
}

.hidden { display: none !important; }

.site-version {
  position: fixed;
  right: 8px;
  bottom: 6px;
  font-size: 11px;
  color: rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 1;
}

/* ヘッダー */
.portal-header {
  position: relative;
  text-align: center;
  padding: 56px 16px 34px;
}

/* ログイン済みでタイトル・説明を隠している時は、上の余白も詰めてシンプルにする */
.portal-header:has(#site-title.hidden) {
  padding-top: 16px;
  padding-bottom: 10px;
}

.portal-header h1 {
  font-size: 42px;
  margin: 0;
  color: #222;
}

.portal-header p {
  margin: 10px 0 0;
  font-size: 16px;
  color: #666;
}

.account-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: #888;
  text-decoration: underline;
}

.header-topbar {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-switch {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.lang-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  user-select: none;
}

.lang-option input { cursor: pointer; }

/* 全体コンテナ */
.portal-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px 30px;
}

.portal-section {
  margin: 0 auto 18px;
  padding: 18px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.65);
  box-shadow: 0 12px 28px rgba(0,0,0,0.06);
}

.portal-section h2 {
  margin: 0 0 12px;
  text-align: center;
  font-size: 22px;
  color: #222;
}

.hint {
  font-size: 0.82rem;
  color: #888;
  margin-top: 8px;
  text-align: center;
}

/* ボタン */
.primary-btn {
  display: inline-block;
  background: #ffcc00;
  border: none;
  border-radius: 50px;
  color: #222;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  padding: 12px 24px;
  text-decoration: none;
}
.primary-btn:hover { opacity: 0.85; }

.secondary-btn {
  display: inline-block;
  background: #eeeeee;
  border: 1px solid #dddddd;
  border-radius: 20px;
  color: #333;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 9px 16px;
  white-space: nowrap;
}
.secondary-btn:hover { background: #ddd; }
.secondary-btn.active { background: #ffcc00; border-color: #ffcc00; }

/* ===== ログイン必須の案内 ===== */
.storage-login-gate {
  text-align: center;
  padding: 40px 20px;
}
.storage-login-gate h2 { margin-bottom: 10px; }
.storage-login-gate p { color: #666; margin-bottom: 18px; }

/* ===== アップロード(枠なし、ボタンだけのシンプルな帯) ===== */
.storage-upload-bar {
  text-align: center;
  padding: 6px 0 18px;
}

/* ===== 絞り込み ===== */
.storage-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}
.storage-select-mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}
.storage-select-mode-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
.storage-tag-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.storage-tag-filter-chip {
  width: auto;
  padding: 6px 14px;
  font-size: 0.82rem;
  border: 1px solid #ddd;
  border-radius: 16px;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-family: inherit;
}
.storage-tag-filter-chip:hover { background: #f0f0f0; }
.storage-tag-filter-chip.active {
  background: #ffcc00;
  border-color: #ffcc00;
  font-weight: bold;
}

/* ===== ギャラリー ===== */
.storage-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.storage-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 3px solid transparent;
  overflow: hidden;
  background: #ddd;
  cursor: pointer;
}
/* 複数選択モードでチェック中の画像は、分かりにくい青チェックの代わりに
   赤枠で選択中だと分かるようにする(2026-09-09)。 */
.storage-card.selected {
  border-color: #e53935;
}
.storage-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.storage-card-select {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  z-index: 1;
  accent-color: #e53935;
}
.storage-card-pending {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
  padding: 6px;
}

.storage-empty-hint { padding: 20px 0; }

/* ===== 拡大表示(ポップアップ) ===== */
.storage-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.storage-lightbox.open { display: flex; }
.storage-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.storage-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}

/* ===== 独自の確認ポップアップ ===== */
.storage-confirm {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3200;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.storage-confirm.open { display: flex; }
.storage-confirm-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}
.storage-confirm-message {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 18px;
  white-space: pre-wrap;
}
.storage-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.storage-confirm-actions button {
  width: auto;
  padding: 8px 18px;
}

/* ===== 独自の右クリックメニュー ===== */
.storage-context-menu {
  position: absolute;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  max-height: 70vh;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px;
}
.storage-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  border-radius: 6px;
}
.storage-context-menu button:hover { background: #f0f0f0; }
.storage-context-menu button.danger { color: #c0392b; }
.storage-context-menu button.danger:hover { background: #fdecea; }

/* ===== トースト通知 ===== */
.storage-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 0.82rem;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 2100;
  max-width: 90%;
  text-align: center;
}
.storage-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 管理者用モデレーション確認 ===== */
.storage-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.storage-admin-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
}
.storage-admin-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.storage-admin-card-meta {
  flex: 1;
  font-size: 0.8rem;
  color: #555;
  word-break: break-all;
}
.storage-admin-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* フッター */
.portal-footer {
  text-align: center;
  padding: 26px 16px 40px;
  color: #777;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.twitter-icon {
  width: 30px;
  height: 30px;
  display: block;
}

/* =========================
   スマホ（<=768）
   ========================= */
@media (max-width: 768px) {

  .portal-header { padding: 44px 14px 20px; }
  .portal-header h1 { font-size: 28px; }
  .portal-header p { font-size: 13px; }

  .lang-switch {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 10px;
    max-width: calc(100% - 20px);
  }

  .portal-container { padding-left: 10px; padding-right: 10px; }

  .portal-section { padding: 14px 10px; border-radius: 10px; }

  .lang-option { font-size: 13px; }

  .storage-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 6px;
  }

  .storage-filter-row { flex-direction: column; align-items: stretch; }
}
