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

body {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 14px;
    background: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header controls */
header.controls {
    background: #2a2a2a;
    padding: 12px 16px;
    border-bottom: 2px solid #3a3a3a;
}

.control-row {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 8px;
}

.control-row:last-child {
    margin-bottom: 0;
}

header label {
    font-size: 13px;
}

header input[type="text"],
header input[type="number"] {
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    margin-left: 4px;
}

#title-input {
    width: 200px;
}

#bpm-input,
#tpb-input,
#rows-input {
    width: 60px;
}

#octave-display {
    font-weight: bold;
    color: #4a9eff;
}

#new-btn,
#play-btn {
    background: #4a9eff;
    color: #fff;
    border: none;
    padding: 6px 16px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
}

#new-btn {
    background: #666;
}

#new-btn:hover {
    background: #777;
}

#play-btn:hover {
    background: #6ab0ff;
}

#play-btn.playing {
    background: #ff6b6b;
}

#help-hint {
    color: #888;
    font-size: 12px;
    margin-left: auto;
}

/* Pattern table */
main {
    flex: 1;
    overflow: auto;
    background: #242424;
}

#pattern-container {
    padding: 8px;
}

#pattern-table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

/* Table header */
#pattern-table thead th {
    background: #2a2a2a;
    color: #aaa;
    padding: 8px 4px;
    text-align: center;
    border: 1px solid #3a3a3a;
    font-weight: bold;
    font-size: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

#pattern-table thead th.row-header {
    width: 40px;
}

#pattern-table thead th.channel-header {
    font-size: 13px;
    color: #4a9eff;
}

/* Table body */
#pattern-table tbody tr {
    background: #1e1e1e;
}

#pattern-table tbody tr:nth-child(4n) {
    background: #252525;
}

#pattern-table tbody tr:nth-child(8n) {
    background: #2a2a2a;
}

#pattern-table tbody td {
    padding: 2px 4px;
    text-align: center;
    border: 1px solid #2a2a2a;
    font-size: 13px;
}

.row-num {
    color: #666;
    font-weight: bold;
    width: 40px;
}

/* Cell types */
.cell {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.cell.note { min-width: 35px; }
.cell.ins { min-width: 25px; }
.cell.vol { min-width: 15px; }

.cell.empty {
    color: #444;
}

.cell.note-off {
    color: #ff6b6b;
    font-weight: bold;
}

/* Cursor highlight */
.cell.cursor {
    background: #4a9eff !important;
    color: #000 !important;
    font-weight: bold;
}

.row-num.cursor-row {
    background: #3a3a3a;
    color: #4a9eff;
}

/* Help overlay */
#help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#help-overlay.hidden {
    display: none;
}

.help-content {
    background: #2a2a2a;
    border: 2px solid #4a9eff;
    padding: 24px 32px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content h2 {
    color: #4a9eff;
    margin-bottom: 20px;
    text-align: center;
}

.help-content h3 {
    color: #e0e0e0;
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 14px;
}

.help-content section {
    margin-bottom: 16px;
    line-height: 1.6;
}

.help-content kbd {
    background: #1a1a1a;
    border: 1px solid #4a4a4a;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 12px;
    color: #4a9eff;
}

.keyboard-layout {
    background: #1a1a1a;
    padding: 8px;
    margin: 8px 0;
    font-size: 12px;
}

.help-close {
    text-align: center;
    margin-top: 20px;
    color: #888;
    font-size: 12px;
}
