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

body {
    font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0a0a0a;
    color: #e8e8e8;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.phase {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.8s ease;
}

.phase.active {
    display: flex;
}

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

/* Title phase */
#title {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 30px;
}

#mic-prompt {
    font-size: 16px;
    opacity: 0.7;
}

/* Opening phase with scroll */
.scroll-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.opening-text {
    font-size: 18px;
    line-height: 1.8;
    white-space: pre-line;
    margin-bottom: 40px;
    max-width: 800px;
}

/* Test phase */
.feedback-text {
    font-size: 18px;
    margin-bottom: 30px;
    min-height: 60px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feedback-text.visible {
    opacity: 1;
}

.action-button {
    padding: 20px 50px;
    font-size: 20px;
    font-weight: 600;
    background: #e8e8e8;
    color: #0a0a0a;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    touch-action: manipulation;
    margin-bottom: 40px;
}

.action-button:active {
    transform: scale(0.95);
    background: #d0d0d0;
}

.hidden {
    display: none !important;
}

/* Microphone gain meter */
.gain-meter-container {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 400px;
}

.gain-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.gain-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a9eff 0%, #00ff88 50%, #ffaa00 80%, #ff4444 100%);
    transition: width 0.05s ease-out;
    border-radius: 4px;
}

/* Performance phase */
.section-text {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 40px;
    white-space: pre-line;
    padding: 0 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.section-text.visible {
    opacity: 1;
}

.guiding-text {
    font-size: 18px;
    line-height: 1.7;
    white-space: pre-line;
    min-height: 80px;
    opacity: 0;
    transition: opacity 0.6s ease;
    padding: 0 20px;
}

.guiding-text.visible {
    opacity: 1;
}

.end-text {
    font-size: 22px;
    opacity: 0;
    animation: fadeInSlow 3s ease forwards;
}

@keyframes fadeInSlow {
    to { opacity: 1; }
}

/* Composer Tools */
.composer-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    z-index: 1000;
    transition: all 0.2s ease;
}

.composer-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.composer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.composer-modal.active {
    display: flex;
}

.composer-content {
    background: #1a1a1a;
    width: 90%;
    height: 90%;
    max-width: 1000px;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border: 1px solid #333;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.composer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.composer-header h2 {
    font-size: 20px;
    color: #fff;
}

.composer-help {
    font-size: 14px;
    color: #888;
    margin-bottom: 15px;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 10px;
}

.close-btn:hover {
    color: #fff;
}

#score-editor {
    flex: 1;
    background: #0f0f0f;
    color: #00ff88;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    padding: 15px;
    border: 1px solid #333;
    border-radius: 4px;
    resize: none;
    margin-bottom: 20px;
    line-height: 1.4;
}

#score-editor:focus {
    outline: none;
    border-color: #555;
}

.composer-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.primary-btn {
    background: #e8e8e8;
    color: #0a0a0a;
}

.primary-btn:hover {
    background: #fff;
}

.secondary-btn {
    background: #333;
    color: #fff;
}

.secondary-btn:hover {
    background: #444;
}

@media (max-width: 600px) {
    #title {
        font-size: 36px;
    }
    
    .opening-text {
        font-size: 16px;
    }
    
    .section-text {
        font-size: 20px;
        margin-bottom: 30px;
    }
    
    .guiding-text {
        font-size: 16px;
    }
    
    .action-button {
        padding: 18px 40px;
        font-size: 18px;
    }
}

