/* Aura Timer - 美しく洗練されたモダンUIスタイルシステム */

/* 1. グローバル設定 & カスタム変数 */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-timer: 'Outfit', sans-serif;
  
  /* カラーパレット (ダークモードを基調としたネオン発光スタイル) */
  --bg-color: #0d0f14;
  --panel-bg: rgba(22, 26, 38, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: rgba(0, 0, 0, 0.4);
  
  --color-primary: #00c6ff;     /* ネオンブルー */
  --color-secondary: #0078ff;   /* ディープブルー */
  --color-accent: #00ffaa;      /* エメラルドグリーン */
  --color-break: #ff477e;       /* ポモドーロ休憩用マゼンタ */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  /* アラート・ステータスカラー */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  
  /* トランジション定義 */
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.2s ease;
}

/* 2. リセット & ベーススタイル */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  padding: 20px;
}

/* 3. 視覚的背景演出（グラデーションオーブ） */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
}

.orb-1 {
  width: 450px;
  height: 450px;
  top: -10%;
  left: -10%;
  background: radial-gradient(circle, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.orb-2 {
  width: 500px;
  height: 500px;
  bottom: -15%;
  right: -10%;
  background: radial-gradient(circle, var(--color-accent) 0%, var(--color-secondary) 100%);
}

/* 4. メインコンテナ (ガラスモーフィズム - 横長レイアウト) */
.app-container {
  width: 100%;
  max-width: 940px; /* タイマー拡大に伴いコンテナ全体の幅を拡大 (820px -> 940px) */
  background: var(--panel-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: 0 20px 50px var(--panel-shadow);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

/* 左右パネル分割 */
.app-left-panel {
  flex: 1.1;
  padding: 36px;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 28px;
  justify-content: space-between;
}

.app-right-panel {
  flex: 0.9;
  padding: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.1);
}

/* 5. ヘッダー */
.app-header {
  text-align: left;
}

.app-title {
  font-family: var(--font-timer);
  font-weight: 800;
  font-size: 1.8rem; /* タイトル拡大 (1.6rem -> 1.8rem) */
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.85rem; /* サブタイトル拡大 (0.72rem -> 0.85rem) */
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* 6. ナビゲーションタブ */
.mode-tabs {
  width: 100%;
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 5px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.78rem; /* タブテキスト拡大 (0.65rem -> 0.78rem) */
  padding: 10px 4px;
  cursor: pointer;
  border-radius: 10px;
  transition: var(--transition-smooth);
  position: relative;
  outline: none;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tab-icon {
  width: 20px; /* アイコン拡大 (16px -> 20px) */
  height: 20px;
  transition: var(--transition-smooth);
}

.tab-btn.active .tab-icon {
  transform: scale(1.15);
}

/* 7. 円形タイマー表示 (全体的に一回り大きく調整) */
.timer-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.progress-ring-wrapper {
  position: relative;
  width: 320px; /* タイマーリングの拡大 (260px -> 320px) */
  height: 320px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* 12時の位置から開始するように回転 */
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 6;
}

.progress-ring-fg {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 597; /* 2 * PI * r (r=95) = ~596.90 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke var(--transition-smooth);
}

/* ポモドーロブレイク時はマゼンタカラーへ変遷するための追加クラス */
.progress-ring-fg.break-phase {
  stroke: var(--color-break);
}

.timer-text-container {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.pomodoro-phase-label {
  font-size: 0.95rem; /* フェーズテキスト拡大 (0.75rem -> 0.95rem) */
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
  transition: var(--transition-smooth);
}

.timer-digits {
  font-family: var(--font-timer);
  font-size: 4.4rem; /* デジタルタイマーテキスト拡大 (3.4rem -> 4.4rem) */
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 6px 24px rgba(255, 255, 255, 0.12);
}

.timer-sub-digits {
  font-family: var(--font-timer);
  font-size: 1.4rem; /* サブ桁（ミリ秒）テキスト拡大 (1.1rem -> 1.4rem) */
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 8. コントロールボタン */
.controls-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 4px;
}

.action-btn-primary {
  width: 72px; /* メインスタートボタン拡大 (64px -> 72px) */
  height: 72px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 198, 255, 0.35);
  transition: var(--transition-smooth);
  outline: none;
}

.action-btn-primary:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(0, 198, 255, 0.45);
}

.action-btn-primary:active {
  transform: translateY(1px) scale(0.98);
}

.action-btn-secondary {
  width: 48px; /* サブボタン拡大 (44px -> 48px) */
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
  outline: none;
}

.action-btn-secondary:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.action-btn-secondary:active {
  transform: scale(0.95);
}

.btn-icon {
  width: 18px; /* アイコン拡大 (16px -> 18px) */
  height: 18px;
}

.btn-icon-play {
  width: 22px; /* 再生アイコン拡大 (20px -> 22px) */
  height: 22px;
  margin-left: 2px;
}

.btn-icon-pause {
  width: 20px; /* 一時停止アイコン拡大 (18px -> 20px) */
  height: 20px;
}

/* 9. オプションパネル */
.mode-options-panel {
  width: 100%;
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  padding: 20px 0;
  min-height: 140px; /* 高さを少し拡張 */
  display: flex;
  align-items: center;
}

.options-group {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.3s ease forwards;
}

.options-group.active {
  display: flex;
}

/* ポモドーロオプション */
.pomodoro-stats {
  text-align: center;
  font-size: 0.9rem; /* セッション統計文字拡大 (0.75rem -> 0.9rem) */
  color: var(--text-muted);
}

.pomodoro-stats strong {
  color: var(--color-accent);
}

.quick-settings {
  display: flex;
  gap: 12px;
}

.setting-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-field label {
  font-size: 0.75rem; /* 設定ラベル拡大 (0.6rem -> 0.75rem) */
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
}

.setting-field input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #ffffff;
  padding: 8px;
  text-align: center;
  font-family: var(--font-timer);
  font-size: 1.05rem; /* 入力数値拡大 (0.9rem -> 1.05rem) */
  outline: none;
  transition: var(--transition-fast);
}

.setting-field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(0, 198, 255, 0.2);
}

/* カウントダウンオプション */
.time-presets {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem; /* プリセットボタン文字拡大 (0.7rem -> 0.82rem) */
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.15);
}

.countdown-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.input-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.input-col label {
  font-size: 0.75rem; /* カウントダウン設定ラベル拡大 (0.6rem -> 0.75rem) */
  color: var(--text-muted);
  text-transform: uppercase;
}

.input-col input {
  width: 58px; /* 入力欄をやや幅広に */
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 0;
  text-align: center;
  font-family: var(--font-timer);
  font-size: 1.05rem; /* 入力数値拡大 (0.9rem -> 1.05rem) */
  outline: none;
  transition: var(--transition-fast);
}

.input-col input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(0, 198, 255, 0.2);
}

/* ストップウォッチラップ表示 */
.lap-times-container {
  max-height: 110px;
  overflow-y: auto;
  padding-right: 4px;
}

/* カスタムスクールバー */
.lap-times-container::-webkit-scrollbar {
  width: 4px;
}

.lap-times-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}

.lap-times-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.lap-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem; /* ラップヘッダー文字拡大 (0.6rem -> 0.75rem) */
  color: var(--text-muted);
  text-transform: uppercase;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
}

.lap-header span {
  flex: 1;
}

.lap-header span:nth-child(1) { text-align: left; }
.lap-header span:nth-child(2) { text-align: center; }
.lap-header span:nth-child(3) { text-align: right; }

.lap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lap-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem; /* ラップ項目文字拡大 (0.7rem -> 0.85rem) */
  font-family: var(--font-timer);
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.lap-item span {
  flex: 1;
}

.lap-item span:nth-child(1) { text-align: left; color: var(--text-muted); }
.lap-item span:nth-child(2) { text-align: center; color: #ffffff; }
.lap-item span:nth-child(3) { text-align: right; color: var(--color-accent); }

.lap-empty {
  text-align: center;
  font-size: 0.85rem; /* ラップ未記録テキスト文字拡大 (0.7rem -> 0.85rem) */
  color: var(--text-muted);
  padding: 10px 0;
}

/* 10. フッター (システム設定) */
.app-config {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.config-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem; /* 設定トグル文字拡大 (0.7rem -> 0.85rem) */
  transition: var(--transition-fast);
  outline: none;
}

.config-btn:hover {
  color: var(--text-main);
}

.config-icon {
  width: 18px; /* 設定アイコン拡大 (14px -> 18px) */
  height: 18px;
}

/* Helper クラス */
.hidden {
  display: none !important;
}

/* アニメーション */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 11. レスポンシブ設計 (スマートフォン等縦長画面用) */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
    max-width: 440px;
    margin: 10px;
  }

  .app-left-panel {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding: 24px;
    gap: 20px;
  }

  .app-right-panel {
    padding: 24px;
  }

  .app-header {
    text-align: center;
  }

  .app-config {
    justify-content: center;
  }

  .progress-ring-wrapper {
    width: 240px; /* モバイルでの表示幅制限に合わせた調整 */
    height: 240px;
  }

  .timer-digits {
    font-size: 3.2rem;
  }
}
