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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

/* ガラポンマシン */
.gachapon-machine {
    margin: 30px 0;
}

.machine-body {
    background: linear-gradient(145deg, #e0e0e0, #f5f5f5);
    border-radius: 20px;
    padding: 30px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.machine-top {
    margin-bottom: 20px;
}

.machine-window {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
    border-radius: 15px;
    border: 8px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.prize-display {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

.question-mark {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.prize-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    animation: bounce 0.5s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ガラポン回転アニメーション */
.gachapon-machine.spinning .machine-window {
    animation: spin 1s ease-in-out;
}

@keyframes spin {
    0% { transform: rotateY(0deg); }
    25% { transform: rotateY(90deg); }
    50% { transform: rotateY(180deg); }
    75% { transform: rotateY(270deg); }
    100% { transform: rotateY(360deg); }
}

.machine-bottom {
    margin-top: 20px;
}

.handle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.handle {
    width: 60px;
    height: 80px;
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
    border-radius: 30px 30px 10px 10px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.handle:hover {
    transform: scale(1.1);
}

.handle.pulled {
    animation: pullHandle 0.5s ease;
}

@keyframes pullHandle {
    0% { transform: translateY(0); }
    50% { transform: translateY(20px); }
    100% { transform: translateY(0); }
}

.handle-knob {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.prize-outlet {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    background: #333;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.prize-capsule {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-radius: 40px;
    margin: 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: dropCapsule 0.8s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

@keyframes dropCapsule {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.capsule-content {
    font-size: 2em;
}

/* 抽選ボタン */
.button-container {
    margin: 30px 0;
}

.lottery-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 50px;
    font-size: 1.5em;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.lottery-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.lottery-button:active:not(:disabled) {
    transform: translateY(0);
}

.lottery-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-icon {
    font-size: 1.2em;
}

/* 在庫情報表示（テスト用） */
.stock-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.stock-title {
    font-size: 0.9em;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
    text-align: center;
}

.stock-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.stock-item {
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
}

.stock-item-rank {
    font-size: 0.9em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stock-item-name {
    font-size: 0.8em;
    color: #333;
    margin-bottom: 5px;
}

.stock-item-count {
    font-size: 1.1em;
    font-weight: bold;
    color: #764ba2;
}

.stock-item-count.low {
    color: #ff6b6b;
}

.stock-item-count.zero {
    color: #999;
    text-decoration: line-through;
}

.stock-loading {
    color: #999;
    font-size: 0.9em;
    text-align: center;
}

/* 結果表示エリア */
.result-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.result-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-header h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.result-content {
    margin: 30px 0;
}

.result-image-container {
    margin-bottom: 20px;
}

.result-image-container img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.result-text {
    margin-top: 20px;
}

.prize-rank {
    font-size: 1.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.prize-name {
    font-size: 1.2em;
    color: #333;
}

.close-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
}

.close-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* ローディング表示 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 1.2em;
    margin-top: 20px;
}

/* フッター */
footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.footer-text {
    color: #999;
    font-size: 0.9em;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    header h1 {
        font-size: 2em;
    }
    
    .machine-window {
        width: 150px;
        height: 150px;
    }
    
    .question-mark {
        font-size: 60px;
    }
    
    .lottery-button {
        padding: 15px 40px;
        font-size: 1.2em;
    }
}
