/* 基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
}

.header h1 {
    font-size: 2.5em;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    color: #718096;
    font-style: italic;
}

/* 設定パネル */
.settings-panel {
    margin-bottom: 30px;
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-toggle button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
}

.settings-toggle button:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

.recording-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

.recording-indicator.active {
    background: #e53e3e;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.settings-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    transition: all 0.3s ease;
}

.settings-content.collapsed {
    display: none;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9em;
}

.setting-group input,
.setting-group select {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.setting-group input:focus,
.setting-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* ビジュアライザー領域 */
.visualizer-area {
    margin-bottom: 30px;
    text-align: center;
}

#visualizer {
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    background: #ffffff;
    cursor: crosshair;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

#visualizer:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.instructions {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 10px;
    border-left: 4px solid #48bb78;
}

.instructions p {
    margin: 0;
    color: #2d3748;
    font-size: 0.95em;
    font-weight: 500;
}

.control-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

.control-btn.active {
    background: linear-gradient(45deg, #48bb78, #38a169);
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #4a5568;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-color.short-press {
    background: #e53e3e;
}

.legend-color.long-press {
    background: #3182ce;
}

.legend-color.cursor {
    background: #38a169;
}

/* 出力パネル */
.output-panel {
    background: #f8fafc;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e2e8f0;
}

.output-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 1em;
    color: #718096;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.output-format h3,
.events-list h3 {
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 1.2em;
}

#outputText {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    resize: vertical;
    background: #ffffff;
}

.copy-btn,
.delete-btn {
    margin-top: 10px;
    background: #48bb78;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.delete-btn {
    background: #e53e3e;
}

.copy-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.delete-btn:hover {
    background: #c53030;
    transform: translateY(-1px);
}

#eventsList {
    min-height: 100px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    background: #ffffff;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f7fafc;
}

.event-item:last-child {
    border-bottom: none;
}

.event-delete {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

/* 状態表示 */
.status-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 15px;
    background: #edf2f7;
    border-radius: 10px;
    font-size: 0.9em;
    color: #4a5568;
    flex-wrap: wrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    #visualizer {
        width: 100%;
        height: 150px;
    }
    
    .controls {
        gap: 10px;
    }
    
    .control-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .legend {
        gap: 15px;
    }
    
    .legend-item {
        font-size: 0.8em;
    }
    
    .status-bar {
        gap: 15px;
        font-size: 0.8em;
    }
    
    .settings-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .controls {
        justify-content: stretch;
    }
    
    .control-btn {
        flex: 1;
        min-width: 0;
    }
    
    .legend {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}