:root {
    --tab-panel: #191816;
    --tab-panel-raised: #201e19;
    --tab-grid: #514d42;
}

.tab-maker-body {
    min-height: 100vh;
    display: block;
    padding: 0 1.25rem 3rem;
}

.tab-maker-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: calc(100% + 2.5rem);
    height: 5rem;
    margin: 0 -1.25rem;
    background: rgba(20, 19, 17, 0.96);
    border-bottom: 0.0625rem solid var(--link-border);
    backdrop-filter: blur(0.75rem);
}

.tab-maker-header .header-logo {
    width: 100%;
    max-width: 76rem;
    margin: 0 auto;
}

.tab-maker-container {
    width: 100%;
    max-width: 76rem;
    margin: 3.5rem auto 0;
}

.page-intro {
    margin-bottom: 2rem;
    text-align: center;
}

.eyebrow {
    margin-bottom: 0.65rem;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.page-intro h1 {
    margin-bottom: 0.45rem;
    color: var(--text-bright);
    font-size: clamp(2rem, 5vw, 3rem);
}

.page-description {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.editor-card {
    border-top: 0.0625rem solid var(--line);
    border-bottom: 0.0625rem solid var(--line);
}

.mobile-note-entry {
    display: none;
}

.editor-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 0.0625rem solid var(--link-border);
}

.song-title-field {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 12rem;
    max-width: 25rem;
}

.song-title-field label {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.song-title-field input {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border: 0.0625rem solid var(--link-border);
    border-radius: 0;
    outline: none;
    background: var(--bg);
    color: var(--text-bright);
    font: inherit;
    transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}

.song-title-field input::placeholder {
    color: #707070;
}

.song-title-field input:focus {
    border-color: var(--accent);
}

.staff-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-button {
    min-height: 2.6rem;
    padding: 0.6rem 0.85rem;
    border: 0.0625rem solid var(--link-border);
    border-radius: 0;
    background: var(--link-bg);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}

.tool-button:hover {
    border-color: var(--accent);
    background: var(--link-bg-hover);
    color: var(--text-bright);
}

.tool-button:active {
    transform: scale(0.98);
}

.tool-button:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.15rem;
}

.export-button {
    border-color: rgba(246, 195, 36, 0.55);
    color: var(--accent);
}

.play-button {
    min-width: 5rem;
    border-color: rgba(246, 195, 36, 0.55);
    color: var(--accent);
}

.play-button[aria-pressed="true"] {
    border-color: #884747;
    color: #ff8585;
}

.bpm-control {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-dim);
    font-size: 0.75rem;
}

.bpm-input {
    width: 4.5rem;
    min-height: 2.6rem;
    padding: 0.55rem 0.45rem;
    border: 0.0625rem solid var(--link-border);
    border-radius: 0;
    outline: none;
    background: var(--link-bg);
    color: var(--text-bright);
    font: inherit;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.bpm-input:focus {
    border-color: var(--accent);
}

.sheet-viewport {
    overflow-x: auto;
    padding: 1.5rem;
    scrollbar-color: #444 transparent;
    scrollbar-width: thin;
}

.sheet {
    min-width: 50rem;
}

.staff {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.6rem;
}

.staff:last-child {
    margin-bottom: 0;
}

.names,
.grid {
    display: grid;
    grid-template-rows: repeat(6, 1.2rem);
}

.names {
    color: var(--text-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
    text-align: center;
}

.names > div {
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid {
    overflow: hidden;
    border-right: 0.0625rem solid #303030;
    border-left: 0.0625rem solid #303030;
}

.string {
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
}

.cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: var(--text-bright);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    cursor: crosshair;
    user-select: none;
    transition: background-color 100ms ease-out;
}

.cell::before {
    position: absolute;
    top: 50%;
    right: 0;
    left: 0;
    border-top: 0.0625rem solid var(--tab-grid);
    content: "";
}

.string:last-child .cell::before {
    border-top-color: #303030;
}

.cell.bar {
    border-left: 0.0625rem solid #777;
}

.cell.last {
    border-right: 0.0625rem solid #777;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.045);
}

.cell.sel {
    z-index: 1;
    outline: 0.125rem solid var(--accent);
    outline-offset: -0.125rem;
    background: rgba(246, 195, 36, 0.1);
}

.cell span {
    position: relative;
    z-index: 1;
    padding: 0.05rem 0.2rem;
    background: var(--tab-panel);
    line-height: 1;
}

.cell.sel span {
    background: #282314;
    color: var(--accent);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    border-top: 0.0625rem solid var(--link-border);
    color: var(--text-dim);
    font-size: 0.75rem;
}

.keyboard-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.hint-key {
    padding: 0.18rem 0.38rem;
    border: 0.0625rem solid #353535;
    border-radius: 0;
    background: var(--tab-panel-raised);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.68rem;
}

.hint-separator {
    color: #555;
}

.secondary-hint {
    text-align: right;
}

.page-note {
    margin-top: 1.15rem;
    color: #777;
    font-size: 0.75rem;
    text-align: center;
}

@media (max-width: 48rem) {
    .tab-maker-body {
        padding: 0 1rem 2rem;
    }

    .tab-maker-header {
        width: calc(100% + 2rem);
        margin-right: -1rem;
        margin-left: -1rem;
    }

    .tab-maker-container {
        margin-top: 2.5rem;
    }

    .editor-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .song-title-field {
        max-width: none;
    }

    .staff-controls {
        justify-content: flex-start;
    }

    .transport-controls {
        width: auto;
    }

    .transport-controls .play-button {
        flex: 0 0 auto;
    }

    .sheet-viewport {
        padding: 1rem;
    }

    .editor-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 0.9rem 1rem;
    }

    .secondary-hint {
        text-align: left;
    }

    .mobile-note-entry {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        border-bottom: 0.0625rem solid var(--link-border);
        background: var(--tab-panel-raised);
    }

    .selection-status {
        overflow: hidden;
        flex: 1;
        color: var(--text-dim);
        font-size: 0.68rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-fret-label {
        color: var(--text-dim);
        font-size: 0.72rem;
    }

    .mobile-fret-input {
        width: 4.5rem;
        min-height: 2.6rem;
        padding: 0.45rem;
        border: 0.0625rem solid var(--link-border);
        border-radius: 0;
        outline: none;
        background: var(--bg);
        color: var(--text-bright);
        font: inherit;
        font-size: 1rem;
        font-variant-numeric: tabular-nums;
    }

    .mobile-fret-input:focus {
        border-color: var(--accent);
    }

    .mobile-note-action {
        min-width: 2.6rem;
        padding: 0.45rem 0.65rem;
    }

    .sheet-viewport {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
}

@media (max-width: 28rem) {
    .tool-button {
        flex: 0 0 auto;
        padding: 0.55rem 0.65rem;
    }

    .tool-button span {
        display: none;
    }

    .staff-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .staff-controls .tool-button {
        width: 100%;
    }

    .transport-controls {
        width: auto;
    }

    .sheet {
        min-width: 44rem;
    }
}
