/* 表示画面(PRISM LIVE に重ねる)。背景は必ず透明にする */
:root {
  /* 配信映像は圧縮でにじむので、はっきりした色・太い縁取り・ぼかしの無い影を使う */
  --ink: #2a1a16;
  --paper: #fffaf0;
  --accent: #ff4f6d;
  --accent-2: #ff8a1f;
  --line: 8px;
  --shadow: 0 12px 0 rgba(42, 26, 22, 0.35);
  --r-N: #7d8a99;
  --r-R: #1f7fe0;
  --r-SR: #9b3fe8;
  --r-SSR: #f2a900;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

body {
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  color: var(--ink);
  /* 1080×1920 の画面を中央に置く */
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

/*
 * 1080×1920 基準で作った画面。js/display.js が zoom で実際の大きさに合わせる。
 * transform: scale で縮小すると iPad(WebKit)では一度描いた絵を縮めるため文字がぼやけるので、
 * 文字を目的の大きさで描き直してくれる zoom を使う。
 */
#stage {
  position: relative;
  flex: none;
  width: 1080px;
  height: 1920px;
}

#debug {
  position: absolute;
  left: 24px;
  bottom: 24px;
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre;
}

#env-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 8px 20px;
  border-radius: 999px;
  background: #ff4d4f;
  color: #fff;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

#notice {
  position: absolute;
  bottom: 24px;
  right: 24px;
  max-width: 900px;
  padding: 12px 22px;
  border-radius: 16px;
  background: rgba(30, 20, 20, 0.75);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

/* 台紙の置き場所。上端は js/display.js が設定する */
#event-slot {
  position: absolute;
  top: 300px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

#pending {
  position: absolute;
  top: -90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 32px;
  border-radius: 999px;
  background: var(--paper);
  border: 6px solid var(--ink);
  font-size: 44px;
  font-weight: 900;
}

/* ---------------- イベント全体のカード ---------------- */
.event {
  position: relative;
  width: 1000px;
  box-sizing: border-box;
  padding: 36px 36px 40px;
  border-radius: 48px;
  background: var(--paper);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  opacity: 0;
  /* --panel-scale は zoom が使えないブラウザ向けの代わり(通常は 1) */
  transform-origin: top center;
  transform: translateY(40px) scale(calc(var(--panel-scale, 1) * 0.96));
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.event.show {
  opacity: 1;
  transform: scale(var(--panel-scale, 1));
}

.event__sender {
  font-size: 80px;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-all;
}
.event__gift {
  margin-top: 4px;
  font-size: 50px;
  font-weight: 900;
  color: #8a3b1f;
}
.event__title {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 40px;
  border-radius: 999px;
  background: var(--accent);
  border: 6px solid var(--ink);
  color: #fff;
  font-size: 60px;
  font-weight: 900;
  /* 白文字に濃い縁取りを付けて、どんな背景・圧縮でも読めるようにする */
  text-shadow: 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink);
}
.event__title:empty { display: none; }

.event__count {
  margin-top: 12px;
  font-size: 52px;
  font-weight: 900;
  color: var(--accent);
  min-height: 62px;
}

.event__play {
  position: relative;
  height: 880px;
  margin-top: 4px;
}

.event__results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
/* 画像テーマ: 結果は1件1行 */
.theme-image .event__results {
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
}

.chip {
  padding: 10px 26px;
  border-radius: 22px;
  background: #fff;
  border: 6px solid var(--rarity, var(--r-N));
  font-size: 46px;
  font-weight: 900;
  line-height: 1.3;
  max-width: 940px;
  animation: chip-in 0.35s ease both;
}
.theme-image .chip {
  max-width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}
.theme-image .chip__rarity { flex: none; }
/* 結果の文字。1行に入りきらないときは、左右にゆっくり流して全部見せる(js/display.js の marqueeIfLong) */
.theme-image .chip__text {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.theme-image .chip__scroll { display: inline-block; }
.theme-image .chip__text.is-marquee {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent);
}
.theme-image .is-marquee .chip__scroll {
  padding-left: 6px;
  animation: chip-marquee var(--marquee-time, 6s) ease-in-out infinite;
}
@keyframes chip-marquee {
  0%, 18% { transform: translateX(0); }
  62%, 84% { transform: translateX(var(--marquee-x, 0)); }
  100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .theme-image .is-marquee .chip__scroll { animation: none; }
}
.chip--more { border-color: var(--ink); color: var(--ink); }
.chip__rarity {
  margin-right: 10px;
  color: var(--rarity, var(--r-N));
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

/* ---------------- ガチャ ---------------- */
.gacha {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.capsule {
  position: absolute;
  width: 340px;
  height: 340px;
}
.capsule__top, .capsule__bottom {
  position: absolute;
  left: 0;
  width: 340px;
  height: 170px;
  box-sizing: border-box;
  border: 10px solid var(--ink);
}
.capsule__top {
  top: 0;
  border-radius: 170px 170px 0 0;
  background: var(--rarity, var(--accent));
  border-bottom-width: 5px;
}
.capsule__bottom { border-top-width: 5px; }
.capsule__bottom {
  bottom: 0;
  border-radius: 0 0 170px 170px;
  background: #fffdf8;
}
.capsule__glow {
  position: absolute;
  inset: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rarity, #fff) 0%, transparent 65%);
  opacity: 0;
}
.reveal {
  position: absolute;
  width: 940px;
  min-height: 420px;
  padding: 40px 40px;
  box-sizing: border-box;
  border-radius: 44px;
  background: #fff;
  border: 14px solid var(--rarity, var(--r-N));
  outline: 6px solid var(--ink);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.reveal__rarity {
  font-size: 84px;
  font-weight: 900;
  color: var(--rarity, var(--r-N));
  letter-spacing: 0.08em;
  line-height: 1;
}
.reveal__label {
  margin-top: 16px;
  font-size: 88px;
  font-weight: 900;
  line-height: 1.25;
  word-break: break-word;
}

/* ---------------- ルーレット ---------------- */
.roulette {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.roulette canvas {
  width: 780px;
  height: 780px;
  margin-top: -60px;
}
.roulette__pointer {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 48px solid transparent;
  border-right: 48px solid transparent;
  border-top: 96px solid var(--ink);
}
.roulette__result {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  min-width: 640px;
  max-width: 960px;
  padding: 16px 40px;
  border-radius: 32px;
  background: #fff;
  border: 12px solid var(--rarity, var(--r-N));
  outline: 6px solid var(--ink);
  box-shadow: var(--shadow);
  font-size: 76px;
  font-weight: 900;
  line-height: 1.2;
  opacity: 0;
}

/* 候補が多いルーレットで、針の下にある候補の名前を大きく出す */
.roulette__ticker {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  max-width: 920px;
  padding: 10px 36px;
  border-radius: 999px;
  background: #fff;
  border: 6px solid var(--ink);
  font-size: 56px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

/* ---------------- 調整用の目安(guide=1) ---------------- */
#guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.guide__comments {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--safe, 1400px);
  bottom: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 60, 60, 0.18) 0 24px, rgba(255, 60, 60, 0.08) 24px 48px);
  color: #fff;
  font-size: 40px;
  font-weight: 900;
  padding: 90px 30px;
  text-shadow: 0 0 6px #000, 0 0 2px #000;
}
.guide__safe {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--safe, 1400px);
  border-top: 6px dashed #ff3b3b;
  color: #ff3b3b;
  font-size: 34px;
  font-weight: 900;
  padding: 8px 30px;
  text-shadow: 0 0 6px #fff, 0 0 2px #fff;
}

/* ---------------- 当選時のレア度別の演出(画像テーマ。js/effects.js) ----------------
 * 再生の枠の中だけに描き、終わると要素ごと取り除く。 */
.theme-image .fx {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.theme-image .fx__glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 900px;
  height: 900px;
  margin: -450px 0 0 -450px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--fx-color) 85%, #fff) 0%, color-mix(in srgb, var(--fx-color) 45%, transparent) 35%, transparent 65%);
  opacity: 0;
}
.theme-image .fx__rays {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1100px;
  height: 1100px;
  margin: -550px 0 0 -550px;
  border-radius: 50%;
  background: repeating-conic-gradient(color-mix(in srgb, var(--fx-color) 70%, transparent) 0deg 6deg, transparent 6deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 62%);
  mask-image: radial-gradient(circle, #000 25%, transparent 62%);
  opacity: 0;
}
.theme-image .fx__aura {
  position: absolute;
  border-radius: 28px;
  box-shadow: 0 0 36px 14px var(--fx-color), 0 0 0 6px color-mix(in srgb, var(--fx-color) 70%, #fff);
  opacity: 0;
}
.theme-image .fx__petal {
  position: absolute;
  border-radius: 80% 0 80% 0;
  background: linear-gradient(135deg, #ffd9e4, #f39ab5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
  opacity: 0;
}
.theme-image .fx__gold {
  position: absolute;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #fff6d0, #e3b54a 60%, #a77a22);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
}
