/* ==============================
   じぶん習慣ナビ — Coaching Green Style
   ============================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Coaching Green palette */
  --green: #2D9F6F;
  --green-light: #6DD5A1;
  --green-pale: #E8F5E9;
  --teal: #1A9B94;
  --teal-light: #5EC4BD;
  --warm: #F5E6D3;
  --warm-dark: #D4A574;
  --brown: #6B5B4B;
  --brown-light: #9A8B7A;
  --gold: #E8B84B;
  --coral: #E8836B;
  --coral-light: #F4A896;

  --bg: #F7F4EE;
  --card-bg: #FFFFFF;
  --text: #2C2520;
  --text-sub: #6B6157;
  --text-muted: #A09890;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 24px rgba(45, 159, 111, .08);
  --shadow-lg: 0 8px 40px rgba(45, 159, 111, .12);
  --font-main: 'Zen Maru Gothic', 'M PLUS Rounded 1c', sans-serif;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Screen system ---------- */
.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
}
.screen.active {
  display: flex;
  animation: fadeIn .5s ease;
}
.screen-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
}

/* ---------- TOP Screen ---------- */
.top-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

/* Floating leaves */
.leaf {
  position: absolute;
  font-size: 2rem;
  opacity: .15;
  animation: leafFloat 8s ease-in-out infinite;
}
.leaf-1 { top: 10%; left: 8%; animation-delay: 0s; font-size: 2.5rem; }
.leaf-2 { top: 50%; right: 5%; animation-delay: 2s; font-size: 1.8rem; }
.leaf-3 { bottom: 15%; left: 15%; animation-delay: 4s; font-size: 2rem; }

@keyframes leafFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-15px) rotate(5deg); }
  50% { transform: translateY(-8px) rotate(-3deg); }
  75% { transform: translateY(-20px) rotate(8deg); }
}

/* Soft circles */
.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: .15;
  animation: float 7s ease-in-out infinite;
}
.bubble-1 { width: 200px; height: 200px; background: var(--green-light); top: -60px; left: -60px; animation-delay: 0s; }
.bubble-2 { width: 150px; height: 150px; background: var(--warm); top: 25%; right: -40px; animation-delay: 1.5s; }
.bubble-3 { width: 120px; height: 120px; background: var(--teal-light); bottom: 20%; left: 10%; animation-delay: 3s; }
.bubble-4 { width: 160px; height: 160px; background: var(--coral-light); bottom: -30px; right: -20px; animation-delay: 2.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

.top-screen {
  position: relative;
  z-index: 1;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100dvh;
}

.hero-badge {
  font-size: 3.5rem;
  margin-bottom: 8px;
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .02em;
  margin-bottom: 12px;
  color: var(--brown);
}
h1 .accent {
  background: linear-gradient(135deg, var(--green), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-subcopy {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 8px;
}
.top-description {
  font-size: .9rem;
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 28px;
}
.top-note {
  margin-top: 14px;
  font-size: .8rem;
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(45, 159, 111, .3);
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 28px rgba(45, 159, 111, .4);
}
.btn-primary:active { transform: scale(.97); }

.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--green), var(--teal));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(45, 159, 111, .25);
  transition: transform .2s, box-shadow .2s, opacity .2s;
}
.btn-primary-sm:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(45, 159, 111, .35);
}
.btn-primary-sm:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card-bg);
  color: var(--green);
  border: 2px solid var(--green-light);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: .9rem;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  transition: transform .2s, background .2s;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--green-pale);
  transform: translateY(-1px);
}
.btn-secondary:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--text-sub);
  border: 2px solid #DDD5CC;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: .9rem;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-outline:hover {
  border-color: var(--green-light);
  color: var(--green);
}

/* ---------- Question Screen ---------- */
.question-screen {
  justify-content: flex-start;
  padding-top: 32px;
}

.progress-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.progress-bar {
  flex: 1;
  height: 10px;
  background: #E0D8D0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--teal), var(--green-light));
  border-radius: 999px;
  transition: width .4s ease;
  background-size: 200% 100%;
  animation: shimmer 3s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.step-counter {
  font-size: .85rem;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  flex: 1;
}

.q-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.q-text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--brown);
  white-space: pre-line;
}
.q-hint {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Chips */
.chips-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid #E0D8D0;
  border-radius: 999px;
  background: #FFFBF7;
  font-size: .9rem;
  font-weight: 500;
  font-family: var(--font-main);
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.chip:hover {
  border-color: var(--green-light);
  background: var(--green-pale);
  transform: translateY(-1px);
}
.chip.selected {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--green-pale), #E0F2F1);
  color: var(--green);
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(45, 159, 111, .15);
}
.chip-emoji {
  font-size: 1.15rem;
}

/* Multi-select hint */
.multi-hint {
  font-size: .75rem;
  color: var(--teal);
  font-weight: 500;
  width: 100%;
  margin-bottom: 4px;
}

/* Step nav */
.step-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* ---------- Loading Screen ---------- */
.loading-screen {
  justify-content: center;
  align-items: center;
  min-height: 100dvh;
  text-align: center;
}
.loading-anim {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--green-light);
  opacity: .4;
  animation: pulse 2s ease-out infinite;
}
.ring-2 { animation-delay: .6s; }
@keyframes pulse {
  0% { transform: scale(.8); opacity: .5; }
  100% { transform: scale(1.6); opacity: 0; }
}
.pulse-core {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  animation: breathe 2s ease infinite;
}
.loading-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-sub);
  line-height: 1.7;
}
.loading-tips {
  margin-top: 20px;
  padding: 0 20px;
}
.loading-tip-text {
  font-size: .85rem;
  color: var(--green);
  font-weight: 500;
  opacity: 0;
  animation: fadeIn 1s ease .5s forwards;
}

/* ---------- Result Screen ---------- */
.result-screen {
  padding-top: 32px;
}
.result-header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
}
.result-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.result-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--brown);
}
.result-title .accent {
  background: linear-gradient(135deg, var(--green), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-sub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Recommendation cards */
.result-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}
.rec-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--green);
  position: relative;
  overflow: hidden;
  animation: slideUp .5s ease both;
}
.rec-card:nth-child(1) { border-left-color: var(--green); animation-delay: .1s; }
.rec-card:nth-child(2) { border-left-color: var(--teal); animation-delay: .25s; }
.rec-card:nth-child(3) { border-left-color: var(--warm-dark); animation-delay: .4s; }

.rec-card .rank {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: .75rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--teal));
  padding: 4px 12px;
  border-radius: 999px;
}
.rec-card:nth-child(2) .rank {
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
}
.rec-card:nth-child(3) .rank {
  background: linear-gradient(135deg, var(--warm-dark), var(--gold));
}

.rec-card .rec-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.rec-card .rec-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--brown);
}
.rec-card .rec-desc {
  font-size: .85rem;
  color: var(--text-sub);
  line-height: 1.7;
  margin-bottom: 14px;
}

/* Habit tip box inside card */
.habit-tip-box {
  background: linear-gradient(135deg, var(--green-pale), #E0F2F1);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 4px;
}
.habit-tip-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.habit-tip-text {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.6;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  border: 1px dashed var(--green-light);
}
.habit-when {
  display: inline-block;
  margin-top: 8px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--warm-dark);
  background: var(--warm);
  padding: 4px 12px;
  border-radius: 999px;
}
.habit-duration {
  display: inline-block;
  margin-top: 4px;
  margin-left: 4px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-pale);
  padding: 4px 12px;
  border-radius: 999px;
}

/* Tip box */
.result-tip-box {
  background: linear-gradient(135deg, #FFF8E1, #FFFDE7);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 2px solid var(--gold);
}
.tip-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 6px;
}
.tip-text {
  font-size: .8rem;
  color: var(--text-sub);
  line-height: 1.8;
}

/* CTA area */
.cta-area {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.cta-lead {
  font-size: .9rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 16px;
}
.btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 700;
  font-family: var(--font-main);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  margin-bottom: 10px;
}
.btn-cta:hover {
  transform: translateY(-2px);
}
.btn-youtube {
  background: linear-gradient(135deg, #FF0000, #CC0000);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255, 0, 0, .2);
}
.btn-line {
  background: linear-gradient(135deg, #06C755, #04A648);
  color: #fff;
  box-shadow: 0 4px 16px rgba(6, 199, 85, .2);
}

/* Result actions */
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.result-footer {
  text-align: center;
  font-size: .75rem;
  color: var(--text-muted);
  padding-bottom: 20px;
}

/* ---------- Leaf Confetti ---------- */
.leaf-confetti {
  position: absolute;
  font-size: 1.2rem;
  animation: leafFall 4s ease forwards;
  z-index: 10;
  pointer-events: none;
}
@keyframes leafFall {
  0% { transform: translateY(-30px) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(150px) rotate(360deg) scale(.4); opacity: 0; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brown);
  color: #fff;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  font-family: var(--font-main);
  opacity: 0;
  transition: all .3s ease;
  z-index: 1000;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
  .screen-inner { max-width: 540px; padding: 32px 24px 48px; }
  h1 { font-size: 2.8rem; }
  .q-text { font-size: 1.4rem; }
  .rec-card { padding: 28px; }
}
