/* ============================================================
   Trip Memories - Main CSS
   ポケモン最新Switchタイトル（スカーレット/バイオレット・レジェンズ アルセウス）
   風の「二人の図鑑・トレーナーカード」UIデザイン。
   TOMMY=バイオレット、Lisa=スカーレットの2トレーナーカラーを基調に、
   訪れた場所を「捕まえた思い出」として図鑑番号付きでカタログ化する。
   ============================================================ */

/* ============================================================
   CSS カスタムプロパティ（デザイントークン）
   ============================================================ */
:root {
  /* ベース（Switch本体のホーム画面のような、淡いラベンダーの発光背景） */
  --color-bg:           #F3EEFF;
  --color-bg-card:      #FFFFFF;
  --color-bg-overlay:   rgba(246, 242, 255, 0.88);
  --color-surface:      #FFFFFF;
  --color-border:       #2A2140;
  --color-border-light: #E5DEFA;

  /* テキスト（インクのような深いプラム色） */
  --color-text-primary:   #2A2140;
  --color-text-secondary: #6E6389;
  --color-text-muted:     #9C93B8;
  --color-text-light:     #D3CCEA;

  /* 図鑑ゴールド（二人共通の実績・トリムカラー） */
  --color-gold:         #FFC53D;
  --color-gold-light:   #FFDD85;
  --color-gold-subtle:  #FFF3D9;
  --color-navy:         #3A5CE0;
  --color-dusty-pink:   #FF8FA3;

  /* カードの巡回アクセント（図鑑タイプチップ風） */
  --color-tile-red:    #FF5D73;
  --color-tile-blue:   #4C8DFF;
  --color-tile-green:  #2FD1A3;
  --color-tile-purple: #8C6CF0;

  /* トレーナーカラー：TOMMY=バイオレット / Lisa=スカーレット */
  --color-tommy:        #6C5CE7;
  --color-tommy-light:  #ECE7FF;
  --color-tommy-border: rgba(108, 92, 231, 0.35);
  --color-lisa:         #FF5D73;
  --color-lisa-light:   #FFE7EA;
  --color-lisa-border:  rgba(255, 93, 115, 0.35);

  /* 追加のトレーナー／タイプカラー */
  --color-violet:       #6C5CE7;
  --color-violet-deep:  #4B3BB5;
  --color-scarlet:      #FF5D73;
  --color-scarlet-deep: #D63A54;
  --color-mint:         #2FD1A3;
  --color-mint-deep:    #1CA987;
  --color-sky:          #4C8DFF;
  --color-sky-deep:     #2E67D9;

  --gradient-duo:  linear-gradient(135deg, var(--color-violet) 0%, var(--color-scarlet) 100%);
  --gradient-holo: linear-gradient(115deg, rgba(255,255,255,0) 32%, rgba(255,255,255,0.45) 48%, rgba(255,255,255,0) 64%);

  /* タイポグラフィ：実機のポケモンSwitch UIと同じ丸ゴシック一系統＋数字用フォント */
  --font-serif:   'M PLUS Rounded 1c', var(--font-sans);
  --font-sans:    'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  --font-display: 'M PLUS Rounded 1c', var(--font-serif);
  --font-numeral: 'Baloo 2', var(--font-display);

  /* スペーシング */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* 角丸（メニュータイルのような、柔らかく大きい丸み） */
  --radius-sm:   12px;
  --radius-md:   20px;
  --radius-lg:   28px;
  --radius-full: 9999px;

  /* シャドウ（発光・浮遊感のあるソフトなグロー影） */
  --shadow-sm:   0 2px 8px rgba(42, 33, 64, 0.10), 0 1px 2px rgba(42, 33, 64, 0.08);
  --shadow-md:   0 10px 24px rgba(42, 33, 64, 0.14), 0 2px 6px rgba(42, 33, 64, 0.08);
  --shadow-lg:   0 18px 36px rgba(42, 33, 64, 0.18), 0 4px 12px rgba(42, 33, 64, 0.10);
  --shadow-xl:   0 28px 56px rgba(42, 33, 64, 0.24), 0 8px 20px rgba(42, 33, 64, 0.12);

  /* トランジション（ぷにっと弾むイージング） */
  --transition-fast:   160ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-normal: 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow:   420ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* レイアウト */
  --header-height:  68px;
  --sidebar-width:  320px;
  --max-content:    1200px;
}

/* ============================================================
   リセット・ベース
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(108, 92, 231, 0.16) 0%, transparent 42%),
    radial-gradient(circle at 88% 6%, rgba(255, 93, 115, 0.14) 0%, transparent 40%),
    radial-gradient(circle at 92% 90%, rgba(47, 209, 163, 0.14) 0%, transparent 38%),
    radial-gradient(circle at 6% 92%, rgba(255, 197, 61, 0.18) 0%, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Switch本体のホーム画面のような、極小の光る点グリッドを全体に薄く敷く */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image: radial-gradient(rgba(108, 92, 231, 0.08) 1.4px, transparent 1.4px);
  background-size: 24px 24px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ============================================================
   タイポグラフィ
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text-primary);
}

/* ロゴ・大見出し：バイオレット→スカーレットのデュオトーングラデーション文字 */
.text-display {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0.02em;
  background: var(--gradient-duo);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--color-text-primary);
  filter: drop-shadow(0 2px 0 rgba(42, 33, 64, 0.25));
}

.text-heading {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  letter-spacing: 0.01em;
  font-weight: 700;
}

.text-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 700;
}

/* ============================================================
   共通レイアウト
   ============================================================ */
.tm-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ヘッダー: Switchのメニューバーのような、光沢のあるガラス質HUD */
.tm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background:
    linear-gradient(120deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.35) 45%, rgba(255,255,255,0.08) 100%),
    linear-gradient(120deg, #EDE7FF 0%, #FFFFFF 42%, #FFE9EF 100%);
  border-bottom: 2px solid var(--color-border-light);
  box-shadow: 0 4px 24px rgba(42, 33, 64, 0.14);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 100;
  overflow: hidden;
}

/* 常時ゆっくり流れるホロ・シーン（トレーディングカードの箔押しのような光の帯） */
.tm-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-holo);
  transform: translateX(-120%);
  animation: tm-header-holo 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tm-header-holo {
  0%   { transform: translateX(-120%); }
  40%  { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.tm-header__logo {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

/* テキストロゴ（幅が十分なとき表示） */
.tm-header__logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.tm-header__logo-accent {
  background: var(--gradient-duo);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
}

/* コンパスアイコン（幅が狭いときのみ表示、通常時は非表示） */
.tm-header__logo-icon {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  height: 36px;
  width: 36px;
  filter: drop-shadow(0 2px 4px rgba(108, 92, 231, 0.35));
}

/* 幅が狭くなったらテキスト→アイコンに切り替え */
@media (max-width: 600px) {
  .tm-header__logo-text {
    display: none;
  }
  .tm-header__logo-icon {
    display: flex;
  }
}

.tm-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
}

.tm-main {
  flex: 1;
  padding-top: var(--header-height);
}

/* ============================================================
   ビュートグル（ヘッダー中央固定） - メニュータブ風セグメントコントロール
   ============================================================ */
.tm-view-toggle {
  display: flex;
  align-items: center;
  background: rgba(42, 33, 64, 0.08);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  position: relative;
  z-index: 1;
}

.tm-view-toggle__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tm-view-toggle__btn.is-active {
  background: var(--gradient-duo);
  color: #fff;
  box-shadow: 0 3px 10px rgba(108, 92, 231, 0.4), 0 1px 0 rgba(255,255,255,0.4) inset;
  transform: translateY(-1px);
}

.tm-view-toggle__btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============================================================
   ユーザーアバター（トレーナーアイコン：色付きリング＋光沢）
   ============================================================ */
.tm-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: white;
  flex-shrink: 0;
  font-family: var(--font-display);
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(42, 33, 64, 0.24), 0 0 0 2px currentColor inset;
  transition: transform var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.tm-user-avatar::after {
  content: '';
  position: absolute;
  top: -30%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.tm-user-avatar:hover {
  transform: translateY(-2px) scale(1.05);
}

.tm-user-avatar--tommy { background: var(--color-tommy); color: var(--color-tommy-light); }
.tm-user-avatar--lisa  { background: var(--color-lisa); color: var(--color-lisa-light); }

/* ============================================================
   ボタン（グロス感のあるカプセル型「押せる」ゲームUIボタン）
   ============================================================ */
.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 11px 26px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* 上部のガラス光沢ハイライト（全ボタン共通） */
.tm-btn::before {
  content: '';
  position: absolute;
  inset: 0 0 55% 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 100%);
  border-radius: var(--radius-full) var(--radius-full) 0 0;
  pointer-events: none;
  z-index: 1;
}

.tm-btn > * {
  position: relative;
  z-index: 2;
}

.tm-btn--primary {
  background: linear-gradient(160deg, var(--color-violet) 0%, #5847D0 100%);
  color: white;
  box-shadow: 0 4px 0 var(--color-violet-deep), 0 8px 18px rgba(108, 92, 231, 0.35);
}

.tm-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--color-violet-deep), 0 12px 22px rgba(108, 92, 231, 0.4);
}

.tm-btn--primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--color-violet-deep);
}

.tm-btn--gold {
  background: linear-gradient(160deg, var(--color-gold-light) 0%, var(--color-gold) 100%);
  color: var(--color-text-primary);
  box-shadow: 0 4px 0 #C98F00, 0 8px 18px rgba(255, 197, 61, 0.35);
}

.tm-btn--gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #C98F00, 0 12px 22px rgba(255, 197, 61, 0.4);
}

.tm-btn--gold:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #C98F00;
}

.tm-btn--outline {
  border: 2px solid var(--color-border-light);
  color: var(--color-text-secondary);
  background: var(--color-surface);
  box-shadow: 0 3px 0 rgba(42, 33, 64, 0.08);
}

.tm-btn--outline:hover {
  border-color: var(--color-violet);
  color: var(--color-violet);
  background: var(--color-tommy-light);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(42, 33, 64, 0.08);
}

.tm-btn--ghost {
  color: var(--color-text-secondary);
  background: transparent;
  padding: 8px 16px;
  border: 2px solid transparent;
  box-shadow: none;
}

.tm-btn--ghost::before {
  display: none;
}

.tm-btn--ghost:hover {
  background: var(--color-gold-subtle);
  color: var(--color-text-primary);
  border-color: var(--color-border-light);
}

.tm-btn--danger {
  background: linear-gradient(160deg, #FF7A73 0%, var(--color-scarlet-deep) 100%);
  color: white;
  border: 2px solid transparent;
  box-shadow: 0 4px 0 #A32739, 0 8px 18px rgba(214, 58, 84, 0.35);
}

.tm-btn--danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #A32739, 0 12px 22px rgba(214, 58, 84, 0.4);
}

.tm-btn--danger:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #A32739;
}

.tm-btn--danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 0 #A32739;
}

.tm-btn--sm {
  padding: 7px 18px;
  font-size: 0.8rem;
}

.tm-btn--lg {
  padding: 15px 34px;
  font-size: 1.02rem;
}

.tm-btn--icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

.tm-btn--icon-sm {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
}

/* ============================================================
   フォーム要素
   ============================================================ */
.tm-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.tm-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  font-weight: 700;
}

.tm-input,
.tm-select,
.tm-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.tm-input:focus,
.tm-select:focus,
.tm-textarea:focus {
  border-color: var(--color-violet);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18);
}

.tm-input.is-error,
.tm-select.is-error {
  border-color: var(--color-scarlet-deep);
  box-shadow: 0 0 0 4px rgba(214, 58, 84, 0.16);
}

.tm-input--search {
  padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239C93B8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.tm-textarea {
  resize: vertical;
  min-height: 100px;
}

.tm-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239C93B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   カード（図鑑エントリーカード：番号バッジ＋光沢＋トレーナーカラーのライン）
   ============================================================ */
.tm-card {
  background: var(--color-bg-card);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
}

/* 図鑑ナンバー（カード登場順に自動採番。「何番目に登録した思い出か」を示す） */
.tm-album-grid {
  counter-reset: tm-entry;
}

.tm-album-grid .tm-card {
  counter-increment: tm-entry;
}

.tm-card::before {
  content: 'No.' counter(tm-entry, decimal-leading-zero);
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  font-family: var(--font-numeral);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(3px);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

/* 光沢スイープ：トレカを傾けたときの箔押しのような反射 */
.tm-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--gradient-holo);
  transform: translateX(-140%) skewX(-12deg);
  transition: transform 650ms ease;
  pointer-events: none;
}

.tm-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-violet);
}

.tm-card:hover::after {
  transform: translateX(140%) skewX(-12deg);
}

/* カード下部のアクセントラインをカードごとに巡回させて、図鑑タイプチップのように */
.tm-album-grid .tm-card { border-bottom: 5px solid var(--color-border-light); }
.tm-album-grid .tm-card:nth-child(4n+1) { border-bottom-color: var(--color-tile-blue); }
.tm-album-grid .tm-card:nth-child(4n+2) { border-bottom-color: var(--color-tile-red); }
.tm-album-grid .tm-card:nth-child(4n+3) { border-bottom-color: var(--color-tile-green); }
.tm-album-grid .tm-card:nth-child(4n+4) { border-bottom-color: var(--color-tile-purple); }

.tm-card__image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--color-gold-subtle);
}

.tm-card__image-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--color-tommy-light) 0%, var(--color-gold-subtle) 50%, var(--color-lisa-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
}

.tm-card__body {
  padding: var(--space-md);
}

.tm-card__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.5;
}

.tm-card__meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: var(--space-sm);
}

.tm-card__meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tm-card__meta-item svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--color-gold);
}

/* ============================================================
   モーダル
   ============================================================ */
.tm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 33, 64, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.tm-modal-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.tm-modal {
  background: var(--color-surface);
  border: 3px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.94);
  transition: transform var(--transition-normal);
}

.tm-modal-overlay.is-open .tm-modal {
  transform: translateY(0) scale(1);
}

.tm-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 2px solid var(--color-border-light);
  background: linear-gradient(120deg, var(--color-tommy-light) 0%, var(--color-surface) 55%, var(--color-lisa-light) 100%);
}

.tm-modal__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text-primary);
}

.tm-modal__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 2px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.tm-modal__close:hover {
  background: var(--color-scarlet);
  border-color: var(--color-scarlet);
  color: white;
  transform: rotate(90deg);
}

.tm-modal__body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tm-modal__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 2px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ============================================================
   スライドパネル（新規記事作成）
   ============================================================ */
.tm-slide-panel {
  position: fixed;
  z-index: 1000;
  background: var(--color-surface);
  box-shadow: var(--shadow-xl);
  transition: transform var(--transition-slow);
  overflow-y: auto;
  border-left: 3px solid var(--color-border-light);
}

/* PC: 右からスライド */
@media (min-width: 768px) {
  .tm-slide-panel {
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    transform: translateX(100%);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  }
  .tm-slide-panel.is-open {
    transform: translateX(0);
  }
}

/* SP: 下からスライド */
@media (max-width: 767px) {
  .tm-slide-panel {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 90vh;
    transform: translateY(100%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none;
    border-top: 3px solid var(--color-border-light);
  }
  .tm-slide-panel.is-open {
    transform: translateY(0);
  }
  /* SPパネルオープン時はFABを画面外に退避 */
  .tm-slide-panel.is-open ~ .tm-fab,
  body.panel-open .tm-fab {
    transform: scale(0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

.tm-slide-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 2px solid var(--color-border-light);
  position: sticky;
  top: 0;
  background: linear-gradient(120deg, var(--color-tommy-light) 0%, var(--color-surface) 55%, var(--color-lisa-light) 100%);
  z-index: 1;
}

.tm-slide-panel__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
}

.tm-slide-panel__body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.tm-slide-panel__footer {
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  border-top: 2px solid var(--color-border-light);
}

/* ============================================================
   フローティングアクションボタン（FAB） - 二人の色が融け合う「メモリーカプセル」
   ============================================================ */
.tm-fab {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid white;
  background:
    linear-gradient(180deg, var(--color-violet) 0%, var(--color-violet) 46%, var(--color-border) 46%, var(--color-border) 54%, var(--color-scarlet) 54%, var(--color-scarlet) 100%);
  box-shadow: 0 6px 0 rgba(42, 33, 64, 0.28), 0 12px 26px rgba(42, 33, 64, 0.32);
  z-index: 1200;
  transition: all var(--transition-fast);
  animation: tm-fab-pulse 2.4s ease-in-out infinite;
  overflow: hidden;
}

/* カプセル中央の白いリング（ポケモンの捕獲カプセルを思わせるシルエット） */
.tm-fab::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  background: white;
  border: 3px solid var(--color-border);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

.tm-fab:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 8px 0 rgba(42, 33, 64, 0.28), 0 16px 30px rgba(42, 33, 64, 0.34);
  animation-play-state: paused;
}

.tm-fab:active {
  transform: translateY(3px) scale(1.02);
  box-shadow: 0 2px 0 rgba(42, 33, 64, 0.28), 0 6px 16px rgba(42, 33, 64, 0.3);
}

@keyframes tm-fab-pulse {
  0%, 100% { box-shadow: 0 6px 0 rgba(42, 33, 64, 0.28), 0 12px 26px rgba(42, 33, 64, 0.32), 0 0 0 0 rgba(255, 197, 61, 0.55); }
  50%      { box-shadow: 0 6px 0 rgba(42, 33, 64, 0.28), 0 12px 26px rgba(42, 33, 64, 0.32), 0 0 0 10px rgba(255, 197, 61, 0); }
}

.tm-fab svg {
  width: 22px;
  height: 22px;
  position: relative;
  z-index: 2;
  color: var(--color-text-primary);
}

/* FABのツールチップ */
.tm-fab::after {
  content: attr(title);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-text-primary);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-sm);
  z-index: 3;
}

.tm-fab:hover::after {
  opacity: 1;
}

/* FAB プラスアイコン（通常状態） */
.tm-fab .tm-fab-icon-plus {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms ease, transform 200ms ease;
  opacity: 1;
  transform: rotate(0deg) scale(1);
  z-index: 2;
}

/* FAB ×アイコン（パネルopen時） */
.tm-fab .tm-fab-icon-close {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms ease, transform 200ms ease;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
  z-index: 2;
}

/* パネルオープン時のFAB状態 */
.tm-fab.is-open {
  background: linear-gradient(180deg, var(--color-text-secondary) 0%, var(--color-text-secondary) 46%, var(--color-border) 46%, var(--color-border) 54%, var(--color-text-secondary) 54%, var(--color-text-secondary) 100%);
  animation: none;
}

.tm-fab.is-open .tm-fab-icon-plus {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.tm-fab.is-open .tm-fab-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* パネルオープン時に検索バーを非表示（被り防止） */
.tm-map-search-bar.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.tm-map-search-bar {
  transition: opacity 200ms ease, transform 200ms ease;
}

/* ============================================================
   画面遷移アニメーション（マップ間をワープするような演出）
   ============================================================ */

.tm-page-transition {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  transform: translateX(100%);
  background-image:
    linear-gradient(
      to right,
      rgba(255, 255, 255, 0.0) 0px,
      rgba(255, 255, 255, 0.25) 4px,
      transparent 10px
    ),
    linear-gradient(
      135deg,
      var(--color-violet) 0%,
      var(--color-sky) 25%,
      var(--color-gold) 50%,
      var(--color-scarlet) 75%,
      var(--color-mint) 100%
    );
  transition: transform 480ms cubic-bezier(0.76, 0, 0.24, 1);
  box-shadow: -6px 0 32px rgba(42, 33, 64, 0.4);
}

/* スライドイン開始 */
.tm-page-transition.is-entering {
  transform: translateX(0);
  pointer-events: all;
}

/* ページ入場時: 左に消えていく */
.tm-page-transition.is-leaving {
  transform: translateX(-30%);
  opacity: 0;
  transition:
    transform 380ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity   380ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ページ入場時のフェードイン */
.tm-main {
  animation: tmPageEnter 480ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes tmPageEnter {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================================
   ポップアップ（地図上の記事一覧）
   ============================================================ */
.tm-map-popup {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 300px;
  max-height: 420px;
  overflow-y: auto;
  border: 2px solid var(--color-border-light);
  z-index: 1300;
}

.tm-map-popup__header {
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 2px solid var(--color-border-light);
  background: linear-gradient(120deg, var(--color-tommy-light) 0%, var(--color-surface) 55%, var(--color-lisa-light) 100%);
}

.tm-map-popup__location {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.tm-map-popup__list {
  padding: var(--space-sm) 0;
}

.tm-map-popup__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.tm-map-popup__item:hover {
  background: var(--color-gold-subtle);
}

.tm-map-popup__item-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-gold-subtle);
  flex-shrink: 0;
  border: 2px solid var(--color-border-light);
}

.tm-map-popup__item-info {
  flex: 1;
  min-width: 0;
}

.tm-map-popup__item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-map-popup__item-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.tm-map-popup__footer {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 2px solid var(--color-border-light);
}

.tm-map-popup__empty {
  padding: var(--space-md);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ============================================================
   サジェストドロップダウン
   ============================================================ */
.tm-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1150;
  max-height: 280px;
  overflow-y: auto;
}

.tm-suggest__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  gap: var(--space-sm);
}

.tm-suggest__item:hover,
.tm-suggest__item.is-active {
  background: var(--color-gold-subtle);
}

.tm-suggest__name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-suggest__count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-primary);
  background: var(--color-gold);
  padding: 2px 9px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.tm-suggest__divider {
  height: 2px;
  background: var(--color-border-light);
  margin: 4px 0;
}

.tm-suggest__section-label {
  padding: 6px var(--space-md) 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ============================================================
   バッジ（絞り込み条件表示）
   ============================================================ */
.tm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--color-tommy-light);
  border: 2px solid var(--color-violet);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-violet-deep);
}

.tm-badge__remove {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.tm-badge__remove:hover {
  background: var(--color-scarlet);
  color: white;
  transform: rotate(90deg);
}

/* ============================================================
   ローディング（モンスターボール風の回転スピナー）
   ============================================================ */
.tm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.tm-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid var(--color-border-light);
  border-top-color: var(--color-violet);
  border-right-color: var(--color-scarlet);
  animation: tm-spin 0.8s linear infinite;
}

@keyframes tm-spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   トースト通知
   ============================================================ */
.tm-toast-container {
  position: fixed;
  bottom: 90px;
  right: var(--space-lg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.tm-toast {
  background: var(--color-text-primary);
  color: white;
  padding: 13px 22px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: tm-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  max-width: 320px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.tm-toast--success { background: linear-gradient(135deg, var(--color-mint) 0%, var(--color-mint-deep) 100%); }
.tm-toast--error   { background: linear-gradient(135deg, #FF7A73 0%, var(--color-scarlet-deep) 100%); }

@keyframes tm-toast-in {
  from { opacity: 0; transform: translateX(30px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes tm-toast-out {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(30px) scale(0.9); }
}

.tm-toast.is-hiding {
  animation: tm-toast-out 0.3s ease forwards;
}

/* ============================================================
   区切り線
   ============================================================ */
.tm-divider {
  height: 2px;
  background: var(--color-border-light);
  margin: var(--space-md) 0;
}

.tm-divider--gold {
  height: 3px;
  background: repeating-linear-gradient(to right, var(--color-gold) 0, var(--color-gold) 8px, transparent 8px, transparent 14px);
}

/* ============================================================
   ユーティリティ
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-sm      { gap: var(--space-sm); }
.gap-md      { gap: var(--space-md); }

.w-full      { width: 100%; }
.mt-sm       { margin-top: var(--space-sm); }
.mt-md       { margin-top: var(--space-md); }
.mt-lg       { margin-top: var(--space-lg); }

/* ============================================================
   ログイン画面 - 「トレーナーカード」風のホロカード
   ============================================================ */
.tm-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.tm-login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(108, 92, 231, 0.2) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(255, 93, 115, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 20% 85%, rgba(47, 209, 163, 0.16) 0%, transparent 42%),
    radial-gradient(circle at 85% 85%, rgba(255, 197, 61, 0.22) 0%, transparent 45%),
    radial-gradient(rgba(108, 92, 231, 0.08) 1.4px, transparent 1.4px);
  background-size: auto, auto, auto, auto, 24px 24px;
  pointer-events: none;
}

.tm-login-card {
  background: var(--color-surface);
  border: 3px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* トレカの箔押しのようなホロ・シーンが縁を流れる */
.tm-login-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-holo);
  transform: translateX(-140%) skewX(-14deg);
  animation: tm-login-holo 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tm-login-holo {
  0%   { transform: translateX(-140%) skewX(-14deg); }
  55%  { transform: translateX(140%) skewX(-14deg); }
  100% { transform: translateX(140%) skewX(-14deg); }
}

.tm-login-card::before {
  content: 'START';
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  background: var(--gradient-duo);
  color: white;
  font-family: var(--font-numeral);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  padding: 6px 20px;
  border-radius: var(--radius-full);
  border: 3px solid white;
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.tm-login-card__logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.tm-login-card__logo-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  background: var(--gradient-duo);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px var(--color-text-primary);
}

.tm-login-card__logo-subtitle {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.tm-login-card__logo-ornament {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: center;
  margin: var(--space-md) 0;
  color: var(--color-gold);
}

.tm-login-card__logo-ornament::before,
.tm-login-card__logo-ornament::after {
  content: '';
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(to right, var(--color-gold) 0, var(--color-gold) 6px, transparent 6px, transparent 11px);
}

.tm-login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.tm-login-form__pw-wrap {
  position: relative;
}

.tm-login-form__pw-wrap .tm-input {
  padding-right: 44px;
}

.tm-login-form__pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.tm-login-form__pw-toggle:hover {
  color: var(--color-text-primary);
  background: var(--color-gold-subtle);
}

.tm-login-form__error {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-scarlet-deep);
  display: none;
  padding: 9px 14px;
  background: var(--color-lisa-light);
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-scarlet-deep);
}

.tm-login-form__error.is-visible {
  display: block;
}

.tm-login-form__submit {
  margin-top: var(--space-sm);
}

/* ============================================================
   マップ画面 - 光沢のある地方マップ風
   ============================================================ */
.tm-map-view {
  position: relative;
  height: calc(100vh - var(--header-height));
}

#tm-map {
  width: 100%;
  height: 100%;
}

.tm-map-search-bar {
  position: absolute;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, calc(100% - var(--space-xl) * 2));
  z-index: 1100;
}

.tm-map-search-bar__inner {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--color-border-light);
}

.tm-map-search-bar__input {
  width: 100%;
  padding: 13px 20px 13px 44px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-primary);
  outline: none;
}

.tm-map-search-bar__icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.tm-map-search-bar .tm-suggest {
  border-radius: var(--radius-lg);
  margin-top: 4px;
  z-index: 1150;
}

/* Leaflet カスタムピン */
.tm-map-pin {
  width: 32px;
  height: 40px;
  position: relative;
  filter: drop-shadow(0 3px 4px rgba(42, 33, 64, 0.35));
}

.tm-map-pin__dot {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: absolute;
  top: 0;
  left: 6px;
  border: 3px solid white;
  box-shadow: var(--shadow-md);
}

.tm-map-pin__dot--gold { background: var(--color-gold); }

/* ============================================================
   Leaflet ズームコントロール リッチデザイン
   ============================================================ */
.leaflet-control-zoom {
  border: 2px solid var(--color-border-light) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 16px !important;
  overflow: hidden;
  margin-bottom: 28px !important;
  margin-left: var(--space-md) !important;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  background: var(--color-surface) !important;
  color: var(--color-text-primary) !important;
  border: none !important;
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  transition: all var(--transition-fast) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.leaflet-control-zoom-in {
  border-bottom: 2px solid var(--color-border-light) !important;
}

.leaflet-control-zoom-out {
  border-bottom: none !important;
}

.leaflet-control-zoom-in:hover,
.leaflet-control-zoom-out:hover {
  background: var(--gradient-duo) !important;
  color: white !important;
}

/* 地図のカラートーン: ラベンダーがかった、光沢のある地方マップ調 */
#tm-map .leaflet-tile-pane {
  filter:
    saturate(1.2)
    brightness(1.04)
    contrast(1.06)
    hue-rotate(8deg);
}

/* 地図全体にバイオレットのビネットを重ねてゲーム画面の縁取り感を演出 */
#tm-map::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 400;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(108, 92, 231, 0.12) 100%
  );
  box-shadow: inset 0 0 0 6px rgba(255, 197, 61, 0.45);
}

/* 地図のアトリビューションをサイトカラーに合わせる */
.leaflet-control-attribution {
  background: rgba(246, 242, 255, 0.9) !important;
  color: var(--color-text-muted) !important;
  font-size: 10px !important;
  border-radius: var(--radius-sm) 0 0 0 !important;
  padding: 3px 8px !important;
}

.leaflet-control-attribution a {
  color: var(--color-violet) !important;
  font-weight: 700;
}

/* Leafletポップアップのカスタマイズ */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  border: 2px solid var(--color-border-light);
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: 300px !important;
}

.leaflet-popup-tip-container {
  display: none;
}

/* ============================================================
   アルバム画面
   ============================================================ */
.tm-album-view {
  padding: var(--space-lg);
  max-width: var(--max-content);
  margin: 0 auto;
}

.tm-album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.tm-album-toolbar__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  background: var(--gradient-duo);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0.6px var(--color-text-primary);
}

.tm-album-filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.tm-album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .tm-album-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

@media (min-width: 1200px) {
  .tm-album-grid {
    gap: var(--space-xl);
  }
}

.tm-album-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 3px dashed var(--color-border-light);
  border-radius: var(--radius-lg);
}

.tm-album-empty__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.7;
  animation: tm-fab-pulse 2.4s ease-in-out infinite;
}

.tm-album-empty__text {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.tm-album-empty__sub {
  font-size: 0.88rem;
  font-weight: 600;
}

/* ============================================================
   記事個別ページ
   ============================================================ */
.tm-article-view {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg) var(--space-2xl);
}

.tm-article-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 3px dashed var(--color-border-light);
}

.tm-article-title-input {
  width: 100%;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--color-text-primary);
  border: none;
  background: transparent;
  outline: none;
  line-height: 1.4;
  padding: 0;
  border-bottom: 3px solid transparent;
  transition: border-color var(--transition-fast);
}

.tm-article-title-input:focus {
  border-bottom-color: var(--color-violet);
}

.tm-article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.tm-article-meta__item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tm-article-meta__item svg {
  width: 14px;
  height: 14px;
  color: var(--color-gold);
}

.tm-article-meta__location {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px dashed var(--color-border);
  transition: color var(--transition-fast);
}

.tm-article-meta__location:hover {
  color: var(--color-violet);
}

/* スクラップブック（図鑑ページのようなブロック配置） */
.tm-scrapbook {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .tm-scrapbook {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

.tm-block {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-bg-card);
  border: 2px solid var(--color-border-light);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.tm-block:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.tm-block--tommy {
  border-color: var(--color-tommy);
  background: var(--color-tommy-light);
}

.tm-block--lisa {
  border-color: var(--color-lisa);
  background: var(--color-lisa-light);
}

.tm-block--wide {
  grid-column: span 2;
}

.tm-block__user-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  color: white;
  z-index: 2;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.tm-block__user-badge--tommy { background: var(--color-tommy); }
.tm-block__user-badge--lisa  { background: var(--color-lisa); }

.tm-block__controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 3;
}

.tm-block:hover .tm-block__controls {
  opacity: 1;
}

.tm-block__control-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--color-border-light);
  transition: all var(--transition-fast);
}

.tm-block__control-btn:hover {
  background: var(--color-violet);
  color: white;
  border-color: var(--color-violet);
}

.tm-block__control-btn--delete:hover {
  background: var(--color-scarlet);
  color: white;
  border-color: var(--color-scarlet);
}

/* 画像ブロック */
.tm-block--image .tm-block__image {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  transition: transform var(--transition-slow);
}

.tm-block--image:hover .tm-block__image {
  transform: scale(1.03);
}

/* テキストブロック */
.tm-block--text {
  padding: var(--space-md);
  padding-top: calc(var(--space-md) + 26px);
}

.tm-block__text-content {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 60px;
  outline: none;
  cursor: text;
}

.tm-block__text-content:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-light);
  pointer-events: none;
}

/* ブロック追加エリア */
.tm-block-add-area {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 3px dashed var(--color-violet);
  border-radius: var(--radius-md);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: var(--color-tommy-light);
}

.tm-block-add-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border: 2px solid var(--color-border-light);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  box-shadow: 0 3px 0 rgba(42, 33, 64, 0.08);
  transition: all var(--transition-fast);
}

.tm-block-add-btn:hover {
  border-color: var(--color-violet);
  color: white;
  background: var(--gradient-duo);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(42, 33, 64, 0.08);
}

/* ドラッグ中 */
.tm-block.sortable-ghost {
  opacity: 0.4;
  background: var(--color-gold-subtle);
}

.tm-block.sortable-drag {
  box-shadow: var(--shadow-xl);
  transform: rotate(2deg);
}

/* 保存ボタンエリア */
.tm-article-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 2px solid var(--color-border-light);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  z-index: 50;
}

.tm-article-save-bar__status {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ============================================================
   画像ライトボックス
   ============================================================ */
.tm-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 30, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.tm-lightbox.is-open {
  opacity: 1;
  pointer-events: all;
}

.tm-lightbox__image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 4px solid white;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform var(--transition-normal);
}

.tm-lightbox.is-open .tm-lightbox__image {
  transform: scale(1);
}

.tm-lightbox__close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--gradient-duo);
  border: 3px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all var(--transition-fast);
}

.tm-lightbox__close:hover {
  transform: rotate(90deg) scale(1.05);
}

/* ============================================================
   画像アップロードUI
   ============================================================ */
.tm-upload-area {
  border: 3px dashed var(--color-violet);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-tommy-light);
}

.tm-upload-area:hover,
.tm-upload-area.is-dragover {
  border-color: var(--color-scarlet);
  background: var(--color-lisa-light);
  transform: translateY(-2px);
}

.tm-upload-area__icon {
  color: var(--color-violet);
  margin-bottom: var(--space-sm);
}

.tm-upload-area__text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.tm-upload-area__text strong {
  color: var(--color-violet);
}

/* ============================================================
   スクロールバーカスタマイズ
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-gold-subtle);
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-duo);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gold);
}

/* ============================================================
   レスポンシブ調整
   ============================================================ */
@media (max-width: 767px) {
  :root {
    --header-height: 58px;
  }

  .tm-header {
    padding: 0 var(--space-md);
  }

  .tm-header__logo {
    font-size: 1rem;
  }

  .tm-album-view {
    padding: var(--space-md);
  }

  .tm-article-view {
    padding: var(--space-md) var(--space-md) 100px;
  }

  .tm-fab {
    bottom: var(--space-lg);
    right: var(--space-md);
    width: 54px;
    height: 54px;
    z-index: 1200;
  }

  .tm-fab::after {
    display: none;
  }

  .tm-scrapbook {
    grid-template-columns: 1fr;
  }

  .tm-block--wide {
    grid-column: span 1;
  }

  .tm-map-search-bar {
    width: calc(100% - var(--space-lg) * 2);
  }

  .tm-view-toggle__btn span {
    display: none;
  }

  .tm-article-save-bar {
    padding: var(--space-sm) var(--space-md);
  }
}

/* ============================================================
   アニメーション
   ============================================================ */
@keyframes tm-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tm-fade-in {
  animation: tm-fade-in 0.3s ease forwards;
}

@keyframes tm-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tm-card {
  animation: tm-fade-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 動きを抑えたい環境では装飾アニメーションを止める */
@media (prefers-reduced-motion: reduce) {
  .tm-header::after,
  .tm-login-card::after,
  .tm-card::after,
  .tm-fab,
  .tm-album-empty__icon {
    animation: none !important;
    transition: none !important;
  }
  .tm-main {
    animation: none !important;
  }
}

/* ============================================================
   印刷スタイル
   ============================================================ */
@media print {
  .tm-header,
  .tm-fab,
  .tm-article-save-bar,
  .tm-block__controls {
    display: none !important;
  }
}
