/* HOT.D.D.C のブランド色（claude-design/DESIGN.md に合わせている） */
:root {
  --primary: #AB0003;
  --primary-dark: #7C0002;
  --accent: #FDD003;
  --text: #333;
  --text-mid: #777;
  --bg: #fff;
  --bg-sub: #F7F5F2;
  --border: #E3DED8;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
               system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-sub);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

/* ── 上下の帯 ────────────────────────────── */
.head {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
}
.brand img { background: #fff; border-radius: 50%; padding: 3px; }

.foot {
  text-align: center;
  color: var(--text-mid);
  font-size: 13px;
  padding: 28px 16px 40px;
}
.foot p { margin: 4px 0; }
.small { font-size: 12px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 8px; }

/* ── 見出し・戻る ─────────────────────────── */
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.back {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.loading, .empty { color: var(--text-mid); text-align: center; padding: 32px 0; }
.error {
  background: #fff3f3;
  border: 1px solid #f2c9c9;
  color: var(--primary-dark);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0;
}

/* ── 切り替えボタン ───────────────────────── */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button {
  flex: 1;
  padding: 11px 8px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.tabs button[aria-pressed="true"] { background: var(--primary); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips button {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.chips button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  font-weight: 700;
}

/* 期間の切り替え（今週／これまで）。部門チップより一段強く見せる */
.chips.periods { margin-bottom: 10px; }
.chips.periods button {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.chips.periods button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── ランキング ───────────────────────────── */
.rank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rank-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.rank-no {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  color: var(--text-mid);
  font-variant-numeric: tabular-nums;
}
/* 1位は色を変える。同率1位が2チームいるときは両方に付くよう、行の位置ではなく印で判定する */
.rank-no.top { color: var(--primary); }
/* 同じ回数のチームには同じ順位を出す。数字だけだと写し間違いに見えるので小さく添える */
.rank-no.tied::after {
  content: "同率";
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-mid);
}
.rank-name { font-weight: 700; font-size: 16px; }
.rank-sub { color: var(--text-mid); font-size: 12px; }
.grow {
  display: inline-block;
  margin-left: 8px;
  font-weight: 700;
  font-size: 12px;
}
.grow.up { color: var(--primary); }
.grow.down, .grow.same { color: var(--text-mid); }
.week-note { text-align: center; margin-top: 14px; }

.rank-count { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rank-count small { font-size: 12px; font-weight: 600; margin-left: 2px; }

/* ── 成長記録 ─────────────────────────────── */
.stat-row { display: flex; gap: 8px; margin-bottom: 14px; }
.stat {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-mid); }

.chart {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}
.chart svg { width: 100%; height: auto; display: block; }
.chart h2 { font-size: 14px; margin: 0 0 8px; color: var(--text-mid); }

/* 5秒ごとの回数（記録の画面） */
.buckets { display: flex; align-items: flex-end; gap: 6px; height: 118px; }
.bucket { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bucket-count { font-size: 13px; font-weight: bold; font-variant-numeric: tabular-nums; }
.bucket-bar { width: 100%; max-width: 44px; background: var(--primary); border-radius: 3px 3px 0 0; }
.bucket-label { font-size: 10px; color: var(--text-mid); white-space: nowrap; }

.try-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.try-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
}
.try-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.badge-open { background: #fff4d6; color: #8a6100; }
.badge-done { background: #e6f4ea; color: #1c6b34; }
.badge-unread { background: var(--primary); color: #fff; }

/* しゅん先生の動画チェック */
.coach-feed-link {
  display: block; margin: -4px 0 12px; padding: 10px 14px;
  background: var(--primary-dark); color: #fff; font-weight: 700;
  border-radius: var(--radius); text-decoration: none;
}
.try-row.unread { background: #fffbe6; border-color: var(--accent); }
.feed-actions { display: flex; gap: 12px; justify-content: flex-end; padding: 4px 4px 0; }
.feed-action {
  background: none; border: 0; padding: 4px 0; font-size: 12px;
  color: var(--text-mid); text-decoration: underline; cursor: pointer;
}

/* ── スロー再生 ───────────────────────────── */
.stage { position: relative; background: #000; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.stage video { width: 100%; display: block; }
.overlay {
  position: absolute;
  top: 10px;
  right: 14px;
  color: #fff;
  text-align: right;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
  pointer-events: none;
}
.overlay .big { font-size: 52px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.overlay .big small { font-size: 15px; font-weight: 700; }
.overlay .sub { font-size: 12px; }
.overlay .state { font-size: 12px; font-weight: 700; color: var(--accent); }
.flash {
  position: absolute;
  inset: 0;
  border: 6px solid var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity .08s;
}
.flash.on { opacity: .95; }

.timeline {
  position: relative;
  height: 34px;
  background: #1c1c1c;
  border-radius: 0 0 var(--radius) var(--radius);
  cursor: pointer;
  overflow: hidden;
}
/* 上の帯＝数えていた30秒。下のヒゲ＝足がついたところ */
.tl-window { position: absolute; top: 0; height: 6px; background: var(--primary); }
.tl-tick { position: absolute; bottom: 5px; width: 2px; background: var(--accent); height: 11px; }
/* 数えなかった接地だけ白く高くする（見てほしいのはこちらなので） */
.tl-tick.missed { background: #fff; height: 22px; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }

.controls { display: flex; gap: 8px; align-items: center; margin: 12px 0 4px; flex-wrap: wrap; }
.controls button {
  padding: 10px 16px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
}
.controls button.play { background: var(--primary); color: #fff; min-width: 96px; }
.controls .speeds { display: flex; gap: 6px; margin-left: auto; }
.controls .speeds button { padding: 8px 12px; font-size: 14px; border-width: 1px; }
.controls .speeds button[aria-pressed="true"] { background: var(--primary); color: #fff; }

/* ── 訂正依頼 ─────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.card h2 { margin-top: 0; }
label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 4px; }
input[type="number"], textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 92px; resize: vertical; }
.hint { font-size: 12px; color: var(--text-mid); margin: 4px 0 0; }
button.send {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}
button.send:disabled { opacity: .5; cursor: default; }
.done {
  background: #e6f4ea;
  border: 1px solid #b7dfc4;
  color: #1c6b34;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 16px;
}
.asked { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.asked li {
  background: var(--bg-sub);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}
.asked .when { color: var(--text-mid); font-size: 12px; }

/* しゅん先生のコメント・専用ログイン */
.coach-card { padding: 24px; }
.coach-card h2 { font-size: 20px; margin: 0 0 16px; }
.coach-card p { margin: 8px 0 16px; }
.coach-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.8; }
.coach-card label { font-size: 14px; margin: 16px 0 8px; }
.coach-card input, .coach-card textarea {
  width: 100%; padding: 16px; border: 1px solid var(--border);
  border-radius: 12px; font: inherit; color: var(--text); background: #fff;
}
.coach-secondary {
  display: block; border: 1px solid var(--primary); border-radius: 999px;
  background: #fff; color: var(--primary); font: inherit; font-weight: 700;
  padding: 8px 24px; margin-top: 16px; min-height: 48px; cursor: pointer;
}
.coach-secondary:disabled { opacity: .5; cursor: default; }
.coach-message { color: var(--primary-dark); font-size: 14px; overflow-wrap: anywhere; }
.coach-card a, .foot a { color: var(--primary); }
.coach-card :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

[hidden] { display: none !important; }
