#studio,
#studio *
{
    border: 0;
    border-radius: 0;
}

#studio
{
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 330px;
    grid-template-rows: 52px minmax(0, 1fr);
    grid-template-areas:
        'bar bar bar'
        'left center right';
    background: var(--chrome);
    gap: 0 4px;
}

#studio-bar
{
    grid-area: bar;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px 0 16px;
    background: var(--chrome);
    color: var(--chrome-fg);
    overflow-x: auto;
    scrollbar-width: none;
}

#studio-bar::-webkit-scrollbar
{
    display: none;
}

.studio-title
{
    font-size: 15px;
    font-weight: 700;
    margin-right: 14px;
    white-space: nowrap;
}

#studio-bar select
{
    width: 220px;
    flex: none;
    background-color: var(--chrome-field);
    color: var(--chrome-fg);
}

#studio-bar select:hover,
#studio-bar select:focus
{
    background-color: var(--chrome-hover);
}

#studio-bar .icon-btn:hover:not(:disabled)
{
    background: var(--chrome-hover);
}

#studio-bar .icon-btn:focus-visible
{
    background: var(--chrome-fg);
    color: var(--chrome);
}

#studio-bar .btn
{
    background: var(--chrome-field);
    color: var(--chrome-fg);
    flex: none;
}

#studio-bar .btn:hover:not(:disabled)
{
    background: var(--chrome-hover);
}

#studio-bar .btn.primary
{
    background: var(--chrome-fg);
    color: var(--chrome);
}

#studio-bar .btn.primary:hover:not(:disabled)
{
    background: var(--chrome-primary-hover);
}

#studio-left,
#studio-right
{
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
}

#studio-left
{
    grid-area: left;
    background: var(--bg);
    gap: 0;
}

#studio-right
{
    grid-area: right;
}

#studio-left .tabs
{
    flex: none;
    background: var(--chrome);
}

.studio-page
{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 18px;
}

.train-progress
{
    margin-bottom: 14px;
}

.train-progress .hint
{
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.char-group + .char-group
{
    margin-top: 14px;
}

.char-group-title
{
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.char-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
    gap: 2px;
}

.char-cell
{
    position: relative;
    height: 40px;
    background: var(--panel);
    font-size: 17px;
    font-weight: 500;
}

.char-cell:hover
{
    background: var(--field);
}

.char-cell .count
{
    position: absolute;
    right: 3px;
    bottom: 1px;
    font-size: 9.5px;
    font-weight: 600;
    opacity: 0.55;
}

.char-cell.done
{
    background: var(--field-hover);
}

.char-cell.done::after
{
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--fg);
}

.char-cell.active
{
    background: var(--fg);
    color: var(--bg);
}

.char-cell.active::after
{
    background: var(--bg);
}

.pair-add
{
    display: flex;
    gap: 2px;
    margin-bottom: 14px;
}

.pair-add input
{
    font-size: 15px;
    letter-spacing: 0.1em;
}

.pair-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 2px;
}

.pair-grid .char-cell
{
    font-size: 16px;
    letter-spacing: 0.04em;
}

#studio-center
{
    grid-area: center;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

#studio-prompt
{
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px 10px;
    flex: none;
}

#studio-target
{
    min-width: 64px;
    height: 64px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fg);
    color: var(--bg);
    font-size: 38px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

#studio-instructions
{
    flex: 1;
    min-width: 0;
}

#studio-instructions strong
{
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

#pad-wrap
{
    position: relative;
    flex: 1;
    min-height: 220px;
    margin: 0 20px;
    background: var(--panel);
}

#pad
{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: crosshair;
}

#pad-ghost
{
    position: absolute;
    left: 14px;
    top: 10px;
    font-size: 11px;
    color: var(--muted);
    pointer-events: none;
}

#split-controls
{
    margin: 10px 20px 0;
    padding: 12px 14px;
    background: var(--panel);
    flex: none;
}

#split-controls .field > label
{
    color: var(--fg);
}

#split-controls .hint
{
    margin-top: 6px;
}

#pad-tools
{
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 20px 18px;
    flex: none;
}

#pad-tools .btn.primary
{
    min-width: 170px;
}

#studio-right .panel-section
{
    overflow: hidden;
}

#studio-samples
{
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#sample-grid
{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: min-content;
    gap: 2px;
}

.sample
{
    position: relative;
    background: var(--panel);
}

.sample svg
{
    display: block;
    width: 100%;
    height: 86px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sample svg path,
.sample svg line,
.sample svg rect
{
    vector-effect: non-scaling-stroke;
}

.sample svg .guide
{
    stroke: var(--faint);
    stroke-width: 1;
}

.sample svg .connector
{
    stroke-dasharray: 3 3;
}

.sample svg .second
{
    stroke: var(--muted);
}

.sample svg .entry
{
    fill: var(--panel);
    stroke-width: 1.6;
}

.sample svg .exit
{
    fill: currentColor;
    stroke: none;
}

.sample-actions
{
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
}

.sample-actions .btn
{
    flex: 1;
    height: 24px;
    padding: 0 4px;
    font-size: 10.5px;
    background: var(--bg);
}

.sample-actions .btn:hover
{
    background: var(--field);
}

.sample-actions .icon-btn
{
    width: 24px;
    height: 24px;
    background: var(--bg);
}

.sample-actions .icon-btn .icon
{
    width: 18px;
    height: 18px;
}

.sample-actions .icon-btn:hover
{
    background: var(--field);
}

#studio-test
{
    flex: none;
}

#studio-test-input
{
    min-height: 58px;
    font-size: 14px;
}

#studio-preview-wrap
{
    position: relative;
    height: 170px;
    margin-top: 2px;
    background: var(--panel);
}

#studio-preview
{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#studio-empty
{
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg);
    text-align: center;
    padding: 24px;
}

#studio-empty h3
{
    font-size: 22px;
}

#studio-empty p
{
    max-width: 520px;
    color: var(--muted);
    line-height: 1.6;
}

#studio-empty .btn
{
    margin-top: 8px;
}

@media (max-width: 1100px)
{
    #studio
    {
        grid-template-columns: 240px minmax(0, 1fr) 280px;
    }
}

@media (max-width: 820px)
{
    #studio
    {
        overflow-y: auto;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 52px auto auto auto;
        grid-template-areas:
            'bar'
            'center'
            'left'
            'right';
        gap: 6px 0;
    }

    #pad-wrap
    {
        min-height: 300px;
    }

    #studio-left,
    #studio-right
    {
        overflow: visible;
    }

    #sample-grid
    {
        max-height: 50vh;
    }
}
