@font-face {
    font-family: 'ITC Avant Garde Gothic';
    src: url('ITC Avant Garde Gothic Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
:root {
    --bg-primary: #0c0d10;
    --bg-secondary: #0c0d10;
    --bg-tertiary: #0c0d10;
    --bg-hover: #35363c;
    --bg-input: #1a1d1f;
    --bg-input-focus: #2a2b30;
    --bg-progress: #1a1b1f;
    --bg-overlay: rgba(12, 13, 16, 0.98);
    --bg-tutorial-overlay: rgba(12, 13, 16, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #8b9099;
    --text-tertiary: #a5aab3;
    --text-success: #4CAF50;
    --text-error: #e5494d;
    --text-warning: #ff2d3d;
    --border-primary: #2a2b30;
    --border-secondary: #35363c;
    --border-hover: #8d9099;
    --border-focus: #e5484d;
    --highlight-color: #e5484d;
    --highlight-gradient: linear-gradient(135deg, #e5484d, #ff2d3d);
    --highlight-success: #4CAF50;
    --highlight-error: #ff2d3d;
    --btn-primary: #1a1b1f;
    --btn-hover: #2a2b30;
    --btn-disabled: #0c0d10;
    --btn-recording: #e5484d;
    --btn-recording-border: #ff2d3d;
    --gradient-upload: linear-gradient(135deg, #1a1b1f 0%, #2a2b30 100%);
    --gradient-upload-hover: linear-gradient(135deg, #2a2b30 0%, #35363c 100%);
    --gradient-progress: linear-gradient(90deg, #e5484d, #ff2d3d);
    --piano-bg: #000000;
    --piano-white-key: #ffffff;
    --piano-black-key: #333333;
    --piano-black-base: #000000;
    --piano-border: #333333;
    --piano-black-border: #000000;
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 10px 30px rgba(0, 0, 0, 0.6);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'ITC Avant Garde Gothic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}
.tutorial-btn.floating {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    opacity: 1;
    visibility: visible;
}
.tutorial-btn.floating:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
    border-color: var(--border-hover);
}
.tutorial-btn.floating.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}
.language-selector.floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}
.language-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 30px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    min-width: 80px;
}
.language-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}
.language-btn .flag {
    font-size: 1.2rem;
}
.language-btn .lang-code {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}
.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    overflow: hidden;
    display: none;
    flex-direction: column;
    min-width: 150px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}
.language-dropdown.show {
    display: flex;
}
.language-option {
    padding: 12px 15px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}
.language-option:last-child {
    border-bottom: none;
}
.language-option:hover {
    background: var(--bg-tertiary);
}
.language-option .flag {
    font-size: 1.2rem;
}
.language-option .lang-name {
    flex: 1;
}
.language-selector.floating.hidden {
    display: none;
}
.instagram-btn.floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
}
.instagram-btn.floating:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.3);
}
.instagram-btn.floating:active {
    transform: scale(0.95);
}
.instagram-icon {
    width: 35px;
    height: 35px;
    object-fit: contain;
}
.instagram-btn.floating.hidden {
    display: none;
}
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}
.logo-main {
    margin-bottom: 60px;
    text-align: center;
}
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.logo-main .logo-container {
    margin-bottom: 10px;
}
.logo-image {
    display: block;
    object-fit: contain;
    object-position: center;
    width: 100%;
    height: auto;
}
.logo-main-image {
    max-width: 500px;
    width: 100%;
    max-height: 106px;
}
.header-logo-image {
    max-width: 150px;
    width: 100%;
    max-height: 32px;
}
.tutorial-logo-image {
    max-width: 220px;
    width: 100%;
    max-height: 47px;
}
.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.5px;
}
.workspace-title .logo-container {
    font-size: 1.5rem;
}
.tutorial-header .logo-container {
    margin: 0;
}
.upload-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px 20px;
    background: var(--bg-overlay);
    text-align: center;
    z-index: 900;
}
.upload-section.hidden {
    display: none;
}
.upload-text {
    max-width: 500px;
    margin-bottom: 40px;
}
.upload-text p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.1rem;
}
.file-upload-btn {
    background: var(--gradient-upload);
    border: 1px solid var(--border-secondary);
    padding: 15px 30px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}
.file-upload-btn:hover {
    background: var(--gradient-upload-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
#midiFile {
    display: none;
}
.copyright {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    z-index: 901;
}
.copyright:hover {
    opacity: 1;
}
.workspace-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    z-index: 800;
}
.workspace-title {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.file-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    margin-top: 60px;
}
.piano-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    height: calc(100vh - 60px);
    overflow: auto;
}
.piano-container {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: fixed;
    top: calc(50% + 30px);
    left: 0;
    transform: translateY(-50%);
    height: calc(100vh - 60px);
    pointer-events: none;
    z-index: 100;
    width: calc(100% - 350px);
    padding: 0 20px;
}
#pianoCanvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    width: 100%;
    height: auto;
    pointer-events: auto;
}
.piano-info {
    position: absolute;
    bottom: 15px;
    left: 15px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-primary);
    z-index: 110;
}
.toolbar {
    width: 350px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
    z-index: 200;
    position: relative;
    height: calc(100vh - 60px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.toolbar:hover {
    overflow-y: auto;
}
.file-loaded-btn {
    background: var(--bg-tertiary);
    padding: 12px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
}
.file-loaded-btn span {
    font-size: 0.95rem;
    font-weight: 500;
}
.file-loaded-btn button {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.file-loaded-btn button:hover {
    background: var(--bg-tertiary);
}
.toolbar-group {
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--border-primary);
}
.toolbar-group h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toolbar-group h3::before {
    content: '';
    display: block;
    width: 4px;
    height: 20px;
    background: var(--border-secondary);
    border-radius: 2px;
}
.control-group {
    margin-bottom: 15px;
}
.control-group:last-child {
    margin-bottom: 0;
}
.control-group label {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: 500;
}
.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.number-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.number-input {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-secondary);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    width: 100px;
    text-align: center;
    transition: border-color 0.3s;
}
.number-input:focus {
    outline: none;
    border-color: var(--border-hover);
}
.number-input.editing {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
}
.unit {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    min-width: 60px;
}
select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-secondary);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
}
select:focus {
    outline: none;
    border-color: var(--border-hover);
}
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 15px;
}
.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border-secondary);
    background: var(--highlight-color);
}
.toolbar-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
button {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-secondary);
    background: var(--btn-primary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
button:hover:not(:disabled) {
    background: var(--btn-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}
button:disabled {
    background: var(--btn-disabled);
    border-color: var(--border-primary);
    cursor: not-allowed;
    opacity: 0.5;
}
button.recording {
    background: var(--btn-recording);
    border-color: var(--btn-recording-border);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.status {
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-primary);
}
.status.info {
    color: var(--text-secondary);
    background: var(--bg-secondary);
}
.status.success {
    color: var(--text-success);
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
}
.status.error {
    color: var(--text-error);
    background: rgba(244, 67, 54, 0.1);
    border-color: rgba(244, 67, 54, 0.3);
}
.status.processing {
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-color: var(--border-secondary);
}
.progress-container {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid var(--border-primary);
}
.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-progress);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: var(--gradient-progress);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}
.midi-info {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}
.midi-info div {
    margin: 5px 0;
}
.tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-tutorial-overlay);
    backdrop-filter: blur(8px);
    z-index: 1;
}
.tutorial-popup {
    position: relative;
    z-index: 2;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    padding: 20px;
    box-shadow: var(--shadow-xl);
    animation: popupFadeIn 0.3s ease;
}
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.close-tutorial {
    background: none;
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}
.close-tutorial:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.tutorial-content {
    position: relative;
    min-height: 200px;
}
.tutorial-step {
    display: none;
    background: var(--bg-primary);
    border-radius: 10px;
    padding: 20px;
    animation: stepFadeIn 0.3s ease;
    border: 1px solid var(--border-primary);
}
@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}
.tutorial-step.active {
    display: block;
}
.step-number {
    display: inline-block;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    margin-bottom: 10px;
    font-weight: bold;
    border: 1px solid var(--border-secondary);
}
.tutorial-step h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}
.tutorial-step p {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 1rem;
}
.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-primary);
}
.nav-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-secondary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}
.nav-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}
.nav-btn:disabled {
    background: var(--bg-primary);
    border-color: var(--border-primary);
    cursor: not-allowed;
    opacity: 0.5;
}
.step-indicators {
    display: flex;
    gap: 10px;
}
.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-primary);
    border: 1px solid var(--border-secondary);
    transition: all 0.3s;
}
.indicator.active {
    background: var(--border-hover);
    transform: scale(1.2);
}
.highlight-area {
    filter: blur(0) !important;
    position: relative;
    z-index: 9998;
    border: 2px solid var(--border-hover) !important;
}
.tutorial-popup {
    filter: blur(0) !important;
    z-index: 9999;
}
.tutorial-active .app-container > *:not(.highlight-area):not(.tutorial-modal) {
    filter: blur(5px);
    transition: filter 0.3s ease;
}
.hidden {
    display: none !important;
}
#startOctaveGroup.hidden {
    display: none;
}
#ads {
    width: 100%;
    padding: 20px 0 20px 0;
    display: none;
}
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        min-height: auto;
        margin-top: 0;
        overflow-y: auto;
    }
    .toolbar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-primary);
        max-height: none;
        overflow-y: visible;
        min-height: auto;
        z-index: auto;
        position: static;
        height: auto;
        overscroll-behavior: auto;
        -webkit-overflow-scrolling: auto;
    }
    .piano-area {
        min-height: 40vh;
        position: static;
        height: auto;
        overflow: visible;
    }
    .piano-container {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        height: auto;
        padding: 10px;
        pointer-events: auto;
        z-index: auto;
        width: 100%;
    }
    .workspace-header {
        position: static;
        height: 50px;
        padding: 10px 15px;
        margin-top: 0;
    }
    .main-layout {
        margin-top: 0;
    }
    .control-row {
        flex-wrap: wrap;
    }
    .number-input {
        width: 80px;
    }
    .tutorial-btn.floating {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        top: 10px;
        left: 10px;
    }
    .language-selector.floating {
        top: 10px;
        right: 10px;
    }
    .language-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
        min-width: 70px;
    }
    .language-btn .flag {
        font-size: 1rem;
    }
    .language-dropdown {
        min-width: 130px;
    }
    .language-option {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    .instagram-btn.floating {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    .instagram-icon {
        width: 28px;
        height: 28px;
    }
    .copyright {
        bottom: 15px;
        left: 15px;
        font-size: 0.75rem;
    }
    .logo-main-image {
        max-width: 350px;
        max-height: 74px;
    }
    .header-logo-image {
        max-width: 120px;
        max-height: 26px;
    }
    .tutorial-logo-image {
        max-width: 180px;
        max-height: 38px;
    }
    .workspace-title .logo-container {
        font-size: 1.2rem;
    }
    .tutorial-popup {
        padding: 15px;
    }
    .logo-main .logo-container {
        margin-bottom: 8px;
    }
    .logo-main {
        margin-bottom: 50px;
    }
    .subtitle {
        font-size: 1rem;
    }
    .tutorial-header .logo-container {
        font-size: 1.5rem;
    }
    .upload-text {
        max-width: 90%;
        margin-bottom: 35px;
    }
    .upload-text p {
        font-size: 1rem;
    }
    #ads {
        padding: 7%;
        display: none;
    }
}
@media (min-width: 769px) and (max-width: 1100px) {
    .toolbar {
        width: 300px;
    }
    .piano-container {
        width: calc(100% - 300px);
    }
    .logo-main-image {
        max-width: 400px;
        max-height: 85px;
    }
    .logo-main {
        margin-bottom: 55px;
    }
}