:root {
  --panel: rgba(10, 15, 24, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.07);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --text: #f5f7fb;
  --muted: #aebbcf;
  --accent-strong: #ffd86a;
  --alpha: #ffaa33;
  --beta: #a855f7;
}

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

body {
  font-family: "Yu Gothic UI", "Segoe UI", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(243, 189, 45, 0.24), transparent 28%),
    linear-gradient(160deg, #10161f 0%, #0a0f17 48%, #05080c 100%);
}

.hidden { display: none !important; }

.viewer-shell {
  min-height: 100vh;
  padding: 24px 16px;
  display: grid;
  place-items: start center;
}

.viewer-card {
  width: min(1280px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

/* 未受信 */
#no-data-screen {
  display: grid;
  place-items: center;
  padding: 80px 0;
  gap: 12px;
}

.no-data-text {
  font-size: 28px;
  font-weight: bold;
  color: var(--accent-strong);
}

.no-data-sub {
  color: var(--muted);
  font-size: 14px;
}

/* ヘッダー */
.viewer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.logo-chip {
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(243, 189, 45, 0.28), rgba(243, 189, 45, 0.12));
  border: 1px solid rgba(243, 189, 45, 0.4);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.header-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.round-label {
  font-size: 22px;
  font-weight: bold;
  color: var(--text);
}

.gacha-count-label {
  font-size: 14px;
  color: var(--alpha);
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 170, 51, 0.12);
  border: 1px solid rgba(255, 170, 51, 0.25);
}

.updated-at {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* チームパネル */
.matchup-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  margin-bottom: 24px;
  align-items: start;
}

.team-panel {
  padding: 20px;
  border-radius: 18px;
  background: var(--panel-strong);
  border-top: 3px solid transparent;
}

.team-alpha { border-top-color: var(--alpha); }
.team-beta  { border-top-color: var(--beta); }

.team-title {
  font-size: clamp(18px, 2.5vw, 28px);
  font-weight: 700;
  margin-bottom: 6px;
}

.team-members {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.6;
}

.picker {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.rule-stage-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rule-stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.meta-image {
  width: 64px;
  height: 64px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s;
}

.meta-image.show { opacity: 1; }

.stage-image {
  width: 120px;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
}

.meta-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* VS・勝利数 */
.vs-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}

.wins-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wins-num {
  font-size: 36px;
  font-weight: 700;
  width: 48px;
  text-align: center;
  color: var(--accent-strong);
}

.wins-format {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.vs-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--muted);
}

/* ブキボード */
.weapons-section {
  margin-top: 8px;
}

.weapons-heading {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.weapon-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.weapon-side {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.weapon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.weapon-side-alpha .weapon-card {
  border-top: 2px solid rgba(255, 170, 51, 0.4);
}

.weapon-side-beta .weapon-card {
  border-top: 2px solid rgba(168, 85, 247, 0.4);
}

.weapon-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  padding: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.weapon-image.show { opacity: 1; }

.check-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  min-height: 24px;
}

.check-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.2s;
}

.check-img.show { opacity: 1; }

.weapon-name {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  word-break: break-all;
  min-height: 32px;
}

@media (max-width: 900px) {
  .matchup-section {
    grid-template-columns: 1fr;
  }

  .vs-block {
    flex-direction: row;
    justify-content: center;
  }

  .weapon-side {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .weapon-board {
    grid-template-columns: 1fr;
  }

  .viewer-card {
    padding: 16px;
  }
}
