/* ==========================================================================
   Life-Guardian iPhone Mockup - 答え合わせ & モチベーション版
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background-color: #F5F5F7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* --------------------------------------------------------------------------
   Page Header (Outside iPhone)
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #1c1c1e;
  font-size: 1.25rem;
  font-weight: 600;
}

.page-header__logo svg {
  color: #007AFF;
}

.page-header__subtitle {
  color: #86868b;
  font-size: 0.875rem;
  padding-left: 12px;
  border-left: 1px solid #d2d2d7;
}

/* --------------------------------------------------------------------------
   Devices Container (横並びレイアウト)
   -------------------------------------------------------------------------- */
.devices-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 40px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   iPhone Frame Container
   -------------------------------------------------------------------------- */
.iphone-container {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.iphone-frame {
  position: relative;
  width: 375px;
  height: 812px;
  background: #1c1c1e;
  border-radius: 50px;
  padding: 14px;
  box-shadow:
    0 0 0 2px #2c2c2e,
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 40px 80px rgba(0, 0, 0, 0.2);
}

.iphone-notch {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 34px;
  background: #1c1c1e;
  border-radius: 0 0 20px 20px;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.iphone-notch__camera {
  width: 12px;
  height: 12px;
  background: #2c2c2e;
  border-radius: 50%;
  margin-top: -4px;
}

.iphone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #F2F2F7;
  border-radius: 38px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Apple Watch Frame (45mm)
   -------------------------------------------------------------------------- */
.watch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.watch-frame {
  position: relative;
  /* 45mm実寸: 45x38mm, アスペクト比 1.18:1 */
  /* 実機に近いサイズ感（大きめに表示） */
  width: 198px;
  height: 242px;
  background: #1c1c1e;
  border-radius: 52px;
  padding: 12px;
  box-shadow:
    0 0 0 2px #2c2c2e,
    0 15px 40px rgba(0, 0, 0, 0.3),
    0 25px 60px rgba(0, 0, 0, 0.2);
}

/* Digital Crown */
.watch-crown {
  position: absolute;
  top: 50px;
  right: -8px;
  width: 8px;
  height: 28px;
  background: linear-gradient(90deg, #3a3a3c 0%, #2c2c2e 50%, #3a3a3c 100%);
  border-radius: 3px;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.3);
}

/* Side Button */
.watch-button {
  position: absolute;
  top: 95px;
  right: -6px;
  width: 6px;
  height: 18px;
  background: linear-gradient(90deg, #3a3a3c 0%, #2c2c2e 50%, #3a3a3c 100%);
  border-radius: 2px;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.3);
}

.watch-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 42px;
  overflow: hidden;
}

/* Watch Placeholder (空の状態) */
.watch-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
}

.watch-placeholder__icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.watch-placeholder__text {
  font-size: 14px;
  color: #666;
}

.watch-label {
  margin-top: 12px;
  font-size: 12px;
  color: #86868b;
}

.watch-reset-btn {
  margin-top: 8px;
  padding: 6px 16px;
  background: #E5E5EA;
  border: none;
  border-radius: 12px;
  font-size: 11px;
  color: #1c1c1e;
  cursor: pointer;
  transition: background 0.2s;
}

.watch-reset-btn:hover {
  background: #D1D1D6;
}

/* --------------------------------------------------------------------------
   Apple Watch App Screens
   -------------------------------------------------------------------------- */
.watch-app-screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.watch-app-screen::-webkit-scrollbar {
  display: none;
}

.watch-app-screen {
  scrollbar-width: none;
}

.watch-app-screen.active {
  display: flex;
  flex-direction: column;
}

/* ① 通知画面 (Notification) */
.watch-notification {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-top: 4px;
  padding-bottom: 8px;
}

.watch-notification__header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.watch-notification__icon {
  font-size: 14px;
}

.watch-notification__app {
  font-size: 10px;
  font-weight: 600;
  color: #FF6B9D;
  letter-spacing: 0.3px;
}

.watch-notification__message {
  font-size: 12px;
  font-weight: 500;
  color: white;
  line-height: 1.3;
  margin-bottom: 8px;
}

.watch-notification__actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Watch Action Buttons */
.watch-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.watch-action-btn:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.watch-action-btn__icon {
  font-size: 14px;
}

.watch-action-btn__label {
  color: white;
}

.watch-action-btn--good {
  background: linear-gradient(135deg, #34C759 0%, #30B350 100%);
}

.watch-action-btn--normal {
  background: linear-gradient(135deg, #007AFF 0%, #0066DD 100%);
}

.watch-action-btn--bad {
  background: linear-gradient(135deg, #8E8E93 0%, #636366 100%);
}

/* ② Triage画面 (症状選択) */
.watch-triage {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.watch-triage__title {
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-align: center;
  margin-bottom: 10px;
}

.watch-triage__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  flex: 1;
}

/* Symptom Buttons */
.watch-symptom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: #1C1C1E;
  border: 2px solid #3A3A3C;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.watch-symptom-btn:active {
  transform: scale(0.94);
}

.watch-symptom-btn:hover {
  border-color: #5A5A5E;
}

.watch-symptom-btn--suggested {
  border-color: #FF9500;
  background: linear-gradient(180deg, rgba(255, 149, 0, 0.15) 0%, rgba(255, 149, 0, 0.05) 100%);
}

.watch-symptom-btn--other {
  border-style: dashed;
}

.watch-symptom-btn__icon {
  font-size: 20px;
}

.watch-symptom-btn__label {
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.watch-symptom-btn__hint {
  font-size: 8px;
  color: #8E8E93;
}

.watch-symptom-btn--suggested .watch-symptom-btn__hint {
  color: #FF9500;
}

/* ③ 完了画面 (Success) */
.watch-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.watch-complete__icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.watch-complete__icon--animated {
  animation: hanamaru-glow 2s ease-in-out infinite;
}

@keyframes hanamaru-glow {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(255, 107, 157, 0.6));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.9));
    transform: scale(1.05);
  }
}

.watch-complete__message {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.watch-complete__sub {
  font-size: 11px;
  color: #8E8E93;
}

.watch-complete--good .watch-complete__icon {
  animation: hanamaru-glow-good 2s ease-in-out infinite;
}

@keyframes hanamaru-glow-good {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(52, 199, 89, 0.6));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(52, 199, 89, 0.9));
    transform: scale(1.05);
  }
}

.watch-complete--normal .watch-complete__icon {
  animation: hanamaru-glow-normal 2s ease-in-out infinite;
}

@keyframes hanamaru-glow-normal {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(0, 122, 255, 0.6));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(0, 122, 255, 0.9));
    transform: scale(1.05);
  }
}

.watch-complete--bad .watch-complete__icon {
  animation: hanamaru-glow-bad 2s ease-in-out infinite;
}

@keyframes hanamaru-glow-bad {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(255, 149, 0, 0.6));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 149, 0, 0.9));
    transform: scale(1.05);
  }
}

/* --------------------------------------------------------------------------
   Screen Switching
   -------------------------------------------------------------------------- */
.screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding-bottom: 84px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #F2F2F7;
}

.screen.active {
  display: block;
}

.screen::-webkit-scrollbar {
  display: none;
}

/* --------------------------------------------------------------------------
   Status Bar
   -------------------------------------------------------------------------- */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 50px 24px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1c1c1e;
  background: white;
}

.status-bar__icons {
  display: flex;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   Tab Bar
   -------------------------------------------------------------------------- */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 20px;
  z-index: 50;
}

.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 16px;
  color: #86868b;
  transition: color 0.2s ease;
}

.tab-bar__item.active {
  color: #007AFF;
}

.tab-bar__icon {
  width: 24px;
  height: 24px;
}

.tab-bar__label {
  font-size: 10px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Screen 1: Home Dashboard
   -------------------------------------------------------------------------- */

/* Usage Stats (動機づけ) */
.usage-stats {
  background: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.usage-stats__item {
  text-align: center;
  padding: 8px 12px;
}

.usage-stats__item--highlight {
  background: #FFF9E6;
  border-radius: 12px;
}

.usage-stats__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #1c1c1e;
}

.usage-stats__item--highlight .usage-stats__value {
  color: #FF9500;
}

.usage-stats__label {
  font-size: 11px;
  color: #86868b;
  margin-top: 2px;
}

/* Data Sync Bar */
.data-sync-bar {
  background: #F2F2F7;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: #86868b;
}

.data-sync-bar__icon {
  font-size: 12px;
}

/* Insight Card (Main Graph) */
.insight-card {
  margin: 8px 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.insight-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.insight-card__title {
  font-size: 17px;
  font-weight: 600;
  color: #1c1c1e;
}

.insight-card__date {
  font-size: 13px;
  color: #86868b;
}

.insight-card__subtitle {
  font-size: 11px;
  color: #86868b;
}

.insight-card__value {
  font-size: 17px;
  font-weight: 700;
  color: #34C759;
}

/* Steps Chart (棒グラフ) */
.steps-chart {
  position: relative;
  padding: 8px 0;
}

.steps-chart__bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 80px;
  padding: 0 4px;
}

.steps-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 36px;
}

.steps-bar__fill {
  width: 20px;
  height: 52px; /* 65% of 80px as default */
  background: linear-gradient(180deg, #34C759 0%, #30B350 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

/* 各曜日の高さを個別に設定 */
.steps-bar[data-day="月"] .steps-bar__fill { height: 52px; }
.steps-bar[data-day="火"] .steps-bar__fill { height: 66px; }
.steps-bar[data-day="水"] .steps-bar__fill { height: 36px; }
.steps-bar[data-day="木"] .steps-bar__fill { height: 74px; }
.steps-bar[data-day="金"] .steps-bar__fill { height: 62px; }
.steps-bar[data-day="土"] .steps-bar__fill { height: 44px; }
.steps-bar[data-day="日"] .steps-bar__fill { height: 54px; }

.steps-bar__fill--goal {
  background: linear-gradient(180deg, #FFD60A 0%, #FF9F0A 100%);
}

.steps-bar__fill--today {
  background: linear-gradient(180deg, #007AFF 0%, #0051D4 100%);
}

.steps-bar__label {
  font-size: 10px;
  color: #86868b;
  margin-top: 6px;
}

.steps-bar--today .steps-bar__label {
  color: #007AFF;
  font-weight: 600;
}

/* Goal Line */
.steps-chart__goal {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  pointer-events: none;
}

.steps-chart__goal-line {
  width: 100%;
  height: 1px;
  background: #FF9500;
  opacity: 0.5;
}

.steps-chart__goal-label {
  position: absolute;
  right: 0;
  top: -14px;
  font-size: 9px;
  color: #FF9500;
  font-weight: 500;
}

/* Steps Summary */
.steps-summary {
  display: flex;
  justify-content: space-around;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid #F2F2F7;
}

.steps-summary__item {
  text-align: center;
}

.steps-summary__value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #1c1c1e;
}

.steps-summary__label {
  font-size: 10px;
  color: #86868b;
}

/* Steps Chart - 横スクロール対応 */
.steps-scroll-container {
  position: relative;
  margin-bottom: 12px;
}

.steps-goal-indicator {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: none;
}

.steps-goal-indicator__line {
  width: 100%;
  height: 1px;
  background: #FF9500;
  opacity: 0.5;
}

.steps-goal-indicator__label {
  position: absolute;
  right: 4px;
  top: -14px;
  font-size: 9px;
  color: #FF9500;
  font-weight: 500;
  background: white;
  padding: 0 4px;
}

.steps-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-top: 8px;
}

.steps-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.steps-scroll-content {
  display: flex;
  width: max-content;
  gap: 8px;
  padding: 0 4px;
}

/* 週単位のコンテナ */
.steps-week {
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: #F9F9F9;
  border-radius: 12px;
  min-width: 180px;
}

.steps-week--current {
  background: #F0F7FF;
}

.steps-week__label {
  font-size: 11px;
  font-weight: 600;
  color: #86868b;
  margin-bottom: 8px;
  text-align: center;
}

.steps-week--current .steps-week__label {
  color: #007AFF;
}

.steps-week__bars {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 80px;
  gap: 4px;
}

.steps-week__bars .steps-bar {
  flex: 1;
  max-width: 24px;
}

.steps-week__bars .steps-bar__fill {
  width: 16px;
  border-radius: 3px 3px 0 0;
}

.steps-week__bars .steps-bar__label {
  font-size: 9px;
}

.steps-week--current .steps-bar--today .steps-bar__fill {
  background: linear-gradient(180deg, #007AFF 0%, #0051D4 100%);
}

/* 今日のサマリー */
.steps-today {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #F2F2F7;
}

.steps-today__main {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.steps-today__value {
  font-size: 24px;
  font-weight: 700;
  color: #1c1c1e;
}

.steps-today__unit {
  font-size: 14px;
  color: #86868b;
}

.steps-today__details {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #86868b;
}

.steps-today__separator {
  color: #D1D1D6;
}

/* Graph Container - 横スクロール対応 */
.graph-container {
  position: relative;
}

.graph-y-labels {
  position: absolute;
  left: 0;
  top: 24px;
  height: 80px;
  width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10px;
  color: #86868b;
  text-align: right;
  padding-right: 4px;
  z-index: 20;
  background: white;
}

/* 中央インジケーター（時刻選択線） */
.graph-center-indicator {
  position: absolute;
  left: 50%;
  top: 20px;
  bottom: 50px;
  z-index: 30;
  pointer-events: none;
  transform: translateX(-50%);
}

.graph-center-indicator__line {
  width: 2px;
  height: 100%;
  background: #007AFF;
  border-radius: 1px;
  opacity: 0.8;
}

.graph-center-indicator__time {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: #007AFF;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* スクロール可能なグラフエリア */
.graph-scroll-wrapper {
  margin-left: 32px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  height: 130px;
}

.graph-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.graph-scroll-content {
  display: flex;
  width: max-content;
  height: 100%;
}

/* 1日分のグラフ */
.graph-day {
  position: relative;
  width: 240px;
  height: 100%;
  flex-shrink: 0;
  border-right: 1px solid #E5E5EA;
}

.graph-day:last-child {
  border-right: none;
}

.graph-day__label {
  position: absolute;
  top: 0;
  left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #86868b;
  background: white;
  padding: 0 4px;
  z-index: 5;
}

.graph-day--today .graph-day__label {
  color: #007AFF;
}

/* Range Bar Chart (Min-Max Heart Rate) */
.range-bar-chart {
  position: absolute;
  top: 24px;
  left: 0;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 2px;
  /* Y軸: 60bpm = bottom, 120bpm = top */
}

.range-bar {
  width: 8px;
  border-radius: 2px;
  background: linear-gradient(180deg, #FF6B6B 0%, #FF3B30 100%);
  opacity: 0.8;
  transition: opacity 0.2s;
  /* CSS変数で位置を計算: 60-120bpmの範囲で80pxの高さ */
  /* bottom = (min - 60) / 60 * 80px */
  /* height = (max - min) / 60 * 80px */
  position: relative;
  --range: 60; /* 60-120 = 60bpm range */
  --chart-height: 80;
  height: calc((var(--max) - var(--min)) / var(--range) * var(--chart-height) * 1px);
  margin-bottom: calc((var(--min) - 60) / var(--range) * var(--chart-height) * 1px);
}

.range-bar:hover {
  opacity: 1;
}

/* 高心拍時（運動・飲酒など） */
.range-bar--elevated {
  background: linear-gradient(180deg, #FF9500 0%, #FF6B00 100%);
}

/* データなし */
.range-bar--empty {
  width: 8px;
  height: 4px;
  margin-bottom: 0;
  background: #E5E5EA;
  opacity: 0.5;
}

/* Legacy: SVG curved graph (for detail panel) */
.heart-graph {
  position: absolute;
  top: 24px;
  left: 0;
  width: 100%;
  height: 80px;
}

.graph-grid {
  stroke: #E5E5EA;
  stroke-width: 0.5;
}

.heart-graph__line {
  fill: none;
  stroke: #FF3B30;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.heart-graph__area {
  fill: rgba(255, 59, 48, 0.1);
}

.heart-graph--small {
  height: 60px;
}

/* Graph Events - アイコンをグラフ上に */
.graph-events {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 80px;
}

.graph-event {
  position: absolute;
  transform: translateX(-50%);
  cursor: pointer;
  transition: transform 0.15s ease;
  z-index: 10;
}

.graph-event:hover {
  transform: translateX(-50%) scale(1.15);
}

.graph-event__icon {
  font-size: 16px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

/* 時間ラベル */
.graph-time-labels {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #86868b;
  padding: 0 4px;
}

/* Graph Legend */
.graph-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #F2F2F7;
}

.graph-legend__item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #86868b;
}

.graph-legend__dot {
  width: 8px;
  height: 8px;
  background: #FF3B30;
  border-radius: 50%;
}

.graph-legend__bar {
  width: 6px;
  height: 14px;
  background: linear-gradient(180deg, #FF6B6B 0%, #FF3B30 100%);
  border-radius: 2px;
}

.graph-legend__range {
  font-size: 12px;
  color: #1c1c1e;
  font-weight: 500;
}

/* Quick Add Card (記録追加ボタン) */
.quick-add-card {
  margin: 8px 16px;
}

.quick-add-card__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: white;
  border: 1px solid #E5E5EA;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-add-card__btn:hover {
  background: #F2F2F7;
  border-color: #007AFF;
}

.quick-add-card__icon {
  font-size: 18px;
  color: #007AFF;
  font-weight: 500;
}

.quick-add-card__text {
  font-size: 15px;
  color: #1c1c1e;
  font-weight: 500;
}

/* Report Card */
.report-card {
  margin: 12px 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.report-card__content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-card__icon {
  font-size: 28px;
}

.report-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-card__label {
  font-size: 14px;
  font-weight: 600;
  color: #1c1c1e;
}

.report-card__status {
  font-size: 12px;
  color: #86868b;
}

.report-card__status strong {
  color: #007AFF;
}

.report-card__btn {
  padding: 8px 16px;
  background: #F2F2F7;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #007AFF;
  cursor: pointer;
  transition: background 0.2s;
}

.report-card__btn:hover {
  background: #E5E5EA;
}

/* Quick Add */
.quick-add {
  margin: 12px 16px;
}

.quick-add__btn {
  width: 100%;
  padding: 14px;
  background: white;
  border: 2px dashed #D1D1D6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-add__btn:hover {
  border-color: #007AFF;
  background: #F0F7FF;
}

.quick-add__icon {
  font-size: 20px;
  color: #007AFF;
}

.quick-add__text {
  font-size: 15px;
  color: #86868b;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  z-index: 200;
}

.modal.active {
  display: block;
}

.modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  max-height: 70%;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal__content--large {
  max-height: 80%;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal__title {
  font-size: 18px;
  font-weight: 600;
  color: #1c1c1e;
}

.modal__close {
  width: 32px;
  height: 32px;
  background: #F2F2F7;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  color: #86868b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__hint {
  text-align: center;
  font-size: 12px;
  color: #86868b;
  margin-top: 16px;
}

/* Stamp Grid (in Modal) */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stamp-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  background: #F2F2F7;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stamp-btn:hover {
  transform: scale(1.02);
  background: #E5E5EA;
}

.stamp-btn:active {
  transform: scale(0.98);
}

.stamp-btn__icon {
  font-size: 28px;
}

.stamp-btn__label {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
}

/* Report Preview */
.report-preview {
  margin-bottom: 20px;
}

.report-preview__period {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  background: #F2F2F7;
  border-radius: 12px;
  margin-bottom: 16px;
}

.report-preview__label {
  font-size: 14px;
  color: #86868b;
}

.report-preview__value {
  font-size: 14px;
  font-weight: 600;
  color: #1c1c1e;
}

.report-preview__stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.report-preview__stat {
  text-align: center;
}

.report-preview__stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #007AFF;
}

.report-preview__stat-label {
  font-size: 12px;
  color: #86868b;
}

.report-preview__note {
  padding: 12px;
  background: #E8F5E9;
  border-radius: 12px;
  text-align: center;
}

.report-preview__note p {
  font-size: 13px;
  color: #2E7D32;
}

/* Send Button */
.send-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #007AFF 0%, #0051a8 100%);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.send-btn__text {
  font-size: 17px;
  font-weight: 600;
  color: white;
}

/* Complete State */
.complete {
  text-align: center;
  padding: 20px 0;
}

.complete__icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.complete__title {
  font-size: 22px;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 8px;
}

.complete__message {
  font-size: 15px;
  color: #86868b;
  line-height: 1.6;
  margin-bottom: 24px;
}

.complete__btn {
  padding: 14px 40px;
  background: #F2F2F7;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #007AFF;
  cursor: pointer;
}

/* Toast */
.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 300;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.toast__icon {
  font-size: 24px;
}

.toast__message {
  font-size: 16px;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Screen 2: Calendar
   -------------------------------------------------------------------------- */

.calendar-header {
  background: white;
  padding: 50px 16px 16px;
}

.calendar-header__title {
  font-size: 22px;
  font-weight: 700;
  color: #1c1c1e;
  margin-bottom: 8px;
}

.calendar-header__legend {
  display: flex;
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #86868b;
}

.legend-icon {
  font-size: 14px;
}

.legend-icon--ecg {
  color: #FF3B30;
  font-size: 12px;
}

/* Calendar Grid */
.calendar {
  margin: 12px 16px;
  background: white;
  border-radius: 16px;
  padding: 12px;
}

.calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: #86868b;
  font-weight: 500;
  margin-bottom: 8px;
}

.calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 44px;
  font-size: 13px;
  color: #1c1c1e;
  background: #F2F2F7;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: transform 0.1s;
}

.calendar__day:active {
  transform: scale(0.95);
}

.calendar__day--empty {
  background: transparent;
  cursor: default;
}

.calendar__day--empty:active {
  transform: none;
}

.calendar__day--good {
  background: #FFE8EC;
}

.calendar__day--normal {
  background: #FFF9E6;
}

.calendar__day--warn {
  background: #E8F4FD;
}

.calendar__day--none {
  background: #F2F2F7;
  color: #86868b;
}

.calendar__day--today {
  background: #007AFF;
  color: white;
  font-weight: 600;
}

.calendar__status {
  font-size: 10px;
  position: absolute;
  bottom: 2px;
}

/* ECG Badge on Calendar */
.calendar__ecg {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  color: #FF3B30;
  line-height: 1;
  filter: drop-shadow(0 0 1px rgba(255, 59, 48, 0.5));
}

/* Monthly Summary */
.monthly-summary {
  margin: 12px 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
}

.monthly-summary__title {
  font-size: 16px;
  font-weight: 600;
  color: #1c1c1e;
  margin-bottom: 12px;
}

.monthly-summary__stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 16px;
}

.summary-stat {
  text-align: center;
}

.summary-stat__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #007AFF;
}

.summary-stat__label {
  font-size: 11px;
  color: #86868b;
}

.monthly-summary__insight {
  padding: 12px;
  background: #FFF9E6;
  border-radius: 10px;
  font-size: 13px;
  color: #1c1c1e;
  text-align: center;
}

.monthly-summary__insight strong {
  color: #FF9500;
}

/* Day Detail Panel */
.day-detail {
  position: absolute;
  bottom: 84px;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(calc(100% + 84px));
  transition: transform 0.3s ease, visibility 0.3s;
  z-index: 60;
  visibility: hidden;
}

.day-detail.active {
  transform: translateY(0);
  visibility: visible;
}

.day-detail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.day-detail__close {
  width: 28px;
  height: 28px;
  background: #F2F2F7;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  color: #86868b;
  cursor: pointer;
}

.day-detail__title {
  font-size: 16px;
  font-weight: 600;
  color: #1c1c1e;
  flex: 1;
}

.day-detail__status {
  font-size: 13px;
  color: #FF9500;
}

.day-detail__graph {
  position: relative;
  height: 80px;
  margin-bottom: 12px;
}

/* Day Detail Range Bars */
.day-detail__range-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 60px;
  padding: 0 4px;
}

.detail-range-bar {
  width: 6px;
  border-radius: 2px;
  background: linear-gradient(180deg, #FF6B6B 0%, #FF3B30 100%);
  opacity: 0.8;
  --range: 60;
  --chart-height: 60;
  height: calc((var(--max) - var(--min)) / var(--range) * var(--chart-height) * 1px);
  margin-bottom: calc((var(--min) - 50) / var(--range) * var(--chart-height) * 1px);
}

.detail-range-bar--empty {
  width: 6px;
  height: 2px;
  margin-bottom: 0;
  background: #E5E5EA;
  opacity: 0.4;
}

.detail-range-bar--elevated {
  background: linear-gradient(180deg, #FF9500 0%, #FF6B00 100%);
}

.day-detail__time-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #86868b;
  padding: 4px 4px 0;
}

.day-detail__events {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
}

.day-detail__insight {
  font-size: 13px;
  color: #86868b;
  text-align: center;
}

/* ECG Timeline Section */
.ecg-timeline {
  margin: 12px 0;
  padding: 12px;
  background: #FFF5F5;
  border-radius: 12px;
  border: 1px solid #FFE0E0;
}

.ecg-timeline__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.ecg-timeline__icon {
  font-size: 16px;
}

.ecg-timeline__title {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
}

.ecg-timeline__count {
  font-size: 12px;
  color: #86868b;
}

.ecg-timeline__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ecg-timeline__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: white;
  border-radius: 8px;
}

.ecg-timeline__time {
  font-size: 12px;
  font-weight: 600;
  color: #1c1c1e;
  min-width: 40px;
}

.ecg-timeline__wave {
  font-size: 14px;
  color: #FF3B30;
}

.ecg-timeline__result {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.ecg-timeline__result--normal {
  color: #34C759;
}

.ecg-timeline__result--afib {
  color: #FF3B30;
}

.ecg-timeline__result--inconclusive {
  color: #FF9500;
}

.ecg-timeline__bpm {
  font-size: 11px;
  color: #86868b;
}

/* Empty state for ECG */
.ecg-timeline--empty {
  display: none;
}

/* --------------------------------------------------------------------------
   Screen 3: Settings
   -------------------------------------------------------------------------- */

.settings-header {
  background: white;
  padding: 50px 16px 16px;
}

.settings-header__title {
  font-size: 28px;
  font-weight: 700;
  color: #1c1c1e;
}

.settings-section {
  margin: 12px 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
}

.settings-section__title {
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.settings-section__desc {
  font-size: 12px;
  color: #86868b;
  margin-bottom: 12px;
}

.settings-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #F2F2F7;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item--editable {
  cursor: pointer;
}

.settings-item--editable:active {
  opacity: 0.7;
}

.settings-item__icon {
  font-size: 20px;
  margin-right: 12px;
}

.settings-item__label {
  flex: 1;
  font-size: 15px;
  color: #1c1c1e;
}

.settings-item__value {
  font-size: 15px;
  color: #86868b;
}

.settings-item__arrow {
  font-size: 18px;
  color: #C7C7CC;
  margin-left: 8px;
}

/* Toggle Switch */
.toggle {
  width: 51px;
  height: 31px;
  background: #E5E5EA;
  border-radius: 16px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}

.toggle--on {
  background: #4CAF50;
}

.toggle--on::after {
  transform: translateX(20px);
}

/* Settings Hints & Notes */
.settings-hint {
  font-size: 11px;
  color: #86868b;
  padding: 4px 12px 12px;
  margin-top: -8px;
}

.settings-note {
  font-size: 11px;
  color: #86868b;
  padding: 12px;
  background: #F2F2F7;
  border-radius: 8px;
  margin-top: 12px;
  line-height: 1.5;
}

/* Symptom Categories */
.symptom-category {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 8px;
  border-top: 1px solid #F2F2F7;
}

.symptom-category:first-of-type {
  border-top: none;
  padding-top: 8px;
}

.symptom-category__icon {
  font-size: 16px;
}

.symptom-category__label {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
}

/* Symptom Tags */
.symptom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
}

.symptom-tag {
  padding: 6px 12px;
  background: #F2F2F7;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  font-size: 13px;
  color: #86868b;
  cursor: pointer;
  transition: all 0.2s;
}

.symptom-tag:hover {
  background: #E5E5EA;
}

.symptom-tag--selected {
  background: #E8F5E9;
  border-color: #4CAF50;
  color: #2E7D32;
}

/* --------------------------------------------------------------------------
   Instructions
   -------------------------------------------------------------------------- */
.instructions {
  margin-top: 24px;
  text-align: center;
  color: #86868b;
  font-size: 14px;
}

/* Disclaimer */
.disclaimer {
  max-width: 600px;
  margin: 24px auto;
  padding: 16px 20px;
  background: #F9F9F9;
  border: 1px solid #E5E5EA;
  border-radius: 12px;
  text-align: left;
}

.disclaimer__title {
  font-size: 13px;
  font-weight: 600;
  color: #1c1c1e;
  margin-bottom: 8px;
}

.disclaimer__text {
  font-size: 12px;
  color: #636366;
  line-height: 1.6;
  margin-bottom: 8px;
}

.disclaimer__link {
  font-size: 12px;
  color: #007AFF;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* タブレット以下：縦並びに変更 */
@media (max-width: 900px) {
  .devices-container {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  .watch-container {
    order: -1; /* Watchを上に */
  }

  .watch-frame {
    width: 160px;
    height: 196px;
    border-radius: 42px;
    padding: 10px;
  }

  .watch-screen {
    border-radius: 34px;
  }

  .watch-crown {
    top: 40px;
    right: -7px;
    width: 7px;
    height: 22px;
  }

  .watch-button {
    top: 75px;
    right: -5px;
    width: 5px;
    height: 14px;
  }

  .watch-placeholder__icon {
    font-size: 36px;
  }

  .watch-placeholder__text {
    font-size: 12px;
  }
}

/* スマホ：フルスクリーンモード */
@media (max-width: 420px) {
  body {
    padding: 0;
    background: white;
  }

  .page-header {
    display: none;
  }

  .devices-container {
    width: 100%;
    gap: 0;
  }

  /* Watchを非表示（スマホではiPhoneのみ） */
  .watch-container {
    display: none;
  }

  .iphone-container {
    width: 100%;
  }

  .iphone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    background: white;
  }

  .iphone-notch {
    display: none;
  }

  .iphone-screen {
    border-radius: 0;
  }

  .status-bar {
    padding-top: 44px;
  }

  .instructions {
    display: none;
  }
}
