/* ========================================
   カラートークン
======================================== */
:root {
  --color-bg:        #FDF6F4;
  --color-card:      #FFFFFF;
  --color-work:      #D98AA6;
  --color-break:     #B8A6D9;
  --color-accent:    #C8A0C9;
  --color-ring-bg:   #F0D9DF;
  --color-text:      #5C4A5C;
  --color-text-sub:  #9B8499;
  --color-exercise:  #A8C4A2;
  --color-ghost-bg:  #F3EDF2;
  --color-ghost-txt: #9B8499;

  --radius-btn:  20px;
  --radius-card: 16px;
  --font-main: 'M PLUS Rounded 1c', sans-serif;
}

/* ========================================
   ベース
======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ========================================
   画面管理
======================================== */
.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: block;
}

.screen-inner {
  max-width: 430px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 100dvh;
  justify-content: center;
}

/* ========================================
   ① 初期画面
======================================== */
.app-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-work);
  letter-spacing: 0.04em;
}

.app-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-sub);
  text-align: center;
  line-height: 1.7;
}

.setup-card {
  background: var(--color-card);
  border-radius: var(--radius-card);
  padding: 28px 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.time-select-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.time-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.select-wrapper {
  position: relative;
  flex: 1;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-sub);
  font-size: 0.85rem;
}

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 10px 36px 10px 16px;
  border: 2px solid var(--color-ring-bg);
  border-radius: var(--radius-btn);
  background: var(--color-bg);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

select:focus {
  border-color: var(--color-work);
}

/* ========================================
   ボタン
======================================== */
.btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
  letter-spacing: 0.03em;
}

.btn:active {
  opacity: 0.8;
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-work);
  color: #fff;
}

.phase-break .btn-primary {
  background: var(--color-break);
}

.btn-exercise {
  background: var(--color-exercise);
  color: #fff;
}

.btn-ghost {
  background: var(--color-ghost-bg);
  color: var(--color-ghost-txt);
}

.btn-large {
  padding: 16px 24px;
  font-size: 1.05rem;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* ========================================
   フェーズラベル
======================================== */
.phase-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-text-sub);
  text-transform: uppercase;
}

/* ========================================
   イラスト
======================================== */
.phase-illust {
  width: 60%;
  max-width: 240px;
  border-radius: var(--radius-card);
  display: block;
}

.illust-md {
  width: 52%;
  max-width: 200px;
}

/* ========================================
   タイマーリング
======================================== */
.timer-ring-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--color-ring-bg);
  stroke-width: 12;
}

.ring-progress {
  fill: none;
  stroke: var(--color-work);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 565.49;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s linear;
}

.ring-break {
  stroke: var(--color-break);
}

.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.timer-mm,
.timer-ss {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-text);
  min-width: 2.4ch;
  text-align: center;
}

.timer-sep {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--color-text-sub);
  line-height: 1;
  margin-bottom: 4px;
}

/* ========================================
   メッセージテキスト
======================================== */
.message-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.7;
}

/* ========================================
   YouTube コンテナ
======================================== */
.yt-container {
  width: 100%;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}

.yt-container iframe,
.yt-container > div {
  width: 100% !important;
  height: 100% !important;
}

/* ========================================
   フェーズ別ボディカラー
======================================== */
body.phase-break {
  background-color: #F8F5FD;
}

body.phase-break .app-title,
body.phase-break select:focus {
  color: var(--color-break);
}

/* ========================================
   iOS ホーム画面追加バナー
======================================== */
.ios-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 16px 16px;
}

.ios-banner-inner {
  background: var(--color-card);
  border: 2px solid var(--color-ring-bg);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -2px 16px rgba(92, 74, 92, 0.08);
}

.ios-banner-text {
  flex: 1;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-text);
}

.ios-banner-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-sub);
  margin-top: 4px;
}

.ios-share-icon {
  display: inline-block;
  font-style: normal;
  background: var(--color-work);
  color: #fff;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 0.75rem;
}

.ios-banner-close {
  background: var(--color-ghost-bg);
  border: none;
  color: var(--color-text-sub);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   スクロール位置調整（小画面）
======================================== */
@media (max-height: 700px) {
  .screen-inner {
    padding: 24px 24px 32px;
    gap: 14px;
    justify-content: flex-start;
  }

  .phase-illust {
    width: 44%;
  }

  .timer-ring-wrap {
    width: 180px;
    height: 180px;
  }

  .timer-mm,
  .timer-ss {
    font-size: 2.2rem;
  }

  .timer-sep {
    font-size: 1.9rem;
  }
}
