:root {
  --bg:       #07090d;
  --surface:  #0d1118;
  --text:     #f4f7fb;
  --muted:    #9ca6b5;
  --line:     rgba(255, 255, 255, 0.1);
  --accent:   #54e6ff;
  --accent-2: #6c74ff;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", sans-serif;
}

/* ── 散らばったカード（背景） ── */
.cards-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-card {
  position: absolute;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  will-change: transform;
}

.bg-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: brightness(0.5) saturate(0.6);
  display: block;
}

/* ── メインカードステージ ── */
.card-stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 10;
  padding: 70px 20px 80px;
}

/* ── カード（プレイヤー） ── */
.card-wrap {
  position: relative;
  width: min(720px, 82vw);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 1px rgba(84, 230, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.8),
    0 8px 32px rgba(0, 0, 0, 0.6);
  transform-style: preserve-3d;
  transform-origin: center center;
}

.card-wrap.flipping {
  animation: card-flip 680ms cubic-bezier(0.45, 0, 0.55, 1) forwards;
}

@keyframes card-flip {
  0%   { transform: rotateY(0deg)  scale(1); }
  42%  { transform: rotateY(90deg) scale(0.94); }
  58%  { transform: rotateY(90deg) scale(0.94); }
  100% { transform: rotateY(0deg)  scale(1); }
}

.card-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 16px;
  display: block;
}

/* ローダー */
.card-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 16px;
  z-index: 2;
  transition: opacity 500ms, visibility 500ms;
}

.card-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.card-spinner {
  width: 26px;
  height: 26px;
  border: 1.5px solid rgba(84, 230, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── クリップ情報 ── */
.card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  animation: info-in 350ms ease both;
}

@keyframes info-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-game {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--accent);
}

/* ── UI 上部 ── */
.ui-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
}

.ui-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-decoration: none;
  transition: color 150ms;
}

.ui-back:hover { color: var(--text); }

.ui-counter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
}

.ui-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.7);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.5);
  font-family: "Inter", sans-serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
  text-decoration: none;
}

.ui-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ui-btn.is-active {
  border-color: rgba(84, 230, 255, 0.4);
  color: var(--accent);
  background: rgba(84, 230, 255, 0.07);
}

.ui-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.ui-btn.is-active .ui-dot {
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ── 左右ナビ ── */
.ui-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.ui-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.7);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: border-color 150ms, color 150ms;
}

.ui-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ui-kbd-hint {
  color: rgba(255, 255, 255, 0.2);
  font-size: 10px;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-family: inherit;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.25);
  line-height: 1.4;
}

/* ── モバイル ── */
@media (max-width: 600px) {
  .ui-top { padding: 14px 16px; }
  .card-stage { padding: 60px 16px 70px; }
  .card-wrap { width: min(420px, 94vw); }
  .ui-nav { gap: 10px; }
}
