:root {
  --gold: #FFD700; --gold2: #FFA500;
  --cyan: #00e5ff; --red: #e03030;
  --green-felt: #0a5c2a; --green-dark: #053518;
  --panel: #0a0f1e; --border: #1a3a5c;
}
* { box-sizing: border-box; margin:0; padding:0; }
body {
  background: #04080f;
  font-family: 'VT323', monospace;
  min-height: 100vh;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-x: hidden;
}

/* ===== CABINET ===== */
#cabinet {
  width: 100%; max-width: 900px;
  background: linear-gradient(180deg,#111827,#070d17);
  border-left: 8px solid #1e2d4a;
  border-right: 8px solid #1e2d4a;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* TITLE BAR */
#titleBar {
  background: #000;
  border-bottom: 3px solid var(--gold);
  padding: 6px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
#titleBar h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 15px var(--gold2), 0 0 30px #ff8800;
  letter-spacing: 6px;
  animation: flicker 5s infinite;
}
@keyframes flicker {
  0%,94%,96%,98%,100% { opacity:1; }
  95% { opacity:0.6; } 97% { opacity:0.8; } 99% { opacity:0.5; }
}
#titleBar .credits {
  font-size: 22px; color: var(--cyan);
  letter-spacing: 2px;
}
#titleBar .credits span { color: var(--gold); font-size: 26px; }

/* MAIN LAYOUT: left panel + game area */
#mainLayout {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1;
  gap: 0;
}

/* ===== LEFT: PAYOUT TABLE ===== */
#payoutPanel {
width: 200px;
  background: var(--panel);
  border-right: 3px solid var(--border);
  padding: 10px;
  /* flexを使わず、単純なブロック配置にします */
  display: block; 
  min-height: 500px;
}

/* CHAIN BONUS のエリアが下に詰まりすぎないように調整 */
#payoutPanel > div:last-child {
  margin-top: auto;            /* ← これでCHAIN BONUSだけを一番下に押しやる */
  padding-bottom: 10px;
}

#payoutTitle {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; color: var(--cyan);
  letter-spacing: 3px; text-align: center;
  margin-bottom: 4px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.payRow {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.5px;
}
.hand-name { color: var(--cyan); /* 役名はシアン色に */ }
.payRow .multiplier { color: var(--gold); /* 倍率は金色に */  font-weight: bold; }
.payRow.active {
  background: rgba(255,215,0,0.35);
  border-color: var(--gold);
  color: #fff;
  box-shadow: 0 0 12px rgba(255,215,0,0.5), inset 0 0 8px rgba(255,215,0,0.2);
}
.chainBonusRow.active {
  background: rgba(255, 215, 0, 0.6);
  border-color: var(--gold);
  color: #000;
  font-weight: bold;
  transition: background 0.3s;
  box-shadow: 0 0 16px rgba(255,215,0,0.7), inset 0 0 10px rgba(255,215,0,0.3);
}
.chainBonusRow.active span {
  color: #000 !important;
}
.payRow.active .multiplier { color: var(--gold); text-shadow: 0 0 16px var(--gold), 0 0 30px var(--gold2); }

/* CHAIN BONUSパネル現在の範囲を常時反転 */
.chainBonusRow.current-range {
  background: rgba(0, 229, 255, 0.18);
  border-color: var(--cyan);
  color: #fff;
}
.chainBonusRow.current-range span { color: var(--cyan) !important; font-weight: 700; }
/* milestoneヒット時のactiveはcurrent-rangeより優先 */
.chainBonusRow.active.current-range {
  background: rgba(255, 215, 0, 0.6);
  border-color: var(--gold);
}
.chainBonusRow.active.current-range span { color: #000 !important; }

/* ===== RIGHT: GAME AREA ===== */
#gameArea {
  display: flex; flex-direction: column;
  background: var(--green-dark);
}

/* TRACKER */
#trackerPanel {
  background: #000;
  border-bottom: 2px solid var(--border);
  padding: 6px 10px;
  display: flex;
  align-items: stretch;
  gap: 0;
}
#trackerLeft {
  flex: 1;
  min-width: 0;
}
#trackerRight {
  width: 150px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
#trackerTitle {
  font-size: 12px; color: var(--cyan); letter-spacing: 3px; margin-bottom: 4px;
}
#cardBoard { display: flex; flex-direction: column; gap: 1px; }
.boardRow { display: flex; align-items: center; gap: 2px; }
.boardSuit { width: 22px; font-size: 16px; text-align: center; flex-shrink: 0; }
.boardSuit.red { color: #e03030; }
.boardSuit.black { color: #ccc; }
.boardCard {
  width: 20px; height: 22px; font-size: 12px;
  text-align: center; line-height: 22px; color: #888;
  border-radius: 2px; transition: 0.2s;
  font-family: 'VT323', monospace;
}
.boardCard.used { color: #222; background: #0a0a0a; }
.boardCard.current {
  color: #000; background: var(--gold); font-weight: bold;
  box-shadow: 0 0 6px var(--gold);
}

/* FIELD */
#fieldZone {
  background: var(--green-felt);
  background-image: radial-gradient(ellipse at center, #0d6b30 0%, #053518 70%);
  padding: 16px 20px 8px;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
  border-bottom: 3px solid #1a4a28;
  transition: box-shadow 0.4s, border-color 0.4s;
}
#fieldZone::before {
  content: 'FIELD';
  position: absolute; top: 6px; left: 12px;
  font-size: 12px; color: rgba(255,255,255,0.15); letter-spacing: 4px;
}
#fieldCards { display: flex; justify-content: center; gap: 14px; }
#chainBanner { min-height: 38px; display:flex; align-items:center; justify-content:center; }
#chainText {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px; font-weight: 900; letter-spacing: 3px; display: none;
}
#chainText.show { display: block; animation: chainPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes chainPop {
  0% { transform: scale(0.2) rotate(-15deg); opacity:0; }
  100% { transform: scale(1) rotate(0); opacity:1; }
}
@keyframes rainbow {
  0%  { color:#ff0000; text-shadow: 0 0 15px #ff0000; }
  16% { color:#ff8800; text-shadow: 0 0 15px #ff8800; }
  33% { color:#ffff00; text-shadow: 0 0 15px #ffff00; }
  50% { color:#00ff88; text-shadow: 0 0 15px #00ff88; }
  66% { color:#00aaff; text-shadow: 0 0 15px #00aaff; }
  83% { color:#aa00ff; text-shadow: 0 0 15px #aa00ff; }
  100%{ color:#ff0000; text-shadow: 0 0 15px #ff0000; }
}
#chainText.rainbow { animation: chainPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275), rainbow 0.8s linear infinite 0.4s; }
#fieldZone.tier1 { border-color:#00e5ff; box-shadow: inset 0 0 40px rgba(0,180,220,0.15), 0 0 20px rgba(0,229,255,0.3); }
#fieldZone.tier2 { border-color:#FFD700; box-shadow: inset 0 0 40px rgba(220,170,0,0.15), 0 0 25px rgba(255,215,0,0.4); }
#fieldZone.tier3 { border-color:#00ff64; box-shadow: inset 0 0 40px rgba(0,200,80,0.15),  0 0 30px rgba(0,255,100,0.4); }
#fieldZone.tier4 { border-color:#ff3232; box-shadow: inset 0 0 40px rgba(200,0,0,0.2),    0 0 35px rgba(255,50,50,0.5); }
#fieldZone.tier5 { animation: rainbowBorder 1s linear infinite; }

/* chain段階ごとのゲームエリア背景色オーバーレイ */
#gameArea { position: relative; transition: background 1s ease; }
#gameArea::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 1s ease, background 1s ease;
}
#gameArea.chain-tier1::before { opacity: 1; background: radial-gradient(ellipse at center, rgba(0,180,255,0.07) 0%, transparent 70%); }
#gameArea.chain-tier2::before { opacity: 1; background: radial-gradient(ellipse at center, rgba(255,215,0,0.08) 0%, transparent 70%); }
#gameArea.chain-tier3::before { opacity: 1; background: radial-gradient(ellipse at center, rgba(0,255,100,0.08) 0%, transparent 70%); }
#gameArea.chain-tier4::before { opacity: 1; background: radial-gradient(ellipse at center, rgba(255,50,50,0.09) 0%, transparent 70%); }
#gameArea.chain-tier5::before { opacity: 1; background: radial-gradient(ellipse at center, rgba(180,0,255,0.09) 0%, transparent 70%); animation: gameAreaRainbow 2s linear infinite; }
@keyframes gameAreaRainbow {
  0%   { background: radial-gradient(ellipse at center, rgba(255,0,100,0.09) 0%, transparent 70%); }
  25%  { background: radial-gradient(ellipse at center, rgba(255,200,0,0.09) 0%, transparent 70%); }
  50%  { background: radial-gradient(ellipse at center, rgba(0,255,150,0.09) 0%, transparent 70%); }
  75%  { background: radial-gradient(ellipse at center, rgba(0,150,255,0.09) 0%, transparent 70%); }
  100% { background: radial-gradient(ellipse at center, rgba(255,0,100,0.09) 0%, transparent 70%); }
}
@keyframes rainbowBorder {
  0%  { border-color:#ff0000; box-shadow: inset 0 0 40px rgba(255,0,0,0.2),   0 0 40px rgba(255,0,0,0.5); }
  25% { border-color:#ffff00; box-shadow: inset 0 0 40px rgba(255,255,0,0.2), 0 0 40px rgba(255,255,0,0.5); }
  50% { border-color:#00ff88; box-shadow: inset 0 0 40px rgba(0,255,136,0.2), 0 0 40px rgba(0,255,136,0.5); }
  75% { border-color:#00aaff; box-shadow: inset 0 0 40px rgba(0,170,255,0.2), 0 0 40px rgba(0,170,255,0.5); }
  100%{ border-color:#ff0000; box-shadow: inset 0 0 40px rgba(255,0,0,0.2),   0 0 40px rgba(255,0,0,0.5); }
}

/* ===== CARD FLIP ===== */
.card-wrapper {
  perspective: 600px;
  display: inline-block;
}
.card-inner {
  position: relative;
  width: 80px; height: 112px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4,0,0.2,1);
}
.card-inner.flipped {
  transform: rotateY(180deg);
}
.card-face, .card-back {
  position: absolute; top:0; left:0; width:100%; height:100%;
  backface-visibility: hidden;
  border-radius: 8px;
}
.card-back {
  background: linear-gradient(135deg, #0a1a3a 25%, #0d2550 50%, #0a1a3a 75%);
  border: 2px solid #2a4a8a;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.6), inset 0 0 20px rgba(0,80,200,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.card-back::after {
  content: '';
  position: absolute; top: 5px; left: 5px; right: 5px; bottom: 5px;
  border: 1px solid rgba(100,150,255,0.3);
  border-radius: 5px;
  background: repeating-linear-gradient(
    45deg,
    transparent, transparent 4px,
    rgba(30,60,120,0.4) 4px, rgba(30,60,120,0.4) 5px
  );
}
.card-face {
  transform: rotateY(180deg);
}

/* ===== POKER ROLE HIGHLIGHT ===== */
#hand .card.poker-card {
  border-width: 3px;
  transform: translateY(-8px);
  z-index: 5;
}
#hand .card.poker-royal    { border-color: #fff;    box-shadow: 0 0 20px #fff,    0 0 40px rgba(255,255,255,0.5); background: linear-gradient(160deg,#fff8e0,#fff); }
#hand .card.poker-straight-flush { border-color: #ff88ff; box-shadow: 0 0 20px #ff44ff, 0 0 40px rgba(255,0,255,0.5); background: linear-gradient(160deg,#fff0ff,#fff); }
#hand .card.poker-four     { border-color: #ff8800; box-shadow: 0 0 20px #ff8800, 0 0 40px rgba(255,136,0,0.5); background: linear-gradient(160deg,#fff4e0,#fff); }
#hand .card.poker-full     { border-color: #FFD700; box-shadow: 0 0 16px #FFD700, 0 0 30px rgba(255,215,0,0.4); background: linear-gradient(160deg,#fffce0,#fff); }
#hand .card.poker-flush    { border-color: #00e5ff; box-shadow: 0 0 16px #00e5ff, 0 0 30px rgba(0,229,255,0.4); background: linear-gradient(160deg,#e0faff,#fff); }
#hand .card.poker-straight { border-color: #00ff88; box-shadow: 0 0 16px #00ff88, 0 0 30px rgba(0,255,136,0.4); background: linear-gradient(160deg,#e0fff0,#fff); }
#hand .card.poker-three    { border-color: #88aaff; box-shadow: 0 0 14px #4488ff, 0 0 25px rgba(68,136,255,0.4); }
#hand .card.poker-two      { border-color: #aaaaff; box-shadow: 0 0 12px #8888ff, 0 0 20px rgba(128,128,255,0.3); }
#hand .card.poker-one      { border-color: #ddddff; box-shadow: 0 0 10px #aaaaff, 0 0 18px rgba(170,170,255,0.3); }

@keyframes pokerReveal {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-18px) scale(1.08); }
  60%  { transform: translateY(-10px) scale(1.04); }
  100% { transform: translateY(-8px) scale(1); }
}
#hand .card.poker-card { animation: pokerReveal 0.4s ease-out forwards; }

/* ===== CARDS ===== */
.card {
  background: linear-gradient(160deg,#fff 0%,#f2f2f2 100%);
  border-radius: 8px; border: 2px solid #ccc;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; user-select: none; position: relative;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.6);
  transition: transform 0.15s, box-shadow 0.15s;
  color: #111;
}
/* corner pip top-left */
.card .corner-tl {
  position: absolute; top: 4px; left: 5px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1;
}
.card .corner-tl .c-rank { font-family:'Arial Black','Arial',sans-serif; font-size:12px; font-weight:900; line-height:1; }
.card .corner-tl .c-suit { font-size:12px; line-height:1; }
/* corner pip bottom-right (rotated) */
.card .corner-br {
  position: absolute; bottom: 4px; right: 5px;
  display: flex; flex-direction: column; align-items: center;
  line-height: 1; transform: rotate(180deg);
}
.card .corner-br .c-rank { font-family:'Arial Black','Arial',sans-serif; font-size:12px; font-weight:900; line-height:1; }
.card .corner-br .c-suit { font-size:12px; line-height:1; }
/* center suit */
.card .center-suit { font-size:32px; line-height:1; }
.card.red-card { color: #cc0000; }
.card.joker {
  background: linear-gradient(135deg,#1a0030,#3d0060);
  color:#fff; border-color:#9b59b6;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.6), 0 0 16px rgba(155,89,182,0.5);
}
.card.joker .center-suit { font-size:36px; }

/* Field card - large */
#fieldCards .card {
  width: 88px; height: 124px; cursor: default;
}
#fieldCards .card .corner-tl .c-rank { font-size:14px; }
#fieldCards .card .corner-tl .c-suit { font-size:14px; }
#fieldCards .card .corner-br .c-rank { font-size:14px; }
#fieldCards .card .corner-br .c-suit { font-size:14px; }
#fieldCards .card .center-suit { font-size:40px; }

/* Hand cards */
#hand .card {
  width: 80px; height: 112px;
}
#hand .card:hover {
  transform: translateY(-14px);
  box-shadow: 2px 4px 10px rgba(0,0,0,0.6), 0 0 18px rgba(255,215,0,0.4);
  z-index: 10;
}
#hand .card.playable {
  transform: translateY(-8px);
  box-shadow: 2px 8px 16px rgba(0,0,0,0.7), 0 0 14px rgba(0,229,255,0.6), 0 0 28px rgba(0,229,255,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#hand .card.playable:hover {
  transform: translateY(-18px);
  box-shadow: 2px 10px 20px rgba(0,0,0,0.7), 0 0 22px rgba(0,229,255,0.9), 0 0 40px rgba(0,229,255,0.4);
}
#hand .card.cannot-play { animation: shake 0.35s ease; opacity:0.5; }
@keyframes shake {
  0%,100% { transform:translateX(0); }
  20% { transform:translateX(-7px) rotate(-2deg); }
  40% { transform:translateX(7px) rotate(2deg); }
  60% { transform:translateX(-5px); }
  80% { transform:translateX(5px); }
}
@keyframes cardFlyIn {
  0% { transform:translateY(-25px) scale(1.15); opacity:0.4; }
  100% { transform:translateY(0) scale(1); opacity:1; }
}
.card-fly { animation: cardFlyIn 0.2s ease-out; }

/* HAND AREA */
#handZone {
  background: #050c18;
  border-top: 3px solid #1a3a28;
  padding: 10px 16px 14px;
}
#handTitle {
  font-size: 14px; color: var(--cyan); letter-spacing: 4px;
  text-align: center; margin-bottom: 8px;
}
#hand { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* POKER RESULT BANNER */
#pokerBanner {
  min-height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 17px; font-weight: 900; letter-spacing: 3px;
  color: var(--gold); text-shadow: 0 0 12px var(--gold2);
}
#pokerBanner.show { animation: chainPop 0.5s cubic-bezier(0.175,0.885,0.32,1.275); }

/* BOTTOM BAR */
#bottomBar {
  background: #000;
  border-top: 2px solid var(--border);
  padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
#bottomBtns {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.statBox {
  text-align: center;
}
.statBox .s-label {
  font-size: 9px; color: var(--cyan); letter-spacing: 2px; display: block;
}
.statBox .s-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 12px var(--gold2);
  line-height: 1;
}
.statBox.chain-stat .s-value { color: var(--cyan); text-shadow: 0 0 12px var(--cyan); transition: color 0.5s, text-shadow 0.5s; }
.statBox.deck-stat .s-value { color: #888; text-shadow: none; font-size:22px; }

#msgBar {
  font-size: 15px; color: var(--cyan); letter-spacing: 1px;
  flex: 1;
  text-align: left;
  min-height: 20px;
  display: flex; align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#msgBar.error { color: #ff6b6b; }
#msgBar.success { color: #2ecc71; }
#msgBar.chain-msg { color: var(--gold); text-shadow: 0 0 8px var(--gold2); }

#newGameBtn {
  font-family: 'Orbitron', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; padding: 10px 20px;
  background: linear-gradient(180deg,#c0392b,#922b21);
  color: #fff; border: 2px solid #e74c3c; border-radius: 4px; cursor: pointer;
  box-shadow: 0 3px 10px rgba(192,57,43,0.4); transition: 0.15s; white-space: nowrap;
}
#newGameBtn:hover { background: linear-gradient(180deg,#e74c3c,#c0392b); transform: translateY(-2px); }

/* MEDAL FLASH */
@keyframes medalFlash {
  0% { transform:scale(1.4); } 100% { transform:scale(1); }
}
.medal-anim { animation: medalFlash 0.4s ease-out; }

/* STUCK OVERLAY */
#stuckOverlay {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0);
  z-index: 50; pointer-events: none;
  transition: background 1.2s ease;
}
#stuckOverlay.show {
  background: rgba(0,0,0,0.65);
  pointer-events: all;
}
#stuckMsg {
  position: fixed; top:50%; left:50%;
  transform: translate(-50%,-50%) scale(0.8);
  font-family: 'Orbitron', sans-serif;
  font-size: 28px; font-weight: 900;
  color: #ff4444;
  text-shadow: 0 0 30px #ff0000, 0 0 60px rgba(255,0,0,0.4);
  letter-spacing: 4px; text-align: center; line-height: 1.6;
  opacity: 0;
  transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s;
  pointer-events: none;
}
#stuckMsg.show {
  opacity: 1;
  transform: translate(-50%,-50%) scale(1);
}

/* GAME OVER / CLEAR */
.overlay {
  position: fixed; top:0; left:0; width:100%; height:100%;
  background: rgba(0,0,0,0.88);
  display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 20px;
  z-index: 100; visibility: hidden; opacity: 0; transition: opacity 0.8s;
}
.overlay.show { visibility: visible; opacity: 1; }
#gameOverTitle {
  font-family: 'Orbitron', sans-serif; font-size: 52px; font-weight: 900;
  color: var(--red); text-shadow: 0 0 30px var(--red), 0 0 60px rgba(255,0,0,0.5);
  animation: glitch 2s infinite; letter-spacing: 4px;
}
@keyframes glitch {
  0%,90%,100% { transform:translate(0); }
  92% { transform:translate(-3px,1px); }
  94% { transform:translate(3px,-1px); }
  96% { transform:translate(-2px,2px); }
}
#clearTitle {
  font-family: 'Orbitron', sans-serif; font-size: 36px; font-weight: 900;
  letter-spacing: 4px;
  animation: rainbow 0.8s linear infinite, clearBounce 0.6s ease;
}
@keyframes clearBounce {
  0% { transform:scale(0) rotate(-20deg); }
  70% { transform:scale(1.15) rotate(3deg); }
  100% { transform:scale(1) rotate(0); }
}
.overlay-score {
  font-family: 'Orbitron', sans-serif; font-size: 18px;
  color: var(--gold); text-shadow: 0 0 12px var(--gold2);
  text-align: center; line-height: 2;
}
.overlay-btn {
  font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 3px; padding: 14px 36px;
  background: linear-gradient(180deg,var(--gold),var(--gold2));
  color: #000; border: none; border-radius: 4px; cursor: pointer;
  box-shadow: 0 0 20px var(--gold2); transition: 0.2s;
}
.overlay-btn:hover { transform:scale(1.05); }
#clearRetryBtn {
  background: linear-gradient(180deg,#00ff88,#00cc66);
  box-shadow: 0 0 20px #00ff88;
}

#insertCoin {
  text-align:center; font-size:14px; color:#2a2a2a; letter-spacing:4px; padding:4px;
  animation: blink 1.5s step-end infinite;
}
@keyframes blink { 50% { opacity:0; } }
/* ===== カード補充めくりアニメ ===== */
@keyframes cardDealIn {
  0%   { transform: translateY(-30px) rotateY(90deg); opacity: 0; }
  50%  { transform: translateY(0)     rotateY(90deg); opacity: 1; }
  100% { transform: translateY(0)     rotateY(0deg);  opacity: 1; }
}
.card-deal-in {
  animation: cardDealIn 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ===== ピンチ演出 ===== */
@keyframes pinchFlash {
  0%,100% { border-color: var(--green-felt); box-shadow: none; }
  25%,75% { border-color: #ff4444; box-shadow: inset 0 0 40px rgba(255,0,0,0.3), 0 0 30px rgba(255,0,0,0.5); }
  50%      { border-color: #ff0000; box-shadow: inset 0 0 60px rgba(255,0,0,0.5), 0 0 50px rgba(255,0,0,0.7); }
}
#fieldZone.pinch-flash {
  animation: pinchFlash 0.4s ease 4;
}

/* ===== 音量スライダー ===== */
#volumeControl {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
}
#volumeControl label {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; color: var(--cyan); letter-spacing: 2px; white-space: nowrap;
}
#volumeSlider {
  -webkit-appearance: none;
  width: 70px; height: 4px;
  background: #1a3a5c; border-radius: 2px; outline: none; cursor: pointer;
}
#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  cursor: pointer;
}
#volumeSlider::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%; border: none;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  cursor: pointer;
}

/* ===== ヘルプモーダル ===== */
#helpBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; font-weight: 700;
  padding: 6px 10px;
  background: transparent;
  color: var(--cyan); border: 1px solid var(--cyan);
  border-radius: 4px; cursor: pointer;
  letter-spacing: 1px;
  transition: 0.15s;
  white-space: nowrap;
}
#helpBtn:hover {
  background: rgba(0,229,255,0.15);
  box-shadow: 0 0 10px rgba(0,229,255,0.4);
}
#helpModal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; visibility: hidden; opacity: 0;
  transition: opacity 0.3s;
}
#helpModal.show { visibility: visible; opacity: 1; }
#helpBox {
  background: linear-gradient(180deg, #0d1829, #060d18);
  border: 2px solid var(--cyan);
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 400px; width: 90%;
  box-shadow: 0 0 40px rgba(0,229,255,0.3);
  position: relative;
}
#helpBox h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold2);
  letter-spacing: 4px;
  text-align: center;
  margin-bottom: 20px;
}
#helpBox ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
#helpBox ul li {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px; font-weight: 500;
  color: #ddd; letter-spacing: 0.5px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--cyan);
  border-radius: 2px;
  line-height: 1.5;
}
#helpBox ul li strong {
  color: var(--gold);
  font-weight: 700;
}
#helpClose {
  display: block;
  margin: 20px auto 0;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  padding: 10px 28px;
  background: linear-gradient(180deg, var(--cyan), #0099bb);
  color: #000; border: none; border-radius: 4px; cursor: pointer;
  box-shadow: 0 0 16px rgba(0,229,255,0.4);
  transition: 0.15s;
}
#helpClose:hover { transform: scale(1.05); }

/* ===== ランキングモーダル ===== */
#rankingBox {
  background: linear-gradient(180deg, #0d1829, #060d18);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 24px 28px;
  max-width: 520px; width: 95%;
  box-shadow: 0 0 40px rgba(255,215,0,0.2);
}
#rankingBox h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px; font-weight: 900;
  color: var(--gold); text-shadow: 0 0 12px var(--gold2);
  letter-spacing: 4px; text-align: center; margin-bottom: 16px;
}
#rankingList { display: flex; flex-direction: column; gap: 4px; }
.rankRow {
  display: grid;
  grid-template-columns: 32px 1fr 50px 100px;
  align-items: center; gap: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  border-left: 2px solid #1a3a5c;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px; color: #ccc;
}
.rankRow.rank-top {
  background: rgba(255,215,0,0.1);
  border-left-color: var(--gold);
}
.rank-pos { font-size: 16px; text-align: center; }
.rank-score { color: var(--gold); font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700; text-align: right; }
.rank-score small { font-size: 9px; color: #888; margin-left: 2px; }
.rank-chain { color: var(--cyan); font-size: 13px; text-align: center; }
.rank-date { color: #aaa; font-size: 13px; font-family: 'Rajdhani', sans-serif; font-weight: 500; text-align: right; letter-spacing: 0.5px; }
.rank-clear {
  font-size: 9px; background: #00ff88; color: #000;
  padding: 1px 4px; border-radius: 2px; margin-left: 4px;
  font-weight: 700; letter-spacing: 1px;
}

/* ランキングボタン */
#rankingBtn {
  font-size: 16px; padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: 4px; cursor: pointer;
  transition: 0.15s;
}
#rankingBtn:hover { background: rgba(255,215,0,0.15); box-shadow: 0 0 10px rgba(255,215,0,0.4); }

/* ===== DOUBLE UP ===== */
#doubleUpBox {
  background: linear-gradient(180deg, #0a0f1e, #050a14);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 380px; width: 92%;
  box-shadow: 0 0 50px rgba(255,215,0,0.25);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
#duTitle {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 16px var(--gold2), 0 0 32px var(--gold2);
  letter-spacing: 4px;
}
#duMedals {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px; color: #aaa; letter-spacing: 1px;
}
#duCardArea {
  width: 110px; height: 154px;
  position: relative;
}
#duCard {
  width: 100%; height: 100%;
  position: relative;
  transition: transform 0.15s;
}
.du-card-back {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #0a1a3a 25%, #0d2550 50%, #0a1a3a 75%);
  border: 2px solid #2a4a8a;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  box-shadow: 2px 4px 12px rgba(0,0,0,0.6);
}
#duMessage {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: 2px; min-height: 22px;
  color: var(--cyan);
}
#duButtons {
  display: flex; gap: 16px;
}
.du-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px; font-weight: 900;
  letter-spacing: 3px; padding: 18px 40px;
  border: none; border-radius: 8px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative; overflow: hidden;
}
.du-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  pointer-events: none;
}
#duHighBtn {
  background: linear-gradient(180deg, #22aaff, #0066cc);
  color: #fff;
  border: 2px solid #44ccff;
  box-shadow: 0 6px 24px rgba(0,136,255,0.6), 0 0 40px rgba(0,180,255,0.3);
  text-shadow: 0 0 10px rgba(100,200,255,0.8);
}
#duHighBtn:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 12px 36px rgba(0,136,255,0.8), 0 0 60px rgba(0,180,255,0.5);
}
#duLowBtn {
  background: linear-gradient(180deg, #ff5555, #cc0000);
  color: #fff;
  border: 2px solid #ff8888;
  box-shadow: 0 6px 24px rgba(255,68,68,0.6), 0 0 40px rgba(255,50,50,0.3);
  text-shadow: 0 0 10px rgba(255,150,150,0.8);
}
#duLowBtn:hover {
  transform: translateY(-5px) scale(1.04);
  box-shadow: 0 12px 36px rgba(255,68,68,0.8), 0 0 60px rgba(255,50,50,0.5);
}
#duResultButtons {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

/* ===== CREDIT BAR ===== */
#creditBar {
  background: #000;
  border-bottom: 2px solid var(--gold);
  padding: 6px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
#creditLeft {
  display: flex; align-items: baseline; gap: 8px;
}
#creditLabel {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; color: var(--cyan); letter-spacing: 3px;
}
#creditVal {
  font-family: 'Orbitron', sans-serif;
  font-size: 26px; font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold2), 0 0 24px var(--gold2);
  min-width: 60px;
}
#betArea {
  display: flex; align-items: center; gap: 6px;
}
#betLabel {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; color: #888; letter-spacing: 3px;
  margin-right: 4px;
}
#betCoins {
  display: flex; gap: 4px; align-items: center;
  margin-right: 8px;
}
.bet-coin {
  font-size: 18px;
  color: var(--gold);
  text-shadow: 0 0 8px var(--gold2);
  transition: all 0.15s;
}
.bet-coin.empty {
  color: #333;
  text-shadow: none;
}
#betAddBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; font-weight: 900; letter-spacing: 1px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #1a1400, #0a0800);
  color: var(--gold);
  border: 2px solid var(--gold2);
  border-radius: 4px; cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 0 8px rgba(255,165,0,0.3);
}
#betAddBtn:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--gold2), #cc7700);
  color: #000;
  box-shadow: 0 0 16px rgba(255,165,0,0.7);
}
#betStartBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; font-weight: 900; letter-spacing: 1px;
  padding: 8px 14px;
  background: linear-gradient(180deg, #00cc44, #008833);
  color: #fff; border: 2px solid #00ff66;
  border-radius: 4px; cursor: pointer;
  box-shadow: 0 0 12px rgba(0,255,100,0.4);
  transition: 0.15s;
  animation: startPulse 1s ease-in-out infinite;
}
#betStartBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0,255,100,0.7);
  animation: none;
}
@keyframes startPulse {
  0%,100% { box-shadow: 0 0 12px rgba(0,255,100,0.4); }
  50%      { box-shadow: 0 0 24px rgba(0,255,100,0.8); }
}
#betCancelBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  padding: 8px 10px;
  background: transparent;
  color: #888; border: 1px solid #444;
  border-radius: 4px; cursor: pointer;
  transition: 0.15s;
}
#betCancelBtn:hover {
  color: #ff6b6b; border-color: #ff6b6b;
  box-shadow: 0 0 8px rgba(255,107,107,0.3);
}
#insertCoinBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px; font-weight: 900; letter-spacing: 2px;
  padding: 6px 14px;
  background: linear-gradient(180deg, #1a1a00, #0a0a00);
  color: var(--gold);
  border: 2px solid var(--gold2);
  border-radius: 4px; cursor: pointer;
  transition: 0.15s;
  box-shadow: 0 0 8px rgba(255,165,0,0.3);
  animation: coinBlink 1.5s step-end infinite;
}
#insertCoinBtn:hover {
  background: linear-gradient(180deg, var(--gold2), #cc7700);
  color: #000;
  box-shadow: 0 0 16px rgba(255,165,0,0.7);
  animation: none;
}
#insertCoinBtn.coin-flash {
  background: var(--gold);
  color: #000;
  animation: none;
}
@keyframes coinBlink { 50% { opacity: 0.5; } }
@keyframes creditPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); color: #fff; }
  100% { transform: scale(1); }
}
#creditVal.credit-pop { animation: creditPop 0.4s ease-out; }

#creditResetBtn {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  padding: 5px 10px;
  background: transparent;
  color: #444; border: 1px solid #333;
  border-radius: 4px; cursor: pointer;
  transition: 0.15s;
}
#creditResetBtn:hover {
  color: #ff6b6b; border-color: #ff6b6b;
}
