/* /haishin/ Mario 64 120-star tracker
 *
 * 半透明黒背景のオーバーレイ風。OBS のブラウザソースに重ねても違和感なく、
 * かつ単独閲覧でも文字が読めるバランスを目指す。
 */

:root {
  --bg: rgba(0, 0, 0, 0.78);
  --fg: #ffffff;
  --muted: #aaaaaa;
  --star-on: #ffd700;
  --star-off: #555555;
  --accent: #ffd700;
  --accent-2: #ff8c00;
  --danger: #ff5b5b;
  --tooltip-bg: rgba(20, 20, 20, 0.95);
  --tooltip-fg: #ffffff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--fg);
  font-family: 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  font-feature-settings: 'palt' 1;
  min-height: 100vh;
}
body {
  background: transparent;
}

.haishin-root {
  min-height: 100vh;
  background: var(--bg);
  padding: 10px 16px 14px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── achievement banner ─────────────────────────────── */
/* 2026-05-06 に 120/120 を達成したことを示す記念表示。
   一覧モード・カウントモード両方の最上部に表示する。 */
.achievement-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.18), rgba(255, 140, 0, 0.18));
  border: 1px solid rgba(255, 215, 0, 0.55);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}
.achievement-banner .ach-text strong {
  color: #fff7c2;
  margin-left: 6px;
}
.achievement-banner .ach-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}
.haishin-root.mode-count .achievement-banner {
  font-size: 13px;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.haishin-root.mode-count .achievement-banner .ach-icon {
  font-size: 14px;
}

/* ── topbar ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.title-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 8px;
}
.mode-toggle {
  display: inline-flex;
  border: 1px solid #444;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.mode-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.mode-btn:hover { background: rgba(255, 255, 255, 0.1); }
.mode-btn.is-active {
  background: var(--accent);
  color: #1a1a1a;
}

/* ── progress ─────────────────────────────── */
.progress {
  text-align: center;
  margin-bottom: 10px;
}
.progress-numbers {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
  font-feature-settings: 'tnum' 1;
}
.count-current {
  font-size: 40px;
  color: var(--accent);
  line-height: 1;
}
.count-sep {
  font-size: 24px;
  color: var(--muted);
}
.count-total {
  font-size: 24px;
  color: var(--fg);
}
.progress-bar {
  position: relative;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px auto 4px;
  max-width: 720px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}
.progress-percent {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  font-feature-settings: 'tnum' 1;
}

/* ── list mode ─────────────────────────────── */
.list-area {
  display: block;
}

.courses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
@media (max-width: 900px) {
  .courses {
    grid-template-columns: 1fr;
  }
}

.course-row {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.course-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-name .course-no {
  display: inline-block;
  min-width: 26px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.star {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--star-off);
  font-size: 24px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.1s, background 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  font-family: inherit;
  padding: 0;
}
.star.is-on {
  color: var(--star-on);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}
.star:hover {
  background: rgba(255, 255, 255, 0.08);
}
.star:active {
  transform: scale(0.92);
}
.star[disabled] {
  cursor: default;
}
.haishin-root[data-can-edit="false"] .star {
  cursor: default;
}

.secrets-block {
  margin-top: 6px;
}
.secrets-row .course-name {
  color: var(--accent);
}
.secrets-row .stars {
  /* 15個並べる、行幅で折り返す */
}

/* ── count mode ─────────────────────────────── */
/* OBSオーバーレイで左上に置きやすいよう、コンパクトに上寄せレイアウト。
   背景の半透明黒は維持しつつ、コンテンツは画面の左上に固まって表示する。 */
.haishin-root.mode-count .list-area {
  display: none;
}
.haishin-root.mode-count {
  min-height: 0;
  max-width: 480px;
  margin: 0;
  padding: 12px 16px 16px;
  display: block;
}
.haishin-root.mode-count .topbar {
  margin-bottom: 0;
  /* タイトルを隠すだけで mode-toggle はそのまま左に残す。
     これで一覧⇔カウント切り替えても toggle の表示位置がブレない。 */
  justify-content: flex-start;
}
.haishin-root.mode-count .title {
  display: none;
}
.haishin-root.mode-count .mode-toggle {
  opacity: 0.7;
  transition: opacity 0.2s;
}
.haishin-root.mode-count .mode-toggle:hover {
  opacity: 1;
}
.haishin-root.mode-count .progress {
  margin: 4px 0 0;
  text-align: left;
}
.haishin-root.mode-count .progress-numbers {
  justify-content: flex-start;
}
.haishin-root.mode-count .count-current {
  font-size: 84px;
  line-height: 0.95;
}
.haishin-root.mode-count .count-sep {
  font-size: 48px;
}
.haishin-root.mode-count .count-total {
  font-size: 48px;
}
.haishin-root.mode-count .progress-bar {
  height: 16px;
  margin: 8px 0 4px;
  max-width: none;
}
.haishin-root.mode-count .progress-percent {
  font-size: 16px;
  margin-top: 0;
  text-align: left;
}

/* ── tooltip ─────────────────────────────── */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -120%);
  transition: opacity 0.15s;
  z-index: 1000;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tooltip.is-show {
  opacity: 1;
}

/* ── toast ─────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: var(--danger);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1001;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── responsive ─────────────────────────────── */
@media (max-width: 640px) {
  .haishin-root { padding: 12px 8px 24px; }
  .title { font-size: 18px; }
  .title-sub { font-size: 12px; }
  .count-current { font-size: 44px; }
  .count-sep { font-size: 24px; }
  .count-total { font-size: 24px; }
  .course-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 10px;
  }
  .course-name {
    white-space: normal;
    font-size: 13px;
  }
  .star {
    font-size: 24px;
    width: 32px;
    height: 32px;
  }
  .haishin-root.mode-count {
    max-width: 100%;
  }
  .haishin-root.mode-count .count-current { font-size: 64px; }
  .haishin-root.mode-count .count-sep { font-size: 36px; }
  .haishin-root.mode-count .count-total { font-size: 36px; }
}
