/* ============================================================
   478呼吸アプリ 見た目（スタイル）
   ------------------------------------------------------------
   テーマ：睡眠・リラックス系🌙
   深い紺の夜空に、薄紫の月のような円がゆっくり呼吸します。
   色を変えたいときは、下の :root をまとめて調整してください。
   ============================================================ */

:root {
  --bg-top: #0b1026;      /* 夜空のいちばん上（濃紺） */
  --bg-bottom: #1a1440;   /* 夜空の下のほう（藍紫） */
  --text: #e8e6f5;        /* メインの文字（月明かり色） */
  --muted: #9a94c0;       /* うすい文字 */
  --circle-in: #cabffa;   /* 円の内側（淡いラベンダー） */
  --circle-out: #6b5bd6;  /* 円の外側（深い紫） */
  --accent: #f5d78e;      /* アクセント（星あかりの金） */
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  /* 小さな星（うっすら） */
  background-image:
    radial-gradient(1px 1px at 20% 15%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 75% 8%,  rgba(255,255,255,.4), transparent),
    radial-gradient(1.5px 1.5px at 88% 30%, rgba(245,215,142,.5), transparent),
    radial-gradient(1px 1px at 10% 45%, rgba(255,255,255,.35), transparent),
    radial-gradient(1px 1px at 60% 55%, rgba(255,255,255,.3), transparent),
    radial-gradient(1.5px 1.5px at 35% 75%, rgba(245,215,142,.4), transparent),
    radial-gradient(1px 1px at 90% 85%, rgba(255,255,255,.4), transparent),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ---- 画面の共通レイアウト ---- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

/* ---- スタート画面 ---- */
.app-title {
  font-size: 30px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: .06em;
}
.app-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 30px;
}

.setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.setting-label { font-size: 15px; }

/* セット数の − ＋ */
.stepper { display: flex; align-items: center; gap: 14px; }
.step-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}
.step-btn:active { background: rgba(255,255,255,.2); }
.step-value { font-size: 22px; font-weight: 700; min-width: 28px; }

/* 音のトグルスイッチ */
.toggle {
  width: 56px; height: 32px;
  border-radius: 16px;
  border: none;
  background: rgba(255,255,255,.15);
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
}
.toggle .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s ease;
}
.toggle.on { background: var(--circle-out); }
.toggle.on .knob { left: 27px; }

/* はじめるボタン */
.start-btn {
  width: 100%;
  margin-top: 18px;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  color: #1a1440;
  background: linear-gradient(135deg, #e8e0ff, var(--circle-in));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(202,191,250,.35);
}
.start-btn:active { transform: scale(.98); }

.note { font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ---- セッション画面 ---- */
.cycle-indicator {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .1em;
  margin: 0 0 8px;
}

.circle-wrap {
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}

/* 呼吸する円（月） */
.breath-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--circle-in), var(--circle-out) 75%);
  box-shadow:
    0 0 40px rgba(140,120,230,.45),
    0 0 90px rgba(140,120,230,.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: scale(1);
  /* ふくらみ・しぼみの時間はJS側で毎回セットします */
  transition: transform 4s linear;
}

.phase-label {
  font-size: 22px;
  font-weight: 700;
  color: #241a4d;
  letter-spacing: .1em;
}
.phase-count {
  font-size: 44px;
  font-weight: 700;
  color: #241a4d;
  line-height: 1.1;
}

.phase-instruction {
  font-size: 15px;
  color: var(--text);
  min-height: 24px;
  margin: 6px 0 26px;
}

/* 中断・もどるボタン */
.stop-btn {
  padding: 12px 32px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 8px;
}
.stop-btn:active { background: rgba(255,255,255,.1); }

/* ---- おわり画面 ---- */
.done-emoji { font-size: 44px; margin: 0 0 6px; }
.done-title { font-size: 24px; margin: 0 0 8px; letter-spacing: .08em; }
.done-text { font-size: 14px; color: var(--muted); margin: 0 0 26px; }
