@charset "utf-8";

body {
  background-color: #DDFFFF;
  margin: 0;
  padding: 0;
  font-family: "Meiryo", "Yu Gothic", sans-serif;
  color: #333;
  min-height: 100vh;
}

/* =========================================
   トップバー
   ========================================= */
#top-bar {
  background-color: #333;
  color: #fff;
  padding: 5px 10px; 
  display: flex;
  flex-direction: column;
  gap: 8px; 
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

.top-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.link-group { display: flex; gap: 8px; }
.nav-link-btn {
  background: #007bff; color: #fff; text-decoration: none;
  padding: 4px 10px; border-radius: 4px; font-size: 13px; transition: background 0.2s;
}
.nav-link-btn:hover { background: #0056b3; }
.nav-link-btn2 {
  background: tomato; color: #fff; text-decoration: none;
  padding: 4px 10px; border-radius: 4px; font-size: 13px; transition: background 0.2s;
}
.nav-link-btn2:hover { background: red; }

.size-row {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  border-bottom: 1px solid #555;
  padding-bottom: 5px;
  margin-bottom: 2px;
}

.size-btn {
  background: #444; color: #ccc; border: 1px solid #666;
  padding: 6px 4px; 
  cursor: pointer; border-radius: 3px; 
  font-size: 13px;
  min-width: 33px;
}
.size-btn.active {
  background: #20b2aa; color: #fff; border-color: #fff; font-weight: bold;
}

.control-row { display: flex; justify-content: flex-start; align-items: center; flex-wrap: wrap; gap: 8px; width: 100%; }
#settings { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.time-btn {
  background: #555; color: #ccc; border: 1px solid #777;
  padding: 4px 8px; cursor: pointer; border-radius: 3px; font-size: 12px;
}
.time-btn.active { background: #ffa07a; color: #fff; border-color: #ff8c00; font-weight: bold; }

h1 { font-size: 11px; margin: 0; font-weight: normal; }


/* =========================================
   サムネイル一覧エリア
   ========================================= */
#gallery-view {
  padding: 10px 5px; 
  display: flex; flex-wrap: wrap;
  gap: 2px; 
  justify-content: flex-start;
  row-gap: 10px; 
}

.thumb-card {
  background: #fff; border: 1px solid #ddd; padding: 1px;
  cursor: pointer; text-align: center; overflow: hidden;
  transition: transform 0.2s;
}
.thumb-card:hover { transform: translateY(-2px); border-color: #999; }

.thumb-img {
  object-fit: contain; display: block; margin: 0 auto; background-color: #eee;
}

.thumb-name {
  font-size: 8px; /* サムネイル番号 */
  font-weight: bold; 
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #333;      
  line-height: 1.2;
}

/* 通常の区切り線 (hr) の設定 */
hr.divider { 
  border: none; border-top: 1px solid #999; 
  width: 100%; 
  margin: 2px 0; 
  flex-basis: 100%; 
}

/* 説明文行 (◆▼◆ / ■◆■) の設定 */
.gallery-text-row {
  flex-basis: 100%; width: 100%;
  padding: 2px 10px; 
  box-sizing: border-box;
  font-size: 16px; 
  line-height: 1.4; color: #333;
  background: transparent;
  text-align: left;
}
.gallery-text-row a { color: blue; text-decoration: underline; }

/* ★追加修正: ■◆■ の中の hr はマージンを0にする */
/* これにより、ラインの間隔が広がりすぎるのを防ぎます */
.gallery-text-row hr {
  margin: 0;
  border: none;
  /* デフォルトの線の色（指定がない場合用） */
  border-top: 1px solid #999; 
}


/* =========================================
   スライドショー画面 (オーバーレイ)
   ========================================= */
#slideshow-overlay {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0,0,0,0.95);
  z-index: 2000; flex-direction: column;
}

#slide-header {
  width: 100%; height: auto; 
  background: rgba(0,0,0,0.5); 
  display: flex; flex-direction: column; 
  padding: 5px 10px; gap: 5px;
}

.header-row-upper { width: 100%; text-align: left; }
#slide-info { font-size: 13px; color: #ddd; font-weight: normal; }

.header-row-lower {
  width: 100%; display: flex; justify-content: flex-end; align-items: center;
  gap: 20px;
}

.slide-header-nav { display: flex; gap: 15px; }

.nav-btn-rect {
  background: rgba(255, 255, 255, 0.15); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 8px 15px; cursor: pointer; border-radius: 4px;
  font-size: 14px; min-width: 40px; backdrop-filter: blur(2px);
}
.nav-btn-rect:hover { background: rgba(255, 255, 255, 0.3); }

.close-btn {
  background: rgba(76, 175, 80, 0.6); border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff; padding: 8px 15px; cursor: pointer; border-radius: 4px;
  font-size: 14px; white-space: nowrap;
}
.close-btn:hover { opacity: 0.9; }

#slide-body {
  flex: 1; display: flex; justify-content: center; align-items: center;
  position: relative; overflow: hidden; user-select: none; width: 100%; cursor: pointer; padding: 0;
}
#main-image {
  max-width: 98%; max-height: 98%; object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.8); transition: opacity 0.2s;
}

.slide-text-container { 
  color: #fff; text-align: center; padding: 20px; 
  background: transparent; max-width: 90%; line-height: 1.5; font-size: 16px;
}
.slide-text-container a { color: #87CEFA; text-decoration: underline; cursor: default; }

.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 40px; color: rgba(255,255,255,0.15);
  cursor: pointer; padding: 20px; user-select: none; transition: color 0.2s; z-index: 2100;
}
.nav-arrow:hover { color: #fff; background: rgba(0,0,0,0.2); }
.nav-left { left: 0px; }
.nav-right { right: 0px; }

#status-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 80px; color: rgba(255,255,255,0.8); opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s; z-index: 2050; text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* =========================================
   スマホ横画面（ランドスケープ）時の最終最適化版（「h1・秒・サイズ・ナビ」完全分離・決着Ver.）
   ========================================= */
@media (max-height: 500px) and (orientation: landscape) {
  
  /* 1. トップバー全体の基本設定（すべての要素を右寄せにします） */
  #top-bar {
    padding: 2px 6px !important;
    display: flex !important;
    flex-direction: row !important; 
    align-items: center !important;
    justify-content: flex-end !important; /* すべての要素を右端へ詰め込みます */
    gap: 12px !important; /* グループ間の適度な隙間 */
  }

  /* 2. 【最重要】h1とナビが一緒に入っている「外箱(.top-row)」の役割を解除し、中身をバラバラにする */
  #top-bar .top-row {
    display: contents !important; /* ★contentsにすることで箱が消え、中のh1とナビが独立します */
  }

  /* 3. 各独立パーツの並び順（order）をご希望の順番通り「左からh1(1) ＞ 秒(2) ＞ サイズ(3) ＞ ナビ(4)」に完全固定 */
  #top-bar h1 {
    display: block !important;
    font-size: 11px !important;
    color: #fff !important;
    margin: 0 !important;
    white-space: nowrap !important;
    order: 1 !important; /* ★1番目：h1 */
  }

  #top-bar .control-row {
    display: flex !important;
    width: auto !important;
    order: 2 !important; /* ★2番目：秒数 */
  }

  #top-bar .size-row {
    display: flex !important;
    width: auto !important;
    order: 3 !important; /* ★3番目：サイズ */
  }

  /* ナビボタンが入っているグループ */
  #top-bar .link-group {
    display: flex !important;
    width: auto !important;
    order: 4 !important; /* ★4番目：ナビ（一番右端） */
  }

  /* 各グループが真横に綺麗に並ぶように一律設定（縦割れ防止） */
  #top-bar .size-row, 
  #top-bar .control-row,
  #top-bar .link-group,
  #settings {
    flex-direction: row !important;
    align-items: center !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 3px !important;
  }

  /* 4. 「サイズ:」「切替:」の文字テキストを消去 */
  #top-bar .size-row,
  #top-bar #settings {
    font-size: 0 !important;
  }

  /* 5. 基本のボタンサイズ設定（ナビボタン・秒数ボタン） */
  .time-btn, .nav-link-btn, .nav-link-btn2 {
    padding: 2px 4px !important; 
    font-size: 11px !important;
    min-width: auto !important;
    line-height: 1.0 !important;
  }

  /* 6. サイズボタンの太さ設定（1.35倍を維持） */
  .size-row .size-btn {
    font-size: 11px !important;
    line-height: 1.0 !important;
    min-width: 25px !important; 
    padding: 2px 4px !important; 
    margin: 0 !important;
  }

  /* =========================================
     スライド表示時（黒画面）の上部コントロール：1行ドッキング
     ========================================= */
  #slide-header {
    padding: 1px 8px !important; 
    display: flex !important;
    flex-direction: row !important; 
    justify-content: space-between !important; 
    align-items: center !important;
    gap: 10px !important;
    height: 24px !important; 
  }

  .header-row-upper {
    width: auto !important; 
  }
  #slide-info {
    font-size: 11px !important; 
    line-height: 24px !important;
  }

  .header-row-lower {
    width: auto !important; 
    gap: 6px !important; 
  }

  .nav-btn-rect, .close-btn {
    padding: 1px 10px !important; 
    font-size: 11px !important;
    line-height: 1.2 !important;
    min-width: auto !important;
  }
}
