:root {
  --primary-color: #ff6b6b;
  --secondary-color: #4ecdc4;
  --accent-color: #ffb86c;
  --bg-color: #f0f8ff;
  --text-color: #333;
}

body {
  font-family: 'Hiragino Maru Gothic ProN', 'Meiryo', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 20px;
}
body.is-fullscreen { padding: 0; background-color: white; }

.app-container {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  box-sizing: border-box;
}
body.is-fullscreen .app-container {
  max-width: 100%; height: 100vh; border-radius: 0; display: flex; flex-direction: column;
}

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding-bottom: 10px; border-bottom: 2px solid #eee; }
h1 { color: var(--primary-color); margin: 0; font-size: 24px; }
.header-right { display: flex; align-items: center; gap: 15px; }

.icon-btn { background: none; border: 1px solid #ddd; font-size: 18px; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.icon-btn:hover { background-color: #f0f0f0; }

.sound-control { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #555; font-size: 14px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--secondary-color); }
input:checked + .slider:before { transform: translateX(20px); }

main { display: flex; flex-wrap: wrap; gap: 30px; justify-content: center; }
body.is-fullscreen main { flex: 1; align-items: center; }

.roulette-section { flex: 1; min-width: 320px; display: flex; flex-direction: column; align-items: center; }

.canvas-container { 
  position: relative; 
  width: 100%; 
  max-width: 500px; 
  aspect-ratio: 1 / 1; 
  margin: 0 auto 20px auto; 
}

@media (max-height: 750px) {
  .canvas-container {
    width: 50vh;
    max-width: 100%;
  }
}

canvas { 
  width: 100%; 
  height: 100%; 
  border-radius: 50%; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
  display: block;
}

.arrow { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 35px solid #ff3b3b; z-index: 10; filter: drop-shadow(0px 3px 2px rgba(0,0,0,0.3)); }

.spin-btn { background-color: var(--primary-color); color: white; border: none; padding: 15px 50px; font-size: 22px; font-weight: bold; border-radius: 40px; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 6px rgba(255, 107, 107, 0.4); }
.spin-btn:hover { background-color: #ff5252; transform: scale(1.05); }
.spin-btn:disabled { background-color: #ccc; cursor: not-allowed; box-shadow: none; transform: none; }

.result { margin-top: 20px; font-size: 24px; font-weight: bold; color: #4a4a4a; min-height: 35px; text-align: center; }

/* 🏆 新機能：当選履歴ボードのデザイン */
.winner-board {
  margin-top: 25px; width: 100%; max-width: 500px;
  background: #fff; border: 2px dashed var(--secondary-color);
  border-radius: 10px; padding: 15px; box-sizing: border-box;
}
.winner-board h3 { margin: 0 0 10px 0; font-size: 16px; color: var(--secondary-color); text-align: center;}
.winner-board ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;}
.winner-board li { background: #e0f7f5; color: #333; padding: 6px 12px; border-radius: 20px; font-size: 14px; font-weight: bold; border: 1px solid #b2dfdb;}

/* 設定エリア */
.settings-section { flex: 1; min-width: 300px; display: flex; flex-direction: column; }
body.is-fullscreen .settings-section { display: none; }

.custom-settings { background: #fff5f5; padding: 15px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #ffe3e3; }
.input-group { margin-bottom: 10px; display: flex; flex-direction: column; gap: 5px; }
.input-group:last-child { margin-bottom: 0; }
.input-group label { font-weight: bold; font-size: 14px; color: #555; }
.input-group input, .input-group select { padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }

.list-header { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
textarea { width: 100%; padding: 10px; font-size: 14px; border: 2px solid #ddd; border-radius: 8px; margin-top: 8px; resize: vertical; box-sizing: border-box; }
.small-btn { background-color: #f0f0f0; border: 1px solid #ccc; padding: 4px 8px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.small-btn:hover { background-color: #e0e0e0; }

.update-btn { margin-top: 15px; background-color: var(--secondary-color); color: white; border: none; padding: 12px; font-size: 16px; font-weight: bold; border-radius: 8px; cursor: pointer; }
.update-btn:hover { background-color: #45b7aa; }

.history-area { margin-top: 20px; background-color: #f8f9fa; padding: 15px; border-radius: 8px; border: 1px solid #e9ecef; }
.history-desc { font-size: 12px; color: #666; margin: 0 0 10px 0; }
.save-btn { width: 100%; background-color: var(--accent-color); color: white; border: none; padding: 10px; font-size: 14px; font-weight: bold; border-radius: 6px; cursor: pointer; margin-bottom: 10px; }
.save-btn:hover { background-color: #f5a653; }
.load-area { display: flex; gap: 10px; }
.load-area select { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.load-btn { background-color: #8be9fd; border: none; padding: 8px 15px; font-weight: bold; border-radius: 6px; cursor: pointer; }

/* 🏆 大画面モーダル (結果発表) */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.85); z-index: 2000;
  display: flex; justify-content: center; align-items: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
  background: white; padding: 40px 20px; border-radius: 20px; text-align: center;
  width: 90%; max-width: 800px;
  transform: scale(0.8); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; z-index: 2001;
}
.modal-overlay.active .modal-content { transform: scale(1); }

#modalTitle { color: #666; font-size: 24px; margin-top: 0; margin-bottom: 20px; }
.modal-winner-box { display: flex; justify-content: center; align-items: center; gap: 20px; }
.sparkle-icon { font-size: 40px; animation: blink 1s infinite alternate; }
.modal-winner {
  font-size: 70px; font-weight: 900; color: var(--primary-color);
  line-height: 1.2; word-break: break-word;
  text-shadow: 2px 2px 0px #fff, 4px 4px 0px rgba(255,107,107,0.3);
}
@media (max-width: 600px) { .modal-winner { font-size: 40px; } }
.modal-desc { font-size: 24px; color: #666; font-weight: bold; margin-bottom: 40px; }

.modal-actions { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.modal-btn {
  padding: 15px 30px; font-size: 20px; font-weight: bold; border: none; border-radius: 12px;
  cursor: pointer; transition: transform 0.2s, opacity 0.2s; display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.modal-btn:hover { transform: translateY(-3px); opacity: 0.9; }
.modal-btn small { font-size: 12px; font-weight: normal; }
.btn-delete { background-color: var(--secondary-color); color: white; box-shadow: 0 4px 0 #38a59c; }

@keyframes blink { from { opacity: 0.5; transform: scale(0.8); } to { opacity: 1; transform: scale(1.1); } }

/* 🎉 演出用Canvas */
#effect-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 1999; }