* {
    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;
    color: #333;
}

#game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

#story-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#story-overlay.hidden {
    display: none;
}

.story-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.story-content h2 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 28px;
}

.story-content p {
    line-height: 1.8;
    font-size: 18px;
    margin-bottom: 30px;
    color: #555;
}

#story-next-btn {
    padding: 12px 30px;
    font-size: 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s;
}

#story-next-btn:hover {
    background: #5568d3;
}

#game-ui {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

#header h1 {
    color: #667eea;
    font-size: 24px;
}

#chapter-info {
    display: flex;
    gap: 10px;
    font-weight: bold;
    color: #764ba2;
}

#score-info {
    display: flex;
    gap: 15px;
    font-size: 16px;
}

#measure-info {
    font-size: 16px;
    color: #666;
}

#game-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#staff-container {
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    min-height: 400px;
    overflow-x: auto;
}

#staff-canvas {
    display: block;
    background: white;
    border: 1px solid #ccc;
}

#cards-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.cards-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.cards-section h3 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 18px;
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.card {
    position: relative;
    cursor: grab;
    transition: all 0.3s;
    user-select: none;
    min-width: 100px;
    padding: 8px;
}

.card:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

.card:active {
    cursor: grabbing;
}

.card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.card.locked {
    opacity: 0.8;
    cursor: default;
}

.card.waiting {
    opacity: 0.7;
}

/* 贈り物パッケージのスタイル */
.gift-package {
    background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
    border: 3px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.rhythm-card.gift-package {
    background: linear-gradient(135deg, #ffe0e0 0%, #ffcccc 100%);
    border-color: #ff9999;
}

.pitch-card.gift-package {
    background: linear-gradient(135deg, #e0f5ff 0%, #cceeff 100%);
    border-color: #99ccff;
}

/* リボン（上） */
.gift-ribbon-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 8px;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff8e6b 50%, #ff6b6b 100%);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.pitch-card .gift-ribbon-top {
    background: linear-gradient(90deg, #4ecdc4 0%, #6bd4cc 50%, #4ecdc4 100%);
}

/* リボン（下） */
.gift-ribbon-bottom {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 8px;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff8e6b 50%, #ff6b6b 100%);
    border-radius: 4px 4px 0 0;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.pitch-card .gift-ribbon-bottom {
    background: linear-gradient(90deg, #4ecdc4 0%, #6bd4cc 50%, #4ecdc4 100%);
}

/* 包装紙の本体 */
.gift-wrapper {
    padding: 20px 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
}

/* ブロックコンテナ */
.gift-blocks {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* リズムブロック */
.rhythm-block {
    background: linear-gradient(135deg, #888 0%, #666 100%);
    border-radius: 4px;
    border: 1px solid #555;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 音程ブロック */
.pitch-block {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border-radius: 4px;
    border: 1px solid #2d8a7a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#status-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

#bpm-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

#bpm-control label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

#bpm-input {
    width: 60px;
    padding: 8px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

#bpm-input:focus {
    outline: none;
    border-color: #667eea;
}

#status-bar button {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#clear-btn {
    background: #ff6b6b;
    color: white;
}

#clear-btn:hover {
    background: #ee5a6f;
}

#play-btn {
    background: #4ecdc4;
    color: white;
}

#play-btn:hover {
    background: #44a08d;
}

#stop-btn {
    background: #95a5a6;
    color: white;
}

#stop-btn:hover {
    background: #7f8c8d;
}

@media (max-width: 768px) {
    #cards-area {
        grid-template-columns: 1fr;
    }
    
    #header {
        flex-direction: column;
        align-items: flex-start;
    }
}

