body {
    font-family: sans-serif;
    margin: 40px;
    background-color: transparent !important;
    color: #e5e7eb !important;
}

#vanta-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
}

h2, h3 {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

h2 {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
    font-size: 32px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 4px;
}

form {
    max-width: 600px;
    margin: 0 auto 30px auto;
}

#uploadForm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease-in-out;
}

#uploadForm.minimized {
    flex-direction: row;
    justify-content: center;
    gap: 15px;
    max-width: 800px;
    margin-bottom: 20px;
}

.hidden-file-input {
    display: none;
}

.custom-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed #444444;
    border-radius: 8px;
    padding: 20px 40px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
}

.custom-file-label:hover {
    border-color: #9b59b6;
    background: rgba(155, 89, 182, 0.05);
}

.custom-file-label svg {
    width: 24px;
    height: 24px;
    stroke: #888888;
    fill: none;
    stroke-width: 2;
}

.custom-file-label:hover svg {
    stroke: #9b59b6;
}

.file-name-display {
    font-size: 14px;
    color: #aaaaaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section {
    background: rgba(20, 20, 22, 0.85);
    border: 1px solid #2d2d30;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
}

#uploadForm.minimized .custom-file-label {
    padding: 10px 20px;
    max-width: 300px;
    border-width: 1px;
}

#uploadForm.minimized button {
    margin-top: 0;
    padding: 12px 24px;
}

.ch-row {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 12px;
}

.ch-label {
    width: 160px;
    font-size: 14px;
    color: #d1d5db;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-btn {
    background: rgba(155, 89, 182, 0.15) !important;
    border: 1px solid rgba(155, 89, 182, 0.3) !important;
    color: #9b59b6 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.preview-btn:hover {
    background: rgba(155, 89, 182, 0.3) !important;
    transform: scale(1.05);
}

.preview-btn svg {
    width: 16px;
    height: 16px;
}

.preview-btn .icon-play {
    fill: #9b59b6;
    stroke: none;
    margin-left: 2px;
}

.preview-btn.playing {
    background: rgba(231, 76, 60, 0.15) !important;
    border-color: rgba(231, 76, 60, 0.3) !important;
    color: #e74c3c !important;
}

.preview-btn.playing svg.icon-stop {
    width: 14px;
    height: 14px;
    stroke: #e74c3c;
    stroke-width: 3;
}

/* タイムライン全体の枠 */
.track-timeline {
    flex: 1;
    height: 18px; /* iPadでも見やすく、ノーツを包み込みやすい絶妙な高さに調整 */
    background: #111112 !important;
    border: 1px solid #28282a !important;
    border-radius: 9px !important; /* 角丸を高さの半分にして綺麗なカプセル型に */
    position: relative;
    cursor: pointer;
    overflow: hidden; /* 🌟 枠からはみ出るノーツを絶対に外に出さない */
    box-sizing: border-box;
}

/* 🌟 再生進捗バー（光るラインを一番手前に持ってくる） */
.playback-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(155, 89, 182, 0.15), rgba(155, 89, 182, 0.5)) !important;
    border-right: 2px solid #9b59b6 !important;
    box-shadow: 0 0 10px #9b59b6; /* サイバー風の発光を少し強化 */
    box-sizing: border-box;
    pointer-events: none;
    z-index: 5; /* 🌟 ノーツよりも数字を大きくして、一番手前に重ねる */
}

/* プレビュー再生中の進捗バー（赤） */
.playback-bar.active {
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.15), rgba(231, 76, 60, 0.5)) !important;
    border-right-color: #e74c3c !important;
    box-shadow: 0 0 10px #e74c3c;
}

/* 🌟 音符のマーカー（枠内にすっぽり収まる上品なカプセルピン） */
.note-marker {
    position: absolute;
    top: 3px !important;       /* 上下に3pxずつの余白を作る */
    bottom: 3px !important;    /* これで枠線の内側に確実に収まる */
    width: 4px !important;     /* スプレッドしすぎないよう少しシャープに */
    background: #9b59b6 !important;
    box-shadow: 0 0 4px #9b59b6;
    border-radius: 2px !important; /* ノーツ自体も角丸にしてキモさを排除 */
    opacity: 0.6;
    pointer-events: none;
    box-sizing: border-box;
    z-index: 2; /* 🌟 再生バー（z-index: 5）の裏側に配置 */
}

.inst-select {
    background-color: #1a1a1c;
    color: #e5e7eb;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    width: 160px;
}

.inst-select:focus {
    border-color: #9b59b6;
}

.custom-input {
    background-color: #1a1a1c;
    color: #e5e7eb;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    width: 180px;
    display: none;
}

.custom-input:focus {
    border-color: #9b59b6;
}

input[type="number"] {
    background-color: #1a1a1c;
    color: #e5e7eb;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    width: 80px;
}

input[type="number"]:focus {
    border-color: #9b59b6;
}

button {
    background-color: #0f0f11;
    color: #ffffff;
    border: 1px solid #2d2d30;
    border-radius: 6px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: #1a1a1a;
    border-color: #444444;
}

button:active {
    transform: scale(0.98);
}

button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

#submitBtn:hover svg {
    animation: savePulse 0.4s ease-in-out forwards;
}

#submitBtn:hover svg .save-label {
    animation: labelFlash 0.4s ease-in-out forwards;
}

.alert-icon {
    vertical-align: middle;
    margin-left: 5px;
    cursor: pointer;
}

.alert-icon:hover {
    animation: shake 0.4s ease-in-out;
}

.playing svg.icon-stop .bar {
    stroke: #9b59b6 !important;
    animation: bounceBar 0.6s infinite ease-in-out alternate;
}
.playing svg.icon-stop .bar-1 { animation-delay: 0.1s; }
.playing svg.icon-stop .bar-2 { animation-delay: 0.3s; }
.playing svg.icon-stop .bar-3 { animation-delay: 0.0s; }

/* 🌟 ここから下が今回の「初期非表示・右側開閉スライド」対応の履歴エリアスタイル */

.history-section {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background-color: rgba(20, 20, 22, 0.95);
    border-left: 1px solid #333;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    z-index: 999;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    
    /* 初期状態：画面右側の外に完全に隠す */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

/* openクラスがついた時だけ画面内に入り込む */
.history-section.open {
    transform: translateX(0);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}

.history-header h3 {
    margin: 0;
    font-size: 16px;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
}

.history-close-btn {
    background: none !important;
    border: none !important;
    color: #888 !important;
    font-size: 24px !important;
    cursor: pointer;
    padding: 0 5px !important;
    line-height: 1;
}

.history-close-btn:hover {
    color: #e74c3c !important;
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 13px;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.history-btn {
    background: #9b59b6 !important;
    border: none !important;
    color: #fff !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 4px !important;
    cursor: pointer;
    flex-shrink: 0;
}

.history-btn:hover {
    background: #8e44ad !important;
}

.history-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 990;
    background: rgba(20, 20, 22, 0.8) !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    padding: 8px 15px !important;
    font-size: 12px !important;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-toggle-btn:hover {
    border-color: #9b59b6 !important;
}

/* アニメーション用キーフレーム定義 */
@keyframes savePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); color: #9b59b6; }
    100% { transform: scale(1); }
}

@keyframes labelFlash {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

@keyframes bounceBar {
    0% { transform: scaleY(0.3); }
    100% { transform: scaleY(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-2px); }
    40%, 80% { transform: translateX(2px); }
}
