/* =========================================================
 * style.css — スロット台UI（ネオン発光テーマ）
 * ---------------------------------------------------------
 * 配色はロマ子様のオッドアイ（赤・青）＋金・ピンク。
 * 色を変えたいときは下のCSS変数だけ書き換えればOK。
 * ========================================================= */

:root {
  /* ---- テーマカラー（ここを変えると全体の色が変わる） ---- */
  --neon-red: #ff2d55;    /* 赤（右目カラー） */
  --neon-blue: #2d7bff;   /* 青（左目カラー） */
  --gold: #ffd700;        /* 金（お嬢様の豪華さ） */
  --neon-pink: #ff6eb4;   /* ピンク（アクセント） */
  --bg-dark: #0a0014;     /* 背景の闇色 */
  --bg-panel: #14001e;    /* パネルの下地色 */
  --lcd-bg: #05010d;      /* 液晶画面の下地 */

  /* ---- サイズ設定 ---- */
  --cell-h: clamp(56px, 14vw, 78px);  /* リール1コマの高さ（画面幅に応じて可変） */
}

/* ---------- 全体リセット＆基本設定 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* ダブルタップズームを無効化して目押しの反応を速くする */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  /* Codex製背景素材の上に暗色を重ねて、筐体が読みやすい明るさに調整 */
  background:
    linear-gradient(rgba(10, 0, 20, 0.82), rgba(10, 0, 20, 0.82)),
    url("../assets/backgrounds/background_normal.png") center / cover no-repeat,
    var(--bg-dark);
  color: #fff;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  /* 100dvh: スマホのアドレスバー伸縮に追従する高さ指定 */
  min-height: 100dvh;
  /* ゲーム画面では長押し選択やスクロールを防ぐ */
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* =========================================================
 * 絵柄の並び順一覧（画面右側のパネル）
 * スマホの狭い画面では場所を取りすぎるため、
 * 横幅に余裕があるとき（860px〜）は右側に常時表示する
 * ========================================================= */
.symbol-list {
  display: none; /* デフォルト非表示。下のmedia queryで表示切替 */
  flex-direction: column;
  gap: 6px;
  width: 190px;
  /* 13件をスクロールなしで収める高さ。画面が低いときは項目側を縮める */
  height: min(640px, 92vh);
  padding: 10px 12px;
  background: linear-gradient(160deg, #1d0530, var(--bg-panel) 60%, #0d0020);
  border: 2px solid var(--neon-blue);
  border-radius: 18px;
  box-shadow: 0 0 16px rgba(45, 123, 255, 0.35);
}

.symbol-list.open {
  display: flex;
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 95;
  width: auto;
  height: min(560px, 72dvh);
  max-width: 420px;
  margin: 0 auto;
  padding: 14px;
  border-color: var(--neon-pink);
  box-shadow:
    0 0 0 999px rgba(4, 0, 12, 0.68),
    0 0 22px rgba(255, 45, 85, 0.52),
    0 0 34px rgba(45, 123, 255, 0.35);
}

@media (min-width: 860px) {
  .symbol-list {
    display: flex;
    margin-top: 204px;
  }

  .symbol-list.open {
    position: static;
    width: 190px;
    height: min(640px, 92vh);
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    border-color: var(--neon-blue);
    box-shadow: 0 0 16px rgba(45, 123, 255, 0.35);
  }
}

.symbol-list-header {
  flex-shrink: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 30px;
}

.symbol-list-title {
  flex-shrink: 0;
  font-size: 0.85rem;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  letter-spacing: 0.05em;
}

.symbol-list-close {
  position: absolute;
  right: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: #fff;
  background: rgba(255, 45, 85, 0.2);
  border: 1px solid rgba(255, 110, 180, 0.55);
  border-radius: 50%;
  cursor: pointer;
}

@media (min-width: 860px) {
  .symbol-list-close {
    display: none;
  }
}

.symbol-list-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* 絵柄を利用可能な高さいっぱいに等間隔配置 */
  flex: 1;
  min-height: 0; /* flexアイテムがつぶれられるようにする（スクロール防止の要） */
  counter-reset: symbol-order;
}

.symbol-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  counter-increment: symbol-order;
}

/* 何番目の絵柄かを示す番号 */
.symbol-list-item::before {
  content: counter(symbol-order);
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  font-size: 0.65rem;
  font-weight: bold;
  color: var(--neon-pink);
}

.symbol-list-icon {
  width: 1.8em !important;
  height: 1.8em !important;
  max-width: 26px !important;
  max-height: 26px !important;
  font-size: 1rem !important;
  flex-shrink: 0;
}

.symbol-list-label {
  font-size: 0.7rem;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
 * スロット台本体
 * ========================================================= */
.slot-machine {
  width: min(440px, 100vw);
  max-height: 100dvh;
  padding: clamp(10px, 3vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 12px);
  background: linear-gradient(160deg, #1d0530, var(--bg-panel) 60%, #0d0020);
  border: 3px solid var(--gold);
  border-radius: 24px;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.4),
    0 0 60px rgba(255, 45, 85, 0.25),
    inset 0 0 30px rgba(45, 123, 255, 0.1);
}

/* ---------- ヘッダー ---------- */
.machine-header {
  position: relative;
  text-align: center;
}

.machine-title {
  font-size: clamp(1.1rem, 4.5vw, 1.5rem);
  color: var(--gold);
  letter-spacing: 0.1em;
  /* ネオン発光風の文字影 */
  text-shadow:
    0 0 8px var(--gold),
    0 0 24px rgba(255, 215, 0, 0.6);
}

.machine-title span span {
  display: block;
  font-size: 0.65em;
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink);
}

/* タイトルロゴ画像（Codex素材。余白込み2048pxなので少し大きめに敷く） */
.title-logo {
  display: block;
  width: min(220px, 55vw);
  margin: -18px auto -22px; /* 画像自体の余白ぶんを詰める */
  filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.5));
}

.countdown-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  margin-top: 6px;
}

.countdown-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  grid-column: 2;
  justify-self: center;
  padding: 6px 28px 8px;
  color: #fff;
  background: linear-gradient(90deg, var(--neon-red), var(--neon-blue));
  border: 2px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    0 0 14px rgba(255, 45, 85, 0.6),
    0 0 14px rgba(45, 123, 255, 0.6),
    0 0 22px rgba(255, 215, 0, 0.35);
  animation: countdownGlow 1.6s ease-in-out infinite alternate;
}

@keyframes countdownGlow {
  from {
    box-shadow:
      0 0 10px rgba(255, 45, 85, 0.5),
      0 0 10px rgba(45, 123, 255, 0.5),
      0 0 16px rgba(255, 215, 0, 0.25);
  }
  to {
    box-shadow:
      0 0 20px rgba(255, 45, 85, 0.8),
      0 0 20px rgba(45, 123, 255, 0.8),
      0 0 34px rgba(255, 215, 0, 0.6);
  }
}

/* 上段:「罵倒の日まで」ラベル */
.countdown-label {
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  font-weight: bold;
  letter-spacing: 0.2em;
  opacity: 0.95;
}

/* 下段: あと○日 の行 */
.countdown-days-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1.05;
}

/* 残り日数の数字（いちばん目立たせる） */
.countdown-number {
  font-size: clamp(2.4rem, 12vw, 3.2rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.9),
    0 0 30px rgba(255, 215, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.6);
  font-variant-numeric: tabular-nums;
}

/* 「あと」「日」の文字 */
.countdown-unit {
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* 当日（8/10）のお祝い表示 */
.countdown-today {
  font-size: clamp(1.1rem, 5vw, 1.4rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.9);
  padding: 6px 0;
}

@media (max-width: 520px) {
  .countdown-line {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .machine-header {
    padding-bottom: 124px;
  }
}

.mute-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
}

/* ---------- BGM選択 ---------- */
.bgm-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.bgm-label {
  font-size: 0.9rem;
}

.bgm-select {
  max-width: 220px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: bold;
  font-family: inherit;
  color: var(--neon-pink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 110, 180, 0.5);
  border-radius: 999px;
  cursor: pointer;
}

.bgm-select:focus {
  outline: none;
  border-color: var(--neon-pink);
  box-shadow: 0 0 8px rgba(255, 110, 180, 0.5);
}

.symbol-list-toggle {
  display: inline-flex;
  position: absolute;
  top: 46px;
  right: 0;
  justify-content: center;
  align-items: center;
  min-width: 104px;
  min-height: 30px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, rgba(45, 123, 255, 0.84), rgba(255, 45, 85, 0.82));
  border: 2px solid rgba(255, 215, 0, 0.9);
  border-radius: 999px;
  box-shadow:
    0 0 12px rgba(45, 123, 255, 0.45),
    0 0 16px rgba(255, 45, 85, 0.34);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

.symbol-list-toggle[aria-expanded="true"] {
  border-color: #fff;
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.5),
    0 0 22px rgba(255, 45, 85, 0.56);
}

.win-counter {
  position: absolute;
  top: 84px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 104px;
  min-height: 34px;
  padding: 4px 8px;
  background:
    linear-gradient(180deg, rgba(255, 45, 85, 0.16), rgba(0, 0, 0, 0.72)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 4px);
  border: 2px solid rgba(255, 215, 0, 0.9);
  border-radius: 8px;
  box-shadow:
    0 0 10px rgba(255, 215, 0, 0.36),
    inset 0 0 10px rgba(255, 45, 85, 0.25);
}

.win-counter-label {
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.85);
}

.win-counter-value {
  flex: 1;
  min-width: 48px;
  text-align: right;
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  color: #ff2d55;
  text-shadow:
    0 0 5px rgba(255, 45, 85, 0.95),
    0 0 12px rgba(255, 45, 85, 0.8),
    0 0 18px rgba(255, 215, 0, 0.42);
}

.player-title {
  position: absolute;
  top: 124px;
  right: 0;
  width: 104px;
  padding: 5px 8px;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.25;
  color: var(--gold);
  background: rgba(20, 0, 30, 0.76);
  border: 1px solid rgba(255, 215, 0, 0.72);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.26);
  text-shadow: 0 0 7px rgba(255, 215, 0, 0.7);
}

.romacoin-display {
  position: absolute;
  top: 84px;
  left: 0;
  min-width: 103px;
  min-height: 34px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 215, 0, 0.16), rgba(0, 0, 0, 0.72)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 4px);
  border: 2px solid rgba(255, 215, 0, 0.9);
  border-radius: 8px;
  box-shadow:
    0 0 10px rgba(255, 215, 0, 0.36),
    inset 0 0 10px rgba(255, 215, 0, 0.25);
}

.romacoin-label {
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.85);
}

.romacoin-value {
  text-align: right;
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: #ffe86a;
  text-shadow:
    0 0 5px rgba(255, 215, 0, 0.95),
    0 0 14px rgba(255, 45, 85, 0.55);
}

.ranking-toggle {
  position: absolute;
  top: 124px;
  left: 0;
  min-width: 104px;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 900;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.86), rgba(255, 45, 85, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.36);
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

@media (max-width: 520px) {
  .symbol-list-toggle,
  .win-counter,
  .romacoin-display,
  .ranking-toggle {
    width: clamp(108px, 31vw, 124px);
    min-width: 0;
  }

  .symbol-list-toggle {
    top: auto;
    right: 2px;
    bottom: 82px;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.64rem;
  }

  .win-counter {
    top: auto;
    right: 2px;
    bottom: 42px;
    min-height: 32px;
    padding: 4px 8px;
  }

  .win-counter-label {
    font-size: 0.5rem;
  }

  .win-counter-value {
    min-width: 38px;
    font-size: 0.95rem;
  }

  .romacoin-display {
    top: auto;
    left: 2px;
    bottom: 82px;
    min-height: 32px;
    padding: 4px 8px;
  }

  .romacoin-label {
    font-size: 0.46rem;
  }

  .romacoin-value {
    font-size: 0.9rem;
  }

  .ranking-toggle {
    top: auto;
    left: 2px;
    bottom: 42px;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.62rem;
  }

  .player-title {
    top: auto;
    left: 50%;
    right: auto;
    bottom: 6px;
    width: clamp(150px, 44vw, 180px);
    padding: 4px 7px;
    font-size: 0.52rem;
    transform: translateX(-50%);
  }
}

@media (min-width: 860px) {
  .symbol-list-toggle {
    display: none;
  }

  .romacoin-display {
    top: 0;
    left: calc(100% + 32px);
    width: 190px;
    min-height: 54px;
    padding: 8px 12px;
    z-index: 2;
  }

  .romacoin-label {
    font-size: 0.72rem;
  }

  .romacoin-value {
    font-size: 1.35rem;
  }

  .win-counter {
    top: 64px;
    right: auto;
    left: calc(100% + 32px);
    width: 190px;
    min-height: 44px;
    padding: 7px 12px;
    z-index: 2;
  }

  .win-counter-label {
    font-size: 0.72rem;
  }

  .win-counter-value {
    font-size: 1.25rem;
  }

  .player-title {
    top: 116px;
    right: auto;
    left: calc(100% + 32px);
    width: 190px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    z-index: 2;
  }

  .ranking-toggle {
    top: 156px;
    left: calc(100% + 32px);
    width: 190px;
    min-height: 36px;
    font-size: 0.78rem;
    z-index: 2;
  }
}

/* =========================================================
 * 液晶画面
 * ========================================================= */
.lcd-screen {
  position: relative;
  min-height: clamp(82px, 13vh, 120px);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  text-align: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 50%, transparent 50%) 0 0 / 100% 4px, /* 走査線風 */
    var(--lcd-bg);
  border: 2px solid var(--neon-blue);
  border-radius: 12px;
  box-shadow:
    0 0 14px rgba(45, 123, 255, 0.5),
    inset 0 0 24px rgba(45, 123, 255, 0.15);
}

.lcd-main {
  font-size: clamp(1rem, 4.2vw, 1.3rem);
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-pink);
}

.lcd-sub {
  font-size: clamp(0.75rem, 3vw, 0.9rem);
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* お題絵柄の表示 */
.lcd-symbol {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: symbolPop 0.4s ease-out;
}

.lcd-symbol-face {
  width: 48px !important;
  height: 48px !important;
  font-size: 2rem !important;
  border-radius: 14%;
}

.lcd-symbol-label {
  font-size: 0.9rem;
  color: var(--neon-pink);
  font-weight: bold;
}

@keyframes symbolPop {
  from { transform: scale(0); }
  60%  { transform: scale(1.25); }
  to   { transform: scale(1); }
}

/* 進行ドット（1回目・2回目・3回目） */
.step-indicator {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.3s, box-shadow 0.3s;
}

.step-dot.active {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* 液晶フラッシュ演出（色別） */
@keyframes lcdFlashAnim {
  0%, 100% { box-shadow: 0 0 14px rgba(45, 123, 255, 0.5); }
  50% { box-shadow: 0 0 40px var(--flash-color), inset 0 0 40px var(--flash-color); }
}

.flash-red     { --flash-color: var(--neon-red);  animation: lcdFlashAnim 0.5s ease-in-out 3; }
.flash-blue    { --flash-color: var(--neon-blue); animation: lcdFlashAnim 0.5s ease-in-out 3; }
.flash-gold    { --flash-color: var(--gold);      animation: lcdFlashAnim 0.5s ease-in-out 3; }
.flash-pink    { --flash-color: var(--neon-pink); animation: lcdFlashAnim 0.5s ease-in-out 3; }
.flash-rainbow { --flash-color: #fff;             animation: lcdFlashAnim 0.25s ease-in-out 6; }

/* =========================================================
 * リールエリア
 * ========================================================= */
.reel-area {
  position: relative;
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  padding: clamp(6px, 1.6vw, 10px);
  background: linear-gradient(180deg, #2a0a3a, #12021e);
  border: 2px solid var(--neon-red);
  border-radius: 16px;
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.4);
  transition: box-shadow 0.3s;
}

.symbols-loading .reel-area {
  opacity: 0;
}

/* 当たり時にリール枠が虹色に光る */
.reel-area.win-glow {
  animation: winGlowAnim 0.6s ease-in-out infinite alternate;
}

@keyframes winGlowAnim {
  from { box-shadow: 0 0 24px var(--neon-red), 0 0 48px var(--neon-pink); }
  to   { box-shadow: 0 0 24px var(--neon-blue), 0 0 48px var(--gold); }
}

/* リール窓: 3コマぶんの高さで、はみ出しは隠す */
.reel-window {
  position: relative;
  width: clamp(70px, 20vw, 98px);
  height: calc(var(--cell-h) * 3);
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.75) 0%,      /* 上下を暗くして奥行きを出す */
    rgba(255, 255, 255, 0.06) 50%,
    rgba(0, 0, 0, 0.75) 100%
  ), #1a0828;
  border: 2px solid rgba(255, 215, 0, 0.5);
  border-radius: 10px;
}

/* 停止した瞬間に窓が光る */
.reel-window.stopped-flash {
  box-shadow: 0 0 20px var(--gold), inset 0 0 20px rgba(255, 215, 0, 0.4);
}

.reel-window.tenpai {
  border-color: var(--gold);
  animation: tenpaiPulse 0.35s ease-in-out infinite alternate;
  box-shadow:
    0 0 18px rgba(255, 215, 0, 0.72),
    0 0 34px rgba(255, 45, 85, 0.42),
    inset 0 0 18px rgba(255, 215, 0, 0.22);
}

@keyframes tenpaiPulse {
  from {
    filter: saturate(1.2);
  }
  to {
    filter: saturate(1.8) brightness(1.22);
  }
}

/* リール帯（JSがtransformで動かす） */
.reel-strip {
  will-change: transform; /* GPU合成でスマホでも滑らかに */
}

.reel-cell {
  height: var(--cell-h);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 仮素材: 絵文字＋色付きの光る円 */
.symbol-placeholder {
  width: calc(var(--cell-h) * 0.78);
  height: calc(var(--cell-h) * 0.78);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: calc(var(--cell-h) * 0.45);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.25), transparent 60%),
              var(--sym-color, #555);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--sym-color, #555);
}

/* 本番画像素材（角丸タイル型なので角を軽く丸める） */
.symbol-image {
  width: calc(var(--cell-h) * 0.9);
  height: calc(var(--cell-h) * 0.9);
  object-fit: contain;
  border-radius: 14%;
}

/* 中央ライン（当たりライン）の目印 */
.payline {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: calc(var(--cell-h) + 8px);
  transform: translateY(-50%);
  border-top: 2px solid rgba(255, 45, 85, 0.8);
  border-bottom: 2px solid rgba(255, 45, 85, 0.8);
  box-shadow: 0 0 10px rgba(255, 45, 85, 0.4);
  pointer-events: none; /* タップの邪魔をしない */
  border-radius: 8px;
}

/* =========================================================
 * 操作ボタン
 * ========================================================= */
.controls {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
}

.stop-buttons {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 16px);
}

/* ストップボタン: 親指で連打しやすい大型サイズ（最小56px） */
.stop-btn {
  position: relative;
  flex: 1;
  max-width: 110px;
  min-height: 48px;
  font-size: clamp(0.9rem, 3.8vw, 1.1rem);
  font-weight: bold;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(180deg, #d40030, #7a0020);
  border: 2px solid var(--neon-red);
  border-radius: 14px;
  box-shadow: 0 4px 0 #4a0014, 0 0 14px rgba(255, 45, 85, 0.5);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
}

/* 3回目の押し順チャレンジで、次に押すSTOPを金色で案内する。 */
.stop-btn.push-order-target {
  color: #3a2500;
  background: linear-gradient(180deg, #fff3a8, var(--gold) 52%, #d49b00);
  border-color: #fff;
  box-shadow:
    0 4px 0 #8a6200,
    0 0 18px rgba(255, 215, 0, 0.9),
    0 0 34px rgba(255, 110, 180, 0.56);
  animation: pushOrderTargetPulse 0.48s ease-in-out infinite alternate;
}

.stop-btn.push-order-target::before {
  content: attr(data-push-order-marker);
  position: absolute;
  top: -15px;
  left: 50%;
  min-width: 34px;
  padding: 2px 7px;
  color: #3a2500;
  background: #fff3b0;
  border: 1px solid #fff;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 1000;
  line-height: 1.15;
  letter-spacing: 0;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  transform: translateX(-50%);
}

.controls.push-order-success .stop-buttons {
  animation: pushOrderSuccess 0.42s cubic-bezier(0.18, 1.5, 0.34, 1);
}

.controls.push-order-miss .stop-buttons {
  animation: pushOrderMiss 0.34s ease-in-out;
}

@keyframes pushOrderTargetPulse {
  from {
    filter: brightness(1);
    box-shadow: 0 4px 0 #8a6200, 0 0 14px rgba(255, 215, 0, 0.72);
  }
  to {
    filter: brightness(1.25);
    box-shadow: 0 4px 0 #8a6200, 0 0 26px rgba(255, 215, 0, 1), 0 0 38px rgba(255, 110, 180, 0.68);
  }
}

@keyframes pushOrderSuccess {
  0% { transform: scale(1); filter: brightness(1); }
  55% { transform: scale(1.045); filter: brightness(1.55); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes pushOrderMiss {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.stop-btn:active:not(:disabled) {
  transform: translateY(3px); /* 押し込んだ手応え */
  box-shadow: 0 1px 0 #4a0014, 0 0 20px var(--neon-red);
}

/* スピンボタン: 画面下部の大きな金ボタン */
.spin-btn {
  min-height: 52px;
  font-size: clamp(1.1rem, 5vw, 1.4rem);
  font-weight: bold;
  letter-spacing: 0.15em;
  color: #3a2500;
  background: linear-gradient(180deg, #ffe566, var(--gold) 50%, #c9a400);
  border: 2px solid #fff3b0;
  border-radius: 16px;
  box-shadow: 0 5px 0 #8a7000, 0 0 20px rgba(255, 215, 0, 0.6);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
}

.spin-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #8a7000, 0 0 28px var(--gold);
}

/* 押せないボタンは暗くする */
.stop-btn:disabled,
.spin-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* =========================================================
 * 当たり演出（フラッシュ・紙吹雪）
 * ========================================================= */
#screen-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}

#screen-flash.active {
  animation: screenFlashAnim 0.8s ease-out;
}

@keyframes screenFlashAnim {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

#confetti-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 60;
}

.confetti {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    /* --drift: 横に流れる量（JSがランダム指定） */
    transform: translate(calc(var(--drift, 0) * 120px), 105vh) rotate(720deg);
    opacity: 0.8;
  }
}

/* =========================================================
 * 毎日参戦チェックイン演出（その日の初回SPINのみ）
 * ========================================================= */
#daily-checkin-layer {
  position: fixed;
  inset: 0;
  z-index: 150; /* 通常カットインより上、罵倒モードの暗転より下 */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 215, 0, 0.28), transparent 42%),
    rgba(11, 0, 20, 0.74);
}

#daily-checkin-layer[hidden] {
  display: none;
}

#daily-checkin-layer::before {
  content: "";
  position: absolute;
  width: min(110vw, 760px);
  aspect-ratio: 1;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 215, 0, 0.18) 0deg 8deg,
    transparent 8deg 20deg
  );
  animation: dailyCheckinRays 8s linear infinite;
}

#daily-checkin-layer.fade-out {
  animation: dailyCheckinFade 0.3s ease-in forwards;
}

.daily-checkin-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  padding: clamp(20px, 5vw, 30px) clamp(14px, 5vw, 28px);
  color: #fff;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(74, 5, 96, 0.98), rgba(26, 3, 45, 0.98)),
    #21002c;
  border: 3px solid var(--gold);
  border-radius: 24px;
  box-shadow:
    0 0 22px rgba(255, 215, 0, 0.72),
    0 0 54px rgba(255, 45, 85, 0.45),
    inset 0 0 24px rgba(255, 255, 255, 0.08);
  animation: dailyCheckinCardPop 0.42s cubic-bezier(0.16, 1.5, 0.42, 1);
}

.daily-checkin-kicker {
  margin: 0 0 4px;
  font-size: clamp(0.72rem, 3vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0.28em;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.78);
}

.daily-checkin-streak {
  margin: 0;
  font-size: clamp(2rem, 10vw, 3.4rem);
  font-weight: 1000;
  line-height: 1.15;
  color: #fff;
  text-shadow:
    0 3px 0 #9d1644,
    0 0 18px rgba(255, 110, 180, 0.86);
}

.daily-checkin-total {
  margin: 4px 0 16px;
  font-size: clamp(0.78rem, 3.6vw, 1rem);
  font-weight: 800;
  color: #eadcf3;
}

.daily-checkin-stamps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(4px, 1.5vw, 8px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.daily-checkin-stamp {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  font-size: clamp(0.7rem, 4vw, 1.25rem);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.32);
  border-radius: 50%;
}

.daily-checkin-stamp.stamped {
  color: #fff;
  background: linear-gradient(145deg, var(--neon-pink), var(--neon-red));
  border: 2px solid #fff3b0;
  box-shadow: 0 0 12px rgba(255, 110, 180, 0.7);
}

.daily-checkin-stamp.current {
  animation: dailyStampSlam 0.48s 0.28s cubic-bezier(0.18, 1.8, 0.36, 1) both;
}

.daily-checkin-message {
  margin: 16px 0 0;
  min-height: 1.5em;
  font-size: clamp(0.78rem, 3.6vw, 1.02rem);
  font-weight: 900;
  color: #fff3b0;
}

#daily-checkin-layer.milestone .daily-checkin-card {
  border-color: #fff;
  animation:
    dailyCheckinCardPop 0.42s cubic-bezier(0.16, 1.5, 0.42, 1),
    dailyMilestoneGlow 0.7s 0.45s linear infinite alternate;
}

#daily-checkin-layer.milestone .daily-checkin-kicker,
#daily-checkin-layer.milestone .daily-checkin-message {
  color: #fff;
  text-shadow: 0 0 12px var(--gold), 0 0 22px var(--neon-pink);
}

@keyframes dailyCheckinCardPop {
  from { transform: scale(0.35) rotate(-5deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes dailyStampSlam {
  0% { transform: scale(2.6) rotate(-14deg); opacity: 0; }
  65% { transform: scale(0.88) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

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

@keyframes dailyCheckinFade {
  to { opacity: 0; }
}

@keyframes dailyMilestoneGlow {
  0% { box-shadow: 0 0 26px var(--neon-red), 0 0 54px var(--gold); }
  50% { box-shadow: 0 0 26px var(--neon-blue), 0 0 54px var(--neon-pink); }
  100% { box-shadow: 0 0 26px var(--gold), 0 0 54px #a64dff; }
}

/* =========================================================
 * カットイン演出（チャンス・激アツ・大当たりバナー）
 * ========================================================= */
#banner-layer {
  position: fixed;
  z-index: 90; /* 紙吹雪(60)より上、ブラックアウト(200)より下 */
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none; /* タップの邪魔をしない */
  transition: opacity 0.25s;
}

#banner-layer[hidden] {
  display: none;
}

#banner-layer.fade-out {
  opacity: 0;
}

/* 背景カットイン（全画面・半透明で下の画面を残す） */
.cutin-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  animation: cutinBgSlide 0.3s ease-out;
}

@keyframes cutinBgSlide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* テキストバナー（中央にドンと拡大表示） */
.cutin-banner {
  position: relative;
  width: min(420px, 86vw);
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
  animation: bannerPop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes bannerPop {
  from { transform: scale(0.2) rotate(-6deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* =========================================================
 * 前兆演出（SPIN押下時に抽選される期待度ステージ）
 * 弱=紫 / 強=赤 / 激アツ=虹 で液晶とリールの色味が変わる
 * ========================================================= */
/* --- 弱前兆: 液晶が紫がかる（ガセの可能性もある控えめな変化） --- */
body.omen-weak .lcd-screen {
  border-color: #a64dff;
  box-shadow: 0 0 14px rgba(166, 77, 255, 0.6), inset 0 0 24px rgba(166, 77, 255, 0.18);
}

/* --- 強前兆: 液晶が赤く、リール窓がゆっくり明滅 --- */
body.omen-strong .lcd-screen {
  border-color: var(--neon-red);
  box-shadow: 0 0 18px rgba(255, 45, 85, 0.7), inset 0 0 28px rgba(255, 45, 85, 0.2);
}

body.omen-strong .reel-window {
  animation: omenReelPulse 1s ease-in-out infinite alternate;
}

@keyframes omenReelPulse {
  from { box-shadow: 0 0 4px rgba(255, 45, 85, 0.2); }
  to   { box-shadow: 0 0 18px rgba(255, 45, 85, 0.8), inset 0 0 12px rgba(255, 45, 85, 0.3); }
}

/* --- 激アツ前兆: 液晶が虹色に揺らめき、リール窓も虹明滅 --- */
body.omen-max .lcd-screen {
  animation: omenRainbowBorder 1.2s linear infinite;
}

@keyframes omenRainbowBorder {
  0%   { border-color: var(--neon-red);  box-shadow: 0 0 20px rgba(255, 45, 85, 0.7); }
  25%  { border-color: var(--gold);      box-shadow: 0 0 20px rgba(255, 215, 0, 0.7); }
  50%  { border-color: var(--neon-blue); box-shadow: 0 0 20px rgba(45, 123, 255, 0.7); }
  75%  { border-color: var(--neon-pink); box-shadow: 0 0 20px rgba(255, 110, 180, 0.7); }
  100% { border-color: var(--neon-red);  box-shadow: 0 0 20px rgba(255, 45, 85, 0.7); }
}

body.omen-max .reel-window {
  animation: omenReelRainbow 0.8s linear infinite;
}

@keyframes omenReelRainbow {
  0%   { box-shadow: 0 0 14px var(--neon-red); }
  33%  { box-shadow: 0 0 14px var(--gold); }
  66%  { box-shadow: 0 0 14px var(--neon-blue); }
  100% { box-shadow: 0 0 14px var(--neon-red); }
}

/* =========================================================
 * 罵倒モード演出（連続プレイ節目または10%抽選）
 * ========================================================= */
/* ブラックアウト画面: 全画面を真っ暗にして警告文を出す */
#blackout {
  position: fixed;
  inset: 0;
  z-index: 200;               /* すべてのUIより手前 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: #000;
}

#blackout[hidden] {
  display: none;              /* hidden属性を確実に効かせる */
}

/* 罵倒モード突入時の専用イラスト。黒背景の画像を画面中央へ大きく出す。 */
.berserk-intro-image {
  display: block;
  width: min(100%, 920px);
  max-height: 100vh;
  object-fit: contain;
  animation: berserkImagePop 0.22s ease-out;
}

@keyframes berserkImagePop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 警告テキスト（赤・巨大・グリッチ風に揺れる） */
.blackout-text {
  font-size: clamp(2rem, 10vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--neon-red);
  text-shadow:
    0 0 20px var(--neon-red),
    0 0 60px rgba(255, 45, 85, 0.8);
  text-align: center;
}

.blackout-text.glitch {
  animation: glitchShake 0.9s steps(2) infinite,
             glitchFlicker 0.15s linear infinite;
}

@keyframes glitchShake {
  0%   { transform: translate(0, 0) skewX(0deg); }
  20%  { transform: translate(-4px, 2px) skewX(-4deg); }
  40%  { transform: translate(4px, -2px) skewX(3deg); }
  60%  { transform: translate(-2px, -3px) skewX(-2deg); }
  80%  { transform: translate(3px, 3px) skewX(4deg); }
  100% { transform: translate(0, 0) skewX(0deg); }
}

@keyframes glitchFlicker {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.65; }
}

.blackout-sub {
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  color: #fff;
  letter-spacing: 0.3em;
  opacity: 0.8;
}

/* 罵倒モード中: ページ背景も赤系素材に切り替わる */
body.berserk {
  background:
    linear-gradient(rgba(30, 0, 8, 0.8), rgba(30, 0, 8, 0.8)),
    url("../assets/backgrounds/background_red.png") center / cover no-repeat,
    var(--bg-dark);
}

/* 罵倒モード中: 筐体全体が赤く明滅し続ける */
body.berserk .slot-machine {
  border-color: var(--neon-red);
  animation: berserkPulse 0.8s ease-in-out infinite alternate;
}

@keyframes berserkPulse {
  from {
    box-shadow:
      0 0 20px rgba(255, 45, 85, 0.5),
      0 0 60px rgba(255, 45, 85, 0.3),
      inset 0 0 30px rgba(255, 45, 85, 0.1);
  }
  to {
    box-shadow:
      0 0 36px var(--neon-red),
      0 0 90px rgba(255, 45, 85, 0.6),
      inset 0 0 50px rgba(255, 45, 85, 0.25);
  }
}

/* 暴走モード中は液晶も赤基調に */
body.berserk .lcd-screen {
  border-color: var(--neon-red);
  box-shadow:
    0 0 14px rgba(255, 45, 85, 0.6),
    inset 0 0 24px rgba(255, 45, 85, 0.2);
}

/* =========================================================
 * 共有パネル
 * ========================================================= */
.share-panel[hidden] {
  display: none;
}

.share-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.share-inner {
  position: relative;
  width: min(440px, 100vw);
  max-height: 88dvh;
  overflow-y: auto;               /* パネル内はスクロール可能に */
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #23063a, var(--bg-panel));
  border: 2px solid var(--gold);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(255, 215, 0, 0.25);
  transform: translateY(100%);
  transition: transform 0.35s ease-out;
}

.share-panel.open .share-inner {
  transform: translateY(0); /* 下からスライドイン */
}

.share-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;   /* タップしやすい44px以上 */
  height: 44px;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
}

.share-title {
  text-align: center;
  font-size: clamp(1.05rem, 4.5vw, 1.3rem);
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
  margin-bottom: 12px;
}

.result-preview-wrap {
  position: relative;
  width: min(260px, 60vw);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border: 2px solid var(--neon-pink);
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(255, 110, 180, 0.5);
  overflow: hidden;
}

.result-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: auto;          /* 長押し保存できるように選択を許可 */
  -webkit-user-select: auto;
  -webkit-touch-callout: default;
}

.result-preview-overlay {
  position: absolute;
  left: 4.5%;
  top: 19%;
  width: 39%;
  height: 47%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2%;
  padding: 1.5%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 217, 236, 0.62));
  border: 1px solid rgba(255, 110, 180, 0.85);
  border-radius: 8px;
  color: #ff2d95;
  text-align: center;
  text-shadow:
    0 1px 0 #fff,
    0 0 4px rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.result-preview-overlay[hidden] {
  display: none;
}

.result-overlay-title {
  font-size: clamp(0.46rem, 2.3vw, 0.9rem);
  font-weight: 900;
  line-height: 1;
}

.result-overlay-days {
  font-size: clamp(0.86rem, 4.8vw, 1.8rem);
  font-weight: 900;
  line-height: 1;
  color: var(--gold);
  text-shadow:
    0 1px 0 #fff,
    0 0 6px rgba(255, 215, 0, 0.82);
}

.result-overlay-sub,
.result-overlay-title-badge,
.result-overlay-batou {
  width: 100%;
  font-size: clamp(0.24rem, 1.15vw, 0.46rem);
  font-weight: 900;
  line-height: 1.2;
  color: #7a245c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-hint {
  text-align: center;
  font-size: 0.72rem;
  color: #999;
  margin: 6px 0 12px;
}

.share-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.share-tab {
  flex: 1;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #bbb;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.share-tab.active {
  color: #fff;
  background: linear-gradient(90deg, var(--neon-red), var(--neon-blue));
  border-color: transparent;
  box-shadow: 0 0 12px rgba(255, 45, 85, 0.5);
}

.share-text {
  width: 100%;
  padding: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  resize: vertical;
  user-select: text;          /* 投稿文は選択・編集できるように */
  -webkit-user-select: text;
  margin-bottom: 12px;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-action {
  display: block;
  width: 100%;
  min-height: 52px;
  line-height: 52px;
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.share-action.primary {
  background: linear-gradient(90deg, var(--neon-red), var(--neon-pink));
  border-color: transparent;
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.55);
}

.share-action.social {
  border-color: transparent;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.16);
}

.share-action.social.x {
  background: linear-gradient(90deg, #111, #333);
}

.share-action.social.instagram {
  background: linear-gradient(90deg, #833ab4, #fd1d1d, #fcb045);
}

.share-action.social.substack {
  background: linear-gradient(90deg, #ff6719, #ff9f3f);
}

.share-action.done {
  background: #1a7a3a;
  border-color: #2fca63;
}

/* =========================================================
 * ホーム画面追加案内
 * ========================================================= */
.home-add-tip[hidden] {
  display: none;
}

.home-add-tip {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  z-index: 90;
  width: min(430px, calc(100vw - 24px));
  min-height: 42px;
  padding: 8px 42px 8px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.92), rgba(255, 45, 85, 0.9) 48%, rgba(45, 123, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  box-shadow:
    0 0 14px rgba(255, 215, 0, 0.45),
    0 0 20px rgba(255, 45, 85, 0.34);
  transform: translateX(-50%);
}

.home-add-tip p {
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.58);
}

.home-add-how-btn {
  min-height: 28px;
  padding: 4px 10px;
  color: #21002c;
  background: #fff;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.home-add-close-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 26px;
  height: 26px;
  color: #fff;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  transform: translateY(-50%);
  cursor: pointer;
}

@media (max-width: 520px) {
  .home-add-tip {
    width: calc(100vw - 18px);
    min-height: 38px;
    padding: 7px 38px 7px 10px;
    gap: 6px;
  }

  .home-add-tip p {
    font-size: 0.62rem;
  }

  .home-add-how-btn {
    min-height: 26px;
    padding: 4px 8px;
    font-size: 0.62rem;
  }

  .home-add-close-btn {
    right: 7px;
    width: 24px;
    height: 24px;
    font-size: 0.68rem;
  }
}

/* =========================================================
 * ロマコインランキング
 * ========================================================= */
.ranking-panel[hidden] {
  display: none;
}

.ranking-panel {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.55);
}

.ranking-inner {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, #24063c, #120018);
  border: 3px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    0 0 22px rgba(255, 215, 0, 0.46),
    inset 0 0 22px rgba(255, 45, 85, 0.18);
}

.ranking-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
}

.ranking-title {
  padding-right: 42px;
  margin-bottom: 12px;
  font-size: 1.05rem;
  color: var(--gold);
  text-align: center;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.7);
}

.ranking-name-form {
  margin-bottom: 10px;
}

.ranking-name-form label {
  display: block;
  margin-bottom: 5px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
}

.ranking-name-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.ranking-name-controls input {
  min-width: 0;
  padding: 9px 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 110, 180, 0.7);
  border-radius: 8px;
  font: inherit;
}

.ranking-name-controls button {
  padding: 8px 12px;
  color: #21002c;
  background: var(--gold);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.ranking-name-controls button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ranking-name-status {
  min-height: 1em;
  margin: 4px 0 0;
  color: #b9a9c9;
  font-size: 0.68rem;
}

.ranking-rules {
  margin: 8px 0 10px;
  padding: 9px 10px;
  color: #ded3e5;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  font-size: 0.7rem;
}

.ranking-rules h3 {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.76rem;
}

.ranking-rules ul {
  margin: 0;
  padding-left: 1.1em;
}

.ranking-rules li {
  margin: 2px 0;
}

.home-add-guide {
  margin: 8px 0 10px;
  padding: 10px 12px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 45, 85, 0.14)),
    rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 215, 0, 0.42);
  border-radius: 10px;
  box-shadow: inset 0 0 14px rgba(255, 215, 0, 0.12);
}

.home-add-guide:focus {
  outline: 2px solid rgba(255, 215, 0, 0.72);
  outline-offset: 2px;
}

.home-add-guide h3 {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 0.82rem;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.55);
}

.home-add-guide p,
.home-add-guide li {
  font-size: 0.7rem;
  line-height: 1.45;
}

.home-add-guide p {
  margin: 0 0 6px;
  color: #f5edf8;
}

.home-add-guide ul {
  margin: 0;
  padding-left: 1.15em;
  color: #ded3e5;
}

.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(62vh, 520px);
  overflow-y: auto;
}

.ranking-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 10px;
}

.ranking-empty {
  padding: 12px 10px;
  color: #b9a9c9;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 215, 0, 0.25);
  border-radius: 8px;
  font-size: 0.78rem;
  text-align: center;
}

.ranking-section-title {
  display: block;
  min-height: auto;
  padding: 8px 10px 2px;
  color: var(--gold);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 900;
}

.ranking-rank {
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--neon-pink);
}

.ranking-label {
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
}

.ranking-value {
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.65);
  white-space: nowrap;
}

.ranking-note {
  margin-top: 10px;
  font-size: 0.68rem;
  color: #b9a9c9;
  text-align: center;
}

/* =========================================================
 * スマホ/PWA表示の見切れ対策
 * ホーム画面起動や初回案内バナーで利用可能な高さが足りない時も、
 * 下方向に逃げられるようにする。
 * ========================================================= */
@media (max-width: 520px) {
  body {
    align-items: flex-start;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .slot-machine {
    max-height: none;
    margin: max(6px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
    gap: 5px;
    padding: 8px;
  }

  .machine-header {
    padding-bottom: 116px;
  }

  .title-logo {
    width: min(168px, 48vw);
  }

  .lcd-screen {
    min-height: 58px;
    padding: 8px;
  }

  .reel-area {
    padding: 6px;
  }

  .controls {
    gap: 6px;
  }

  .stop-btn {
    min-height: 36px;
  }

  .spin-btn {
    min-height: 42px;
  }
}

/* =========================================================
 * アクセシビリティ: 動きを減らす設定に配慮
 * ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .countdown-badge,
  .flash-red, .flash-blue, .flash-gold, .flash-pink, .flash-rainbow,
  .reel-area.win-glow,
  .reel-window.tenpai,
  #screen-flash.active,
  .blackout-text.glitch,
  body.berserk .slot-machine,
  body.omen-strong .reel-window,
  body.omen-max .lcd-screen,
  body.omen-max .reel-window,
  #daily-checkin-layer::before,
  #daily-checkin-layer.fade-out,
  .daily-checkin-card,
  .daily-checkin-stamp.current,
  #daily-checkin-layer.milestone .daily-checkin-card,
  .stop-btn.push-order-target,
  .controls.push-order-success .stop-buttons,
  .controls.push-order-miss .stop-buttons {
    animation: none;
  }
}

/* =========================================================
 * 低めの画面（iPhone SE〜8など）向けの圧縮
 * カウントダウンを大きくしたぶん、他の要素を詰めて1画面に収める
 * ========================================================= */
@media (max-height: 720px) {
  :root {
    --cell-h: clamp(44px, 11vw, 56px);
  }
  .lcd-screen {
    min-height: 64px;
    padding: 8px;
  }
  .title-logo {
    width: min(180px, 50vw);
    margin: -24px auto -30px;
  }
  .countdown-number {
    font-size: clamp(2rem, 10vw, 2.6rem);
  }
  .countdown-badge {
    padding: 4px 22px 6px;
  }
  .slot-machine {
    gap: clamp(5px, 1vh, 8px);
    padding: clamp(8px, 2vw, 14px);
  }
  .spin-btn {
    min-height: 44px;
  }
  .stop-btn {
    min-height: 40px;
  }
}

@media (max-height: 680px) {
  :root {
    --cell-h: 40px;
  }
  .lcd-screen {
    min-height: 56px;
  }
  .countdown-number {
    font-size: clamp(1.7rem, 8vw, 2.1rem);
  }
  .countdown-badge {
    padding: 3px 18px 5px;
  }
  .stop-btn {
    min-height: 34px;
  }
  .spin-btn {
    min-height: 38px;
  }
}
