/* ══════════════════════════════════════════════════════════
   タイマー・ストップウォッチ — スタイル
   テーマカラー: Amber (#d97706)
   ══════════════════════════════════════════════════════════ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fffbeb;
  color: #1c1917;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── ヘッダー ── */
header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
}
.logo { font-weight: 700; font-size: 1.1rem; color: #d97706; text-decoration: none; }
.logo:hover { color: #b45309; }

/* ── メイン ── */
main {
  flex: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  width: 100%;
}

/* ── ヒーロー ── */
.hero { text-align: center; padding: 32px 0 24px; }
.hero-icon { font-size: 3rem; margin-bottom: 12px; }
.hero h1 { font-size: 1.75rem; font-weight: 700; color: #92400e; margin-bottom: 8px; }
.description { color: #d97706; font-size: 0.95rem; line-height: 1.7; }

/* ── ツールラップ ── */
.tool-wrap {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 16px rgba(217,119,6,.1);
}

/* ── モードタブ ── */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 28px;
}
.mode-tab {
  padding: 11px;
  border: 2px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  color: #d97706;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  touch-action: manipulation;
}
.mode-tab:hover { border-color: #fcd34d; background: #fef3c7; }
.mode-tab.active {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 2px 10px rgba(217,119,6,.4);
}

/* ══════════════════════════════
   円形プログレス
   ══════════════════════════════ */
.ring-wrap {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 24px;
}
.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

/* SVGサークル */
.ring-bg   { fill: none; stroke: #fef3c7; stroke-width: 14; }
.ring-fill {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 753.98;   /* 2π × 120 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .6s ease, stroke .4s;
}
.ring-fill.running   { stroke: #d97706; }
.ring-fill.finished  { stroke: #dc2626; }
.sw-ring             { stroke: #10b981; }
.sw-ring.sw-running  { stroke: #059669; }

/* 中央テキスト */
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.time-display {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: 'SFMono-Regular', 'Courier New', monospace;
  color: #1c1917;
  line-height: 1;
  letter-spacing: .02em;
}
.time-display .cs {
  font-size: 1.6rem;
  color: #78716c;
}
.timer-label {
  font-size: 0.78rem;
  color: #a16207;
  font-weight: 500;
}

/* タイマー終了時アニメーション */
@keyframes pulse-red {
  0%, 100% { color: #dc2626; }
  50%       { color: #fca5a5; }
}
.time-display.finished { animation: pulse-red 0.8s ease infinite; }

/* ══════════════════════════════
   時間入力
   ══════════════════════════════ */
.time-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.time-sep { font-size: 1.5rem; font-weight: 700; color: #d97706; margin-bottom: 20px; }

.time-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.adj-btn {
  width: 36px;
  height: 24px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fef3c7;
  color: #d97706;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}
.adj-btn:hover { background: #fde68a; }
.adj-btn:active { background: #fcd34d; }

.time-input {
  width: 64px;
  height: 52px;
  border: 2px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'SFMono-Regular', monospace;
  color: #1c1917;
  outline: none;
  -moz-appearance: textfield;
  transition: border-color .18s, box-shadow .18s;
}
.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.time-input:focus { border-color: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,.15); }
.time-input:disabled { background: #f5f5f4; color: #a8a29e; border-color: #e7e5e4; }

.time-unit { font-size: 0.72rem; color: #a16207; font-weight: 600; }

/* ══════════════════════════════
   プリセット
   ══════════════════════════════ */
.preset-wrap { margin-bottom: 24px; text-align: center; }
.preset-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #d97706;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.preset-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.preset-btn {
  padding: 7px 16px;
  border: 1.5px solid #fcd34d;
  border-radius: 20px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
}
.preset-btn:hover { background: #d97706; color: #fff; border-color: #d97706; }
.preset-btn.active { background: #d97706; color: #fff; border-color: #d97706; box-shadow: 0 2px 8px rgba(217,119,6,.35); }

/* ══════════════════════════════
   コントロールボタン
   ══════════════════════════════ */
.ctrl-btns {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.ctrl-btn {
  padding: 14px 36px;
  border-radius: 50px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  touch-action: manipulation;
}
.start-btn {
  background: #d97706;
  color: #fff;
  box-shadow: 0 4px 14px rgba(217,119,6,.4);
  min-width: 140px;
}
.start-btn:hover  { background: #b45309; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(217,119,6,.45); }
.start-btn:active { transform: translateY(0); }
.start-btn.pause  { background: #78716c; box-shadow: 0 4px 14px rgba(120,113,108,.3); }
.start-btn.pause:hover { background: #57534e; }

.reset-btn {
  background: #fff;
  color: #78716c;
  border: 2px solid #e7e5e4;
  min-width: 100px;
}
.reset-btn:hover  { border-color: #dc2626; color: #dc2626; }
.reset-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ストップウォッチ用コントロール */
.sw-ctrl-btns { gap: 10px; }
.lap-btn {
  background: #fff;
  color: #059669;
  border: 2px solid #a7f3d0;
  min-width: 90px;
}
.lap-btn:hover:not(:disabled) { background: #059669; color: #fff; border-color: #059669; }
.lap-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════
   終了メッセージ
   ══════════════════════════════ */
.finish-msg {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #dc2626;
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  margin-top: 8px;
  animation: fade-in .4s ease;
}
.finish-icon { font-size: 1.3rem; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════
   ラップ一覧
   ══════════════════════════════ */
.lap-area {
  margin-top: 20px;
  border-top: 1px solid #fde68a;
  padding-top: 16px;
}
.lap-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  font-size: 0.75rem;
  font-weight: 700;
  color: #a16207;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 8px 8px;
}
.lap-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 8px;
  border-radius: 8px;
  font-family: 'SFMono-Regular', monospace;
  font-size: 0.9rem;
  transition: background .15s;
}
.lap-item:nth-child(odd) { background: #fffbeb; }
.lap-item:first-child { font-weight: 700; color: #d97706; }
.lap-num { color: #78716c; }

/* ══════════════════════════════
   汎用カード
   ══════════════════════════════ */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(217,119,6,.06);
}
.card h2 { font-size: 1.1rem; font-weight: 700; color: #92400e; margin-bottom: 16px; }

.how-item { margin-bottom: 16px; }
.how-item:last-child { margin-bottom: 0; }
.how-item h3 { font-size: 0.95rem; font-weight: 600; color: #d97706; margin-bottom: 4px; }
.how-item p  { font-size: 0.875rem; color: #374151; line-height: 1.65; }

/* Amazon */
.amazon-note { font-size: 0.85rem; color: #64748b; margin-bottom: 16px; }
.amazon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.amazon-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all .18s;
}
.amazon-item:hover { border-color: #fcd34d; background: #fffbeb; box-shadow: 0 2px 8px rgba(217,119,6,.12); }
.amazon-item-icon { font-size: 1.5rem; }
.amazon-item-name { font-size: 0.875rem; font-weight: 600; color: #1c1917; }
.amazon-item-desc { font-size: 0.78rem; color: #64748b; line-height: 1.45; }
.amazon-item-link { font-size: 0.78rem; color: #d97706; font-weight: 600; margin-top: 4px; }

/* ── ヒーローバッジ ── */
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 13px;
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fcd34d;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; }
.faq-item { padding: .9rem 0; border-bottom: 1px solid #fef3c7; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: .9rem; font-weight: 700; color: #d97706; margin-bottom: .35rem; }
.faq-a { font-size: .85rem; color: #57534e; line-height: 1.75; }

/* ── 活用シーン ── */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.scene-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 12px;
}
.scene-icon { font-size: 1.7rem; flex-shrink: 0; }
.scene-body strong { display: block; font-size: .88rem; font-weight: 700; color: #92400e; margin-bottom: .2rem; }
.scene-body p { font-size: .78rem; color: #78716c; line-height: 1.55; margin: 0; }

/* ── 関連ツール ── */
.related-tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.related-tool-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.related-tool-item:hover { border-color: #d97706; box-shadow: 0 2px 8px rgba(217,119,6,.12); }
.related-tool-icon { font-size: 1.6rem; flex-shrink: 0; }
.related-tool-item strong { display: block; font-size: .88rem; font-weight: 700; color: #d97706; margin-bottom: .2rem; }
.related-tool-item p { font-size: .76rem; color: #78716c; line-height: 1.5; margin: 0; }

.amazon-notice { font-size: 0.72rem; color: #bbb; margin-top: 0.2rem; }

/* ── フッター ── */
footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.8rem;
  color: #9ca3af;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
footer a { color: #d97706; text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer p + p { margin-top: 4px; }

.hidden { display: none !important; }

/* ══════════════════════════════
   レスポンシブ
   ══════════════════════════════ */

/* ─── Tips grid (rank-tracker 統一パターン) ──────── */
.tips-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.tip-item { display: flex; gap: .65rem; }
.tip-icon { font-size: 1.4rem; flex-shrink: 0; }
.tip-text strong { display: block; font-weight: 700; margin-bottom: .15rem; font-size: .88rem; }
.tip-text p { font-size: .8rem; color: #78716c; line-height: 1.55; }
@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .tool-wrap { padding: 20px 16px; }

  .ring-wrap { width: 240px; height: 240px; }
  .time-display { font-size: 2.4rem; }

  .time-input { width: 54px; height: 46px; font-size: 1.3rem; }
  .time-sep { font-size: 1.2rem; }

  .ctrl-btn { padding: 12px 24px; font-size: 0.9rem; min-width: auto; }
  .start-btn { min-width: 120px; }

  .amazon-grid { grid-template-columns: 1fr; }

  .tips-grid { grid-template-columns: 1fr; }
}

.amazon-notice {
  font-size: 0.72rem;
  color: #bbb;
  margin-top: 0.2rem;
}
