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

body {
    background: #0a0a0f;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    overflow: hidden;
}

/* スクリーン共通 */
.screen {
    display: none;
    width: 100vw;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* タイトル画面 */
#titleScreen {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.title-content {
    text-align: center;
}

.title-content h1 {
    font-size: 4rem;
    background: linear-gradient(90deg, #ff0080, #00d4ff, #ff0080);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 3s linear infinite;
    margin-bottom: 10px;
}

@keyframes gradientMove {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.subtitle {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.menu-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 15px;
}

.current-mode {
    font-size: 0.95rem;
    margin-bottom: 30px;
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
}

.current-mode:hover {
    transform: scale(1.05);
}

/* 難易度別カラー */
.current-mode.easy {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
}
.current-mode.easy:hover {
    background: rgba(74, 222, 128, 0.2);
    border-color: #4ade80;
}

.current-mode.normal {
    color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
}
.current-mode.normal:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
}

.current-mode.hard {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.current-mode.hard:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.current-mode.expert {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.current-mode.expert:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.menu-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
    border: 2px solid #3d3d5c;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-btn:hover:not(:disabled) {
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-3px);
}

.menu-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.menu-btn .icon {
    font-size: 1.5rem;
}

.file-section {
    margin-bottom: 40px;
}

.file-label {
    display: inline-block;
    padding: 15px 30px;
    background: linear-gradient(90deg, #ff0080, #7928ca);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-label:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 128, 0.5);
}

.file-label input {
    display: none;
}

.file-name {
    margin-top: 15px;
    color: #666;
}

.key-guide {
    margin-top: 30px;
}

.key-guide h3 {
    color: #666;
    margin-bottom: 15px;
}

.keys {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.key {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2d2d44 0%, #1a1a2e 100%);
    border: 2px solid #3d3d5c;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* ゲーム画面 */
#gameScreen {
    flex-direction: column;
    background: #0a0a0f;
}

.game-header {
    display: flex;
    justify-content: space-between;
    padding: 20px 40px;
    background: rgba(0, 0, 0, 0.5);
}

.score-display, .combo-display, .accuracy-display {
    text-align: center;
}

.score-display .label, .combo-display .label, .accuracy-display .label {
    display: block;
    font-size: 0.8rem;
    color: #666;
}

#score, #accuracy {
    font-size: 2rem;
    font-weight: bold;
}

#combo {
    font-size: 3rem;
    font-weight: bold;
    color: #ff0080;
}

.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#gameCanvas {
    background: linear-gradient(180deg, #0a0a0f 0%, #1a1a2e 100%);
    border-radius: 10px;
}

.lane-labels {
    display: flex;
    gap: 0;
    margin-top: 10px;
}

.lane-label {
    width: 80px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #666;
}

.judgement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.1s ease;
    text-shadow: 0 0 20px currentColor;
    pointer-events: none;
}

.judgement.perfect { color: #00ffff; }
.judgement.great { color: #00ff00; }
.judgement.good { color: #ffff00; }
.judgement.miss { color: #ff0000; }

.game-controls {
    padding: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
}

.control-btn {
    padding: 10px 25px;
    font-size: 1rem;
    background: #2d2d44;
    border: 1px solid #3d3d5c;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #3d3d5c;
}

.control-btn.primary {
    background: linear-gradient(90deg, #00d4ff, #0099cc);
    border: none;
}

.control-btn.danger {
    background: linear-gradient(90deg, #ff0055, #cc0044);
    border: none;
}

.control-btn.full-width {
    width: 100%;
    margin-top: 10px;
}

/* エディター画面 */
#editorScreen {
    flex-direction: column;
    background: #0d0d12;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #1a1a24;
    border-bottom: 1px solid #2d2d44;
}

.editor-info {
    display: flex;
    gap: 30px;
    font-family: monospace;
    font-size: 1.1rem;
}

.editor-controls {
    display: flex;
    gap: 10px;
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-sidebar {
    width: 250px;
    background: #14141c;
    padding: 20px;
    border-right: 1px solid #2d2d44;
    overflow-y: auto;
}

.editor-sidebar h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    margin-top: 20px;
}

.editor-sidebar h3:first-child {
    margin-top: 0;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    color: #888;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.setting-group input[type="number"],
.setting-group select {
    width: 100%;
    padding: 8px;
    background: #1a1a24;
    border: 1px solid #2d2d44;
    border-radius: 5px;
    color: #fff;
    font-size: 1rem;
}

.setting-group input[type="range"] {
    width: calc(100% - 40px);
    vertical-align: middle;
}

.setting-group input[type="range"] + span {
    display: inline-block;
    width: 30px;
    text-align: right;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
}

/* オプショングループ */
.options-group {
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-top: 5px;
}

.options-group > label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.options-group > label:hover {
    color: #00d4ff;
}

.sub-option {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-left: 20px;
}

.sub-option label {
    font-size: 0.85rem;
    color: #888;
    margin-right: 8px;
}

#difficultySelect {
    background: #1a1a24;
    color: #fff;
    padding: 8px 12px;
    border: 1px solid #2d2d44;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
}

#difficultySelect:focus {
    outline: none;
    border-color: #00d4ff;
}

.editor-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
}

#editorCanvas {
    background: linear-gradient(180deg, #0a0a0f 0%, #1a1a2e 100%);
}

.editor-timeline {
    width: 100%;
    height: 80px;
    position: absolute;
    bottom: 0;
    left: 0;
    background: #14141c;
    border-top: 1px solid #2d2d44;
}

#timelineCanvas {
    width: 100%;
    height: 100%;
}

/* 結果画面 */
#resultScreen {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    align-items: center;
    justify-content: center;
}

.result-content {
    text-align: center;
    background: rgba(30, 30, 50, 0.8);
    padding: 50px 80px;
    border-radius: 20px;
    border: 1px solid #3d3d5c;
}

.result-content h2 {
    font-size: 2rem;
    color: #00d4ff;
    margin-bottom: 20px;
}

.result-grade {
    font-size: 8rem;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 0 0 50px currentColor;
}

.result-grade.S { color: #00ffff; }
.result-grade.A { color: #00ff00; }
.result-grade.B { color: #ffff00; }
.result-grade.C { color: #ff8800; }
.result-grade.D { color: #ff0000; }

.result-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin: 30px 0;
}

.result-stats .stat {
    text-align: center;
}

.result-stats .label {
    display: block;
    color: #666;
    font-size: 0.9rem;
}

.result-stats .value {
    font-size: 2rem;
    font-weight: bold;
}

.judgement-breakdown {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.judge-stat {
    padding: 10px 20px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
}

.judge-stat .name {
    display: block;
    font-size: 0.8rem;
}

.judge-stat .count {
    font-size: 1.5rem;
    font-weight: bold;
}

.judge-stat.perfect { color: #00ffff; }
.judge-stat.great { color: #00ff00; }
.judge-stat.good { color: #ffff00; }
.judge-stat.miss { color: #ff0000; }

.result-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

/* アニメーション */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.combo-display.active #combo {
    animation: pulse 0.2s ease;
}

/* キー押下エフェクト */
.key-pressed {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%) !important;
    border-color: #00d4ff !important;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
}

/* パブリッシャー画面 */
#publisherScreen {
    flex-direction: column;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
}

.publisher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid #3d3d5c;
}

.publisher-header h2 {
    color: #00d4ff;
    margin: 0;
}

.publisher-content {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
}

.publisher-info {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.publisher-info p {
    margin: 0;
    color: #aaa;
}

.song-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.song-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid #3d3d5c;
    border-radius: 10px;
    padding: 15px 20px;
    transition: all 0.2s ease;
}

.song-slot:hover {
    border-color: #00d4ff;
}

.song-slot.has-audio {
    border-color: #4ade80;
}

.song-slot.generated {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.05);
}

.song-number {
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
    min-width: 30px;
}

.song-slot.has-audio .song-number {
    color: #4ade80;
}

.song-name {
    flex: 1;
    color: #888;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-slot.has-audio .song-name {
    color: #fff;
}

.song-status {
    display: flex;
    gap: 5px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-badge.easy { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.status-badge.normal { background: rgba(0, 212, 255, 0.2); color: #00d4ff; }
.status-badge.hard { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.status-badge.expert { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.status-badge.pending { background: rgba(100, 100, 100, 0.2); color: #666; }

.song-actions {
    display: flex;
    gap: 8px;
}

.song-actions button {
    padding: 8px 12px;
    font-size: 0.85rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.song-actions .upload-btn {
    background: linear-gradient(90deg, #ff0080, #7928ca);
    color: #fff;
}

.song-actions .upload-btn:hover {
    transform: scale(1.05);
}

.song-actions .generate-btn {
    background: #2d2d44;
    color: #00d4ff;
    border: 1px solid #00d4ff;
}

.song-actions .generate-btn:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.2);
}

.song-actions .generate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.song-actions .test-btn {
    background: #2d2d44;
    color: #4ade80;
    border: 1px solid #4ade80;
}

.song-actions .test-btn:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.2);
}

.song-actions .test-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.song-actions .remove-btn {
    background: transparent;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.song-actions .remove-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

.publisher-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.generating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.generating-overlay h3 {
    color: #00d4ff;
    margin-bottom: 20px;
}

.generating-overlay .progress-text {
    color: #aaa;
    margin-top: 10px;
}

/* 難易度選択ダイアログ */
.difficulty-dialog {
    background: rgba(30, 30, 50, 0.95);
    padding: 30px 40px;
    border-radius: 15px;
    border: 1px solid #3d3d5c;
    text-align: center;
}

.difficulty-dialog h3 {
    color: #00d4ff;
    margin-bottom: 10px;
}

.difficulty-dialog p {
    color: #888;
    margin-bottom: 20px;
}

.diff-select-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.diff-select-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
}

.diff-select-btn.easy {
    color: #4ade80;
    border-color: #4ade80;
}
.diff-select-btn.easy:hover {
    background: rgba(74, 222, 128, 0.2);
}

.diff-select-btn.normal {
    color: #00d4ff;
    border-color: #00d4ff;
}
.diff-select-btn.normal:hover {
    background: rgba(0, 212, 255, 0.2);
}

.diff-select-btn.hard {
    color: #f59e0b;
    border-color: #f59e0b;
}
.diff-select-btn.hard:hover {
    background: rgba(245, 158, 11, 0.2);
}

.diff-select-btn.expert {
    color: #ef4444;
    border-color: #ef4444;
}
.diff-select-btn.expert:hover {
    background: rgba(239, 68, 68, 0.2);
}

.diff-cancel-btn {
    padding: 8px 20px;
    background: transparent;
    border: 1px solid #666;
    border-radius: 5px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.diff-cancel-btn:hover {
    border-color: #999;
    color: #fff;
}

/* 音楽タブ */
.music-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #3d3d5c;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

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

.tab-btn.active {
    background: linear-gradient(90deg, #ff0080, #00d4ff);
    border-color: transparent;
    color: #fff;
}

.tab-content {
    display: none;
    min-height: 120px;
}

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

/* 音楽リスト */
.music-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.music-list::-webkit-scrollbar {
    width: 8px;
}

.music-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.music-list::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 4px;
}

.music-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.music-item:last-child {
    margin-bottom: 0;
}

.music-item:hover {
    background: rgba(0, 212, 255, 0.2);
}

.music-item.selected {
    background: linear-gradient(90deg, rgba(255, 0, 128, 0.3), rgba(0, 212, 255, 0.3));
    border: 1px solid #00d4ff;
}

.music-item .title {
    font-size: 0.9rem;
    color: #fff;
}

.music-item .size {
    font-size: 0.75rem;
    color: #666;
}

.music-list .loading,
.music-list .error {
    text-align: center;
    padding: 20px;
    color: #888;
}

.music-list .error {
    color: #ff4444;
}

/* 録音コントロール */
.record-controls {
    text-align: center;
    padding: 15px;
}

.record-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    background: linear-gradient(90deg, #ff4444, #ff6666);
    border: none;
    border-radius: 50px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.5);
}

.record-btn.recording {
    background: linear-gradient(90deg, #ff0000, #ff3333);
    animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.8); }
}

.recording-status {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #ff4444;
}

.recording-time {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    margin-top: 8px;
    font-family: monospace;
}

.recorded-audio {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.recorded-audio audio {
    width: 100%;
    margin-bottom: 12px;
}

.record-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.use-btn, .save-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.use-btn {
    background: linear-gradient(90deg, #00ff88, #00cc66);
    color: #000;
}

.save-btn {
    background: linear-gradient(90deg, #4488ff, #2266dd);
    color: #fff;
}

.use-btn:hover, .save-btn:hover {
    transform: scale(1.05);
}

.save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* モバイル対応 - タッチ・スケール制御 */
html, body {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

#gameCanvas {
    touch-action: none;
}

/* タッチレーン表示（デフォルトは非表示、モバイルのみ表示） */
.touch-lanes {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    display: none; /* PCでは非表示 */
    z-index: 100;
    pointer-events: auto;
}

.touch-lane {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.1s ease;
}

.touch-lane:nth-child(1) { background: rgba(255, 0, 85, 0.3); }
.touch-lane:nth-child(2) { background: rgba(0, 212, 255, 0.3); }
.touch-lane:nth-child(3) { background: rgba(0, 212, 255, 0.3); }
.touch-lane:nth-child(4) { background: rgba(255, 0, 85, 0.3); }

.touch-lane.active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}

/* モバイルレスポンシブ */
@media (max-width: 768px) {
    .title-content h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .menu-buttons {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 10px;
    }

    .menu-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .current-mode {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    .music-tabs {
        gap: 5px;
        padding: 0 10px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .music-list {
        max-height: 140px;
    }

    .music-item {
        padding: 8px 10px;
    }

    .music-item .title {
        font-size: 0.85rem;
    }

    .file-section {
        padding: 0 10px;
    }

    .file-label {
        padding: 10px 18px;
        font-size: 0.9rem;
    }

    .key-guide {
        margin-top: 15px;
    }

    .key-guide h3 {
        font-size: 0.9rem;
    }

    .keys {
        gap: 8px;
    }

    .key {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* ゲーム画面 */
    .game-header {
        padding: 8px 15px;
    }

    #score, #accuracy {
        font-size: 1.2rem;
    }

    #combo {
        font-size: 1.8rem;
    }

    #gameScreen {
        padding-bottom: 120px; /* タッチレーン用のスペース */
    }

    .game-container {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow: hidden;
    }

    #gameCanvas {
        width: 100% !important;
        max-width: 100vw !important;
        height: auto !important;
        max-height: calc(100vh - 200px) !important; /* ヘッダー + タッチレーン分を除く */
        object-fit: contain;
    }

    .lane-labels {
        display: none; /* モバイルではタッチレーンのラベルを使用 */
    }

    .touch-lanes {
        display: flex !important; /* モバイルでは表示 */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 120px !important;
        z-index: 1000;
    }

    .lane-label {
        font-size: 1rem;
    }

    .judgement {
        font-size: 2rem;
        top: 30%;
    }

    .game-controls {
        position: fixed;
        top: 10px;
        right: 10px;
        flex-direction: column;
        gap: 5px;
        padding: 0;
        z-index: 100;
    }

    .control-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        opacity: 0.7;
    }

    /* エディター画面 */
    #editorScreen {
        overflow: hidden;
    }

    .editor-header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px;
        justify-content: center;
    }

    .editor-header > button:first-child {
        width: 100%;
        margin-bottom: 5px;
    }

    .editor-info {
        width: 100%;
        justify-content: center;
        gap: 15px;
        font-size: 0.9rem;
        margin-bottom: 5px;
    }

    .editor-controls {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        width: 100%;
    }

    .editor-controls .control-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .editor-container {
        flex-direction: column;
        height: calc(100vh - 130px);
    }

    .editor-sidebar {
        width: 100%;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: flex-start;
        border-right: none;
        border-bottom: 1px solid #2d2d44;
    }

    .editor-sidebar h3 {
        display: none;
    }

    .editor-sidebar .setting-group {
        margin-bottom: 0;
        min-width: 80px;
        flex: 1;
    }

    .editor-sidebar .setting-group label {
        font-size: 0.75rem;
        margin-bottom: 3px;
    }

    .editor-sidebar .setting-group input[type="number"],
    .editor-sidebar .setting-group select {
        padding: 5px;
        font-size: 0.85rem;
    }

    .editor-sidebar .options-group {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px;
        width: 100%;
    }

    .editor-sidebar .options-group > label {
        margin-bottom: 0;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .editor-sidebar .control-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .editor-sidebar .control-btn.full-width {
        flex: 1;
        min-width: 120px;
    }

    .editor-main {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    #editorCanvas {
        width: 100% !important;
        max-height: 100% !important;
        touch-action: none;
    }

    .editor-timeline {
        height: 60px;
        position: relative;
    }

    #timelineCanvas {
        touch-action: none;
    }

    .setting-group {
        margin-bottom: 10px;
    }

    .sub-option {
        margin-left: 0;
        margin-top: 5px;
    }

    /* 結果画面 */
    .result-content {
        padding: 25px 20px;
        margin: 10px;
        width: calc(100% - 20px);
    }

    .result-grade {
        font-size: 5rem;
    }

    .result-stats {
        gap: 15px;
        flex-wrap: wrap;
    }

    .result-stats .value {
        font-size: 1.3rem;
    }

    .judgement-breakdown {
        flex-wrap: wrap;
        gap: 8px;
    }

    .judge-stat {
        padding: 6px 12px;
    }

    .result-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .result-buttons .menu-btn {
        width: 100%;
    }

    /* 録音 */
    .record-btn {
        padding: 10px 20px;
        font-size: 1rem;
    }

    .recording-time {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .title-content h1 {
        font-size: 1.6rem;
    }

    .menu-btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .menu-btn .icon {
        font-size: 1rem;
    }

    #gameScreen {
        padding-bottom: 100px;
    }

    #gameCanvas {
        max-height: calc(100vh - 180px) !important;
    }

    .touch-lanes {
        height: 100px !important;
    }

    .touch-lane {
        font-size: 1.5rem;
    }
}
