/* ============================================================
   Lofi Work Space – style.css
   ============================================================ */

/* ── CSS 変数（カラーテーマをここで一元管理） ── */
:root {
  --accent:      #a78bfa;                   /* アクセント：ソフトパープル（集中モード） */
  --accent-alt:  #34d399;                   /* 休憩モード：グリーン */
  --glass-bg:    rgba(12, 12, 28, 0.50);
  --glass-edge:  rgba(255, 255, 255, 0.11);
  --text-1:      #f1f5f9;
  --text-2:      rgba(241, 245, 249, 0.55);
  --blur:        blur(28px);
  --radius-lg:   24px;
  --radius-md:   12px;
  --radius-sm:   8px;
}

/* ── リセット ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-1);
  /* 動画が読み込まれる前のフォールバック背景 */
  background: linear-gradient(135deg, #0d0d1f 0%, #1a1535 50%, #0d1520 100%);
}

/* ── 背景動画（全画面） ── */
#bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

/* ── 暗めのオーバーレイ ── */
/* background の透明度を上げると動画が明るく見える */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 14, 0.52);
  z-index: -1;
}

/* ── メインレイアウト（画面中央に配置） ── */
.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  gap: 28px;
}

/* ── サイトタイトル ── */
.site-title {
  font-size: clamp(0.8rem, 2.5vw, 1.05rem);
  font-weight: 300;
  letter-spacing: 0.55em;
  color: var(--text-1);
  opacity: 0.65;
  user-select: none;
  animation: fadeUp 0.9s ease-out both;
}

/* ── ガラスモーフィズム パネル ── */
.panel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  max-width: 800px;
  width: 100%;
  animation: fadeUp 0.9s ease-out 0.15s both;
}

/* ── セクション共通 ── */
.timer-section,
.mixer-section {
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.mixer-section { align-items: stretch; }

/* ── セクションラベル ── */
.section-label {
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-2);
  align-self: flex-start;
}

/* ── モード切り替えタブ ── */
.mode-toggle {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--glass-edge);
}

.mode-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.77rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  background: transparent;
  color: var(--text-2);
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(167, 139, 250, 0.45);
}

/* ── 円形プログレスリング ── */
.ring-wrapper {
  position: relative;
  width: 176px;
  height: 176px;
}

/* SVG全体を -90度回転して12時方向からスタート */
.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 7;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear, stroke 0.4s ease;
}

/* タイマー数字（リング中央に絶対配置） */
.timer-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text-1);
}

/* タイマー終了時の点滅アニメーション */
.timer-display.flash {
  animation: flash 0.75s ease-in-out 5;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

/* ── タイマー操作ボタン ── */
.timer-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 18px rgba(167, 139, 250, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 7px 26px rgba(167, 139, 250, 0.52);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  border: 1px solid var(--glass-edge);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-1);
}

/* ── 縦の区切り線 ── */
.divider {
  width: 1px;
  background: var(--glass-edge);
  align-self: stretch;
  margin: 24px 0;
}

/* ── オーディオトラック ── */
.track {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track + .track {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-edge);
}

.track-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.track-icon { font-size: 1rem; line-height: 1; }

.track-name {
  flex: 1;
  font-size: 0.83rem;
  font-weight: 500;
}

/* ── 再生/ミュート トグルボタン ── */
.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text-1);
}

.toggle-btn[data-active="true"] {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.55);
  color: var(--accent);
}

/* ── ボリュームスライダー ── */
.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  /* グラデーション（塗り色）は JS で動的に更新される */
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
  transition: transform 0.15s ease;
}

.vol-slider::-webkit-slider-thumb:hover,
.vol-slider::-webkit-slider-thumb:active {
  transform: scale(1.3);
}

.vol-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.vol-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
}

/* 音量パーセント表示 */
.vol-pct {
  font-size: 0.67rem;
  color: var(--text-2);
  text-align: right;
  letter-spacing: 0.04em;
}

/* ── フェードインアニメーション ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── レスポンシブ（タブレット・スマホ） ── */
@media (max-width: 640px) {
  .panel {
    grid-template-columns: 1fr;
  }

  .divider {
    width: auto;
    height: 1px;
    margin: 0 28px;
  }

  .timer-section { padding: 28px 24px 20px; }
  .mixer-section { padding: 20px 24px 28px; }

  .ring-wrapper {
    width: 155px;
    height: 155px;
  }

  .timer-display { font-size: 1.9rem; }

  .mode-btn {
    padding: 6px 13px;
    font-size: 0.73rem;
  }
}

@media (max-width: 380px) {
  .timer-controls {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}
