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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(255,255,255,0.5); }
    to { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(255,255,255,0.8); }
}

/* フォームコンテナ */
.form-container {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.form-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.input-group input[type="text"] {
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    width: 250px;
    transition: border-color 0.3s;
}

.input-group input[type="text"]:focus {
    border-color: #667eea;
    outline: none;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.input-group button {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s;
}

.input-group button:hover {
    transform: scale(1.05);
}

/* スロットマシン */
.roulette-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.slot-machine {
    position: relative;
    width: 300px;
    height: 200px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 20px;
    overflow: hidden;
}

.slot-display {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    height: 140px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slot-reel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slot-item {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 0 10px;
    word-wrap: break-word;
}

.slot-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 5px solid #B8860B;
    border-radius: 20px;
    pointer-events: none;
}

.slot-machine.spinning .slot-reel {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(0); }
    100% { transform: translateY(-700px); }
}

/* 当選者表示 */
.winner-display {
    text-align: center;
    margin-top: 20px;
}

#winner-text {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.celebration {
    font-size: 72px;
    position: absolute;
    animation: celebrate 3s ease-out;
}

@keyframes celebrate {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0;
    }
}

/* 参加者パネル */
.participants-panel {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.participants-panel h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

#participants-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.participant-item {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    position: relative;
    transition: transform 0.3s;
}

.participant-item:hover {
    transform: scale(1.05);
}

.participant-item.admin {
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
}

.participant-item.admin::after {
    content: "👑";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 16px;
}

.participant-item.last-winner {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
}

.participant-item.second-last-winner {
    opacity: 0.7;
}

.participant-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* 控制面板 */
.control-panel {
    text-align: center;
    margin-bottom: 30px;
}

#start-roulette-btn {
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 4px 15px rgba(255,107,107,0.4);
}

#start-roulette-btn:hover {
    transform: scale(1.05);
}

#start-roulette-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.status-display {
    margin-top: 15px;
    color: white;
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* 履歴パネル */
.history-panel {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}

.history-panel h3 {
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

#history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.history-item .winner {
    font-weight: bold;
    color: #667eea;
}

.history-item .time {
    font-size: 12px;
    color: #666;
}

/* エラーメッセージ */
.error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff4757;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(255,71,87,0.4);
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
}

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

/* ローディングスピナー */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin-loader 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ユーティリティクラス */
.hidden {
    display: none !important;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .slot-machine {
        width: 250px;
        height: 150px;
    }
    
    .slot-display {
        width: 200px;
        height: 100px;
    }
    
    .slot-item {
        font-size: 32px;
        height: 100px;
    }
    
    #participants-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .participant-stats {
        flex-direction: column;
        gap: 10px;
    }
}