/* ===== Safariの自動文字サイズ調整を無効化 ===== */
html {
    font-size: 14px !important; /* 基準サイズ */
    -webkit-text-size-adjust: none !important;
}

/* ===== ベース設定（ライトモード） ===== */
body {
    font-family: "Century Gothic", "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.7;
    font-size: 1rem;
    transition: background 0.3s, color 0.3s;
}

h1 {
    text-align: center;
    font-weight: 400;
    margin: 20px 0;
    color: #222;
    font-size: 1.9em;
}

/* ===== リンク ===== */
a {
    text-decoration: none;
    color: #007bff;
    font-size: 1em;
    transition: color 0.2s ease;
    cursor: pointer;
}
a:hover {
    color: #0056b3;
}

/* iPhoneでも押しやすいようにリンク領域拡大 */
.post a, .reply a {
  display: inline-block;
  padding: 4px 6px;
  line-height: 1.4;
  position: relative;
  z-index: 2;
}

/* ←ここからは別ブロック（波カッコを閉じたあとに書く） */
.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;      /* ボタン行の下に余白 */
}

.post hr {
  margin: 8px 0 0;
  border: 0;
  border-top: 1px solid #ddd;               /* ライト時 */
}
body.dark-mode .post hr {
  border-top-color: rgba(255,255,255,.25);  /* ダーク時は薄く */
}

/* ===== 投稿カード ===== */
/* 投稿カード：親だけセンタリング */
.post{
  background:#fff;
  border-radius:8px;
  padding:16px 20px;
  margin:15px auto;     /* 親だけ中央寄せ */
  max-width:800px;
  box-shadow:0 2px 8px rgba(0,0,0,.05);
}

/* 返信カード：横はフル幅、右autoを使わない */
.reply{
  background:#fff;
  border-radius:8px;
  padding:16px 20px;
  margin:12px 0;
  max-width:none;
  width:auto;
  position:relative;
  box-sizing:border-box;
}
/* （任意）左のスレッド線 */
.reply::before{
  content:"";
  position:absolute;
  left:-8px;
  top:0; bottom:0;
  width:2px;
  background:#e0e0e0;
}
/* 返信の見た目は .reply-card に集約（カード本体） */
.reply-card{
  background:#fff;
  border-radius:8px;
  padding:16px 20px;
  box-shadow:0 2px 8px rgba(0,0,0,.05);
}


small {
    color: #888;
    font-size: 0.9em;
}

/* ===== フォーム ===== */
form {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    max-width: 800px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
textarea, input[type="text"], input[type="email"], input[type="password"], input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    margin: 8px 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1em;
}
button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
}
button:hover {
    background: #0056b3;
}

/* ===== ダークモード ===== */
body.dark-mode {
    background-color: #121212;
    color: #ddd;
}
body.dark-mode h1 {
    color: #eee;
}
body.dark-mode .post,
body.dark-mode .reply-card,
body.dark-mode form {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode a {
    color: #4dabf7;
}
body.dark-mode a:hover {
    color: #82cfff;
}

/* ===== ダークモード切替ボタン位置調整 ===== */
.dark-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

/* スマホではタイトル下に移動 */
@media (max-width: 768px) {
    .dark-toggle {
        position: relative;
        top: 0;
        right: 0;
        margin: 10px 0;
        text-align: right;
    }
}

/* ===== ダークモード切替ボタンデザイン ===== */
.dark-toggle button {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: #eee;
    cursor: pointer;
    font-size: 14px;
}
body.dark-mode .dark-toggle button {
    background: #444;
    color: #fff;
}

/* ===== ボタン風リンク ===== */
a.btn {
    display: inline-block;
    padding: 8px 14px;
    margin: 4px 4px 0 0;
    background: #ddd;
    color: #000;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}
a.btn.primary {
    background: #007bff;
    color: #fff;
}

/* ===== YouTube埋め込みレスポンシブ対応 ===== */
iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    display: block;
}

/* ===== スマホ全般（幅768px以下） ===== */
@media (max-width: 768px) {
    html {
        font-size: 14px !important;
    }
}

/* ===== iPhone・小型スマホ（幅430px以下） ===== */
@media (max-width: 430px) {
    html {
        font-size: 14px !important;
    }
}

/* YouTubeリンクの見た目 */
.youtube-link-wrapper {
    margin: 5px 0 15px;
    text-align: left;
}
.youtube-link {
    font-weight: bold;
    color: #1e90ff;
    text-decoration: none;
}
.youtube-link:hover {
    text-decoration: underline;
}

/* YouTube埋め込みレスポンシブ */
.youtube-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 10px 0 5px;
}
.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
/* ===== iPhoneでもreply/likeを必ず表示する保証 ===== */
.post-actions a,
.reply a {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer;
    touch-action: manipulation; /* iPhoneタップ改善 */
    -webkit-tap-highlight-color: transparent; /* タップ時のグレー反転防止 */
}
.user-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
}
.btn.radio-btn {
    background: #ff5722;
    color: white;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    margin-top: 10px;
    transition: background 0.2s ease;
}
.btn.radio-btn:hover {
    background: #e64a19;
}
.radio-player {
    display: inline-block;
    vertical-align: middle;
    margin-top: 5px;
}
.radio-player audio {
    height: 30px;
    vertical-align: middle;
}

/* 横並び画像ギャラリー */
.image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 5px 0;
}
.image-gallery img {
    max-width: 150px;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.2s ease;
}
.image-gallery img:hover {
    transform: scale(1.05);
}

/* モーダル背景 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 40px;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.9);
    overflow: auto;
}
/* モーダル画像 */
.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 85%;
}
/* 閉じるボタン */
.close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
}

/* deleteボタン：小さく＋灰で固定 */
.post-actions .delete-form { display:inline; margin:0; }
.post-actions .delete-form button{
  font-size: 12px;
  padding: 0 6px;          /* 高さを出さない */
  line-height: 1;
  height: 16px;            /* もっと小さくしたければ 16px などに */
  min-height: 0;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;

  border-radius: 3px;
  background: #e53935;      /* 赤 */
  border: 1px solid #c62828; /* 赤系の枠 */
  color: #fff;               /* 文字は白 */
  cursor: pointer;

  margin-left: 6px;

  /* iOS既定の見た目を無効化（高さブレ防止） */
  -webkit-appearance: none;
          appearance: none;
}
.post-actions .delete-form button:hover  { filter: brightness(0.95); }
.post-actions .delete-form button:active { transform: translateY(1px); }


/* reply = 入れ物（幅は親.post基準）＋寄せた分だけ幅を縮める */
.reply{
  box-sizing: border-box;
  width: 100%;
  margin: 12px 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;

  /* モバイル既定：寄せ量（--indent は PHP から来る値）。--ml に確定値を入れる */
  --ml: clamp(0px, var(--indent, 12px), 32px);
  margin-left: var(--ml);
  width: calc(100% - var(--ml));   /* ← 寄せた分だけ幅を縮めるのがキモ */
}

/* 見た目のカード */
.reply-card{
  background:#fff;
  border-radius:8px;
  padding:16px 20px;
  box-shadow:0 2px 8px rgba(0,0,0,.05);
}
body.dark-mode .reply-card{ background:#1e1e1e; }

/* スレッド線は使わない */
.reply::before{ content:none; display:none; }

/* 画面が広いときは上限を少し増やす（必要に応じて数値調整OK） */
@media (min-width: 680px){
  .reply{
    --ml: clamp(0px, var(--indent, 16px), 56px);
    margin-left: var(--ml);
    width: calc(100% - var(--ml));
  }
}

