/* 縁日ルーレット — 深夜の縁日 × ネオン */

:root {
  --ink: #0c0a14;
  --panel: #16121f;
  --panel-2: #1d1729;
  --line: #2c2438;
  --red: #e8442e;
  --red-glow: rgba(232, 68, 46, 0.45);
  --gold: #e8b44a;
  --paper: #f3ead8;
  --muted: #8d84a0;
  --grand: #e8b44a;
  --goldp: #e06a3c;
  --silver: #8fa8d0;
  --base-c: #4a4160;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, .cell { touch-action: manipulation; }

body {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  background:
    radial-gradient(600px 400px at 15% -5%, rgba(232, 68, 46, 0.12), transparent 60%),
    radial-gradient(500px 380px at 90% 0%, rgba(232, 180, 74, 0.10), transparent 60%),
    var(--ink);
  color: var(--paper);
  line-height: 1.8;
  letter-spacing: 0.04em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 提灯の光 */
.lantern {
  position: fixed; top: -80px; width: 220px; height: 220px;
  border-radius: 50%; filter: blur(70px); pointer-events: none; z-index: 0;
  animation: sway 7s ease-in-out infinite alternate;
}
.lantern-l { left: -60px; background: rgba(232, 68, 46, 0.28); }
.lantern-r { right: -60px; background: rgba(232, 180, 74, 0.22); animation-delay: -3.5s; }
@keyframes sway { from { transform: translateY(0); } to { transform: translateY(26px); } }

main, .site-head, .site-foot { position: relative; z-index: 1; }

.beta-banner {
  position: relative; z-index: 2;
  background: rgba(232, 180, 74, 0.12); border-bottom: 1px solid rgba(232, 180, 74, 0.4);
  color: var(--gold); font-size: 12px; text-align: center; padding: 8px 14px;
}
.line-welcome {
  position: relative; z-index: 2;
  background: rgba(6, 199, 85, 0.14); border-bottom: 1px solid rgba(6, 199, 85, 0.5);
  color: #7fe6a8; font-size: 13px; text-align: center; padding: 9px 14px;
}
.line-welcome strong { color: #fff; }

.site-head {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 20px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-family: 'RocknRoll One', sans-serif; font-size: 30px; color: var(--paper);
  width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--red); border-radius: 50%;
  box-shadow: 0 0 24px var(--red-glow), inset 0 -4px 0 rgba(0,0,0,0.25);
}
.brand h1 { font-family: 'RocknRoll One', sans-serif; font-size: 24px; line-height: 1.3; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.14em; }

.head-badges { display: flex; gap: 8px; }
.badge {
  font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel);
}
.badge-safe { color: #7fd6a4; border-color: rgba(127, 214, 164, 0.4); }
.badge-odds a { color: var(--gold); text-decoration: none; }
.sound-toggle {
  font-size: 15px; width: 34px; height: 34px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; transition: box-shadow 0.2s;
}
.sound-toggle:hover { box-shadow: 0 0 12px var(--red-glow); }
.sound-toggle.muted { opacity: 0.45; }

main { max-width: 880px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; display: grid; gap: 28px; }

section { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }

h2 { font-family: 'RocknRoll One', sans-serif; font-size: 17px; margin-bottom: 14px; font-weight: 400; }
.h-deco { color: var(--red); margin-right: 6px; }
.muted { color: var(--muted); font-size: 12px; }

/* カウントダウン */
.countdown-panel { text-align: center; padding: 32px 24px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.round-name { font-family: 'RocknRoll One', sans-serif; color: var(--gold); font-size: 15px; letter-spacing: 0.12em; }
.cd-label { font-size: 12px; color: var(--muted); margin-top: 10px; letter-spacing: 0.3em; }
.cd-time {
  font-family: 'DotGothic16', monospace; font-size: clamp(48px, 12vw, 76px);
  color: var(--paper); text-shadow: 0 0 22px var(--red-glow); line-height: 1.2; margin: 4px 0 8px;
}
.cd-note { font-size: 13px; color: var(--muted); }
.cd-note strong { color: var(--gold); font-size: 16px; }

.btn-primary {
  margin-top: 18px; font-family: 'RocknRoll One', sans-serif; font-size: 16px;
  color: var(--paper); background: var(--red); border: none; border-radius: 12px;
  padding: 14px 34px; cursor: pointer; letter-spacing: 0.08em;
  box-shadow: 0 6px 0 #9c2417, 0 0 30px var(--red-glow);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #9c2417; }
.btn-primary:disabled { opacity: 0.4; cursor: default; }

.btn-remind {
  display: block; width: 100%; margin-top: 12px;
  font-family: 'Zen Kaku Gothic New', sans-serif; font-size: 14px; color: #7fe6a8;
  background: rgba(6, 199, 85, 0.12); border: 1px solid rgba(6, 199, 85, 0.5);
  border-radius: 12px; padding: 13px; cursor: pointer;
}
.btn-remind:active { transform: translateY(2px); }
.btn-remind:disabled { opacity: 0.55; cursor: default; }

/* 口の購入 */
.buy-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 12px 0; padding: 12px; background: var(--panel-2); border-radius: 12px;
}
.cart-info { font-size: 13px; color: var(--muted); flex: 1; text-align: center; min-width: 150px; }
.cart-info strong { color: var(--gold); font-family: 'DotGothic16', monospace; font-size: 17px; }
.btn-buy {
  font-family: 'RocknRoll One', sans-serif; font-size: 14px;
  color: var(--paper); background: var(--red); border: none; border-radius: 10px;
  padding: 11px 22px; cursor: pointer;
  box-shadow: 0 4px 0 #9c2417;
}
.btn-buy:active { transform: translateY(3px); box-shadow: 0 1px 0 #9c2417; }
.btn-buy:disabled { opacity: 0.35; cursor: default; }
.btn-ghost-dark {
  font-family: inherit; font-size: 13px; color: var(--paper);
  background: none; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 16px; cursor: pointer;
}
.btn-ghost-dark:hover { border-color: var(--gold); color: var(--gold); }
.my-own { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.own-label { font-size: 12px; color: var(--muted); }
.my-slot-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.slot-chip {
  font-family: 'DotGothic16', monospace; font-size: 17px;
  background: var(--panel-2); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 8px; padding: 5px 12px;
}
.no-slots { font-size: 12px; color: var(--muted); }

/* 盤面 */
.board-status { font-size: 13px; color: var(--muted); margin-bottom: 12px; text-align: center; }
.board {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px;
  user-select: none; -webkit-user-select: none;
}
.cell {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: 'DotGothic16', monospace; font-size: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); transition: background 0.25s, transform 0.25s, opacity 0.4s;
}
.cell.free { cursor: pointer; }
.cell.free:hover { border-color: var(--paper); color: var(--paper); transform: scale(1.08); }
.cell.free:active { transform: scale(0.9); background: var(--panel); }
/* 無料モード: 口はタップ選択不可（自動付与のみ） */
.board.free-mode .cell.free { cursor: default; }
.board.free-mode .cell.free:hover { transform: none; border-color: var(--line); color: var(--muted); }
.board.free-mode .cell.free:active { transform: none; background: var(--panel-2); }
.cell.taken { opacity: 0.4; border-style: dashed; }
.cell.selected {
  border-color: var(--red); color: var(--paper); cursor: pointer;
  box-shadow: 0 0 12px var(--red-glow); background: rgba(232, 68, 46, 0.18);
}
.cell.mine { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 10px rgba(232, 180, 74, 0.35); }

.board-legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.board-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.lg-free { background: var(--panel-2); border: 1px solid var(--line); }
.lg-taken { background: var(--panel-2); border: 1px dashed var(--line); opacity: 0.5; }
.lg-sel { background: rgba(232, 68, 46, 0.4); border: 1px solid var(--red); }
.lg-mine { background: var(--panel-2); border: 1px solid var(--gold); }
.cell.settled-base { opacity: 0.22; transform: scale(0.9); }
.cell.settled-silver { background: var(--silver); color: var(--ink); opacity: 0.95; }
.cell.settled-gold { background: var(--goldp); color: var(--ink); opacity: 0.95; }
.cell.settled-grand {
  background: var(--grand); color: var(--ink);
  animation: winner 0.9s ease-in-out infinite alternate;
}
.cell.alive-hot { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow); color: var(--paper); }
@keyframes winner {
  from { box-shadow: 0 0 8px rgba(232, 180, 74, 0.6); transform: scale(1); }
  to { box-shadow: 0 0 30px rgba(232, 180, 74, 1); transform: scale(1.12); }
}

.tier-banner {
  min-height: 34px; margin-top: 14px; text-align: center;
  font-family: 'RocknRoll One', sans-serif; font-size: 16px; color: var(--gold);
}
.tier-banner.pop { animation: bannerpop 0.5s ease; }
@keyframes bannerpop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 結果 */
.result-panel.hidden { display: none; }
.result-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
  background: var(--panel-2); font-size: 14px;
}
.result-row .rn { font-family: 'DotGothic16', monospace; color: var(--gold); font-size: 18px; }
.result-row.win-grand { border-color: var(--grand); box-shadow: 0 0 18px rgba(232, 180, 74, 0.35); }
.result-row.win-gold { border-color: var(--goldp); }
.result-row.win-silver { border-color: var(--silver); }
.seed-line { margin-top: 12px; font-size: 12px; color: var(--muted); }
.seed-line code { color: var(--gold); }

/* 公示 */
.odds-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.odds-table th, .odds-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.odds-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.odds-table td:nth-child(2), .odds-table td:nth-child(3), .odds-table td:nth-child(4) { text-align: right; font-family: 'DotGothic16', monospace; }
.tier-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.legal-notes { margin: 16px 0 0 18px; font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.legal-foot { margin-top: 14px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 12px; }

/* 無料モード（広告） */
.ad-slot {
  border: 1px dashed var(--line); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 0.24em;
  background: repeating-linear-gradient(45deg, transparent, transparent 10px,
    rgba(255, 255, 255, 0.025) 10px, rgba(255, 255, 255, 0.025) 20px);
}
.sponsor-line { font-size: 12px; color: var(--gold); margin-top: 8px; }
.sponsor-line strong { font-family: 'RocknRoll One', sans-serif; }
.free-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.free-bar .muted { grid-column: 1 / -1; text-align: center; }
.btn-free { width: 100%; padding: 14px 10px; font-size: 14px; }
.btn-free:disabled { opacity: 0.4; cursor: default; }
@media (max-width: 700px) {
  .free-bar { grid-template-columns: 1fr; }
}

/* 招待（裂変） */
.ref-box {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 14px 0 10px; padding: 16px; background: var(--panel-2); border-radius: 12px;
  border: 1px dashed var(--gold);
}
.ref-code { font-size: 12px; color: var(--muted); }
.ref-code strong {
  font-family: 'DotGothic16', monospace; font-size: 26px; color: var(--gold);
  letter-spacing: 0.18em;
}
.ref-actions { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.btn-line {
  font-family: 'RocknRoll One', sans-serif; font-size: 14px; color: #fff;
  background: #06c755; border: none; border-radius: 10px; padding: 11px 20px; cursor: pointer;
  box-shadow: 0 4px 0 #049a41;
}
.btn-line:active { transform: translateY(3px); box-shadow: 0 1px 0 #049a41; }
.share-result { width: 100%; margin-top: 6px; padding: 13px; }
.ref-note { margin-top: 6px; font-size: 11px; }
@media (max-width: 700px) {
  .ref-box { flex-direction: column; align-items: stretch; text-align: center; }
  .ref-actions { justify-content: stretch; }
  .ref-actions button { flex: 1; }
}

/* 購入モーダル */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(6, 4, 12, 0.78); backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
  width: min(440px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--gold); border-radius: 16px;
  padding: 26px; box-shadow: 0 0 60px rgba(232, 180, 74, 0.2);
}
.modal h3 { font-family: 'RocknRoll One', sans-serif; font-size: 17px; font-weight: 400; margin-bottom: 12px; color: var(--gold); }
.buy-summary { font-size: 14px; margin-bottom: 14px; }
.buy-summary strong { color: var(--gold); font-family: 'DotGothic16', monospace; font-size: 18px; }
.pay-methods { display: grid; gap: 8px; margin-bottom: 14px; }
.pay-methods label {
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pay-methods label:has(input:checked) { border-color: var(--red); box-shadow: 0 0 10px var(--red-glow); }
.pay-methods input { accent-color: var(--red); }
.modal-note { font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* FAQ */
.faq details {
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
  background: var(--panel-2); overflow: hidden;
}
.faq summary {
  padding: 13px 16px; cursor: pointer; font-size: 14px; font-weight: 500;
  list-style: none; position: relative;
}
.faq summary::after { content: "＋"; position: absolute; right: 16px; color: var(--gold); }
.faq details[open] summary::after { content: "－"; }
.faq details p { padding: 0 16px 14px; font-size: 13px; color: var(--muted); }

.site-foot { text-align: center; padding: 24px; color: var(--muted); font-size: 12px; }
.site-foot a { color: var(--gold); }

/* モバイル固定購入バー */
.sticky-buy {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(12, 10, 20, 0.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  animation: slideup 0.25s ease;
}
.sticky-buy.hidden { display: none; }
.sb-info { flex: 1; text-align: center; font-size: 13px; color: var(--muted); }
.sb-info strong { color: var(--gold); font-family: 'DotGothic16', monospace; font-size: 17px; }
.sb-clear { padding: 10px 14px; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---- モバイル最適化 ---- */
@media (max-width: 700px) {
  .site-head { padding: 12px 16px; }
  .brand { gap: 10px; }
  .brand-mark { width: 42px; height: 42px; font-size: 22px; }
  .brand h1 { font-size: 18px; }
  .brand-sub { font-size: 9px; }
  .badge { font-size: 11px; padding: 4px 10px; }

  main { padding: 16px 12px 110px; gap: 16px; }
  section { padding: 16px 14px; border-radius: 14px; }

  .countdown-panel { padding: 22px 14px; }
  .btn-primary { width: 100%; padding: 15px 20px; }

  .buy-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .buy-bar .btn-buy { display: none; } /* モバイルは固定バーから購入 */

  .modal-overlay { align-items: flex-end; display: flex; justify-content: center; }
  .modal {
    width: 100%; max-width: none; border-radius: 18px 18px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    animation: slideup 0.25s ease;
  }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; padding: 14px; }

  .result-row { font-size: 13px; flex-wrap: wrap; }
  .odds-table { font-size: 12px; }
  .odds-table th, .odds-table td { padding: 8px 4px; }
}

@media (max-width: 560px) {
  .board { grid-template-columns: repeat(10, 1fr); gap: 3px; }
  .cell { font-size: 9px; border-radius: 4px; }
}
