/* ビーだまレース（party/marble）。テーマ色はガラスっぽい青紫（仕様§5）。
 * 画面のほとんどはCanvas 1枚で、その上にHUDとテロップと結果シートを重ねる。 */

:root {
  --party-bg: #f1eefe;
  --party-bg2: #ffffff;
  --party-card: #ffffff;
  --party-accent: #7c6cf0;
  --party-accent-dark: #5646c9;
  --party-accent-soft: #e8e4ff;
  --party-text: #2a2450;
  --party-muted: #7b74a0;
  --party-line: #e0dbf6;
}

/* ===== ゲーム画面の枠 ===== */

.marble-game {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 6px) calc(env(safe-area-inset-right) + 8px)
    calc(env(safe-area-inset-bottom) + 6px) calc(env(safe-area-inset-left) + 8px);
  background: var(--party-bg);
}

.marble-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px 6px;
  font-weight: 800;
  color: var(--party-accent-dark);
}

.marble-hud__race b {
  font-size: 20px;
}

.marble-hud__time {
  font-variant-numeric: tabular-nums;
  color: var(--party-muted);
  font-size: 15px;
}

/* ===== コース（Canvas）とその上の重ね物 ===== */

.marble-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #171436;
  box-shadow: 0 6px 0 rgba(60, 46, 140, 0.18);
  /* 応援タップでスクロールや選択が起きないように */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.marble-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* いまの順位（アイコンだけの小さなチップを1行に並べる） */
.marble-standing {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  pointer-events: none;
}

.marble-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  color: #2a2450;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.marble-chip b {
  font-size: 11px;
  color: var(--party-accent-dark);
}

.marble-chip--done {
  background: rgba(255, 233, 160, 0.95);
}

/* 実況テロップ（ローカル判定・シミュレーションには影響しない） */
.marble-telop {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  padding: 8px 12px;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  background: linear-gradient(90deg, rgba(124, 108, 240, 0), rgba(124, 108, 240, 0.85), rgba(124, 108, 240, 0));
  pointer-events: none;
  animation: marble-telop-in 0.25s ease-out;
}

@keyframes marble-telop-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* レース番号・カウントダウンの大きな表示 */
.marble-big {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(23, 20, 54, 0.55);
  pointer-events: none;
}

.marble-big__main {
  margin: 0;
  font-size: 74px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.marble-big__sub {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #ffe9a0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

/* ===== 結果シート（コースの上に重ねる） ===== */

.marble-sheet {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  padding: 16px 14px calc(env(safe-area-inset-bottom) + 16px);
  background: rgba(23, 20, 54, 0.86);
  color: #fff;
}

.marble-sheet__title {
  margin: 4px 0 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  color: #ffe9a0;
}

.marble-sheet__list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.marble-sheet__list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
  font-size: 16px;
}

.marble-rank {
  min-width: 2.2em;
  font-size: 18px;
  font-weight: 900;
  color: #ffe9a0;
}

.marble-who {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marble-pt {
  font-weight: 900;
  color: #b8f0d8;
}

.marble-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.marble-total-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.marble-total-name {
  width: 6.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marble-total-barwrap {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.marble-total-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #9d8bff, #ffe9a0);
}

.marble-total-pt {
  width: 3.4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.marble-podium {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.marble-podium-item {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
}

.marble-podium-1 {
  background: linear-gradient(90deg, #ffd76a, #ffb43f);
  color: #4a3400;
  font-size: 24px;
}

.marble-podium-2 {
  background: rgba(226, 230, 245, 0.85);
  color: #2f3550;
}

.marble-podium-3 {
  background: rgba(226, 176, 132, 0.85);
  color: #4a2c12;
}

.marble-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.marble-wait {
  margin: 8px 0 0;
  text-align: center;
  font-weight: 700;
  color: #c9c3f0;
}

.marble-cheer {
  margin: 6px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--party-muted);
}

/* ---- きょうのコース（docs/party-todaycourse-spec.md） ---- */

/* HUDの行のまん中に出す小さな表示。HUDは結果シートの外なので結果画面でも見える */
.marble-hud__daily {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--party-accent-soft);
  color: var(--party-accent-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ロビーのトグル（reflexのチーム戦トグルと同じ見た目の作法） */
.daily-opt__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 2px;
  cursor: pointer;
  text-align: left;
}
.daily-opt__row input {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  accent-color: var(--party-accent);
}
.daily-opt__row small {
  color: var(--party-muted, #7b74a0);
}
.daily-opt__note {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--party-accent-dark, #5646c9);
  text-align: left;
}
