:root {
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-light: #fef3c7;
  --primary-dark: #b45309;
  --accent: #ea580c;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #f59e0b;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font-family: 'M PLUS Rounded 1c', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* リセット & ベース */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 24px);
  overflow-x: hidden;
}

/* ユーティリティ */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.font-bold { font-weight: 700; }

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  font-size: 28px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.3));
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-btn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* メインコンテンツ */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 飲み会案内カード */
.info-section {
  width: 100%;
}

.info-card {
  background: linear-gradient(145deg, #ffffff 0%, #fffbeb 100%);
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.25s ease;
}

.info-card-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.info-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-accent {
  background: #f59e0b;
  color: #ffffff;
}

.info-title {
  font-size: 17px;
  font-weight: 800;
  color: #1e293b;
}

.info-toggle-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-card.collapsed .chevron {
  transform: rotate(-90deg);
}

.info-card.collapsed .info-card-body {
  display: none;
}

.info-card-body {
  padding: 0 16px 16px;
  border-top: 1px dashed #fde68a;
  margin-top: 4px;
}

.info-subtitle {
  font-size: 13px;
  color: var(--primary-dark);
  font-weight: 600;
  margin: 10px 0 14px;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid #fef3c7;
}

.info-item-icon {
  font-size: 22px;
  line-height: 1;
}

.info-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-val {
  font-size: 14px;
  color: #1e293b;
  line-height: 1.4;
}

.info-subval {
  font-size: 12px;
  color: #64748b;
}

.info-links {
  margin-top: 6px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.link-btn:active {
  background: #dbeafe;
}

/* スケジュール & メモ */
.schedule-block, .notes-block {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid #fef3c7;
}

.block-heading {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
}

.timeline-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}

.timeline-time {
  font-weight: 700;
  color: var(--primary-dark);
  min-width: 44px;
  font-family: monospace;
}

.timeline-text {
  color: #334155;
}

.notes-text {
  font-size: 13px;
  color: #475569;
  white-space: pre-wrap;
  line-height: 1.5;
}

/* 掲示板セクション */
.bbs-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bbs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.bbs-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bbs-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.bbs-count-badge {
  font-size: 12px;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.25);
}

.btn-accent {
  background: #f59e0b;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-accent:active {
  transform: scale(0.95);
  background: #d97706;
}

.btn-sm {
  font-size: 13px;
  padding: 6px 12px;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* 投稿フォームカード */
.post-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.required-mark {
  font-size: 10px;
  color: #dc2626;
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.optional-mark {
  font-size: 10px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 16px;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 10px 12px 10px 38px;
  font-family: var(--font-family);
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-family);
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text-main);
  outline: none;
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.form-textarea:focus {
  border-color: var(--border-focus);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

/* クイック絵文字 */
.quick-emojis {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-emoji-label {
  font-size: 11px;
  color: var(--text-light);
  white-space: nowrap;
}

.quick-emoji-btn {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  font-size: 11px;
  padding: 3px 8px;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.quick-emoji-btn:active {
  transform: scale(0.92);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* 画像選択 */
.image-select-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-select-btn:active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.image-preview-container {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-preview-card {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid #f59e0b;
  box-shadow: var(--shadow-sm);
}

.image-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.image-preview-info {
  font-size: 12px;
  color: var(--text-muted);
}

/* スピナー */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 投稿タイムライン */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-card);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.skeleton-card {
  height: 120px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 投稿カード */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-author-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.post-meta {
  display: flex;
  flex-direction: column;
}

.post-author-name {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.post-time {
  font-size: 11px;
  color: var(--text-light);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-delete-btn {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.post-delete-btn:active {
  color: #ef4444;
}

/* 投稿本文 */
.post-body {
  font-size: 14.5px;
  color: #1e293b;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-body a {
  color: #2563eb;
  text-decoration: underline;
}

/* 投稿添付画像 */
.post-image-wrap {
  position: relative;
  max-width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f8fafc;
  cursor: zoom-in;
}

.post-image-wrap img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.post-image-wrap:active img {
  transform: scale(0.98);
}

/* リアクションバー */
.post-reactions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  padding: 5px 10px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.reaction-btn:active {
  transform: scale(0.90);
}

.reaction-btn.active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.2);
}

.reaction-count {
  font-size: 12px;
  font-weight: 700;
}

/* 画像モーダル (ライトボックス) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  z-index: 101;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.modal-close-btn {
  position: absolute;
  top: -46px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* トースト通知 */
.toast-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-error {
  background: #dc2626;
}

.toast.toast-success {
  background: #059669;
}

@keyframes toastFade {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* フッター */
.app-footer {
  text-align: center;
  padding: 20px 10px 10px;
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
