:root {
    --base: #1e1e2e;
    --text: #cdd6f4;
    --surface0: #313244;
    --surface1: #45475a;
    --red: #f38ba8;
    --lavender: #b4befe;
    --yellow: #f9e2af;
    --sapphire: #74c7ec;
    --finger-thumb: #f9e2af;
    --finger-index: #a6e3a1;
    --finger-middle: #89b4fa;
    --finger-ring: #cba6f7;
    --finger-pinky: #f5c2e7;
    --finger-mouse: #94e2d5;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--base);
    color: var(--text);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    overflow-x: auto;
    user-select: none;
}

.profile-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 16px;
    min-height: 55px;
    border-bottom: 1px solid color-mix(in srgb, var(--surface1) 70%, transparent);
    background-color: color-mix(in srgb, var(--base) 94%, black);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.profile-bar-start {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 0 0 auto;
}

#profile-select,
.profile-btn,
.finger-select {
    box-sizing: border-box;
    margin: 0;
    border: 1px solid var(--surface1);
    border-radius: 6px;
    background-color: var(--surface0);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    vertical-align: middle;
}

#profile-select {
    min-width: 170px;
    height: 34px;
    padding: 0 28px 0 10px;
    display: flex;
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23cdd6f4' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 12px 12px;
}

.profile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.profile-btn:hover,
#profile-select:hover,
.finger-select:hover {
    border-color: var(--sapphire);
}

.profile-btn:focus-visible,
#profile-select:focus-visible,
.finger-select:focus-visible {
    outline: 2px solid var(--sapphire);
    outline-offset: 2px;
}

.finger-summary {
    flex: 1 1 12rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 6px);
    min-width: 0;
}

.profile-transfer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.finger-count {
    border: 1px solid color-mix(in srgb, var(--finger-color) 70%, transparent);
    border-radius: 6px;
    background-color: color-mix(in srgb, var(--finger-color) 24%, transparent);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    font-size: clamp(11px, 2.2vw, 13px);
    line-height: 1;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 10.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1020px) {
    .finger-summary {
        flex: 1 1 100%;
        justify-content: center;
    }
}

.app-container {
    display: flex;
    justify-content: flex-start;
    padding: 72px clamp(16px, 4vw, 60px) 60px 60px;
    gap: 320px;
    width: max-content;
    min-width: min-content;
    min-height: 100vh;
    position: relative;
    box-sizing: border-box;
}

.column {
    flex: 0 0 auto;
    min-width: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
}

#left-column {
    width: 240px;
}

#right-column {
    width: 484px;
}

h2 {
    color: var(--lavender);
    text-align: center;
    margin-top: 0;
    line-height: 1.25;
}

.item-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--surface1);
    border-radius: 8px;
    background-color: var(--surface0);
    color: var(--text);
    margin-bottom: 20px;
    outline: none;
    font-size: 16px;
    line-height: 1.25;
}

.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    display: grid;
    grid-auto-rows: 52px;
    align-content: start;
    gap: 10px;
    position: relative;
}

#list-left {
    padding-right: 40px;
    margin-right: -40px;
}

#list-right {
    padding-left: 40px;
    margin-left: -40px;
}

.list-item {
    background-color: var(--surface0);
    padding: 12px 14px;
    height: 52px;
    min-height: 52px;
    margin: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    cursor: grab;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s;
    touch-action: none;
}

.list-item[data-finger] {
    background-color: color-mix(in srgb, var(--finger-color) 18%, var(--surface0));
    border: 1px solid color-mix(in srgb, var(--finger-color) 45%, transparent);
}

.list-item.is-dragging {
    z-index: 10;
    cursor: grabbing;
    background-color: var(--surface1);
    transition: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.item-text {
    flex: 0 1 auto;
    min-width: 0;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.related-actions {
    flex: 1 1 auto;
    min-width: 0;
    color: color-mix(in srgb, var(--text) 48%, transparent);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

#list-left .item-text {
    flex-grow: 1;
}

.btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.edit-btn { color: var(--yellow); }
.delete-btn { color: var(--red); }

.anchor {
    width: 16px;
    height: 16px;
    background-color: var(--sapphire);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
    z-index: 12;
    flex: 0 0 auto;
}

.finger-select {
    width: 92px;
    height: 28px;
    padding: 0 22px 0 6px;
    display: flex;
    align-items: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23cdd6f4' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
    background-position: right 6px center;
    background-repeat: no-repeat;
    background-size: 10px 10px;
}

/* Inner Edges: Right side of left list, Left side of right list */
.anchor-left { right: -24px; }
.anchor-right { left: -24px; }

.connector-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

#connector-svg {
    display: block;
    overflow: visible;
}

.connection-line {
    stroke: var(--sapphire);
    stroke-width: 3;
    fill: none;
    opacity: 0.7;
    stroke-linecap: round;
    cursor: pointer;
    pointer-events: stroke;
}

.connection-line:hover {
    opacity: 1;
    stroke-width: 5;
}

.temp-line {
    stroke-dasharray: 5,5;
    opacity: 0.5;
    pointer-events: none;
}
