:root {
  --primary: #3ABCB1;
  --primary-dark: #2da99e;
  --primary-light: #E8F7F6;
  --secondary: #E07A5F;
  --secondary-light: #FBF0EE;
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --text: #2C2C2C;
  --text-muted: #888;
  --border: #E0DED8;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ======= ヘッダー ======= */
.app-header {
  background: var(--primary);
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(58,188,177,0.35);
}
.app-header h1 { font-size: 17px; font-weight: 700; }
.app-header .user-badge {
  font-size: 12px;
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 20px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ======= レイアウト ======= */
.container { max-width: 760px; margin: 0 auto; padding: 20px 16px; }

/* ======= カード ======= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

/* ======= ボタン ======= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  min-height: 48px;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.3;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover:not(:disabled) { background: #c96a50; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 2px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #e74c3c; color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }

/* ======= ナビゲーション ======= */
.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.nav-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.18s;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.nav-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.nav-item .nav-icon { font-size: 34px; margin-bottom: 8px; display: block; }
.nav-item .nav-label { font-size: 14px; font-weight: 700; }
.nav-item .nav-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ======= バッジ ======= */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-green { background: var(--primary-light); color: var(--primary); }
.badge-orange { background: var(--secondary-light); color: var(--secondary); }
.badge-初級 { background: #E8F5E9; color: #388E3C; }
.badge-中級 { background: #FFF3E0; color: #E65100; }
.badge-上級 { background: #FCE4EC; color: #C2185B; }

/* ======= フォーム ======= */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
}
.form-textarea { min-height: 80px; resize: vertical; }

/* ======= チェックボックス ======= */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.check-item:hover { background: var(--bg); }
.check-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.check-label { font-size: 14px; line-height: 1.5; }

/* ======= 場面カード ======= */
.scene-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 8px;
}
.scene-card:hover, .scene-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.scene-card.selected { box-shadow: 0 0 0 3px rgba(58,188,177,0.18); }
.scene-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.scene-meta { font-size: 12px; color: var(--text-muted); }

/* ======= 返答例カード ======= */
.response-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.response-card:hover, .response-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.response-text { font-size: 16px; font-weight: 700; margin: 8px 0 6px; }
.response-note { font-size: 13px; color: var(--text-muted); }

/* ======= 気持ちグリッド ======= */
.feeling-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.feeling-btn {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.feeling-btn:hover, .feeling-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.feeling-btn .f-emoji { font-size: 28px; display: block; margin-bottom: 5px; }
.feeling-btn .f-text { font-size: 12px; font-weight: 700; }

/* ======= ステップバー ======= */
.step-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  align-items: center;
}
.step-seg {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  transition: background 0.3s;
}
.step-seg.active { background: var(--primary); }
.step-seg.done { background: var(--primary); opacity: 0.45; }

/* ======= 戻るボタン ======= */
.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  font-family: inherit;
  text-decoration: none;
}
.back-btn:hover { text-decoration: underline; }

/* ======= セクションタイトル ======= */
.section-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text);
}

/* ======= トースト ======= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #2C2C2C;
  color: white;
  padding: 13px 26px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  z-index: 9999;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ======= ローディング ======= */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.7s linear infinite;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

/* ======= 空状態 ======= */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .e-icon { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 14px; }

/* ======= ユーティリティ ======= */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; gap: 8px; }

/* ======= 印刷 ======= */
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  body { background: white; font-size: 12px; }
  .app-header { display: none; }
  /* トーストは position:fixed なので、隠していないと紙面に焼き込まれてしまう */
  .toast { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .container { padding: 0; max-width: none; }
  .btn { display: none; }
  .back-btn { display: none; }
  .scene-img { max-width: 160px; }
}
.print-only { display: none; }

/* ======= レスポンシブ ======= */
@media (max-width: 500px) {
  .nav-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .nav-item { padding: 16px 10px; }
  .nav-item .nav-icon { font-size: 28px; }
  .feeling-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .section-title { font-size: 17px; }
}
