/* 投票ページ（vote-flow.js）：画面いっぱいの 3D。上の中央に「一覧／1点ずつ投票」と見ている範囲、右上に表示設定と投票履歴、左上に作品名、下の中央に横一列のボタン（設計選型 C2, 2026-11-26）。
 * 2026-11-27 の改版で、3D の上の板とボタン列は白い板（文字は濃い色）に。Like はティール、Skip は白。 */
html:has(.vote-flow) {
  overflow: hidden;
}
.vote-flow {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #fff, var(--fc-color-bg) 72%);
  color: var(--fc-color-text);
}
#app > .vote-flow {
  animation: none;
}
/* お知らせはボタンと重ならないよう上に出す */
body:has(.vote-flow) #notice {
  top: 84px;
  bottom: auto;
}
.vote-flow-card,
.vote-flow-piece {
  position: absolute;
  inset: 0;
}
.vote-flow-stage.showcase-stage {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  cursor: grab;
}
.vote-flow-stage.is-turning {
  cursor: grabbing;
}
.vote-flow-stage .showcase-canvas {
  touch-action: none;
}
.vote-flow-stage .showcase-fallback {
  inset: 14% 25% 24%;
  width: 50%;
  height: 62%;
}
.vote-flow-stage .showcase-hint {
  top: 76px;
  left: 50%;
  bottom: auto;
  transform: translateX(-50%);
  white-space: nowrap;
  /* 最初の作品のときだけ出して（vote-flow.js の hint）、数秒で消える */
  animation: vote-flow-hint 0.4s ease 4s forwards;
}
@keyframes vote-flow-hint {
  to {
    opacity: 0;
  }
}
/* 上の中央：切り替えと範囲 */
.vote-flow-top {
  position: absolute;
  top: 20px;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
}
.vote-flow-scope {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-pill);
  background: rgb(255 255 255 / 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--fc-color-text-muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
/* 右上：表示設定と投票履歴 */
.vote-flow-tools {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vote-flow-tune {
  position: relative;
}
.vote-flow:not(.is-3d) .vote-flow-tune {
  display: none;
}
.vote-flow .showcase-tune {
  position: static;
  width: 44px;
  height: 44px;
  border: 1px solid var(--fc-color-border);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.92);
  color: var(--fc-color-text);
  font-size: 22px;
  text-shadow: none;
  opacity: 1;
}
.vote-flow .showcase-tune:hover,
.vote-flow .showcase-tune[aria-expanded='true'] {
  background: var(--fc-color-accent-soft);
  transform: none;
}
.vote-flow .showcase-panel {
  top: 54px;
  right: 0;
  width: 240px;
  max-height: none;
}
.vote-flow-mine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-pill);
  background: rgb(255 255 255 / 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--fc-color-text);
  font-size: 13px;
  font-weight: 700;
}
.vote-flow-mine:hover,
.vote-flow-mine[aria-expanded='true'] {
  background: var(--fc-color-accent-soft);
  color: var(--fc-color-text);
}
.vote-flow-mine[data-count]:not([data-count=''])::after {
  content: attr(data-count);
  color: var(--fc-color-text-muted);
  font-family: var(--fc-font-number);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
/* 左上：作品の情報。3D に重なっても読めるよう、すりガラスの板に載せる */
.vote-flow-info {
  position: absolute;
  left: 32px;
  top: 84px;
  z-index: 3;
  /* 作品は画面の中央に高さのおよそ 28% の半径で置かれるので、そこにかからない幅まで */
  max-width: min(420px, calc(50vw - 28vh - 48px));
  padding: 16px 20px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-lg);
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--fc-shadow-sm);
}
.vote-flow-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vote-flow-tags span {
  padding: 3px 10px;
  border-radius: var(--fc-radius-sm);
  background: var(--fc-color-surface-sunken);
  color: var(--fc-color-text);
  font-size: 12px;
  font-weight: 700;
}
.vote-flow-tags span:empty {
  display: none;
}
.vote-flow-info h2 {
  margin: 10px 0 6px;
  color: var(--fc-color-text);
  font-size: 26px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.vote-flow-info .meta {
  margin: 0;
  color: var(--fc-color-text-muted);
}
.vote-flow-detail {
  margin-left: 8px;
  color: var(--fc-color-text);
  font-weight: 700;
  text-decoration: underline;
}
.vote-flow-note {
  margin: 10px 0 0;
  color: var(--fc-color-text-muted);
  font-size: 12px;
}
.vote-flow-info .showcase-shake {
  position: static;
  margin-bottom: 14px;
}
/* 下の中央：左から 前へ／Skip／迷い中／Like。Skip と Like がいちばん大きい */
.vote-flow-rail {
  position: absolute;
  left: 50%;
  bottom: 32px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 26px;
  padding: 12px 30px 10px;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-xl);
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--fc-shadow-md);
  transform: translateX(-50%);
}
.vote-flow-rail button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fc-color-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.vote-flow-rail button span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 22px;
  transition:
    transform 0.15s,
    box-shadow 0.2s;
}
.vote-flow-rail button span .icon {
  width: 26px;
  height: 26px;
}
.vote-flow-back span .icon,
.vote-flow-later span .icon {
  width: 20px;
  height: 20px;
}
.vote-flow-rail button:hover:not(:disabled) span {
  transform: scale(1.06);
}
.vote-flow-rail button:active:not(:disabled) span {
  transform: scale(0.96);
}
.vote-flow-rail button:focus-visible {
  outline: none;
}
.vote-flow-rail button:focus-visible span {
  outline: 3px solid var(--fc-color-focus-ring);
  outline-offset: 3px;
}
.vote-flow-back span,
.vote-flow-later span {
  width: 48px !important;
  height: 48px !important;
  border: 1px solid var(--fc-color-border);
  background: var(--fc-color-surface-sunken);
  font-size: 18px !important;
}
.vote-flow-back:disabled {
  opacity: 0.35;
  cursor: default !important;
}
.vote-flow-like span,
.vote-flow-skip span {
  width: 72px !important;
  height: 72px !important;
  font-size: 28px !important;
}
.vote-flow-like span {
  background: var(--fc-color-accent);
  color: var(--fc-color-text-on-accent);
  box-shadow: var(--fc-shadow-sm);
}
.vote-flow-skip span {
  border: 1.5px solid var(--fc-color-border-strong);
  background: var(--fc-color-surface);
  color: var(--fc-color-text);
}
/* 投票履歴を開いているあいだは、ボタンを残りの幅の中央へずらして押せるようにしておく */
.vote-flow:has(.vote-mine:not([hidden])) .vote-flow-rail {
  left: calc(50% - 190px);
}
/* いま選んでいる Like／Skip */
.vote-flow-rail [data-chosen] span {
  outline: 3px solid var(--fc-color-text);
  outline-offset: 4px;
}
.vote-flow-rail [data-chosen]::after {
  content: '選択中';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: var(--fc-color-text-muted);
  font-size: 10px;
}
/* 投票し終えたとき */
.vote-flow-done {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(440px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 8px 0;
  border-radius: var(--fc-radius-xl);
  background: #fff;
  color: var(--fc-color-text);
}
.vote-flow-done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
/* 投票履歴：右から出るパネル */
.vote-mine {
  position: absolute;
  top: 76px;
  right: 20px;
  bottom: 20px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 360px;
  box-sizing: border-box;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--fc-color-border);
  border-radius: var(--fc-radius-xl);
  background: rgb(255 255 255 / 0.96);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--fc-shadow-lg);
  animation: fv-drop-in var(--motion-base, 0.2s) var(--motion-ease, ease);
}
.vote-mine[hidden] {
  display: none;
}
.vote-mine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vote-mine-head h2 {
  margin: 0;
  color: var(--fc-color-text);
  font-size: 18px;
}
.vote-mine-head button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--fc-color-surface-sunken);
  color: var(--fc-color-text);
}
.vote-mine-note {
  margin: 0;
  color: var(--fc-color-text-muted);
  font-size: 12px;
}
.vote-mine .empty {
  color: var(--fc-color-text-muted);
}
.vote-mine .empty h3 {
  color: var(--fc-color-text);
}
.vote-mine-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.vote-mine-item {
  display: grid;
  gap: 6px;
}
.vote-mine-thumb {
  display: block;
  padding: 0;
  border: 0;
  border-radius: var(--fc-radius-lg);
  overflow: hidden;
  aspect-ratio: 1;
  background: radial-gradient(
    circle at 50% 35%,
    #fff,
    var(--fc-color-accent-soft)
  );
  cursor: pointer;
}
.vote-mine-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.vote-mine .vote-switch button {
  border-color: var(--fc-color-border);
  background: transparent;
  color: var(--fc-color-text-muted);
}
.vote-mine .vote-switch .chosen {
  border-color: var(--fc-color-accent);
  background: var(--fc-color-accent);
  color: var(--fc-color-text-on-accent);
}
/* 作品の入れ替え：Like／Skip／迷い中は静かに消えて、次がふわっと出る。前へは左から */
.vote-flow-rise {
  animation: vote-flow-in 0.35s ease;
}
.vote-flow-return {
  animation: vote-flow-return 0.35s ease;
}
[class*='vote-flow-out-'] {
  animation: vote-flow-out 0.26s ease forwards;
}
@keyframes vote-flow-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
}
@keyframes vote-flow-return {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}
@keyframes vote-flow-out {
  to {
    opacity: 0;
    transform: scale(0.985);
  }
}
/* 横幅が足りない画面では、左上の板が作品にかかるので下へ。横長は Skip・Like の列の左、縦長はその上 */
@media (min-width: 721px) and (max-width: 1180px) and (min-aspect-ratio: 1/1) {
  .vote-flow-info {
    top: auto;
    bottom: 32px;
    max-width: calc(50% - 248px);
    padding: 12px 16px;
  }
  .vote-flow-info h2 {
    margin: 6px 0 4px;
    font-size: 19px;
  }
  .vote-flow-note {
    display: none;
  }
  /* 自分の投票を開くと Skip・Like の列が左へ寄るので、そのあいだは隠す */
  .vote-flow:has(.vote-mine:not([hidden])) .vote-flow-info {
    display: none;
  }
}
/* 上の中央の切り替えが右上のボタンにかかる幅では、コンテスト名の札を省く（スマホと同じ） */
@media (max-width: 800px) {
  .vote-flow-scope {
    display: none;
  }
}
@media (min-width: 721px) and (max-aspect-ratio: 1/1) {
  .vote-flow-info {
    top: auto;
    bottom: 140px;
    max-width: min(420px, calc(100% - 64px));
  }
}
@media (max-width: 720px) {
  .vote-flow-top {
    top: 12px;
    left: 12px;
    transform: none;
  }
  .vote-flow-scope {
    display: none;
  }
  .vote-flow .works-toggle > * {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }
  .vote-flow .works-toggle svg {
    display: none;
  }
  .vote-flow-tools {
    top: 12px;
    right: 12px;
    gap: 6px;
  }
  .vote-flow-mine {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .vote-flow-mine > span,
  .vote-flow-mine::after {
    display: none;
  }
  .vote-flow-stage .showcase-hint {
    top: 66px;
  }
  /* スマホは作品名をボタンの上に置く（白い板） */
  .vote-flow-info {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(128px + env(safe-area-inset-bottom));
    max-width: none;
    padding: 10px 14px;
  }
  .vote-flow-info h2 {
    margin: 8px 0 4px;
    font-size: 19px;
  }
  .vote-flow-note {
    display: none;
  }
  .vote-flow-rail,
  .vote-flow:has(.vote-mine:not([hidden])) .vote-flow-rail {
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom));
    gap: 18px;
    padding: 10px 20px 8px;
  }
  .vote-flow-rail button {
    font-size: 11px;
  }
  .vote-flow-rail button span {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
  .vote-flow-back span,
  .vote-flow-later span {
    width: 44px !important;
    height: 44px !important;
  }
  .vote-flow-like span,
  .vote-flow-skip span {
    width: 62px !important;
    height: 62px !important;
    font-size: 24px !important;
  }
  .vote-flow-rail button span .icon {
    width: 22px;
    height: 22px;
  }
  .vote-flow-back span .icon,
  .vote-flow-later span .icon {
    width: 18px;
    height: 18px;
  }
  .vote-flow-rail [data-chosen]::after {
    display: none;
  }
  .vote-mine {
    inset: 0;
    width: auto;
    border: 0;
    border-radius: 0;
  }
  .vote-mine-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .vote-flow-rise,
  .vote-flow-return,
  [class*='vote-flow-out-'] {
    animation: none;
  }
  .vote-flow-stage .showcase-hint {
    animation-duration: 0s;
  }
}
