/* --- 全体設定 --- */
body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif;
  background: #fdf5e6;
  color: #5d4037;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* --- ヘッダー固定エリア（一番上に配置） --- */

.diary-fixed-container {
  position: fixed;
  top: 0; /* 画面最上部に固定 */
  left: 0;
  width: 100%;
  background: #fdf5e6;
  z-index: 1000;
  padding: 8px 0 5px 0; /* 上下余白を最小化 */
  border-bottom: 2px solid #e0d5c1;
}

.diary-header { 
  text-align: center; 
  margin-bottom: 5px; 
}

.diary-header h1 { 
  font-size: 1.0rem; 
  color: #8d6e63; 
  margin: 0; 
  display: block;
}

.diary-header p { 
  font-size: 0.65rem; 
  color: #a1887f; 
  margin: 0; 
}

/* --- 操作エリア（コンパクトに集約） --- */
.controls {
  max-width: 460px;
  margin: 0 auto;
  text-align: center;
  background: #fff;
  padding: 5px 10px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.setting-row {
  margin-bottom: 5px;
  font-size: 0.7rem;
  color: #8d6e63;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

#lang-select, #limit-select {
  padding: 2px 4px;
  border-radius: 8px;
  border: 1px solid #e0d5c1;
  background-color: #fff;
  color: #5d4037;
  font-size: 0.7rem;
}

.button-group {
  display: flex;
  justify-content: center;
  gap: 8px;
}

#gen-btn, .link-btn {
  flex: 1;
  padding: 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

#gen-btn { background: #fbc02d; color: white; }
.link-btn { background: #81c784; color: white; }

#gen-btn:hover, .link-btn:hover { opacity: 0.8; transform: translateY(-1px); }
#gen-btn:disabled { background: #ccc; cursor: not-allowed; }

#status-msg { font-size: 10px; color: #888; margin-top: 2px; height: 12px; }

/* --- チャット表示エリア：ヘッダーが詰まった分、開始位置を上げる --- */
.chat-container { 
  max-width: 500px; 
  margin: 0 auto; 
  display: flex; 
  flex-direction: column; 
  /* ヘッダー全体の高さに合わせて調整 */
  padding: 125px 15px 60px 15px; 
}

/* --- チャットバブル設定 --- */
.timestamp {
  font-size: 0.7rem; color: #bcaaa4; text-align: center;
  margin-top: 30px; margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px; padding: 3px 12px; align-self: center;
}

.bubble {
  padding: 12px 16px; border-radius: 18px; margin: 12px 0;
  max-width: 85%; position: relative; font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.risuko { background: #fff9c4; align-self: flex-start; color: #5d4037; border-top-left-radius: 2px; }
.suzuko { background: #e1f5fe; align-self: flex-end; color: #01579b; border-top-right-radius: 2px; }

/* 名前表示（日本語） */
.bubble.risuko.lang-ja::before { content: "リス子"; }
.bubble.suzuko.lang-ja::before { content: "スズ子"; }

/* 名前表示（英語） */
.bubble.risuko.lang-en::before { content: "Risuko"; }
.bubble.suzuko.lang-en::before { content: "Suzuko"; }

.risuko::before { position: absolute; top: -18px; left: 5px; font-size: 0.7rem; color: #fbc02d; font-weight: bold; }
.suzuko::before { position: absolute; top: -18px; right: 5px; font-size: 0.7rem; color: #03a9f4; font-weight: bold; }

.scene-img {
  width: 100%;
  max-width: 420px;
  border-radius: 15px;
  margin: 18px auto;
  display: block;
  border: 5px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* モバイル用のパディング調整 */
@media (max-width: 480px) {
  .chat-container { padding-top: 135px; }
}