/* =====================================================================
 * stage.css — 結果カード（.result-card 配下）/ リビール層（.reveal-*）/ プリショー層の枠
 *
 * 所有権（仕様 §6）: .result-card と配下、.reveal-root .reveal-label .reveal-emoji
 * .preshow-layer、および reveal 演出用の .reveal-drum .reveal-banner .reveal-countdown
 * .reveal-kicker。プリショーの中身（.ps-）は preshow.js が供給する。
 * ===================================================================== */

/* ---------- 結果カード ---------- */
.result-card {
  position: relative;
  padding: 28px 20px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 209, 102, .38);
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 209, 102, .08);
  text-align: center;
  /* 固定バーの下に潜らない */
  scroll-margin-top: calc(var(--menubar-h) + var(--modebar-h) + var(--safe-top) + 8px);
  animation: result-in .45s cubic-bezier(.2, 1, .3, 1) both;
}
.result-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(640px 260px at 50% -80px, rgba(255, 209, 102, .18), transparent 70%);
  pointer-events: none;
}
.result-card > * { position: relative; }   /* ::before の上に出す */
@keyframes result-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.result-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .22em;
  line-height: 1.4;
}
.result-kicker::before, .result-kicker::after {
  content: "";
  flex: 0 0 24px;
  height: 1px;
  background: rgba(255, 209, 102, .5);
}

.result-emoji {
  margin: 4px 0 2px;
  font-family: var(--font-emoji);
  font-size: clamp(72px, 22vw, 120px);
  line-height: 1.15;
}

.result-label {
  margin: 2px 0 6px;
  padding: 0 4px;
  color: var(--gold);
  font-size: clamp(30px, 8vw, 52px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .02em;
  text-shadow:
    0 1px 0 #d9a400,
    0 2px 0 #b78900,
    0 3px 0 #946f00,
    0 8px 22px rgba(0, 0, 0, .55);
}

.result-reason {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

#result-attitude {
  margin: 10px 0 0;
  color: var(--accent-soft);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
}
#result-attitude:empty { display: none; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
}
.result-actions > * { flex: 1 1 150px; max-width: 100%; }

.result-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}
.result-sections > * {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
}
.result-sections > *:empty { display: none; }

.result-card > .fine-print { margin-top: 8px; }

/* ---------- リビール層（全画面） ---------- */
.reveal-root {
  position: fixed;
  inset: 0;
  z-index: 500;
  /* core.reveal が --sx / --sy を util.loop で動かしてスポットライトにする */
  --sx: 50%;
  --sy: 40%;
  background: radial-gradient(circle at var(--sx) var(--sy), transparent 0 110px, rgba(0, 0, 0, .92) 220px);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  color: var(--text);
  text-align: center;
  transition: opacity .4s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 「本日のお食事は……」 */
.reveal-kicker {
  margin: 0;
  min-height: 1.4em;
  padding: 0 16px;
  color: #fff;
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.4;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}

/* 鼓動する 🥁（絵文字は core が入れる） */
.reveal-drum {
  font-family: var(--font-emoji);
  font-size: clamp(88px, 24vw, 150px);
  line-height: 1;
  transform-origin: 50% 60%;
  animation: reveal-drum-pulse .5s ease-in-out infinite;
}
@keyframes reveal-drum-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.14) rotate(-3deg); }
}

/* 本気モードの残り秒数 */
.reveal-countdown {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

/* 金色の立体文字。label が 8 文字超なら core が font-size を 0.6 倍にする（.long でも可） */
.reveal-label {
  --reveal-fs: clamp(44px, 13vw, 110px);
  margin: 0;
  padding: 0 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--gold);
  font-size: var(--reveal-fs);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .04em;
  text-shadow:
    0 1px 0 #e6b000,
    0 2px 0 #d1a000,
    0 3px 0 #bc8f00,
    0 4px 0 #a67e00,
    0 5px 0 #916d00,
    0 6px 0 #7b5c00,
    0 7px 0 #654b00,
    0 10px 20px rgba(0, 0, 0, .65),
    0 20px 48px rgba(0, 0, 0, .5);
  animation: reveal-bounce .7s cubic-bezier(.34, 1.56, .64, 1) both;
}
.reveal-label.long { font-size: calc(var(--reveal-fs) * .6); }

/* 巨大絵文字 */
.reveal-emoji {
  font-family: var(--font-emoji);
  font-size: clamp(110px, 34vw, 220px);
  line-height: 1;
  animation: reveal-bounce .7s cubic-bezier(.34, 1.56, .64, 1) .12s both;
}

@keyframes reveal-bounce {
  0%   { opacity: 0; transform: scale(.2) translateY(40px); }
  55%  { opacity: 1; transform: scale(1.18) translateY(-8px); }
  75%  { transform: scale(.94) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 「おめでとうございます」バナー */
.reveal-banner {
  display: inline-block;
  max-width: calc(100% - 32px);
  padding: 12px 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff0b3 0%, var(--gold) 45%, var(--gold-2) 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 255, 255, .14);
  color: #3a2a00;
  font-size: clamp(18px, 5vw, 28px);
  font-weight: 900;
  letter-spacing: .14em;
  line-height: 1.3;
  animation: reveal-banner-in .5s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes reveal-banner-in {
  from { opacity: 0; transform: translateY(24px) scale(.9); }
  to   { opacity: 1; transform: none; }
}

/* プリショー層（core が #reveal-root 内に作る <div class="preshow-layer">。中身は preshow.js） */
.preshow-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 20px);
  background: var(--bg);   /* スポットライトの穴を覆う不透明背景 */
  overflow: hidden auto;
  overscroll-behavior: contain;
  text-align: center;
}
.preshow-layer:empty { display: none; }   /* 空にされた後はリビールを隠さない */

/* ---------- 動きを減らす: バウンスは fade に ---------- */
@media (prefers-reduced-motion: reduce) {
  .result-card { animation: none; }
  .reveal-label, .reveal-emoji { animation: reveal-fade .4s ease both; }
  .reveal-banner { animation: reveal-fade .3s ease both; }
  .reveal-drum { animation: reveal-drum-pulse-soft 1.2s ease-in-out infinite; }
  .reveal-root { transition-duration: .15s; }
}
@keyframes reveal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes reveal-drum-pulse-soft {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* ---------- 強制カラー ---------- */
@media (forced-colors: active) {
  .result-card { border: 1px solid CanvasText; }
  .result-label, .reveal-label { color: CanvasText; text-shadow: none; }
  .reveal-banner { border: 2px solid ButtonText; }
  .result-sections > * { border-color: CanvasText; }
}
