:root {
    --bg-dark: #0a0a0f;
    --bg-grid: #12121a;
    --cell-empty: #1a1a2e;
    --cell-hover: #2a2a4e;
    --cell-active: #00ff88;
    --cell-glow: rgba(0, 255, 136, 0.4);
    --border-color: #2d2d4a;
    --text-primary: #e0e0ff;
    --text-dim: #6a6a8a;
    --accent: #00ff88;
    --accent-secondary: #ff6b6b;
    --accent-tertiary: #4ecdc4;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    height: -webkit-fill-available;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: var(--bg-dark);
    background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(0, 255, 136, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(78, 205, 196, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 90%, rgba(255, 107, 107, 0.05) 0%, transparent 40%);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
}

/* Language selector */
.lang-selector {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 4px;
    z-index: 100;
}

.lang-btn {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(18, 18, 26, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

h1 {
    font-family: 'Orbitron', 'Arial Black', sans-serif;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 900;
    letter-spacing: 0.1em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-tertiary) 50%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
    text-shadow: 0 0 60px var(--cell-glow);
    text-align: center;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 25px;
    text-align: center;
}

.container {
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px var(--border-color),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 30px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, var(--cell-glow) 0%, transparent 50%);
    opacity: 0.3;
    pointer-events: none;
}

.grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.grid-container {
    position: relative;
    z-index: 1;
}

.grid-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 320px;
}

.grid-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-inline {
    font-size: 9px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 55px;
    flex-shrink: 0;
}

.grid-control-row .tags-container {
    flex: 1;
    justify-content: flex-start;
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 34px);
    grid-template-rows: repeat(9, 34px);
    gap: 2px;
    background: var(--bg-grid);
    padding: 6px;
    border-radius: 8px;
    cursor: crosshair;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px var(--border-color),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    position: relative;
    overflow: visible;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.grid.wall-mode {
    border-color: #ffc832;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 15px rgba(255, 200, 50, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Note labels на краях */
.note-labels {
    position: absolute;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
}

.note-labels.top {
    top: -18px;
    left: 28px;
    right: 28px;
    height: 18px;
    display: flex;
    justify-content: space-around;
}

.note-labels.left {
    left: -24px;
    top: 28px;
    bottom: 28px;
    width: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    text-align: right;
}

.note-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    color: var(--accent);
    font-weight: 500;
}

.note-labels.left .note-label {
    width: auto;
    height: auto;
    flex: 1;
    padding-right: 4px;
}

/* Edge indicators */
.edge-indicators {
    position: absolute;
    pointer-events: none;
}

.edge-indicators.top {
    top: 0;
    left: 20px;
    right: 20px;
    height: 20px;
    display: flex;
    justify-content: space-around;
    padding: 0 8px;
}

.edge-indicators.left {
    left: 0;
    top: 20px;
    bottom: 20px;
    width: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 8px 0;
}

.edge-indicator {
    width: 34px;
    height: 4px;
    background: transparent;
    border-radius: 2px;
}

.edge-indicators.left .edge-indicator {
    width: 4px;
    height: 34px;
}

.edge-indicator.triggered {
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent), 0 0 30px var(--accent);
}

.cell {
    width: 34px;
    height: 34px;
    background: var(--cell-empty);
    border-radius: 4px;
    position: relative;
    border: 1px solid var(--border-color);
}

.cell:hover {
    background: var(--cell-hover);
    border-color: var(--accent);
    box-shadow: 
        0 0 16px var(--cell-glow),
        inset 0 0 12px var(--cell-glow);
}

.cell.active {
    background: radial-gradient(circle, var(--cell-active) 0%, #00cc6a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    box-shadow: 
        0 0 20px var(--cell-glow),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.cell.multi {
    background: radial-gradient(circle, #ff9f43 0%, #ee5a24 100%);
    box-shadow: 
        0 0 25px rgba(255, 159, 67, 0.5),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    border-color: #ff9f43;
}

.cell.collision,
.cell.colliding {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: var(--accent-secondary) !important;
    box-shadow: 
        0 0 32px rgba(255, 107, 107, 0.8),
        inset 0 0 24px rgba(255, 107, 107, 0.4) !important;
}

/* Стены */
.cell.wall {
    cursor: pointer;
}

.cell.wall-sound {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
    border: 2px solid #818cf8;
    box-shadow: 
        0 0 20px rgba(99, 102, 241, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.cell.wall-sound::before {
    content: '♪';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.cell.wall-silent {
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%);
    border: 2px solid #64748b;
    box-shadow: 
        0 0 12px rgba(71, 85, 105, 0.4),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.cell.wall-silent::before {
    content: '×';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cell.wall-drum {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    border: 2px solid #fbbf24;
    box-shadow: 
        0 0 20px rgba(245, 158, 11, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.cell.wall-drum::before {
    content: '◉';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Snare */
.cell.wall-snare {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 50%, #be185d 100%);
    border: 2px solid #f472b6;
    box-shadow: 
        0 0 20px rgba(236, 72, 153, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.cell.wall-snare::before {
    content: '⊛';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Bass */
.cell.wall-bass {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 50%, #5b21b6 100%);
    border: 2px solid #a78bfa;
    box-shadow: 
        0 0 20px rgba(124, 58, 237, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
}

.cell.wall-bass::before {
    content: '≋';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Hi-Hat */
.cell.wall-hihat {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 50%, #d97706 100%);
    border: 2px solid #fde68a;
    box-shadow: 
        0 0 20px rgba(252, 211, 77, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.cell.wall-hihat::before {
    content: '🎩';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Retro 8-bit */
.cell.wall-retro {
    background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
    border: 2px solid #34d399;
    box-shadow: 
        0 0 20px rgba(16, 185, 129, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
    image-rendering: pixelated;
}

.cell.wall-retro::before {
    content: '▣';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 
        2px 0 0 rgba(0, 0, 0, 0.5),
        0 2px 0 rgba(0, 0, 0, 0.5);
}

/* Chiptune */
.cell.wall-chiptune {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%);
    border: 2px solid #fb7185;
    box-shadow: 
        0 0 20px rgba(244, 63, 94, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.15);
    image-rendering: pixelated;
}

.cell.wall-chiptune::before {
    content: '♫';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 
        1px 0 0 rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(0, 0, 0, 0.5);
}

.cell.wall:hover {
    transform: scale(1.05);
}

/* Touch эффекты */
.cell.touch-active {
    transform: scale(0.95);
    background: var(--cell-hover);
    border-color: var(--accent);
}

.cell.touch-charging {
    position: relative;
}

.cell.touch-charging::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent));
    border-radius: 0 0 4px 4px;
}

/* Line highlight эффекты */
.cell.line-highlight {
    background: rgba(0, 255, 136, 0.15);
    box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.3);
}

/* Direction triangles */
.arrow {
    display: none;
    position: absolute;
    pointer-events: none;
    width: 0;
    height: 0;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8))
            drop-shadow(0 0 8px var(--accent))
            drop-shadow(0 0 12px var(--accent));
    transition: all 0.15s ease;
}

.cell.active .arrow {
    display: block;
}

.cell.active:hover .arrow {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 1))
            drop-shadow(0 0 12px var(--accent))
            drop-shadow(0 0 20px var(--accent));
}

/* Triangle pointing UP */
.arrow.up {
    left: 50%;
    top: 6px;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 10px solid #ffffff;
}

/* Triangle pointing RIGHT */
.arrow.right {
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 10px solid #ffffff;
}

/* Triangle pointing DOWN */
.arrow.down {
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 10px solid #ffffff;
}

/* Triangle pointing LEFT */
.arrow.left {
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 10px solid #ffffff;
}

/* Hit band - линии нот */
.hit-band {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    animation: hitBandFade 0.4s ease-out forwards;
}

@keyframes hitBandFade {
    0% { opacity: 0.7; }
    100% { opacity: 0; }
}

.hit-band.vertical {
    width: 34px;
    height: 100%;
    top: 0;
    background: linear-gradient(180deg, 
        transparent 0%,
        rgba(0, 255, 136, 0.6) 45%,
        rgba(0, 255, 136, 0.6) 55%,
        transparent 100%);
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 15px rgba(0, 255, 136, 0.3);
}

.hit-band.horizontal {
    height: 34px;
    width: 100%;
    left: 0;
    background: linear-gradient(90deg, 
        transparent 0%,
        rgba(0, 255, 136, 0.6) 45%,
        rgba(0, 255, 136, 0.6) 55%,
        transparent 100%);
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 15px rgba(0, 255, 136, 0.3);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 160px;
    position: relative;
    z-index: 1;
}

button {
    padding: 10px 16px;
    background: var(--cell-empty);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 44px;
    min-height: 44px;
}

button:hover {
    background: var(--cell-hover);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 
        0 0 16px var(--cell-glow),
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 0 12px var(--cell-glow);
}

button:active {
    background: var(--cell-empty);
    box-shadow: 
        inset 0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 8px var(--cell-glow);
}

button.active {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 
        0 0 24px var(--cell-glow),
        inset 0 0 16px var(--cell-glow);
}

.tempo-control, .scale-control, .synth-control, .echo-control {
    display: flex;
    gap: 6px;
}

.tempo-control button, .scale-control button, .synth-control button, .echo-control button {
    flex: 1;
    font-weight: 700;
    font-size: 13px;
}

/* Tags container */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.controls .tags-container {
    margin-bottom: 8px;
}

.tag {
    padding: 3px 6px !important;
    min-width: auto !important;
    min-height: auto !important;
    font-size: 8px !important;
    border-radius: 10px !important;
    opacity: 0.5;
    transition: all 0.15s ease;
}

.tag:hover {
    opacity: 0.8;
}

.tag.active {
    opacity: 1;
    background: rgba(0, 255, 136, 0.25) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    box-shadow: 0 0 10px var(--cell-glow) !important;
}

/* Wall tags */
.wall-tag {
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 12px !important;
    border-radius: 6px !important;
    opacity: 0.4;
    transition: all 0.15s ease;
}

.wall-tag:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.wall-tag.active {
    opacity: 1;
    background: rgba(255, 200, 50, 0.3) !important;
    border-color: #ffc832 !important;
    box-shadow: 0 0 12px rgba(255, 200, 50, 0.5) !important;
}

/* Record button */
#recordBtn.recording {
    background: #ff4444 !important;
    border-color: #ff4444 !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.6) !important;
    animation: pulse-record 1s ease-in-out infinite;
}

@keyframes pulse-record {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Effects panel */
.effects-wrapper {
    position: relative;
}

#effectsToggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

#effectsToggle.open {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--accent);
}

.effects-panel {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: rgba(18, 18, 26, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 12px;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    z-index: 100;
    box-shadow: 
        0 -10px 40px rgba(0, 0, 0, 0.5),
        0 0 20px var(--cell-glow);
    animation: popUp 0.2s ease;
}

.effects-panel.open {
    display: flex;
}

.effects-panel::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--accent);
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
    display: flex;
}

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

.modal {
    background: rgba(18, 18, 26, 0.98);
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 30px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px var(--cell-glow);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-tertiary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    text-align: center;
}

.modal-version {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    margin-bottom: 20px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: transparent;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

.modal-content {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
}

.modal-content p {
    margin-bottom: 15px;
}

.modal-content a {
    color: var(--accent);
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

.modal-content h3 {
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 20px 0 10px;
}

.modal-content ul {
    list-style: none;
    padding: 0;
}

.modal-content li {
    padding: 4px 0;
    padding-left: 15px;
    position: relative;
}

.modal-content li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 10px;
}

.modal-inspired {
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    text-align: center;
}

.modal-inspired p {
    margin-bottom: 8px;
}

.modal-inspired p:last-child {
    margin-bottom: 0;
}

.modal-thanks {
    font-size: 11px;
    color: var(--text-dim);
}

.modal-contact {
    text-align: center;
}

.modal-contact a {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--accent);
    border-radius: 20px;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
}

.modal-contact a:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.modal-footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.modal-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.modal-footer a:hover {
    text-decoration: underline;
}

.label {
    font-size: 10px;
    color: var(--text-dim);
    padding: 6px 0;
    margin-top: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.hidden {
    display: none;
}

/* Mobile touch instruction */
.mobile-instruction {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .desktop-instruction {
        display: none;
    }
    .mobile-instruction {
        display: inline;
    }
    
    .cell {
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        will-change: background, opacity, transform;
    }
    
    /* Увеличиваем touch targets */
    .tag, .wall-tag {
        min-width: 28px;
        min-height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    button {
        min-height: 36px;
    }
    
    /* Модалка с жестами */
    .modal-overlay {
        overscroll-behavior: contain;
    }
    
    .modal {
        overscroll-behavior: contain;
    }
}

/* Responsive для планшетов */
@media (max-width: 1024px) {
    .container {
        padding: 20px;
        gap: 20px;
    }
    
    .grid {
        gap: 3px;
    }
    
    h1 {
        font-size: 2rem;
    }
}

/* Responsive для мобильных */
@media (max-width: 600px) {
    body {
        padding: 10px 8px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }
    
    .subtitle {
        font-size: 0.65rem;
        margin-bottom: 12px;
    }
    
    .grid {
        gap: 2px;
        padding: 4px;
    }
    
    .cell {
        font-size: 1.2em;
        border-radius: 6px;
    }
    
    .arrow {
        font-size: 1rem;
    }
    
    .arrow span {
        font-size: 0.75rem;
    }
    
    .note-labels {
        font-size: 0.55rem;
    }
    
    .note-labels.top {
        top: -14px;
        left: 14px;
        right: 14px;
        height: 14px;
    }
    
    .note-labels.left {
        left: -18px;
        top: 14px;
        bottom: 14px;
        width: 18px;
    }
    
    button {
        font-size: 0.7rem;
        padding: 8px 12px;
        min-width: 0;
    }
    
    /* Container становится вертикальным */
    .container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
    }
    
    /* Controls на всю ширину */
    .controls {
        width: 100%;
        gap: 6px;
    }
    
    /* Grid wrapper центрируем */
    .grid-wrapper {
        width: 100%;
        align-items: center;
    }
    
    /* Grid controls компактнее */
    .grid-controls {
        max-width: 100%;
        gap: 4px;
    }
    
    .grid-control-row {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .label-inline {
        width: 100%;
        font-size: 8px;
        margin-bottom: 2px;
    }
    
    /* Теги для тач-устройств */
    .tag {
        font-size: 10px !important;
        padding: 6px 10px !important;
        min-height: 32px;
    }
    
    .wall-tag {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
    
    .grid-control-row .tags-container {
        gap: 6px;
    }
    
    /* Language selector меньше */
    .lang-selector {
        position: absolute;
        top: 10px;
        right: 10px;
        gap: 3px;
    }
    
    .lang-btn {
        padding: 4px 7px;
        font-size: 9px;
    }
    
    /* Modal на весь экран */
    .modal {
        max-width: 95%;
        padding: 20px;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .modal h2 {
        font-size: 1.4rem;
    }
    
    .modal-content {
        font-size: 12px;
    }
    
    .modal-content h3 {
        font-size: 11px;
        margin: 15px 0 8px;
    }
    
    .modal-content li {
        font-size: 11px;
    }
    
    /* Effects panel адаптивная */
    .effects-panel {
        min-width: 150px;
        padding: 12px;
    }
    
    /* Label меньше */
    .label {
        font-size: 9px;
    }
    
    /* Tempo/Scale/Synth controls */
    .tempo-control, .scale-control, .synth-control, .echo-control {
        gap: 4px;
    }
}

/* Ландшафтная ориентация мобильных */
@media (max-width: 800px) and (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 8px;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 2px;
    }
    
    .subtitle {
        font-size: 0.6rem;
        margin-bottom: 8px;
    }
    
    .container {
        flex-direction: row;
        padding: 10px;
        gap: 10px;
    }
    
    .controls {
        width: 140px;
        overflow-y: auto;
        max-height: calc(100vh - 120px);
    }
    
    .grid-controls {
        max-width: 280px;
    }
    
    .lang-selector {
        top: 5px;
        right: 5px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .grid {
        grid-template-columns: repeat(9, 30px);
        grid-template-rows: repeat(9, 30px);
    }
    
    .tag {
        font-size: 9px !important;
        padding: 5px 8px !important;
        min-height: 28px;
    }
    
    .wall-tag {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}

