* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.title {
  font-size: 1.5rem;
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.points-display {
  display: flex;
  gap: 20px;
  font-size: 1.1rem;
}

.points-display strong {
  color: #ffd700;
  font-size: 1.3rem;
}

.bet-info {
  color: #aaa;
  font-size: 0.95rem;
  align-self: center;
}

/* スロットマシン本体 */
.slot-machine {
  position: relative;
  background: #16213e;
  border: 3px solid #ffd700;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 0 30px rgba(255,215,0,0.3);
  width: 100%;
}

.reels-wrapper {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.reel-container {
  width: calc(33.33% - 6px);
  height: 270px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  border: 2px solid #ccc;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* 上下フェードアウト */
.reel-container::before,
.reel-container::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 2;
  pointer-events: none;
}

.reel-container::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.95), transparent);
}

.reel-container::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255,255,255,0.95), transparent);
}

.reel {
  display: flex;
  flex-direction: column;
  position: absolute;
  width: 100%;
  top: 0;
}

.symbol-cell {
  width: 100%;
  height: 90px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.symbol-cell img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 6px;
}

.symbol-cell .placeholder {
  width: 70px;
  height: 70px;
  border-radius: 6px;
  background: #f0f0f0;
  border: 2px dashed #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: #444;
}

/* ペイラインSVGオーバーレイ */
.paylines-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.payline-line {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

.payline-line.active {
  stroke-width: 7;
  stroke-dasharray: none;
  animation: payline-rainbow 0.13s linear infinite;
}

@keyframes payline-rainbow {
  0%   { stroke: #ff0000; filter: drop-shadow(0 0 8px #ff0000); opacity: 1; }
  20%  { stroke: #ffee00; filter: drop-shadow(0 0 8px #ffee00); opacity: 0.5; }
  40%  { stroke: #00cc00; filter: drop-shadow(0 0 8px #00cc00); opacity: 1; }
  60%  { stroke: #0099ff; filter: drop-shadow(0 0 8px #0099ff); opacity: 0.5; }
  80%  { stroke: #ff00bb; filter: drop-shadow(0 0 8px #ff00bb); opacity: 1; }
  100% { stroke: #ff0000; filter: drop-shadow(0 0 8px #ff0000); opacity: 0.5; }
}

/* 当選リール - レインボーストロボ */
.reel-container.winner {
  animation: reel-rainbow 0.13s linear infinite;
}

@keyframes reel-rainbow {
  0%   { border-color: #ff0000; box-shadow: 0 0 18px #ff0000, 0 0 36px #ff0000; }
  14%  { border-color: #ff8800; box-shadow: 0 0 18px #ff8800, 0 0 36px #ff8800; }
  28%  { border-color: #ffee00; box-shadow: 0 0 18px #ffee00, 0 0 36px #ffee00; }
  42%  { border-color: #00cc00; box-shadow: 0 0 18px #00cc00, 0 0 36px #00cc00; }
  57%  { border-color: #0099ff; box-shadow: 0 0 18px #0099ff, 0 0 36px #0099ff; }
  71%  { border-color: #8800ff; box-shadow: 0 0 18px #8800ff, 0 0 36px #8800ff; }
  85%  { border-color: #ff00bb; box-shadow: 0 0 18px #ff00bb, 0 0 36px #ff00bb; }
  100% { border-color: #ff0000; box-shadow: 0 0 18px #ff0000, 0 0 36px #ff0000; }
}

/* スロットマシン外枠のレインボーフラッシュ */
.slot-machine.winner-flash {
  animation: machine-rainbow 0.13s linear infinite;
}

@keyframes machine-rainbow {
  0%   { border-color: #ff0000; box-shadow: 0 0 50px #ff0000, 0 0 100px rgba(255,0,0,0.4); }
  14%  { border-color: #ff8800; box-shadow: 0 0 50px #ff8800, 0 0 100px rgba(255,136,0,0.4); }
  28%  { border-color: #ffee00; box-shadow: 0 0 50px #ffee00, 0 0 100px rgba(255,238,0,0.4); }
  42%  { border-color: #00cc00; box-shadow: 0 0 50px #00cc00, 0 0 100px rgba(0,204,0,0.4); }
  57%  { border-color: #0099ff; box-shadow: 0 0 50px #0099ff, 0 0 100px rgba(0,153,255,0.4); }
  71%  { border-color: #8800ff; box-shadow: 0 0 50px #8800ff, 0 0 100px rgba(136,0,255,0.4); }
  85%  { border-color: #ff00bb; box-shadow: 0 0 50px #ff00bb, 0 0 100px rgba(255,0,187,0.4); }
  100% { border-color: #ff0000; box-shadow: 0 0 50px #ff0000, 0 0 100px rgba(255,0,0,0.4); }
}

/* リーチリール (reel-2) */
.reel-container.reach {
  border-color: #ff8c00;
  animation: reach-glow 0.5s ease-in-out infinite alternate;
}

@keyframes reach-glow {
  from { box-shadow: 0 0 8px rgba(255,140,0,0.4); }
  to   { box-shadow: 0 0 24px rgba(255,140,0,1); }
}

/* メッセージ */
.message {
  min-height: 36px;
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255,215,0,0.6);
}

/* ボタン群 */
.controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.spin-btn {
  width: 160px;
  height: 56px;
  font-size: 1.4rem;
  font-weight: bold;
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
  border: none;
  border-radius: 28px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,140,0,0.5);
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 2px;
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,140,0,0.7);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(0);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mute-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #16213e;
  border: 2px solid #555;
  color: #eee;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.mute-btn:hover {
  border-color: #ffd700;
}

/* 設定ボタン */
.settings-btn {
  background: transparent;
  border: 1px solid #555;
  color: #aaa;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, color 0.2s;
}

.settings-btn:hover {
  border-color: #ffd700;
  color: #ffd700;
}

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #16213e;
  border: 2px solid #ffd700;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-content h2 {
  color: #ffd700;
  font-size: 1.4rem;
}

.modal-note {
  color: #aaa;
  font-size: 0.85rem;
}

/* 絵柄リスト */
.symbol-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.symbol-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.symbol-row .preview {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #0f0f1a;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.symbol-row .preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.symbol-row .preview .placeholder {
  font-size: 1rem;
  font-weight: bold;
  color: #666;
}

.symbol-row label {
  font-size: 0.85rem;
  color: #aaa;
  width: 50px;
  flex-shrink: 0;
}

.symbol-row input[type="text"] {
  flex: 1;
  background: #0f0f1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #eee;
  padding: 8px 10px;
  font-size: 0.8rem;
  min-width: 0;
}

.symbol-row input[type="text"]:focus {
  outline: none;
  border-color: #ffd700;
}

/* 特殊設定 */
.special-settings {
  border-top: 1px solid #333;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.special-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.special-row label {
  color: #aaa;
  font-size: 0.9rem;
  width: 100px;
  flex-shrink: 0;
}

.special-row select {
  background: #0f0f1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #eee;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.special-row select:focus {
  outline: none;
  border-color: #ffd700;
}

.payout-hint {
  font-size: 0.8rem;
  color: #888;
}

/* BGM設定 */
.bgm-settings {
  border-top: 1px solid #333;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bgm-settings h3 {
  color: #ffd700;
  font-size: 1rem;
}

.bgm-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bgm-row label {
  color: #aaa;
  font-size: 0.85rem;
  width: 80px;
  flex-shrink: 0;
}

.bgm-row input[type="text"] {
  flex: 1;
  background: #0f0f1a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #eee;
  padding: 8px 10px;
  font-size: 0.8rem;
  min-width: 0;
}

.bgm-row input[type="text"]:focus {
  outline: none;
  border-color: #ffd700;
}

/* ボタン */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  background: #ffd700;
  color: #1a1a2e;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background: #ffcc00;
}

.btn-secondary {
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-secondary:hover {
  border-color: #aaa;
  color: #eee;
}

@media (max-width: 380px) {
  .title { font-size: 1rem; }
  .reel-container { height: 240px; }
  .symbol-cell { height: 80px; }
  .symbol-cell img, .symbol-cell .placeholder { width: 60px; height: 60px; }
}
