/* ============================================================
   Trip Memories - Main CSS
   高級ホテルのアルバムのような上質なデザイン
   ============================================================ */

/* ============================================================
   CSS カスタムプロパティ（デザイントークン）
   ============================================================ */
:root {
  /* カラーパレット */
  --color-bg:           #F8F4EF;
  --color-bg-card:      #FFFCF8;
  --color-bg-overlay:   rgba(248, 244, 239, 0.95);
  --color-surface:      #FFFFFF;
  --color-border:       #E8E0D5;
  --color-border-light: #F0EAE2;

  /* テキスト */
  --color-text-primary:   #2C2420;
  --color-text-secondary: #6B5B4E;
  --color-text-muted:     #9E8E82;
  --color-text-light:     #BFB0A5;

  /* アクセントカラー */
  --color-gold:         #B8965A;
  --color-gold-light:   #D4B07A;
  --color-gold-subtle:  #F0E8D8;
  --color-navy:         #2C3E5A;
  --color-dusty-pink:   #C4899A;

  /* ユーザーカラー */
  --color-tommy:        #4A7FBF;
  --color-tommy-light:  #EBF2FA;
  --color-tommy-border: rgba(74, 127, 191, 0.3);
  --color-lisa:         #D4789A;
  --color-lisa-light:   #FDF0F5;
  --color-lisa-border:  rgba(212, 120, 154, 0.3);

  /* タイポグラフィ */
  --font-serif:   'Georgia', 'Times New Roman', 'Noto Serif JP', serif;
  --font-sans:    -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  --font-display: 'Georgia', var(--font-serif);

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

  /* 角丸 */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-full: 9999px;

  /* シャドウ */
  --shadow-sm:   0 1px 4px rgba(44, 36, 32, 0.06);
  --shadow-md:   0 4px 16px rgba(44, 36, 32, 0.10);
  --shadow-lg:   0 8px 32px rgba(44, 36, 32, 0.14);
  --shadow-xl:   0 16px 48px rgba(44, 36, 32, 0.18);

  /* トランジション */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* レイアウト */
  --header-height:  64px;
  --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);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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: normal;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.text-display {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: 0.02em;
}

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

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

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

.tm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  z-index: 100;
}

.tm-header__logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--color-text-primary);
}

.tm-header__logo span {
  color: var(--color-gold);
}

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

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

/* ============================================================
   ビュートグル
   ============================================================ */
.tm-view-toggle {
  display: flex;
  align-items: center;
  background: var(--color-border-light, #F0EAE2);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

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

.tm-view-toggle__btn.is-active {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

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

/* ============================================================
   ユーザーアバター
   ============================================================ */
.tm-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: white;
  flex-shrink: 0;
}

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

/* ============================================================
   ボタン
   ============================================================ */
.tm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tm-btn--primary {
  background: var(--color-text-primary);
  color: white;
}

.tm-btn--primary:hover {
  background: var(--color-navy);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tm-btn--gold {
  background: var(--color-gold);
  color: white;
}

.tm-btn--gold:hover {
  background: var(--color-gold-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tm-btn--outline {
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  background: transparent;
}

.tm-btn--outline:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.tm-btn--ghost {
  color: var(--color-text-secondary);
  background: transparent;
  padding: 8px 16px;
}

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

.tm-btn--danger {
  background: transparent;
  color: #C04040;
  border: 1px solid rgba(192, 64, 64, 0.3);
}

.tm-btn--danger:hover {
  background: rgba(192, 64, 64, 0.08);
  border-color: #C04040;
  transform: translateY(-1px);
}

.tm-btn--danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tm-btn--sm {
  padding: 6px 16px;
  font-size: 0.8rem;
}

.tm-btn--lg {
  padding: 14px 32px;
  font-size: 1rem;
}

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

.tm-btn--icon-sm {
  width: 32px;
  height: 32px;
  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.08em;
  color: var(--color-text-secondary);
  font-weight: 500;
}

.tm-input,
.tm-select,
.tm-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 0.95rem;
  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-gold);
  box-shadow: 0 0 0 3px rgba(184, 150, 90, 0.15);
}

.tm-input.is-error,
.tm-select.is-error {
  border-color: #E05252;
  box-shadow: 0 0 0 3px rgba(224, 82, 82, 0.15);
}

.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='%239E8E82' 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='%239E8E82' 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: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.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: var(--color-gold-subtle);
  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-size: 1rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.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;
  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(44, 36, 32, 0.5);
  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-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.97);
  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: 1px solid var(--color-border-light);
}

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

.tm-modal__close {
  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-modal__close:hover {
  background: var(--color-gold-subtle);
  color: var(--color-text-primary);
}

.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: 1px 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;
}

/* 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;
  }
  .tm-slide-panel.is-open {
    transform: translateY(0);
  }
}

.tm-slide-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}

.tm-slide-panel__title {
  font-family: var(--font-serif);
  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: 1px solid var(--color-border-light);
}

/* ============================================================
   フローティングアクションボタン（FAB）
   ============================================================ */
.tm-fab {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-gold);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  transition: all var(--transition-fast);
}

.tm-fab:hover {
  background: var(--color-gold-light);
  transform: scale(1.08);
  box-shadow: var(--shadow-xl);
}

.tm-fab svg {
  width: 22px;
  height: 22px;
}

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

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

/* ============================================================
   ポップアップ（地図上の記事一覧）
   ============================================================ */
.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: 1px solid var(--color-border);
  z-index: 1300;
}

.tm-map-popup__header {
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.tm-map-popup__location {
  font-family: var(--font-serif);
  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;
}

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

.tm-map-popup__item-title {
  font-size: 0.85rem;
  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: 1px 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% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  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;
  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;
  color: var(--color-gold);
  background: var(--color-gold-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

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

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

/* ============================================================
   バッジ（絞り込み条件表示）
   ============================================================ */
.tm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--color-gold-subtle);
  border: 1px solid var(--color-gold-light);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.tm-badge__remove {
  width: 16px;
  height: 16px;
  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-gold);
  color: white;
}

/* ============================================================
   ローディング
   ============================================================ */
.tm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.tm-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: tm-spin 0.8s linear infinite;
}

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

/* ============================================================
   トースト通知
   ============================================================ */
.tm-toast-container {
  position: fixed;
  bottom: 80px;
  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: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: tm-toast-in 0.3s ease forwards;
  max-width: 320px;
}

.tm-toast--success { background: #3A7D5A; }
.tm-toast--error   { background: #C04040; }

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

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

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

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

.tm-divider--gold {
  background: linear-gradient(to right, transparent, var(--color-gold-light), transparent);
}

/* ============================================================
   ユーティリティ
   ============================================================ */
.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(ellipse at 20% 50%, rgba(184, 150, 90, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(74, 127, 191, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(212, 120, 154, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.tm-login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  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;
}

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

.tm-login-card__logo-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 0.1em;
  color: var(--color-text-primary);
}

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

.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: 1px;
  background: linear-gradient(to right, transparent, var(--color-gold-light));
}

.tm-login-card__logo-ornament::after {
  background: linear-gradient(to left, transparent, var(--color-gold-light));
}

.tm-login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.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;
  color: #C04040;
  display: none;
  padding: 8px 12px;
  background: rgba(192, 64, 64, 0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid #C04040;
}

.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: 1px solid var(--color-border);
}

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

.tm-map-search-bar__icon {
  position: absolute;
  left: 14px;
  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;
}

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

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

/* Leafletポップアップのカスタマイズ */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--color-border);
  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-serif);
  font-size: 1.4rem;
  color: 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);
}

.tm-album-empty__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

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

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

/* ============================================================
   記事個別ページ
   ============================================================ */
.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: 1px solid var(--color-border-light);
}

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

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

.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;
  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: 1px dashed var(--color-border);
  transition: color var(--transition-fast);
}

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

/* スクラップブック */
.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);
}

.tm-block:hover {
  box-shadow: var(--shadow-md);
}

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

.tm-block--lisa {
  border-color: var(--color-lisa-border);
  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;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: white;
  z-index: 2;
  font-weight: 500;
}

.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: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

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

.tm-block__control-btn--delete:hover {
  background: #FEE;
  color: #C04040;
}

/* 画像ブロック */
.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.02);
}

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

.tm-block__text-content {
  font-size: 0.9rem;
  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: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.tm-block-add-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  transition: all var(--transition-fast);
}

.tm-block-add-btn:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: var(--color-gold-subtle);
}

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

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

/* 保存ボタンエリア */
.tm-article-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--color-bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-border);
  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;
  color: var(--color-text-muted);
}

/* ============================================================
   画像ライトボックス
   ============================================================ */
.tm-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 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-sm);
  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: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background var(--transition-fast);
}

.tm-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.tm-upload-area:hover,
.tm-upload-area.is-dragover {
  border-color: var(--color-gold);
  background: var(--color-gold-subtle);
}

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

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

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

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

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

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

  .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: 52px;
    height: 52px;
    z-index: 1200;
  }

  .tm-fab::before {
    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.3s ease forwards;
}

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