/* ============ Design tokens ============ */
:root {
  --bg: #f3f5fa;
  --bg-deep: #0f172a;
  --card: #ffffff;
  --ink: #16203a;
  --muted: #64748b;
  --line: #e2e8f0;

  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-soft: #eef2ff;
  --primary-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

  --accent: #f59e0b;
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;

  --gold: #f5b301;
  --silver: #9aa5b1;
  --bronze: #c9793a;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(79, 70, 229, .18);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(1200px 400px at 50% -220px, rgba(124, 58, 237, .14), transparent 70%),
    var(--bg);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
}

/* ============ Top bar ============ */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(15, 23, 42, .88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 0 clamp(16px, 4vw, 32px);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  background: var(--primary-grad);
  display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(124, 58, 237, .5);
}
.brand-mark svg { width: 19px; height: 19px; }
header.topbar h1 {
  font-size: 1.02rem; font-weight: 700; margin: 0;
  letter-spacing: .02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: .68rem; color: #94a3b8; letter-spacing: .14em; line-height: 1.2; }

/* ============ Layout ============ */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 32px) clamp(14px, 4vw, 24px) 110px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 3.5vw, 26px);
  margin-bottom: 18px;
  box-shadow: var(--shadow-md);
  animation: rise .35s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
h2 { font-size: 1.12rem; font-weight: 700; margin: 0 0 6px; letter-spacing: .01em; }
.section-lead { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }
.muted { color: var(--muted); font-size: .88rem; }

/* ============ Forms ============ */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .9rem; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  font-size: 1rem;
  font-family: inherit;
  background: #fbfcfe;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

/* ============ Buttons ============ */
button {
  cursor: pointer;
  border: none;
  border-radius: var(--r-md);
  padding: 12px 22px;
  font-size: .98rem;
  font-weight: 700;
  font-family: inherit;
  background: var(--primary-grad);
  color: #fff;
  box-shadow: var(--shadow-sm), 0 4px 14px rgba(99, 82, 233, .32);
  transition: transform .12s, box-shadow .15s, filter .15s, background .15s;
}
button:hover { filter: brightness(1.06); box-shadow: var(--shadow-lg); }
button:active { transform: scale(.97); }
button:disabled {
  opacity: .45; cursor: not-allowed;
  box-shadow: none; filter: grayscale(.4);
}
button.secondary {
  background: var(--primary-soft); color: var(--primary);
  box-shadow: none;
}
button.secondary:hover { background: #e0e7ff; filter: none; box-shadow: none; }
button.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
button.danger:hover { background: #fee2e2; filter: none; box-shadow: none; }
button.ghost {
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--line); box-shadow: none;
}
button.ghost:hover { color: var(--ink); border-color: #cbd5e1; filter: none; box-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ============ Chips / badges ============ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .76rem; font-weight: 700;
  background: rgba(255, 255, 255, .14); color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, .18);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: #047857; border: none; }

/* 明るい背景用の小さなラベル（.pillはダークなヘッダー専用） */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: 1px;
}

/* ============ Segmented control ============ */
.segmented {
  display: inline-flex;
  background: #e9edf5;
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
}
.segmented button {
  background: transparent; color: var(--muted);
  border-radius: var(--r-sm);
  padding: 9px 18px;
  font-weight: 700; font-size: .92rem;
  box-shadow: none; white-space: nowrap;
}
.segmented button:hover { filter: none; box-shadow: none; color: var(--ink); }
.segmented button.active {
  background: #fff; color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ============ Voter type picker (big cards) ============ */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
@media (max-width: 540px) { .choice-grid { grid-template-columns: 1fr; } }
.choice {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  box-shadow: none; color: var(--ink);
}
.choice:hover { border-color: #c7d2fe; filter: none; box-shadow: var(--shadow-sm); }
.choice.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}
.choice .c-title { font-weight: 800; font-size: 1.05rem; display: block; }
.choice .c-desc { font-weight: 500; font-size: .82rem; color: var(--muted); display: block; margin-top: 2px; }
.choice .c-check {
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line);
  display: grid; place-items: center;
  transition: all .15s;
}
.choice.active .c-check { border-color: var(--primary); background: var(--primary); }
.choice .c-check svg { width: 12px; height: 12px; opacity: 0; transition: opacity .15s; }
.choice.active .c-check svg { opacity: 1; }

/* ============ Progress ============ */
.progress-wrap { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.progress-bar {
  flex: 1; height: 9px; border-radius: 999px;
  background: #e6eaf3; overflow: hidden;
}
.progress-bar > div {
  height: 100%; border-radius: 999px;
  background: var(--primary-grad);
  transition: width .4s cubic-bezier(.2, .7, .3, 1);
}
.progress-label { font-size: .84rem; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ============ Item grid ============ */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.item-card {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: none;
  transition: border-color .15s, box-shadow .18s, transform .15s;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 92px;
}
.item-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
  filter: none;
}
.item-card .i-name { font-weight: 800; font-size: 1rem; line-height: 1.4; padding-right: 26px; }
.item-card .i-desc { font-size: .8rem; color: var(--muted); font-weight: 500; }
.item-card .i-status {
  margin-top: auto; padding-top: 8px;
  font-size: .76rem; font-weight: 700; color: #94a3b8;
  display: flex; align-items: center; gap: 5px;
}
.item-card.voted { border-color: #a7f3d0; background: linear-gradient(180deg, #fff, #f2fdf9); }
.item-card.voted .i-status { color: #059669; }
.item-card .i-arrow {
  position: absolute; top: 14px; right: 12px;
  color: #cbd5e1; transition: transform .15s, color .15s;
}
.item-card:hover .i-arrow { transform: translateX(2px); color: var(--primary); }

/* ============ Score picker ============ */
.criteria-block {
  padding: 16px 0 18px;
  border-bottom: 1px dashed var(--line);
}
.criteria-block:last-child { border-bottom: none; }
.criteria-name { font-weight: 700; font-size: .96rem; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.criteria-name .req { font-size: .7rem; color: var(--muted); font-weight: 600; }
.score-scale { display: flex; gap: 8px; flex-wrap: wrap; }
.score-scale button {
  min-width: 52px; height: 52px;
  border-radius: 50%;
  background: #fff; color: var(--ink);
  border: 2px solid var(--line);
  font-size: 1.05rem; font-weight: 800;
  box-shadow: none;
  padding: 0;
  display: grid; place-items: center;
  transition: all .13s;
}
.score-scale button:hover { border-color: #a5b4fc; color: var(--primary); filter: none; box-shadow: none; }
.score-scale button.active {
  background: var(--primary-grad); color: #fff; border-color: transparent;
  transform: scale(1.1);
  box-shadow: 0 4px 14px rgba(99, 82, 233, .4);
}
.score-hint { display: flex; justify-content: space-between; font-size: .74rem; color: #94a3b8; margin-top: 7px; font-weight: 600; }

/* ============ Sticky action bar (vote) ============ */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px clamp(14px, 4vw, 24px) calc(12px + env(safe-area-inset-bottom));
}
.action-bar .inner {
  max-width: 880px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
}
.action-bar .status { flex: 1; font-size: .84rem; font-weight: 600; color: var(--muted); }
.action-bar button { padding: 13px 30px; font-size: 1.02rem; }

/* ============ Tables / ranking ============ */
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
th { color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
/* 大きな表（採点表など）で先頭列を固定してスクロールしやすくする */
.table-scroll .sticky-col { position: sticky; left: 0; background: var(--card); z-index: 1; box-shadow: 2px 0 0 var(--line); }
.table-scroll thead .sticky-col { z-index: 2; }

/* 投票画面: 部門の見出し */
.cat-heading {
  grid-column: 1 / -1;
  margin: 14px 0 2px;
  font-weight: 800;
  color: var(--primary);
  font-size: .95rem;
  display: flex; align-items: center; gap: 8px;
}
.cat-heading::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.rank-badge {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  font-weight: 800; font-size: .92rem;
  background: #eef1f7; color: var(--muted);
}
.rank-badge.r1 { background: linear-gradient(135deg, #fde68a, var(--gold)); color: #78350f; box-shadow: 0 2px 8px rgba(245, 179, 1, .45); }
.rank-badge.r2 { background: linear-gradient(135deg, #e5e9ee, var(--silver)); color: #334155; }
.rank-badge.r3 { background: linear-gradient(135deg, #e8b48a, var(--bronze)); color: #57230b; }

.score-cell { min-width: 170px; }
.score-line { display: flex; align-items: center; gap: 10px; }
.score-line .val { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.bar {
  flex: 1; height: 8px; border-radius: 999px; background: #edf0f7; overflow: hidden; min-width: 60px;
}
.bar > div {
  height: 100%; border-radius: 999px;
  background: var(--primary-grad);
  transition: width .5s cubic-bezier(.2, .7, .3, 1);
}

/* ============ Stats chips ============ */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.stat {
  flex: 1; min-width: 165px;
  background: #f8fafc; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.stat .s-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat .s-icon svg { width: 21px; height: 21px; }
.stat.vote-judge .s-icon { background: var(--primary-soft); color: var(--primary); }
.stat.vote-visitor .s-icon { background: var(--ok-soft); color: #047857; }
.stat.items { background: #fff; border-style: dashed; }
.stat.items .s-icon { background: #f1f5f9; color: var(--muted); }
.stat .s-label { font-size: .74rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.stat .s-value { font-size: 1.45rem; font-weight: 800; line-height: 1.3; }
.stat .s-unit { font-size: .8rem; font-weight: 700; color: var(--muted); margin-left: 3px; }

/* ============ Admin tab nav (grouped) ============ */
.tab-nav { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; align-items: flex-end; }
.tab-group { max-width: 100%; min-width: 0; }
/* 設定だけ右端に寄せて「準備するもの」と役割を分ける */
.tab-group-end { margin-left: auto; }
.tab-group-label {
  font-size: .72rem; font-weight: 800; color: var(--muted);
  letter-spacing: .08em; margin: 0 0 6px 6px;
}

/* スマホ: 上部のタブは隠してボトムナビ（.bottom-nav）に切り替える */
@media (max-width: 640px) {
  /* 一覧行: 名前を1行目いっぱいに、操作（プルダウン・ボタン）は2行目へ */
  .list-row { flex-wrap: wrap; row-gap: 8px; }
  .list-row .grow { flex-basis: 100%; }
}

/* ============ Image preview modal ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .58);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
  width: 100%; max-width: 860px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
}
.modal-card canvas { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 10px; }

/* ============ Survey option editor (Google Forms風) ============ */
.option-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.option-row .opt-dot {
  width: 18px; height: 18px; border: 2px solid #cbd5e1; border-radius: 50%; flex-shrink: 0;
}
.option-row.multi .opt-dot { border-radius: 4px; }
.option-row input { flex: 1; min-width: 0; }
.option-row .opt-remove {
  background: transparent; color: var(--muted); box-shadow: none;
  padding: 6px 10px; font-size: 1.05rem; line-height: 1; flex-shrink: 0;
}
.option-row .opt-remove:hover { color: var(--danger); filter: none; box-shadow: none; }

/* ============ 使用量の警告バナー ============ */
.usage-banner {
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: .9rem;
  line-height: 1.6;
  border: 1px solid;
}
.usage-banner.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.usage-banner.danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }

/* ============ Misc ============ */
.method-desc {
  background: var(--primary-soft);
  border-radius: var(--r-md);
  padding: 11px 14px;
  margin-top: 10px;
  font-size: .86rem;
  color: #3730a3;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .grid2 { grid-template-columns: 1fr; } }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.empty {
  text-align: center; color: var(--muted);
  padding: 34px 10px; font-size: .92rem;
  border: 1.5px dashed var(--line); border-radius: var(--r-md);
}

.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(8px);
  background: var(--bg-deep); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-size: .92rem; font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 60;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; box-shadow: none;
  color: var(--muted); font-weight: 700; font-size: .9rem;
  padding: 4px 2px; margin-bottom: 10px;
}
.back-link:hover { color: var(--primary); filter: none; box-shadow: none; }

.hero {
  text-align: center;
  padding: clamp(6px, 2vw, 14px) 0 clamp(14px, 3vw, 22px);
}
.hero h2 { font-size: clamp(1.3rem, 4.5vw, 1.7rem); margin: 0; }
.hero p { color: var(--muted); font-size: .92rem; margin: 6px 0 0; }

/* ============ Skeleton loading（読み込み中の骨組み表示） ============ */
.sk-line {
  border-radius: 8px;
  background: linear-gradient(90deg, #e9edf5 25%, #f6f8fc 50%, #e9edf5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============ 検索バー（投票画面） ============ */
.search-wrap { position: relative; margin: 0 0 12px; }
.search-wrap svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: #94a3b8; pointer-events: none;
}
.search-wrap input {
  padding-left: 42px;
  border-radius: 999px;
  background: #f4f6fb;
  border-color: transparent;
}
.search-wrap input:focus { background: #fff; border-color: var(--primary); }

/* ============ 部門チップ（横スクロールの絞り込み） ============ */
.chip-row {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--muted);
  font-weight: 700; font-size: .86rem;
  box-shadow: none;
  transition: all .15s;
}
.chip:hover { border-color: #c7d2fe; color: var(--primary); filter: none; box-shadow: none; }
.chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 3px 10px rgba(79, 70, 229, .3);
}

/* ============ ボトムシート（採点フォーム） ============ */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0);
  display: flex; align-items: flex-end; justify-content: center;
  transition: background .25s;
}
.sheet-overlay.open { background: rgba(15, 23, 42, .55); }
.sheet {
  width: 100%; max-width: 720px;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 48px rgba(15, 23, 42, .28);
  max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .7, .3, 1);
}
.sheet-overlay.open .sheet { transform: translateY(0); }
.sheet-head { padding: 10px 20px 12px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-handle {
  width: 42px; height: 5px; border-radius: 999px;
  background: #d7dce7; margin: 0 auto 10px;
}
.sheet-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-close {
  flex: none;
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  background: #f1f5f9; color: var(--muted);
  box-shadow: none;
  display: grid; place-items: center;
}
.sheet-close:hover { background: #e2e8f0; color: var(--ink); filter: none; box-shadow: none; }
.sheet-body { overflow-y: auto; padding: 4px 20px 10px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
}
.sheet-foot .status { flex: 1; font-size: .84rem; font-weight: 600; color: var(--muted); }
.sheet-foot button { padding: 13px 30px; font-size: 1.02rem; }

/* ============ 投票完了のお祝い画面 ============ */
.celebrate-overlay {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .25s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.celebrate-card {
  background: var(--card);
  border-radius: 22px;
  padding: 34px 28px 28px;
  width: 100%; max-width: 400px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
  animation: pop .4s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes pop {
  from { opacity: 0; transform: scale(.82); }
  to   { opacity: 1; transform: scale(1); }
}
.cel-mark { width: 84px; height: 84px; margin: 0 auto; }
.cel-mark svg { width: 100%; height: 100%; }
.cel-circle {
  stroke-dasharray: 202; stroke-dashoffset: 202;
  animation: draw .55s .1s ease-out forwards;
}
.cel-check {
  stroke-dasharray: 42; stroke-dashoffset: 42;
  animation: draw .35s .55s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ============ 上位3位の表彰台（管理画面） ============ */
.podium { display: flex; gap: 10px; align-items: flex-end; margin: 16px 0 8px; }
.podium-card {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px 8px 12px;
}
.podium-card.pos1 {
  order: 2;
  padding-top: 20px; padding-bottom: 18px;
  background: linear-gradient(180deg, #fffbeb, #fff);
  border-color: #fde68a;
  box-shadow: 0 6px 18px rgba(245, 179, 1, .16);
}
.podium-card.pos2 { order: 1; }
.podium-card.pos3 { order: 3; }
.podium-card .p-name {
  font-weight: 800; font-size: .92rem; line-height: 1.35;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 4px;
}
.podium-card .p-score { font-weight: 800; font-size: 1.18rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.podium-card .p-score small { font-weight: 700; font-size: .68rem; color: var(--muted); margin-left: 2px; }
.podium-card .p-count { font-size: .74rem; font-weight: 600; color: var(--muted); }
@media (max-width: 540px) {
  .podium { gap: 6px; }
  .podium-card { padding: 10px 4px 9px; }
  .podium-card .p-name { font-size: .8rem; }
  .podium-card .p-score { font-size: 1.02rem; }
}

/* ============ 管理画面のモバイル用ボトムナビ ============ */
.bottom-nav { display: none; }
@media (max-width: 640px) {
  .tab-nav { display: none; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(6, 1fr);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav button {
    background: none; box-shadow: none;
    border-radius: 10px;
    padding: 6px 2px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted);
    font-size: .6rem; font-weight: 700; line-height: 1.2;
    white-space: nowrap;
  }
  .bottom-nav button svg { width: 20px; height: 20px; flex: none; }
  .bottom-nav button:hover { filter: none; box-shadow: none; }
  .bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }
}

/* ============ 取り消しできるトースト ============ */
.toast.has-action {
  pointer-events: auto;
  display: flex; align-items: center; gap: 4px;
}
.toast .toast-action {
  background: none; box-shadow: none;
  color: #a5b4fc;
  font-weight: 800; font-size: .92rem;
  padding: 4px 8px;
  white-space: nowrap;
}
.toast .toast-action:hover { color: #c7d2fe; filter: none; box-shadow: none; }
