/* ────────────────────────────────────────────────
 * ボイスシェア スタイル (RAKUA 風)
 * 藤色 + コーラル + 黄マーカー、丸ゴ、ピル型ボタン
 * ──────────────────────────────────────────────── */
:root {
  /* メインカラー (藤色) */
  --primary:    #7B83C7;
  --primary-d:  #6770B5;
  --primary-l:  #A8AEDD;
  --primary-bg: #EDF0FA;       /* 藤色の超淡い背景 */

  /* アクセント (コーラル) */
  --accent:     #E8A0AA;
  --accent-d:   #D88894;
  --accent-l:   #F4B7C2;

  /* マーカー風ハイライト (黄) */
  --marker:     #FFEC9E;
  --marker-d:   #FFE070;

  /* セクション背景 (ミントなど) */
  --mint:       #C8E8DD;
  --mint-l:     #DEEFE8;

  /* 状態色 */
  --danger:     #D86C7A;
  --success:    #8FB988;

  /* 基本色 */
  --bg:         #FAFAFA;
  --bg-card:    #FFFFFF;
  --surface:    #FFFFFF;
  --text:       #2C2C2C;
  --text-mid:   #6B6B6B;
  --text-light: #9B9B9B;
  --border:     #E5E5EA;

  /* 形状 */
  --radius-card: 20px;
  --radius-pill: 999px;
  --radius-sm:   10px;

  /* 影 (やさしめ) */
  --shadow-sm:  0 2px 8px rgba(123, 131, 199, 0.10);
  --shadow:     0 4px 16px rgba(123, 131, 199, 0.14);
  --shadow-lg:  0 8px 24px rgba(123, 131, 199, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro",
               "Yu Gothic UI", "Meiryo", "M PLUS Rounded 1c", system-ui, sans-serif;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ────────────────────────────────────────────────
 * ページ共通レイアウト
 * ──────────────────────────────────────────────── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 120px;
  min-height: 100dvh;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--text);
  /* 下線下にマーカー風のうっすら黄色 */
  display: inline-block;
  background: linear-gradient(transparent 65%, var(--marker) 65%);
  padding: 0 4px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-mid);
  margin: 4px 0 24px;
  line-height: 1.6;
}

/* カード: 白背景・大きく丸い・やさしい影 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(123, 131, 199, 0.10);
}
.card.center { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.hidden { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.row { display: flex; gap: 10px; }
.muted { color: var(--text-mid); font-size: 13px; }
.error {
  color: var(--danger);
  font-size: 13px;
  background: #FCEEF0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  border-left: 3px solid var(--danger);
}

/* ────────────────────────────────────────────────
 * ボタン (ピル型基本)
 * ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  min-height: 46px;
  border: none;
  border-radius: var(--radius-pill);  /* ピル型 */
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn:active   { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-primary   { background: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-secondary { background: var(--accent); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-d); }
.btn-accent    { background: var(--accent); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--accent-d); }
.btn-danger    { background: var(--danger); }
.btn-success   { background: var(--primary); }   /* 緑代わりに藤色 */
.btn-success:hover:not(:disabled) { background: var(--primary-d); }

.btn-ghost {
  background: #fff;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-l);
}

.btn-block { width: 100%; }
.btn-lg    { padding: 16px 28px; font-size: 16px; min-height: 56px; }
.btn-sm    { padding: 8px 16px;  font-size: 13px; min-height: 36px; }

/* ────────────────────────────────────────────────
 * トップメニュー: タイル
 * ──────────────────────────────────────────────── */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
.tile {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 24px 14px 18px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(123, 131, 199, 0.10);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.tile:active { transform: scale(0.97); }
.tile-icon {
  font-size: 38px;
  margin-bottom: 8px;
  display: inline-block;
  /* キラキラ感: ふんわりした藤色背景の円 */
  width: 76px;
  height: 76px;
  line-height: 76px;
  border-radius: 50%;
  background: var(--primary-bg);
}
.tile-label {
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
  position: relative;
}
/* タイルのラベル下に黄色マーカーをうっすら */
.tile-label::after {
  content: "";
  display: block;
  height: 6px;
  background: var(--marker);
  border-radius: 999px;
  margin: 4px 14% 0;
  opacity: 0.7;
}

/* ────────────────────────────────────────────────
 * フッターバー (画面下部ボタン群)
 * ──────────────────────────────────────────────── */
.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(123, 131, 199, 0.15);
  z-index: 100;
}
.footer-bar .btn { flex: 1; }

/* ────────────────────────────────────────────────
 * セクション ラベル
 * ──────────────────────────────────────────────── */
.label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mid);
  margin: 0 0 10px;
  letter-spacing: 0.04em;
  /* マーカー風ハイライト */
  display: inline-block;
  background: linear-gradient(transparent 60%, var(--marker) 60%);
  padding: 0 6px;
}

/* ────────────────────────────────────────────────
 * ドロップゾーン (アップロード)
 * ──────────────────────────────────────────────── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 36px 16px;
  border-radius: var(--radius-card);
  border: 2px dashed var(--primary-l);
  background: var(--primary-bg);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:hover,
.dropzone.dragover {
  background: #E0E5F5;
  border-color: var(--primary);
}
.dropzone-icon { font-size: 36px; }
.dropzone-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-d);
}
.dropzone-hint { font-size: 12px; color: var(--text-mid); }

/* ────────────────────────────────────────────────
 * 録音/録画 UI
 * ──────────────────────────────────────────────── */
.rec-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
}
.rec-timer {
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  margin: 16px 0;
  font-family: "SF Mono", Menlo, monospace;
}
.rec-timer.recording { color: var(--accent); }

.rec-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
  animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.waveform {
  width: 100%;
  height: 80px;
  background: var(--primary-bg);
  border-radius: 14px;
  display: block;
}

/* カウントダウンオーバーレイ (3, 2, 1) */
.countdown-overlay {
  position: fixed;
  inset: 0;
  background: rgba(123, 131, 199, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  pointer-events: auto;
  backdrop-filter: blur(2px);
}
.countdown-number {
  font-size: 160px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: countdown-pop 1s ease-out;
}
@keyframes countdown-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  20%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 0.95; }
}

/* ────────────────────────────────────────────────
 * プレビュー (audio/video)
 * ──────────────────────────────────────────────── */
.media-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
.media-wrap video {
  width: 100%;
  max-height: 60vh;
  display: block;
}
.fade-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.05s linear;
  z-index: 2;
}
.audio-player {
  width: 100%;
  margin-top: 8px;
}

/* ────────────────────────────────────────────────
 * トリミング タイムライン
 * ──────────────────────────────────────────────── */
.timeline {
  position: relative;
  height: 60px;
  background: var(--primary-bg);
  border-radius: 14px;
  margin: 14px 0;
  touch-action: none;
  user-select: none;
}
.timeline-range {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(123, 131, 199, 0.28);
  border-radius: 14px;
  pointer-events: none;
}
.timeline-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 14px;
  background: var(--primary);
  border-radius: 7px;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
.timeline-handle::before {
  content: "";
  width: 2px; height: 22px;
  background: #fff;
  border-radius: 1px;
}
.timeline-handle.end { background: var(--accent); }
.timeline-playhead {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 2px;
  background: var(--text);
  pointer-events: none;
}

.range-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-mid);
  padding: 0 4px;
}
.range-info b { color: var(--primary-d); font-weight: 700; }

/* ────────────────────────────────────────────────
 * 共有 URL 表示
 * ──────────────────────────────────────────────── */
.share-url-box {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  word-break: break-all;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-mid);
  margin-bottom: 12px;
  border: 1px solid rgba(123, 131, 199, 0.20);
}

/* ────────────────────────────────────────────────
 * スピナー
 * ──────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 4px solid var(--primary-bg);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 8px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ────────────────────────────────────────────────
 * トースト
 * ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(44, 44, 44, 0.92);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toast-fade 2.5s ease forwards;
}
@keyframes toast-fade {
  0%   { opacity: 0; transform: translate(-50%, 20px); }
  10%  { opacity: 1; transform: translate(-50%, 0); }
  85%  { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -10px); }
}

/* ────────────────────────────────────────────────
 * 「STEP」風バッジ (装飾用、必要なら使う)
 * ──────────────────────────────────────────────── */
.step-badge {
  display: inline-block;
  padding: 6px 18px;
  background: var(--primary-bg);
  color: var(--primary-d);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* PC 向け調整 */
@media (min-width: 720px) {
  .page { padding: 32px 24px 140px; }
  .page-title { font-size: 28px; }
  .card { padding: 28px 24px; }
}
