@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap');

:root {
  /* ベースカラー */
  --bg-app: #f8fafc;
  --bg-gradient-base: radial-gradient(circle at top left, #eff6ff, #f8fafc);
  --bg-mood: transparent;
  /* JSで操作 */

  --bg-card: #ffffff;
  --bg-card-elevated: #f0f9ff;

  /* 処方箋（紙） */
  --bg-paper: #fffcf5;
  --paper-pattern: linear-gradient(#e5e7eb 1px, transparent 1px),
    linear-gradient(90deg, #e5e7eb 1px, transparent 1px);
  --paper-line: rgba(203, 213, 225, 0.4);
  /* 線を薄く */

  /* ボーダー */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #3b82f6;

  /* テキスト */
  --text-main: #1e293b;
  --text-subtle: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --font-base: "Roboto", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-handwriting: "Noto Sans JP", sans-serif;
  /* 手書き風もあえて標準に寄せる（要望により統一） */

  /* アクセント */
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --primary-soft: rgba(59, 130, 246, 0.1);
  --primary-strong: #2563eb;

  /* インタラクション */
  --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 40px -5px rgba(0, 0, 0, 0.1);
  --shadow-pressed: 0 2px 10px rgba(0, 0, 0, 0.05);

  --scale-pressed: 0.98;

  --radius-card: 20px;
  --radius-pill: 9999px;
  --radius-sm: 12px;

  --slider-track: #e2e8f0;
  --slider-thumb: #ffffff;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ダークモード */
html[data-theme="dark"] {
  --bg-app: #0f172a;
  --bg-gradient-base: radial-gradient(circle at 50% 0%, #1e293b, #0f172a);

  --bg-card: #1e293b;
  --bg-card-elevated: #334155;

  --bg-paper: #1e293b;
  /* ダークモードでの紙は落ち着いた紺色 */
  --paper-pattern: linear-gradient(#334155 1px, transparent 1px),
    linear-gradient(90deg, #334155 1px, transparent 1px);
  --paper-line: #475569;

  --border-subtle: #334155;
  --border-strong: #475569;

  --text-main: #f1f5f9;
  --text-subtle: #cbd5e1;
  --text-muted: #64748b;

  --primary: #60a5fa;
  --primary-glow: rgba(96, 165, 250, 0.6);
  --primary-soft: rgba(96, 165, 250, 0.15);
  --primary-strong: #3b82f6;

  --shadow-soft: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 20px 40px -5px rgba(0, 0, 0, 0.6);

  --slider-track: #334155;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans JP", system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  overflow-x: hidden;
  transition: background-color var(--transition-med);
  font-family: var(--font-base);
  /* ベースフォント適用 */
}

/* 背景のエフェクトレイヤー */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient-base);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-mood);
  /* JSで制御するグラデーション */
  opacity: 0.6;
  z-index: -1;
  transition: background var(--transition-med);
  pointer-events: none;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ヘッダー */
.app-hero {
  padding: 24px 20px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-hero-inner {
  margin: 0 auto;
  max-width: 960px;
  border-radius: var(--radius-pill);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] .app-hero-inner {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.05);
}

.hero-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  box-shadow: 0 0 15px var(--primary-glow);
  flex-shrink: 0;
}

.hero-text {
  flex: 1;
}

.app-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-subtitle {
  display: none;
  /* シンプル化のためヘッダーでは隠す */
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--text-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-card-elevated);
  color: var(--text-main);
  border-color: var(--primary);
}

/* メイン */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 120px;
  /* 下部paddingを広めに（ボトムシート考慮） */
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .app-main {
    padding: 24px 24px 140px;
    /* スマホでの左右余白を確保 */
  }
}

/* カード共通 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

html[data-theme="dark"] .card {
  border-color: rgba(255, 255, 255, 0.05);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 24px;
  text-align: center;
}

/* フォーム要素 */
.form-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.form-section {
  /* 背景なしでスッキリさせる */
  padding: 0;
}

.section-header {
  margin-bottom: 16px;
  text-align: center;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.section-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.section-note {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 4px;
}

/* グリッドレイアウト */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.card-grid-mood {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid-media {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 600px) {
  .card-grid-mood {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 選択カード */
.mood-card,
.effect-card,
.media-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.mood-card:hover,
.effect-card:hover,
.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: var(--border-strong);
}

.mood-card:active,
.effect-card:active,
.media-card:active {
  transform: scale(var(--scale-pressed));
  box-shadow: var(--shadow-pressed);
}

.mood-card.is-selected,
.effect-card.is-selected,
.media-card.is-selected {
  background: var(--bg-card-elevated);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.card-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* アイコン画像 */
.mood-card-image,
.effect-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
  margin-bottom: 8px;
  transition: transform var(--transition-bounce);
}

.mood-card:hover .mood-card-image,
.effect-card:hover .effect-image {
  transform: scale(1.1);
}

.card-label-main {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
}

/* メディアアイコン */
.media-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: background var(--transition-fast);
}

html[data-theme="dark"] .media-icon-wrap {
  background: #334155;
}

.media-card.is-selected .media-icon-wrap {
  background: var(--primary);
}

.media-icon {
  width: 20px;
  height: 20px;
  transition: filter var(--transition-fast);
}

html[data-theme="dark"] .media-icon {
  filter: invert(1);
}

.media-card.is-selected .media-icon {
  filter: brightness(0) invert(1);
}

/* スライダー */
.time-control {
  padding: 0 10px;
}

.slider {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--slider-track);
  outline: none;
  margin: 20px 0 10px;
  /* 下マージンを減らす */
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--slider-thumb);
  border: 2px solid var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0 2px;
  /* 両端のスライダー丸み分少し余白 */
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.slider-labels li {
  text-align: center;
  width: 40px;
  /* 固定幅を持たせて中央揃えしやすくする */
  display: flex;
  justify-content: center;
}

/* 最初と最後だけ位置調整 */
.slider-labels li:first-child {
  justify-content: flex-start;
  width: auto;
}

.slider-labels li:last-child {
  justify-content: flex-end;
  width: auto;
}

/* テキストエリア */
.text-input {
  width: 100%;
  border-radius: 16px;
  /* 角を少し丸く */
  border: 1px solid var(--border-subtle);
  padding: 16px;
  /* パディングを増やす */
  font-size: 1rem;
  /* 文字サイズ調整 */
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-main);
  resize: vertical;
  min-height: 120px;
  /* 高さ確保 */
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* アクションエリア */
.form-section-submit {
  text-align: center;
}

.primary-button {
  width: 100%;
  max-width: 320px;
  padding: 16px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.primary-button:active {
  transform: scale(var(--scale-pressed));
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ローディング */
.pharmacy-loading {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pharmacy-icon {
  font-size: 2rem;
  animation: shake 2s infinite ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(-10deg) scale(1.1);
  }

  75% {
    transform: rotate(10deg) scale(1.1);
  }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* 処方箋結果 */
.card-result {
  padding: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
  border: none;
}

.prescription-paper {
  background-color: var(--bg-paper);
  background-image: var(--paper-pattern);
  background-size: 20px 20px;
  padding: 32px 24px;
  /* スマホで窮屈にならないよう調整 */
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  /* 影を柔らかく */
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  /* カード感を強める */
  margin: 0;
  /* マージンリセット */
}

/* 模様を薄くするために背景色ブレンド調整 */
html[data-theme="light"] .prescription-paper {
  /* 白半透明を重ねて模様を薄く見せるハック、あるいはrgbaでパターン定義し直すべきだが今回は手軽に */
  background-image:
    linear-gradient(rgba(255, 252, 245, 0.5), rgba(255, 252, 245, 0.5)),
    var(--paper-pattern);
}

.prescription-paper::before {
  /* 紙の左端の穴や装飾用の線など (シンプルにするため今回は省略) */
  content: "";
}

.prescription-header {
  border-bottom: 2px solid var(--text-main);
  padding-bottom: 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.prescription-mark {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.prescription-date {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-subtle);
}

.prescription-title {
  font-size: 1.5rem;
  text-align: center;
  margin: 0 0 24px;
  font-family: var(--font-base);
  letter-spacing: 0.1em;
}

.markdown-output {
  font-size: 0.95rem;
  line-height: 2;
  /* 行間を広げて書き込みっぽく */
  color: var(--text-main);
  font-family: var(--font-handwriting);
}

.markdown-output h2 {
  font-size: 1.15rem;
  background: rgba(0, 0, 0, 0.03);
  /* 背景色追加でカード風強調 */
  padding: 12px 16px;
  border-radius: 12px;
  margin-top: 32px;
  margin-bottom: 16px;
  border-bottom: none;
  font-weight: 700;
}

html[data-theme="dark"] .markdown-output h2 {
  background: rgba(255, 255, 255, 0.05);
}

.markdown-output ul {
  list-style: none;
  /* デフォルトの点を消す */
  padding: 0;
}

.markdown-output li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
}

.markdown-output li::before {
  content: "・";
  position: absolute;
  left: 0;
  top: 0;
}

.prescription-footer {
  margin-top: 40px;
  text-align: right;
  /* タイトルと合わせる */
  font-size: 1.2rem;
  color: var(--text-subtle);
  opacity: 0.8;
}

.placeholder-text {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* 配信サービスリンク */
.service-links-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-pill {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  text-decoration: none;
  color: var(--text-subtle);
  transition: all var(--transition-fast);
}

.service-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-elevated);
}

/* ダイアログ (Modal) */
.modal {
  border: none;
  border-radius: var(--radius-card);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 0;
  width: 90%;
  max-width: 400px;
  background: var(--bg-card);
  color: var(--text-main);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-inner {
  padding: 32px;
}

.modal-title {
  margin-top: 0;
  font-size: 1.2rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--text-subtle);
  margin-bottom: 24px;
  line-height: 1.6;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-actions {
  margin-top: 24px;
}

/* スマホ最適化 (ボトムシート風) */
@media (max-width: 640px) {
  .app-main {
    padding-bottom: 100px;
    /* ボトムシート用の余白 */
  }

  /* フォーム送信ボタンを浮遊させる */
  .form-section-submit {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    padding: 16px 20px 24px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-top: 1px solid var(--border-subtle);
    border-radius: 20px 20px 0 0;
  }

  html[data-theme="dark"] .form-section-submit {
    background: #1e293b;
    border-color: #334155;
  }

  .primary-button {
    max-width: none;
    width: 100%;
  }

  /* ローディング表示もボトムシート内に */
  .pharmacy-loading {
    margin-top: 8px;
    flex-direction: row;
    justify-content: center;
  }

  .pharmacy-icon {
    font-size: 1.5rem;
  }

  .prescription-paper {
    padding: 24px;
    width: auto;
    margin: 0;
    transform: none;
    /* スマホでは傾きなしで見やすく */
  }
}

.donation-section {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-strong);
  text-align: center;
}

.donation-message {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  font-family: var(--font-handwriting);
}

.donation-button {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-handwriting);
  font-weight: 700;
  color: #c2410c;
  /* スタンプっぽい朱色/オレンジ */
  border: 2px solid #c2410c;
  border-radius: 8px;
  padding: 12px 32px;
  background: var(--bg-card);
  border: 2px solid var(--text-muted);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.donation-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-elevated);
}

/* シェアボタン */
.share-container {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  /* スマホで折り返す */
}

@media (max-width: 600px) {
  .share-container {
    flex-direction: column;
    /* スマホでは縦並び */
    align-items: stretch;
    /* 横幅いっぱいに */
    gap: 12px;
    max-width: 280px;
    /* 幅制限 */
    margin-left: auto;
    margin-right: auto;
  }

  .share-button {
    justify-content: center;
    /* テキスト中央揃え */
    padding: 14px;
    /* 高さ確保 */
  }
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1;
  color: #fff;
  /* 共通で白文字 */
}

.x-share-button {
  background: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.x-share-button:hover {
  background: #333;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.line-share-button {
  background: #06c755;
  box-shadow: 0 4px 12px rgba(6, 199, 85, 0.15);
}

.line-share-button:hover {
  background: #05b34d;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 199, 85, 0.2);
}

.share-button:active {
  transform: translateY(0);
}

html[data-theme="dark"] .x-share-button {
  background: #fff;
  color: #000;
}

html[data-theme="dark"] .x-share-button:hover {
  background: #e2e8f0;
}

/* LINEボタンはダークモードでも緑のままが見やすいが、微調整 */
html[data-theme="dark"] .line-share-button {
  opacity: 0.9;
}

/* お薬手帳ボタン */
.history-toggle {
  background: white;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
  margin-left: 8px;
  /* ダークモードボタンの横 */
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.history-toggle:hover {
  background: var(--bg-card-elevated);
  border-color: var(--primary);
  color: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-subtle);
}

html[data-theme="dark"] .history-toggle {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-subtle);
}

html[data-theme="dark"] .history-toggle:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

/* 履歴モーダル */
.history-modal {
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  padding: 0;
  border: none;
  border-radius: var(--radius-card);
  background: var(--bg-paper);
  /* 紙の背景 */
  background-image: var(--paper-pattern);
  background-size: 20px 20px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.history-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.history-modal .modal-inner {
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text-muted);
}

.modal-title {
  margin: 0;
  font-size: 1.4rem;
}

.close-modal-button {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 8px;
}

.close-modal-button:hover {
  color: var(--text-main);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* 履歴アイテム（日記帳風） */
.history-item {
  position: relative;
  padding: 16px 0 24px 24px;
  /* 左にタイムライン用の余白 */
  border-left: 2px solid var(--border-subtle);
}

.history-item:last-child {
  border-left-color: transparent;
}

.history-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--primary);
}

.history-date {
  font-weight: 700;
  color: var(--primary-strong);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.history-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

html[data-theme="dark"] .history-card {
  background: rgba(30, 41, 59, 0.6);
}

.history-meta {
  display: flex;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.history-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.history-content {
  font-size: 0.9rem;
  line-height: 1.6;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 8px;
}

.history-content h3 {
  font-size: 1rem;
  margin: 8px 0 4px;
}

.history-empty-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* レスポンシブでボタンを隠さない */
@media (max-width: 640px) {
  .history-toggle span {
    display: none;
    /* アイコンだけにする */
  }
}