* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0a0a12;
  --bg2: #12121e;
  --bg3: #1a1a2e;
  --neon-pink: #ff2d78;
  --neon-purple: #9d00ff;
  --neon-blue: #00d4ff;
  --text: #e8e8f0;
  --text-dim: #888899;
  --border: #2a2a3e;
  --nav-h: 64px;
  --header-h: 52px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ヘッダー */
.header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.logo {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.05em;
}

/* メイン */
.main {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 16px);
  min-height: 100vh;
}

/* ビュー */
.view {
  display: none;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 統計カード */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

.stat-card.neon-pink {
  border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 45, 120, 0.15);
}

.stat-card.neon-purple {
  border-color: var(--neon-purple);
  box-shadow: 0 0 12px rgba(157, 0, 255, 0.15);
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.stat-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
}

/* セクションタイトル */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  margin-top: 8px;
}

/* エントリーリスト */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.entry-card:active {
  border-color: var(--neon-pink);
}

.entry-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.entry-shop {
  font-size: 15px;
  font-weight: 700;
}

.entry-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--neon-pink);
}

.entry-card-mid {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.entry-genre {
  font-size: 11px;
  background: var(--bg3);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--neon-purple);
  border: 1px solid var(--neon-purple);
}

.entry-area {
  font-size: 11px;
  color: var(--text-dim);
}

.entry-stars {
  color: #ffcc00;
  font-size: 12px;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.entry-tag {
  font-size: 10px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--neon-blue);
}

.entry-date-small {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* FABボタン */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 45, 120, 0.4);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.fab:active {
  transform: scale(0.92);
}

/* カレンダー */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-nav {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 22px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-title {
  font-size: 16px;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}

.cal-day-header {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  padding: 4px 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.cal-day:active {
  background: var(--bg3);
}

.cal-day.has-entry {
  background: var(--bg2);
  border: 1px solid var(--neon-pink);
}

.cal-day.today {
  background: rgba(255, 45, 120, 0.15);
  color: var(--neon-pink);
  font-weight: 700;
}

.cal-day.selected {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  color: white;
  font-weight: 700;
}

.cal-dot {
  width: 4px;
  height: 4px;
  background: var(--neon-pink);
  border-radius: 50%;
  position: absolute;
  bottom: 3px;
}

.cal-day.empty {
  cursor: default;
}

/* マップ */
#view-map {
  padding: 0;
}

#map {
  height: calc(100vh - var(--header-h) - var(--nav-h) - 44px);
  width: 100%;
  z-index: 1;
}

.map-stats {
  height: 44px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--neon-blue);
  font-weight: 700;
}

/* チャート */
.chart-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
  max-height: 220px;
}

/* ボトムナビ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--neon-pink);
}

.nav-icon {
  font-size: 20px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 0 0 32px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  background: var(--bg3);
  border: none;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* フォーム */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--neon-pink);
}

.form-textarea {
  min-height: 100px;
  resize: none;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888899' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* カスタム追加行 */
.custom-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.custom-add-row .form-input {
  flex: 1;
}

.btn-add-custom {
  background: var(--bg3);
  border: 1px solid var(--neon-purple);
  border-radius: 12px;
  color: var(--neon-purple);
  font-size: 20px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-tag-inline {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.15s;
}

.btn-add-tag-inline:hover {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}

/* 星評価 */
.star-rating {
  display: flex;
  gap: 8px;
}

.star {
  font-size: 28px;
  color: var(--border);
  cursor: pointer;
  transition: color 0.15s;
}

.star.active {
  color: #ffcc00;
}

/* 評価カテゴリ */
.rating-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.rating-row:last-child {
  border-bottom: none;
}

.rating-cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
}

.rating-row .star-rating {
  gap: 4px;
}

.rating-row .star {
  font-size: 22px;
}

/* 詳細モーダルのカテゴリ評価 */
.rating-cats-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rating-cat-detail {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.rating-cat-detail span:first-child {
  color: var(--text-dim);
}

/* タグ選択 */
.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-option {
  font-size: 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-dim);
}

.tag-option.selected {
  background: rgba(0, 212, 255, 0.15);
  border-color: var(--neon-blue);
  color: var(--neon-blue);
}

/* ボタン */
.form-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px;
  margin-top: 8px;
}

.btn-save {
  flex: 1;
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-save:active { opacity: 0.8; }

.btn-x-post {
  flex: 1;
  background: var(--bg3);
  border: 1px solid #1da1f2;
  border-radius: 14px;
  color: #1da1f2;
  font-size: 14px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
}

.btn-delete {
  flex: 1;
  background: var(--bg3);
  border: 1px solid #ff4444;
  border-radius: 14px;
  color: #ff4444;
  font-size: 14px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
}

/* X投稿エリア */
.x-post-area {
  margin: 12px 20px 0;
  background: var(--bg3);
  border: 1px solid #1da1f2;
  border-radius: 14px;
  padding: 14px;
}

.x-post-area.hidden { display: none; }

.x-post-label {
  font-size: 11px;
  color: #1da1f2;
  font-weight: 700;
  margin-bottom: 8px;
}

.x-post-textarea {
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  width: 100%;
  resize: none;
  min-height: 120px;
  outline: none;
  font-family: inherit;
}

/* 月次サマリーボタン */
.btn-monthly-summary {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--neon-pink);
  border-radius: 14px;
  color: var(--neon-pink);
  font-size: 14px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.2s;
  box-shadow: 0 0 12px rgba(255,45,120,0.15);
}

.btn-monthly-summary:active {
  background: rgba(255,45,120,0.1);
}

/* サマリーキャンバス */
.summary-canvas-wrap {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.summary-canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* トーンセレクター */
.tone-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.tone-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tone-btn.active {
  background: rgba(255, 45, 120, 0.15);
  border-color: var(--neon-pink);
  color: var(--neon-pink);
  font-weight: 700;
}

.x-post-char {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

.x-post-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-copy {
  background: var(--bg);
  border: 1px solid #1da1f2;
  border-radius: 8px;
  color: #1da1f2;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
}

.btn-x-open {
  flex: 1;
  background: #1da1f2;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
}

/* 詳細モーダル */
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
  color: var(--text-dim);
  font-size: 12px;
}

.detail-value {
  font-weight: 600;
}

.detail-memo {
  background: var(--bg3);
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.7;
  margin-top: 8px;
  color: var(--text);
}

/* 空状態 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 2;
}

/* Leafletカスタム */
.leaflet-container {
  background: #0a0a12 !important;
}

.custom-marker {
  background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  width: 24px;
  height: 24px;
  border: 2px solid white;
}
