:root {
  --font-main: 'Noto Sans JP', sans-serif;
  --font-heading: 'M PLUS Rounded 1c', sans-serif;
  --primary: #ec4899;
  --primary-hover: #db2777;
  --primary-light: rgba(236, 72, 153, 0.15);
  --secondary: #8b5cf6;
  --accent: #f43f5e;
  --gold: #fbbf24;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-dark {
  --bg-body: #0d1117;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(30, 37, 48, 0.95);
  --bg-input: #161b22;
  --border: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(236, 72, 153, 0.6);
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --text-highlight: #ff79c6;
  --glow-1: rgba(236, 72, 153, 0.18);
  --glow-2: rgba(139, 92, 246, 0.18);
  --cal-cell-bg: #161b22;
  --cal-cell-active: #21262d;
}

body.theme-light {
  --bg-body: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-input: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(236, 72, 153, 0.6);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-highlight: #db2777;
  --glow-1: rgba(236, 72, 153, 0.08);
  --glow-2: rgba(139, 92, 246, 0.08);
  --cal-cell-bg: #ffffff;
  --cal-cell-active: #f1f5f9;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 背景グロー装飾 */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 450px;
  height: 450px;
  background: var(--glow-1);
  top: -100px;
  right: -50px;
}
.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: var(--glow-2);
  bottom: 10%;
  left: -100px;
}

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
}
.logo-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #f43f5e, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  background: var(--bg-input);
  color: var(--text-main);
  border-color: var(--border);
}
.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(236, 72, 153, 0.3);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* メインコンテナ */
.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 1;
}

/* ヒーローカード */
.hero-card {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.hero-card h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.hero-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.hero-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-badge {
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

/* コントロールバー */
.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input-wrapper {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrapper input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}
.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 1.2rem;
}
.btn-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.view-toggles {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}
.view-btn {
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.view-btn.active {
  background: var(--primary);
  color: #fff;
}

/* フィルタ行 */
.filter-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 65px;
}
.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}
.chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}
.text-gold {
  color: var(--gold);
}

/* イベントリスト表示 */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 日付セクショングループ */
.date-section-header {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 16px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}
.date-section-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}
.badge-today {
  background: #ef4444;
  color: #fff;
}
.badge-tomorrow {
  background: #f97316;
  color: #fff;
}
.badge-weekend {
  background: #8b5cf6;
  color: #fff;
}

/* イベントカード */
.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-card:hover {
  transform: translateY(-2px);
  border-color: rgba(236, 72, 153, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  background: var(--bg-card-hover);
}

.event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.event-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}
.tag-free {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.tag-area {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}
.tag-time {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.btn-fav {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 2px;
}
.btn-fav:hover {
  color: var(--gold);
  transform: scale(1.15);
}
.btn-fav.active {
  color: var(--gold);
}

.event-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-main);
}
.event-title a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}
.event-title a:hover {
  color: var(--primary);
}

.event-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meta-item i {
  font-size: 1rem;
  color: var(--primary);
}

.event-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.event-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.btn-detail {
  background: var(--primary);
  color: #fff;
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.btn-detail:hover {
  background: var(--primary-hover);
}
.btn-cal-add {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.btn-cal-add:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

/* カレンダービュー */
.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.calendar-header h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}
.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.day-name.sun { color: #f43f5e; }
.day-name.sat { color: #3b82f6; }

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-day-cell {
  min-height: 80px;
  background: var(--cal-cell-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.cal-day-cell:hover {
  border-color: var(--primary);
  background: var(--cal-cell-active);
}
.cal-day-cell.other-month {
  opacity: 0.3;
}
.cal-day-cell.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.cal-day-cell.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}
.cal-day-num {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.cal-badges {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.cal-event-dot {
  font-size: 0.68rem;
  background: var(--primary);
  color: #fff;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-day-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}

/* 読み込み中・空状態 */
.loading-state, .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.spinner {
  font-size: 2.2rem;
  animation: spin 1s linear infinite;
  color: var(--primary);
  margin-bottom: 12px;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* フッター */
.app-footer {
  text-align: center;
  padding: 30px 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer-note {
  margin-top: 6px;
  font-size: 0.72rem;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .header-container { padding: 10px 14px; }
  .hide-mobile { display: none; }
  .main-container { padding: 14px 12px 40px; }
  .hero-card { padding: 16px; }
  .controls-card { padding: 14px; }
  .cal-day-cell { min-height: 55px; padding: 4px; }
  .cal-event-dot { font-size: 0.6rem; padding: 1px 2px; }
}
