/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 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;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.icon {
    display: inline-block;
    animation: rotate 3s linear infinite;
}

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

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 言語切り替え */
.language-selector {
    text-align: center;
    margin-bottom: 20px;
}

.lang-btn {
    background: white;
    border: none;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lang-btn.active {
    background: #4CAF50;
    color: white;
}

/* スコアボード */
.score-board {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.score-item {
    background: white;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    font-size: 1.1rem;
    font-weight: bold;
}

.score-item span:last-child {
    color: #4CAF50;
    font-size: 1.3rem;
}

/* ゲームエリア */
.game-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 500px;
    position: relative;
}

/* スクリーン */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.5s;
}

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

/* スタート画面 */
#start-screen {
    text-align: center;
}

#start-screen h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
}

.btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 20px 0;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(76,175,80,0.4);
}

.btn:active {
    transform: translateY(0);
}

.tutorial {
    margin-top: 40px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.tutorial h3 {
    color: #4CAF50;
    margin-bottom: 15px;
}

.tutorial ol {
    list-style-position: inside;
    line-height: 1.8;
}

/* ゲームキャンバス */
#game-canvas {
    position: relative;
    height: 400px;
}

/* ゴミエリア */
.trash-area {
    height: 250px;
    position: relative;
    border-bottom: 3px dashed #ddd;
    margin-bottom: 20px;
    overflow: hidden;
}

/* ゴミアイテム */
.trash-item {
    position: absolute;
    font-size: 3rem;
    cursor: grab;
    transition: transform 0.1s;
    user-select: none;
}

.trash-item:active {
    cursor: grabbing;
    transform: scale(1.2);
}

.trash-item.dragging {
    opacity: 0.8;
    z-index: 1000;
}

/* ゴミ箱エリア */
.bins-area {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.bin {
    flex: 1;
    background: #f5f5f5;
    border: 3px solid #ddd;
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.bin:hover {
    transform: translateY(-5px);
    border-color: #4CAF50;
}

.bin.drop-hover {
    background: #e8f5e9;
    border-color: #4CAF50;
    transform: scale(1.05);
}

.bin.correct {
    animation: correctAnimation 0.5s;
}

.bin.wrong {
    animation: wrongAnimation 0.5s;
}

@keyframes correctAnimation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); background: #c8e6c9; }
}

@keyframes wrongAnimation {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.bin-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.bin-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #666;
}

/* タイマー */
.timer-bar {
    margin-top: 20px;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.1s linear;
    width: 100%;
}

/* 結果画面 */
#result-screen {
    text-align: center;
}

#result-screen h2 {
    font-size: 2.5rem;
    color: #4CAF50;
    margin-bottom: 30px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stat-item {
    background: #f5f5f5;
    padding: 20px 30px;
    border-radius: 15px;
    font-size: 1.1rem;
}

.stat-item span:last-child {
    font-weight: bold;
    color: #4CAF50;
    font-size: 1.3rem;
}

.high-score {
    font-size: 1.5rem;
    margin: 20px 0;
    color: #ff9800;
}

/* ランキング */
.ranking {
    margin-top: 40px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.ranking h3 {
    color: #4CAF50;
    margin-bottom: 15px;
}

.ranking ol {
    text-align: left;
    list-style-position: inside;
}

.ranking li {
    padding: 10px;
    background: #f5f5f5;
    margin-bottom: 5px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
}

/* フィードバック */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
}

.feedback.show {
    animation: feedbackPop 1s;
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.feedback.correct {
    color: #4CAF50;
}

.feedback.wrong {
    color: #f44336;
}

/* レスポンシブ */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .game-area {
        padding: 20px;
    }
    
    .bins-area {
        flex-wrap: wrap;
    }
    
    .bin {
        min-width: 30%;
    }
    
    .trash-item {
        font-size: 2.5rem;
    }
    
    .bin-icon {
        font-size: 2rem;
    }
    
    .score-board {
        gap: 15px;
    }
    
    .score-item {
        padding: 10px 15px;
        font-size: 1rem;
    }
}