<!-- M4+M2+M5: FluentWindow (Mica), dynamic sidebar, named elements for AI/DB wiring. -->
<ui:FluentWindow x:Class="DansoriEQ.App.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
        xmlns:ctrl="clr-namespace:DansoriEQ.App.Controls"
        Title="Dansori EQ"
        Height="1020" Width="1700"
        MinHeight="900" MinWidth="1460"
        WindowStartupLocation="CenterScreen"
        Background="Transparent"
        Foreground="#F2F3F5"
        FontFamily="Segoe UI Variable, Segoe UI">

    <ui:FluentWindow.Resources>
        <SolidColorBrush x:Key="Card"    Color="#26262B"/>
        <SolidColorBrush x:Key="Card2"   Color="#2D2D33"/>
        <SolidColorBrush x:Key="Stroke"  Color="#3A3A42"/>
        <SolidColorBrush x:Key="Accent"  Color="#4CC2FF"/>
        <SolidColorBrush x:Key="TextDim" Color="#A8ABB4"/>
        <SolidColorBrush x:Key="TextMute" Color="#767A83"/>
        <SolidColorBrush x:Key="WinBg"   Color="#1B1B1F"/>

        <Style x:Key="GroupHeader" TargetType="TextBlock">
            <Setter Property="Foreground" Value="{StaticResource TextDim}"/>
            <Setter Property="FontSize" Value="13"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Margin" Value="10,16,10,6"/>
        </Style>
        <Style x:Key="Chip" TargetType="Border">
            <Setter Property="Background" Value="{StaticResource Card2}"/>
            <Setter Property="BorderBrush" Value="{StaticResource Stroke}"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="CornerRadius" Value="9"/>
            <Setter Property="Padding" Value="11,7"/>
            <Setter Property="Margin" Value="0,0,8,8"/>
        </Style>
        <Style TargetType="ListBoxItem">
            <Setter Property="Foreground" Value="{StaticResource TextDim}"/>
            <Setter Property="Padding" Value="8,5"/>
            <Setter Property="Background" Value="Transparent"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#283B4A"/>
                    <Setter Property="Foreground" Value="{StaticResource Accent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </ui:FluentWindow.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>  <!-- WPF-UI title bar -->
            <RowDefinition Height="*"/>     <!-- content -->
        </Grid.RowDefinitions>

        <!-- WPF-UI title bar (draggable, min/max/close) -->
        <ui:TitleBar Grid.Row="0" Title="Dansori EQ"
                     Background="#1B1B1F" Foreground="#F2F3F5"/>

        <Border Grid.Row="1" Background="{StaticResource WinBg}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="288"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- ============ SIDEBAR ============ -->
            <Border Grid.Column="0" Background="#15000000" BorderBrush="{StaticResource Stroke}" BorderThickness="0,0,1,0">
                <DockPanel>

                    <!-- search with placeholder overlay -->
                    <Grid DockPanel.Dock="Top" Margin="14,14,14,8">
                        <TextBox x:Name="SidebarSearch" Height="38"
                                 VerticalContentAlignment="Center" Padding="10,0"
                                 Background="{StaticResource Card}" Foreground="{StaticResource TextDim}"
                                 BorderBrush="{StaticResource Stroke}"
                                 TextChanged="SidebarSearch_TextChanged"/>
                        <TextBlock Text="이어폰 · 헤드폰 검색…" IsHitTestVisible="False"
                                   VerticalAlignment="Center" Margin="12,0,0,0"
                                   Foreground="{StaticResource TextMute}">
                            <TextBlock.Style>
                                <Style TargetType="TextBlock">
                                    <Setter Property="Visibility" Value="Collapsed"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Text, ElementName=SidebarSearch}" Value="">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </Grid>

                    <!-- footer: DB stats + update button -->
                    <StackPanel DockPanel.Dock="Bottom" Margin="12">
                        <Button x:Name="BtnDbUpdate" Height="38" Content="⟳  프로파일 DB 업데이트"
                                Click="BtnDbUpdate_Click"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}"
                                BorderBrush="{StaticResource Stroke}"/>
                        <TextBlock x:Name="DbStatsText"
                                   Text="DB 로딩 중…"
                                   Foreground="{StaticResource TextMute}" FontSize="11"
                                   HorizontalAlignment="Center" Margin="0,8,0,0"/>
                    </StackPanel>

                    <!-- profile lists: IEM (top half) + Headphone (bottom half) -->
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>

                        <!-- IEM section -->
                        <DockPanel Grid.Row="0">
                            <TextBlock DockPanel.Dock="Top"
                                       Style="{StaticResource GroupHeader}" Text="🎧  IN-EAR MONITORS"/>
                            <ListBox x:Name="IemList"
                                     BorderThickness="0" Background="Transparent"
                                     DisplayMemberPath="Name"
                                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                                     SelectionChanged="IemList_SelectionChanged"/>
                        </DockPanel>

                        <!-- Separator -->
                        <Border Grid.Row="1" BorderBrush="{StaticResource Stroke}" BorderThickness="0,1,0,0">
                            <DockPanel>
                                <TextBlock DockPanel.Dock="Top"
                                           Style="{StaticResource GroupHeader}" Text="🎧  HEADPHONES"/>
                                <ListBox x:Name="HeadphoneList"
                                         BorderThickness="0" Background="Transparent"
                                         DisplayMemberPath="Name"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         SelectionChanged="HeadphoneList_SelectionChanged"/>
                            </DockPanel>
                        </Border>
                    </Grid>
                </DockPanel>
            </Border>

            <!-- ============ MAIN ============ -->
            <DockPanel Grid.Column="1">

                <!-- header -->
                <Grid DockPanel.Dock="Top" Margin="22,18,22,6">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock x:Name="HeadphoneLabel"
                                   Text="기기를 선택하세요" FontSize="20" FontWeight="Bold"/>
                        <Border x:Name="HeadphoneTypeBorder"
                                Background="#2438E0C4" CornerRadius="20" Padding="9,3"
                                Margin="12,0,0,0" VerticalAlignment="Center">
                            <TextBlock x:Name="HeadphoneTypeBadge"
                                       Text="IEM" Foreground="#38E0C4" FontSize="11" FontWeight="Bold"/>
                        </Border>
                        <Border x:Name="HeadphoneSourceBadge"
                                Background="{StaticResource Card}" CornerRadius="20" Padding="9,3"
                                Margin="8,0,0,0" VerticalAlignment="Center" Visibility="Collapsed">
                            <TextBlock x:Name="HeadphoneSourceText"
                                       Foreground="{StaticResource TextMute}" FontSize="11"/>
                        </Border>
                    </StackPanel>
                    <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                        <!-- primary buttons always visible -->
                        <Button Content="⚙ 설정"    Click="BtnSettings_Click" Height="32" Padding="12,0" Margin="0,0,8,0"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}"/>
                        <Button Content="🎚 이펙트"  Click="BtnEffects_Click"  Height="32" Padding="12,0" Margin="0,0,8,0"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}"/>
                        <Button Content="↶ 되돌리기" Click="BtnUndo_Click"     Height="32" Padding="12,0" Margin="0,0,8,0"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}"/>
                        <Button Content="⟲ 리셋"    Click="BtnReset_Click"    Height="32" Padding="12,0" Margin="0,0,8,0"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}"/>
                        <!-- secondary buttons in dropdown -->
                        <Button x:Name="BtnMore" Content="···" Click="BtnMore_Click" Height="32" Padding="12,0" Margin="0,0,12,0"
                                Background="{StaticResource Card}" Foreground="{StaticResource TextDim}" BorderBrush="{StaticResource Stroke}">
                            <Button.ContextMenu>
                                <ContextMenu Background="#26262B" BorderBrush="#3A3A42" BorderThickness="1" Foreground="#F2F3F5">
                                    <MenuItem Header="❓ 도움말"        Click="BtnHelp_Click"/>
                                    <MenuItem Header="⌨ 명령 창"       Click="BtnCommand_Click"/>
                                    <MenuItem Header="📚 프리셋 라이브러리" Click="BtnPresets_Click"/>
                                    <Separator/>
                                    <MenuItem Header="↥ 내보내기"      Click="BtnExport_Click"/>
                                    <MenuItem Header="↧ 가져오기"      Click="BtnImport_Click"/>
                                </ContextMenu>
                            </Button.ContextMenu>
                        </Button>
                        <CheckBox x:Name="ActiveToggle" Content="활성" IsChecked="False"
                                  Checked="Active_Changed" Unchecked="Active_Changed"
                                  ToolTip="EQ 켜기/끄기 (Ctrl+Alt+B)"
                                  Foreground="{StaticResource TextDim}" VerticalAlignment="Center"/>
                    </StackPanel>
                </Grid>

                <!-- AI DOCK (bottom) -->
                <Border DockPanel.Dock="Bottom" Background="#18000000"
                        BorderBrush="{StaticResource Stroke}" BorderThickness="0,1,0,0" Padding="22,14">
                    <StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,12"
                                    HorizontalAlignment="Left">
                            <!-- avatar + soundwave rings (rings behind) -->
                            <Grid Width="60" Height="60" Margin="0,0,12,0" VerticalAlignment="Top"
                                  ClipToBounds="False">
                                <ctrl:SoundwaveRings x:Name="AvatarRings"/>
                                <ctrl:MascotAvatar x:Name="Mascot"/>
                            </Grid>
                            <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                    BorderThickness="1" CornerRadius="12" Padding="14,11"
                                    VerticalAlignment="Top" MaxWidth="780">
                                <StackPanel>
                                    <ctrl:EqBarsFx x:Name="ThinkingBars" Margin="0,0,0,6"
                                                   HorizontalAlignment="Left" Visibility="Collapsed"/>
                                    <TextBlock x:Name="AiResponse" TextWrapping="Wrap"
                                               Foreground="{StaticResource TextDim}" FontSize="12.5"
                                               Text="원하는 소리를 말하듯 입력하세요. AI가 EQ를 만들어 적용하고, 무엇을 왜 바꿨는지 여기에 설명합니다."/>
                                </StackPanel>
                            </Border>
                        </StackPanel>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="PromptBox" Grid.Column="0" Height="46"
                                     VerticalContentAlignment="Center" Padding="14,0"
                                     Background="{StaticResource Card}" Foreground="#F2F3F5"
                                     BorderBrush="{StaticResource Stroke}"
                                     KeyDown="Prompt_KeyDown"/>
                            <Button Grid.Column="1" Content="➤" Width="46" Height="46" Margin="10,0,0,0"
                                    Click="BtnSend_Click"
                                    Background="{StaticResource Accent}" Foreground="#04222F"
                                    FontWeight="Bold" BorderThickness="0"/>
                        </Grid>
                        <TextBlock Text="Enter로 전송 · 변경은 Equalizer APO에 즉시 적용 · 제공자/모델은 ⚙ 설정 → 🧩 AI 관리에서"
                                   Foreground="{StaticResource TextMute}" FontSize="11" Margin="0,8,0,0"/>
                    </StackPanel>
                </Border>

                <!-- content: graph + filter chips -->
                <ScrollViewer VerticalScrollBarVisibility="Auto">
                    <StackPanel Margin="22,12,22,24">

                        <!-- empty-state hint (이소리) — hidden once a profile is picked -->
                        <Border x:Name="EmptyHint" Background="{StaticResource Card}"
                                BorderBrush="{StaticResource Accent}" BorderThickness="1"
                                CornerRadius="12" Padding="14,10" Margin="0,0,0,16">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Image Grid.Column="0" Height="76" Margin="0,-6,14,-10"
                                       VerticalAlignment="Bottom"
                                       Source="pack://application:,,,/Assets/Characters/sori_idle.png"/>
                                <StackPanel Grid.Column="1" VerticalAlignment="Center">
                                    <TextBlock Text="시작해볼까요?" FontWeight="Bold" FontSize="14"
                                               Foreground="{StaticResource Accent}"/>
                                    <TextBlock Foreground="{StaticResource TextDim}" FontSize="12.5"
                                               TextWrapping="Wrap" Margin="0,4,0,0"
                                               Text="왼쪽에서 쓰는 이어폰/헤드폰을 선택하면 그 기기에 맞춘 EQ부터 시작해요. 그다음 아래 입력창에 원하는 소리를 말하듯 적어보세요."/>
                                </StackPanel>
                                <Button Grid.Column="2" Content="✕" Click="EmptyHintClose_Click"
                                        Width="26" Height="26" VerticalAlignment="Top"
                                        Background="Transparent" Foreground="{StaticResource TextMute}"
                                        BorderThickness="0" FontSize="12"/>
                            </Grid>
                        </Border>

                        <!-- graph zone (PoC): 이소리(좌) · 이단(우)가 EQ 그래프를 둘러싸고,
                             그래프가 앞에서 두 캐릭터의 몸통·하체를 덮는다. 캐릭터는 그래프보다 크게.
                             미세한 상하 부유(호흡) 루프로 "살아있는" 느낌을 준다. 값은 시각 확인 후 조정. -->
                        <Grid MinHeight="600" Margin="0,0,0,16" ClipToBounds="False">
                            <!-- 부유(떠다님)는 코드에서 구동(MainWindow) → 아바타와 리듬·말하기 반응을 동기화 -->

                            <!-- 이소리 (좌, 그래프 뒤) — 단독 비교용으로 지금은 숨김. 듀얼로 되돌리려면 Visibility 제거 -->
                            <Image Source="pack://application:,,,/Assets/Characters/sori_idle.png"
                                   Visibility="Collapsed"
                                   HorizontalAlignment="Left" VerticalAlignment="Bottom"
                                   Height="500" Margin="-28,0,0,0" Panel.ZIndex="0"
                                   IsHitTestVisible="False" RenderTransformOrigin="0.5,1">
                                <Image.RenderTransform><TranslateTransform x:Name="SoriFloat"/></Image.RenderTransform>
                            </Image>
                            <!-- 단독 캐릭터: 이단 자리(우)에 이소리. 그래프를 왼쪽으로 밀어 거의 안 겹치게.
                                 위로 올려 하체가 조금 더 보이게(bottom margin). 부유는 코드에서 BgSoriFloat 구동. -->
                            <Image x:Name="BgSori" Source="pack://application:,,,/Assets/Characters/sori_idle.png"
                                   Visibility="Collapsed"
                                   HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                   Height="500" Margin="0,0,-28,30" Panel.ZIndex="0"
                                   IsHitTestVisible="False" RenderTransformOrigin="0.5,1">
                                <Image.RenderTransform><TranslateTransform x:Name="BgSoriFloat"/></Image.RenderTransform>
                            </Image>

                            <ctrl:Live2DCharacterView x:Name="Live2DCharacter"
                                                      HorizontalAlignment="Right" VerticalAlignment="Bottom"
                                                      Width="390" Height="600" Margin="0,0,0,0"
                                                      Panel.ZIndex="0"/>
                            <!-- graph card (앞; 캐릭터 몸통·하체를 덮음) -->
                            <Border Panel.ZIndex="1" VerticalAlignment="Bottom"
                                    Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                    BorderThickness="1" CornerRadius="12" Padding="16"
                                    Margin="8,0,410,0">
                                <StackPanel>
                                    <Grid Margin="0,0,0,10">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                            <TextBlock Text="EQUALIZATION CURVE"
                                                       Foreground="{StaticResource TextDim}" FontWeight="Bold" FontSize="13"
                                                       VerticalAlignment="Center"/>
                                            <ComboBox x:Name="CharacterSelect" Width="116" Height="28" Margin="14,0,0,0"
                                                      SelectionChanged="CharacterSelect_SelectionChanged"
                                                      Background="{StaticResource Card2}" Foreground="{StaticResource TextDim}"
                                                      BorderBrush="{StaticResource Stroke}" SelectedIndex="0">
                                                <ComboBoxItem Tag="leesori" Content="LeeSori"/>
                                                <ComboBoxItem Tag="haruka" Content="Haruka"/>
                                                <ComboBoxItem Tag="isabel" Content="Isabel"/>
                                                <ComboBoxItem Tag="noeul" Content="Noeul"/>
                                            </ComboBox>
                                        </StackPanel>
                                        <Border HorizontalAlignment="Right" Background="#20FFB454"
                                                CornerRadius="20" Padding="10,3">
                                            <TextBlock x:Name="PreampLabel"
                                                       Text="Preamp −6.0 dB"
                                                       Foreground="#FFB454" FontWeight="Bold" FontSize="12"/>
                                        </Border>
                                    </Grid>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <ctrl:EqGraphControl x:Name="Graph" Grid.Column="0" Height="520"/>
                                        <ctrl:VolumePanel x:Name="VolPanel" Grid.Column="1" Width="150" Margin="16,0,0,0"/>
                                    </Grid>
                                </StackPanel>
                            </Border>
                        </Grid>

                        <!-- filter chips -->
                        <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                BorderThickness="1" CornerRadius="12" Padding="16" Margin="0,0,0,16">
                            <StackPanel>
                                <Grid Margin="0,0,0,10">
                                    <TextBlock x:Name="FilterCountLabel"
                                               Text="ACTIVE FILTERS · 0 / 40 bands"
                                               Foreground="{StaticResource TextDim}" FontWeight="Bold" FontSize="13"
                                               VerticalAlignment="Center"/>
                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                        <Button Content="＋ 밴드 추가" Click="BtnAddBand_Click"
                                                Height="28" Padding="10,0" Margin="0,0,8,0"
                                                Background="{StaticResource Card2}" Foreground="{StaticResource TextDim}"
                                                BorderBrush="{StaticResource Stroke}"/>
                                        <Button Content="전체 지우기" Click="BtnClearBands_Click"
                                                Height="28" Padding="10,0"
                                                Background="{StaticResource Card2}" Foreground="{StaticResource TextDim}"
                                                BorderBrush="{StaticResource Stroke}"/>
                                    </StackPanel>
                                </Grid>
                                <WrapPanel x:Name="FilterChipsPanel"/>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                </ScrollViewer>
            </DockPanel>

            <!-- ============ HELP DRAWER ============ -->
            <Border x:Name="HelpPanel" Grid.Column="0" Grid.ColumnSpan="2" Panel.ZIndex="20"
                    HorizontalAlignment="Right" Width="0" ClipToBounds="True"
                    Background="#1E1E24" BorderBrush="{StaticResource Stroke}" BorderThickness="1,0,0,0">
                <ScrollViewer Width="380" HorizontalAlignment="Left" VerticalScrollBarVisibility="Auto">
                    <StackPanel Margin="22">
                        <Grid Margin="0,0,0,10">
                            <TextBlock Text="도움말" FontSize="18" FontWeight="Bold"/>
                            <Button Content="✕" Click="HelpClose_Click" HorizontalAlignment="Right"
                                    Width="30" Height="30" Background="Transparent"
                                    Foreground="{StaticResource TextDim}" BorderThickness="0" FontSize="14"/>
                        </Grid>

                        <!-- welcoming duo (이소리 · 이단) -->
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,0,0,4">
                            <Image Source="pack://application:,,,/Assets/Characters/sori_idle.png"
                                   Height="160" Margin="-6,0,-14,0"/>
                            <Image Source="pack://application:,,,/Assets/Characters/dan_idle.png"
                                   Height="160" Margin="-14,0,-6,0"/>
                        </StackPanel>
                        <TextBlock HorizontalAlignment="Center" Foreground="{StaticResource Accent}"
                                   FontWeight="Bold" FontSize="13" Margin="0,0,0,8"
                                   Text="이소리 &amp; 이단이 도와드릴게요"/>

                        <TextBlock Foreground="{StaticResource TextDim}" TextWrapping="Wrap" FontSize="12.5"
                                   Margin="0,0,0,16"
                                   Text="처음 오셨나요? 아래 3단계면 나만의 소리를 만들 수 있어요."/>

                        <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                BorderThickness="1" CornerRadius="10" Padding="14" Margin="0,0,0,10">
                            <StackPanel>
                                <TextBlock Text="① 기기 고르기" FontWeight="Bold" Foreground="#4CC2FF"/>
                                <TextBlock Foreground="{StaticResource TextDim}" FontSize="12.5"
                                           TextWrapping="Wrap" Margin="0,6,0,0"
                                           Text="왼쪽 목록에서 쓰는 이어폰/헤드폰을 검색해 선택하세요. 목록에 없으면 'DB 업데이트'로 받을 수 있어요."/>
                            </StackPanel>
                        </Border>
                        <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                BorderThickness="1" CornerRadius="10" Padding="14" Margin="0,0,0,10">
                            <StackPanel>
                                <TextBlock Text="② 말로 소리 만들기" FontWeight="Bold" Foreground="#4CC2FF"/>
                                <TextBlock Foreground="{StaticResource TextDim}" FontSize="12.5"
                                           TextWrapping="Wrap" Margin="0,6,0,0"
                                           Text="맨 아래 입력창에 원하는 느낌을 그냥 말하듯 적으세요."/>
                                <TextBlock Foreground="{StaticResource TextMute}" FontSize="11.5"
                                           TextWrapping="Wrap" Margin="0,6,0,0"
                                           Text="예) '보컬을 더 가깝게', '저음은 단단하게', '치찰음 줄여줘'"/>
                            </StackPanel>
                        </Border>
                        <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                BorderThickness="1" CornerRadius="10" Padding="14" Margin="0,0,0,10">
                            <StackPanel>
                                <TextBlock Text="③ 그래프로 다듬기 (선택)" FontWeight="Bold" Foreground="#4CC2FF"/>
                                <TextBlock Foreground="{StaticResource TextDim}" FontSize="12.5"
                                           TextWrapping="Wrap" Margin="0,6,0,0"
                                           Text="그래프의 점을 직접 조절할 수 있어요. • 드래그: 좌우=주파수, 상하=음량  • 마우스 휠: 조절 폭(Q)  • 더블클릭: 밴드 추가  • 우클릭: 삭제"/>
                            </StackPanel>
                        </Border>

                        <TextBlock Text="AI API 키 발급" FontWeight="Bold" Margin="4,4,0,6"/>
                        <TextBlock Foreground="{StaticResource TextDim}" FontSize="12" TextWrapping="Wrap"
                                   Margin="4,0,0,8"
                                   Text="AI 기능을 쓰려면 API 키가 필요합니다. ⚙ 설정에 붙여넣으세요."/>
                        <Button Content="🔗 Claude (Anthropic) 키 발급"
                                Tag="https://console.anthropic.com/settings/keys" Click="HelpUrl_Click"
                                HorizontalContentAlignment="Left" Height="34" Padding="12,0" Margin="0,0,0,6"
                                Background="{StaticResource Card}" Foreground="#4CC2FF"
                                BorderBrush="{StaticResource Stroke}"/>
                        <Button Content="🔗 ChatGPT (OpenAI) 키 발급"
                                Tag="https://platform.openai.com/api-keys" Click="HelpUrl_Click"
                                HorizontalContentAlignment="Left" Height="34" Padding="12,0" Margin="0,0,0,6"
                                Background="{StaticResource Card}" Foreground="#4CC2FF"
                                BorderBrush="{StaticResource Stroke}"/>
                        <Button Content="🔗 Gemini (Google) 키 발급"
                                Tag="https://aistudio.google.com/app/apikey" Click="HelpUrl_Click"
                                HorizontalContentAlignment="Left" Height="34" Padding="12,0" Margin="0,0,0,12"
                                Background="{StaticResource Card}" Foreground="#4CC2FF"
                                BorderBrush="{StaticResource Stroke}"/>

                        <Border Background="{StaticResource Card}" BorderBrush="{StaticResource Stroke}"
                                BorderThickness="1" CornerRadius="10" Padding="14">
                            <StackPanel>
                                <TextBlock Text="소리가 안 바뀌나요?" FontWeight="Bold"/>
                                <TextBlock Foreground="{StaticResource TextDim}" FontSize="12"
                                           TextWrapping="Wrap" Margin="0,6,0,0"
                                           Text="이 앱은 Equalizer APO로 소리를 바꿉니다. APO가 없으면 '미리보기 모드'로 동작합니다."/>
                            </StackPanel>
                        </Border>
                    </StackPanel>
                </ScrollViewer>
            </Border>
        </Grid>
        </Border>

        <!-- window neon frame (thin blue glow, non-interactive) so the app edge glows like the popups -->
        <Border Grid.Row="0" Grid.RowSpan="2" Margin="2" CornerRadius="8" IsHitTestVisible="False"
                BorderBrush="#4CC2FF" BorderThickness="1.2" Panel.ZIndex="90">
            <Border.Effect>
                <DropShadowEffect Color="#4CC2FF" BlurRadius="18" ShadowDepth="0" Opacity="0.4"/>
            </Border.Effect>
        </Border>

        <!-- Success toast (이단 thumbs-up): centered above the command prompt -->
        <ctrl:MascotToast x:Name="SuccessToast" Grid.Row="1" Panel.ZIndex="100"
                          HorizontalAlignment="Center" VerticalAlignment="Bottom"
                          Margin="0,0,0,86"/>
    </Grid>
</ui:FluentWindow>







