/* ベース変数（案4：月と鐘ベース） */
:root {
  --bg: #f2f5fb;
  --surface: #ffffff;
  --surface-alt: #f6f8fd;
  --border: #d7e0f0;
  --text: #121a2f;
  --text-muted: #5c6b8a;
  --primary: #3b6fd8;
  --primary-hover: #2b5bc0;
  --primary-soft: #eaf0fc;
  --accent: #1e8c8d;
  --accent-soft: #e2f4f4;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --warn-border: #fcd34d;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fca5a5;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(18, 26, 47, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}

.app-header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.btn-install-app {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  flex-shrink: 0;
}

.btn-install-app:hover {
  background: var(--surface-alt);
}

[hidden] {
  display: none !important;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.84rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 8px;
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--primary);
}

/* ビューヘッダー（全画面共通の縦積み構造） */
.view-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 16px;
}

.view-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.view-header h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.view-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* 共通カード・ボタン */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
}

.btn-icon-menu {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--text-muted);
}

.btn-icon-menu:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--text);
}

.primary-cta-wrap {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary:hover:not(:disabled) {
  background: #f1f5f9;
}

.btn-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn-duration {
  flex: 0 1 auto;
  min-width: 110px;
  background: var(--surface-alt);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-duration:hover {
  background: #e0f2fe;
}

.muted-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 通知・エラーバナー */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.alert-banner.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.alert-banner.error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
  display: block;
}

.alert-banner ul {
  margin: 0;
  padding-left: 20px;
}

/* ルーティン一覧 */
.routine-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.routine-title-wrap,
.med-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.routine-title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.routine-meta {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1.15rem;
  user-select: none;
  padding: 2px 4px;
  flex-shrink: 0;
}

.meta-pill {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
}

.routine-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.is-dragging {
  opacity: 0.5;
}

.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.empty-state {
  text-align: center;
  padding: 32px 18px;
}

/* フォーム */
.form-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.text-input,
.select-input {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.text-input:focus,
.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.med-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg);
}

/* 行程カードの追加・複製・移動・削除アニメーション */
.med-card {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

@keyframes med-card-enter {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
}

@keyframes med-card-duplicate {
  0% {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.28);
  }
  65% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
}

@keyframes med-card-moved {
  0% {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.3);
  }
  100% {
    border-color: var(--border);
    box-shadow: var(--shadow);
  }
}

.med-card-enter {
  animation: med-card-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.med-card-duplicate {
  animation: med-card-duplicate 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.med-card-moved {
  animation: med-card-moved 0.55s ease-out;
}

.med-card-removing {
  overflow: hidden;
  pointer-events: none;
  border-color: var(--danger-border);
  transition:
    height 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    padding-top 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    padding-bottom 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    margin-bottom 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    border-top-width 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    border-bottom-width 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease 0.16s;
}

.med-card-removing.is-collapsing {
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-top-width: 0;
  border-bottom-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  .med-card,
  .med-card-removing {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
  .med-card-enter,
  .med-card-duplicate,
  .med-card-moved {
    animation-duration: 0.01ms !important;
  }
}

.step-field {
  margin-bottom: 10px;
}

.step-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.step-fixed-label {
  flex: 1 1 160px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

/* 時間設定モーダル */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-dialog {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
}

.modal-dialog h2 {
  margin: 0 0 14px;
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.modal-section {
  margin-bottom: 16px;
}

.manual-duration-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manual-duration-row .text-input {
  flex: 1 1 140px;
  min-width: 0;
}

.manual-duration-row .select-input {
  flex: 0 0 96px;
}

.duration-preview {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
}

.duration-preview.is-error {
  color: var(--danger);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.legal-doc h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.legal-doc h2 {
  font-size: 1.08rem;
  margin-top: 22px;
}

/* タイマー実行画面 (SCR-04) */
.timer-card {
  text-align: center;
  padding: 28px 20px;
}

.timer-med-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.timer-step-label {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.timer-guide-banner {
  margin: 12px auto 0;
  padding: 8px 14px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 0.95rem;
  max-width: 420px;
}

.timer-clock {
  font-size: clamp(2.2rem, 11vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 14px 0;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 14px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.18s linear;
}

.timer-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.pause-panel {
  text-align: center;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 音声設定・視覚フィードバック */
.confirm-med-list {
  padding-left: 20px;
  margin: 8px 0 0;
}

.confirm-med-list li {
  margin-bottom: 6px;
}

.rate-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.speech-subtitle {
  margin-top: 12px;
  min-height: 1.4em;
  font-size: 0.88rem;
  color: var(--primary);
  font-weight: 600;
}

@keyframes timer-flash {
  0% {
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.35);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

.timer-card.is-flash {
  animation: timer-flash 0.45s ease-out;
}

/* 完了画面・ステータスバッジ (SCR-05) */
.status-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.status-badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-badge.info {
  background: #e0f2fe;
  color: var(--primary);
}

.status-badge.success {
  background: #ccfbf1;
  color: var(--accent);
}

/* 未保存完了履歴インライン一覧 (SCR-01) */
.pending-banner {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.pending-banner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pending-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pending-batch-error {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 0.86rem;
}

.pending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
}

.pending-item-info {
  min-width: 0;
}

.pending-item-title {
  font-weight: 700;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.pending-item-time {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.pending-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-item-actions .btn {
  flex: 1 1 120px;
}

/* 行程複製・テンプレート選択・備考 */
.med-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.edit-add-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-add-actions .btn {
  flex: 1 1 200px;
}

.med-note-text {
  font-size: 0.84rem;
  margin-top: 2px;
}

.timer-med-note {
  font-size: 0.88rem;
  margin-top: 4px;
}

.modal-dialog-wide {
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.modal-tab {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.modal-tab.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.picker-search-wrap {
  margin-bottom: 10px;
}

.picker-list {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.picker-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.picker-item:hover {
  border-color: var(--primary);
}

.picker-item.is-selected {
  border-color: var(--primary);
  background: #f0f9ff;
}

.picker-checkbox {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.picker-item-body {
  min-width: 0;
  flex: 1;
}

.picker-item-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.picker-item-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.picker-item-steps {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 4px;
}

.picker-item-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.picker-source-badge {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.picker-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ios-install-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
}

/* 共通アクションメニュー（ボトムシート風モーダル） */
.action-sheet-backdrop {
  align-items: flex-end;
  padding: 12px;
}

.action-sheet-dialog {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-sheet-header {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.action-sheet-title {
  margin: 0 !important;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.action-sheet-subtitle {
  margin: 4px 0 0;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.action-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-sheet-cancel {
  padding-top: 4px;
}

@media (min-width: 600px) {
  .action-sheet-backdrop {
    align-items: center;
  }
}


/* ===== Stillbell 瞑想タイマー拡張スタイル ===== */

[data-theme="dark"] {
  --bg: #121a2f;
  --surface: #18233d;
  --surface-alt: #1f2d4d;
  --border: #2c3d63;
  --text: #f0f4f8;
  --text-muted: #9aa8c7;
  --primary: #8db5f3;
  --primary-hover: #75a3ee;
  --primary-soft: rgba(141, 181, 243, 0.16);
  --accent: #2db3b4;
  --accent-soft: rgba(30, 140, 141, 0.22);
  --warn: #f4e6a3;
  --warn-bg: #2a2414;
  --warn-border: #6b5822;
  --danger: #f87171;
  --danger-bg: #31171b;
  --danger-border: #7f1d1d;
  --shadow: 0 6px 20px rgba(7, 11, 22, 0.45);
}

[data-theme="dark"] .btn-primary {
  color: #0e1526;
}

[data-theme="dark"] .btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
  background: #28395e;
}

[data-theme="dark"] .input,
[data-theme="dark"] select.input,
[data-theme="dark"] textarea.input {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .modal-dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

[data-theme="dark"] .chip-btn {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .chip-btn.active {
  background: var(--primary);
  color: #0e1526;
  border-color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 統計サマリーカード */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stats-summary-grid.stats-4 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 560px) {
  .stats-summary-grid.stats-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.session-desc {
  margin: 2px 0 0;
  font-size: 0.85rem;
}

.badge-preset {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(141, 181, 243, 0.35);
  margin-right: 6px;
}

/* フェーズ編集カード */
.phase-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phase-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.phase-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.phase-badge-prepare {
  background: rgba(244, 230, 163, 0.16);
  color: var(--warn);
}

.phase-badge-meditation {
  background: var(--accent-soft);
  color: var(--accent);
}

.phase-badge-cooldown {
  background: var(--primary-soft);
  color: var(--primary);
}

.phase-move-actions {
  display: flex;
  gap: 6px;
}

.phase-fields {
  display: grid;
  gap: 10px;
}

.duration-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
}

.duration-value {
  font-weight: 600;
}

.add-phase-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.edit-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 確認画面・設定 */
.confirm-total {
  margin-bottom: 10px;
}

.confirm-phase-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.confirm-phase-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.confirm-phase-num {
  font-weight: 700;
  color: var(--primary);
}

.confirm-phase-name {
  font-weight: 600;
  margin-right: auto;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 560px) {
  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.voice-detail-box {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  background: var(--surface-alt);
  border-radius: 6px;
}

/* タイマー実行画面 */
.timer-screen {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timer-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wake-lock-badge {
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.timer-center-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.phase-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.timer-phase-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
}

.timer-clock-wrap {
  transition: opacity 0.3s ease;
}

.timer-clock-wrap.clock-dimmed {
  opacity: 0.25;
}

.timer-clock {
  font-size: 3.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.timer-total-rem {
  margin-top: 4px;
  font-size: 0.88rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 20px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s linear;
}

.timer-subtitle {
  min-height: 1.4em;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 呼吸ガイドリング */
.breathing-ring {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 8px auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breathing-ring.hidden-ring {
  display: none;
}

.breathing-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 140, 141, 0.36), rgba(141, 181, 243, 0.1));
  border: 2px solid var(--accent);
  transition: transform 4s ease-in-out;
  transform: scale(0.75);
}

.breathing-ring[data-breath-state="inhale"] .breathing-core {
  transform: scale(1.06);
  transition: transform 4s ease-out;
}

.breathing-ring[data-breath-state="exhale"] .breathing-core {
  transform: scale(0.72);
  transition: transform 6s ease-in-out;
}

.breathing-label {
  position: relative;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.timer-toggles {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.timer-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.early-stop-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 完了・振り返り */
.complete-summary-card {
  text-align: center;
}

.complete-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.complete-duration {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--primary);
  margin: 4px 0;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}

@media (min-width: 520px) {
  .mood-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.complete-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-actions .btn {
  flex: 1 1 140px;
}

/* 履歴・ヒートマップ */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 6px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.heatmap-cell.level-1 {
  background: rgba(30, 140, 141, 0.3);
  border-color: rgba(45, 179, 180, 0.45);
}

.heatmap-cell.level-2 {
  background: rgba(30, 140, 141, 0.6);
  border-color: rgba(45, 179, 180, 0.78);
}

.heatmap-cell.level-3 {
  background: var(--accent);
  border-color: var(--accent);
}

.history-log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-log-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.history-log-title {
  margin: 0;
  font-size: 1rem;
}

.history-log-date {
  font-size: 0.82rem;
}

.history-log-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-duration {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
}

.history-log-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mood-pill {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.history-memo-text {
  margin: 6px 0 0;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.history-log-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.alert-banner.success {
  background: var(--accent-soft);
  border: 1px solid rgba(45, 179, 180, 0.4);
  color: var(--accent);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* 広告スロット枠・ガイド記事 */
.ad-slot-card {
  margin: 20px 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  min-height: 110px;
  overflow: hidden;
}

.ad-slot-card--rectangle {
  min-height: 280px;
}

.ad-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.guide-article h2 {
  margin-top: 24px;
}

.guide-article h3 {
  margin-top: 16px;
  font-size: 1rem;
}
