.gsa-analyzer-shell {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid #d8dde3;
    border-radius: 12px;
    background: #fff;
}

.gsa-phase-menu {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e6ea;
}

.gsa-phase-track {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.gsa-phase-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gsa-phase-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    padding: 0;
    border: 2px solid #b8bec5;
    border-radius: 50%;
    background: #e5e7eb;
    color: #5c6670;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.gsa-phase-item.is-selected .gsa-phase-circle {
    color: #16803a;
    border-color: #16803a;
}

.gsa-phase-item.is-completed .gsa-phase-circle {
    color: #fff;
    border-color: #16803a;
    background: #16803a;
}

.gsa-phase-item.is-completed.is-selected .gsa-phase-circle {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #16803a;
}

.gsa-phase-selected-name {
    display: none;
    color: #16803a;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.gsa-phase-item.is-selected .gsa-phase-selected-name {
    display: inline-block;
}

.gsa-analyzer-workspace {
    padding: 12px;
    background: #f3f5f7;
}

.gsa-view[hidden] {
    display: none !important;
}

.gsa-view-stage {
    width: min(100%, 520px);
    aspect-ratio: 9 / 16;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: #111820;
}

.gsa-view-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #c8d0d8;
    font-size: 14px;
    letter-spacing: .02em;
}

.gsa-main-menu,
.gsa-sub-menu {
    border-top: 1px solid #e2e6ea;
    background: #fff;
}

.gsa-menu-scroll {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

.gsa-menu-button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #b8bec5;
    border-radius: 8px;
    background: #fff;
    color: #27313b;
    font-size: 13px;
    font-weight: 600;
}

.gsa-menu-button:disabled {
    color: #8a929a;
    background: #f1f3f5;
    cursor: not-allowed;
}

.gsa-sub-menu {
    min-height: 54px;
}

.gsa-sub-menu-content {
    min-height: 54px;
    padding: 8px 12px;
}

/* Stage 5-B: local video and New Swing browser-session UI. */
.gsa-local-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.gsa-video-meta {
    width: min(100%, 520px);
    margin: 8px auto 0;
    color: #5c6670;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.gsa-new-swing-form,
.gsa-new-swing-choice {
    display: grid;
    gap: 12px;
}

.gsa-new-swing-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gsa-form-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.gsa-form-field input[type="text"],
.gsa-form-field select,
.gsa-file-input {
    width: 100%;
    min-height: 38px;
}

.gsa-field-label,
.gsa-sub-menu-title {
    color: #27313b;
    font-size: 13px;
    font-weight: 700;
}

.gsa-sub-menu-title {
    margin: 0;
}

.gsa-field-help {
    color: #6b747d;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.gsa-choice-group {
    margin: 0;
    padding: 0;
    border: 0;
}

.gsa-choice-group label,
.gsa-checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #343d46;
    font-size: 13px;
}

.gsa-checkbox-row,
.gsa-action-row,
.gsa-inline-status {
    grid-column: 1 / -1;
}

.gsa-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gsa-action-button {
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #16803a;
    border-radius: 8px;
    background: #16803a;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.gsa-action-button.is-secondary {
    border-color: #b8bec5;
    background: #fff;
    color: #27313b;
}

.gsa-inline-status {
    min-height: 18px;
    color: #5c6670;
    font-size: 12px;
}

.gsa-inline-status.is-error {
    color: #a52828;
}

.gsa-inline-status.is-success {
    color: #16803a;
}

/* Stage 5-C: local Video Edit controls. */
.gsa-video-edit-panel {
    display: grid;
    gap: 10px;
}

.gsa-video-edit-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gsa-video-edit-toolbar .gsa-action-button.is-active {
    border-color: #16803a;
    box-shadow: 0 0 0 2px rgba(22, 128, 58, .16);
}

.gsa-video-edit-values {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: #5c6670;
    font-size: 12px;
}

.gsa-video-edit-values strong {
    color: #27313b;
}

/* Stage 5-D: browser-only Swing Phase Setting / Phase Capture. */
.gsa-phase-setting-panel {
    display: grid;
    gap: 10px;
}

.gsa-phase-setting-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    color: #5c6670;
    font-size: 12px;
}

.gsa-phase-setting-heading > strong {
    color: #16803a;
    font-size: 13px;
}

.gsa-phase-setting-heading span strong {
    color: #27313b;
}

.gsa-phase-setting-toolbar .gsa-action-button:disabled {
    border-color: #c8cdd2;
    background: #eef0f2;
    color: #8a929a;
    cursor: not-allowed;
}

/* Stage 5-F: Open Swing / Existing Analysis read-only view. */
.gsa-existing-image-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gsa-phase-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.gsa-line-overlay {
    position: absolute;
    pointer-events: none;
    overflow: visible;
}

.gsa-phase-readout,
.gsa-phase-comment-view {
    width: min(100%, 520px);
    margin: 8px auto 0;
    color: #5c6670;
    font-size: 12px;
}

.gsa-phase-comment-view {
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    background: #fff;
    color: #343d46;
    white-space: pre-wrap;
}

.gsa-open-swing-panel {
    display: grid;
    gap: 10px;
}

.gsa-open-swing-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.gsa-project-list {
    display: grid;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
}

.gsa-project-card {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8dde3;
    border-radius: 8px;
    background: #fff;
    color: #27313b;
    text-align: left;
    cursor: pointer;
}

.gsa-project-card:hover:not(:disabled) {
    border-color: #16803a;
}

.gsa-project-card:disabled {
    background: #f4f5f6;
    color: #7b838b;
    cursor: not-allowed;
}

.gsa-project-card span,
.gsa-project-card small {
    font-size: 12px;
}

.gsa-project-status {
    width: fit-content;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef0f2;
    font-weight: 700;
}

.gsa-existing-project-summary {
    display: grid;
    gap: 3px;
    color: #5c6670;
    font-size: 12px;
}

.gsa-existing-project-summary strong {
    color: #27313b;
    font-size: 13px;
}

.gsa-phase-image[hidden] {
    display: none !important;
}


/* Stage 5-G: interactive Analysis Line drawing/editing. */
.gsa-line-overlay.is-interactive {
    pointer-events: auto;
    touch-action: none;
    cursor: crosshair;
}

.gsa-line-overlay.is-interactive .gsa-line-hit-target {
    pointer-events: stroke;
    cursor: move;
}

.gsa-analysis-line.is-selected {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, .65));
}

.gsa-line-handle {
    fill: #fff;
    stroke: #16803a;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    pointer-events: all;
    cursor: grab;
}

.gsa-analysis-panel {
    display: grid;
    gap: 10px;
}

.gsa-analysis-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #5c6670;
    font-size: 12px;
}

.gsa-analysis-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.gsa-line-tool.is-active {
    border-color: #16803a;
    box-shadow: 0 0 0 2px rgba(22, 128, 58, .16);
}

.gsa-analysis-label {
    color: #27313b;
    font-size: 12px;
    font-weight: 700;
}

.gsa-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gsa-color-swatch {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid #c7ccd1;
    border-radius: 50%;
    background: var(--gsa-swatch);
    cursor: pointer;
}

.gsa-color-swatch.is-selected {
    border-color: #16803a;
    box-shadow: 0 0 0 2px rgba(22, 128, 58, .18);
}

.gsa-comment-editor{display:grid;gap:10px}.gsa-comment-textarea{width:100%;min-height:110px;box-sizing:border-box;resize:vertical}


/* Stage 5-K: user-side Pro Analysis request panel. */
.gsa-pro-analysis-panel {
    display: grid;
    gap: 12px;
}

.gsa-pro-analysis-comment {
    width: 100%;
    min-height: 112px;
    box-sizing: border-box;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid #b8bec5;
    border-radius: 8px;
    font: inherit;
    line-height: 1.45;
}

.gsa-pro-analysis-comment:focus {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

/* Stage 7-B-1: responsive public UI refinement. */
.gsa-analyzer-shell {
    max-width: 1120px;
}

@media (min-width: 1024px) {
    .gsa-analyzer-shell:has(.gsa-sub-menu-content:not(:empty)) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        grid-template-areas:
            "phase phase"
            "workspace submenu"
            "menu menu";
        align-items: stretch;
    }

    .gsa-analyzer-shell:has(.gsa-sub-menu-content:not(:empty)) > .gsa-phase-menu {
        grid-area: phase;
    }

    .gsa-analyzer-shell:has(.gsa-sub-menu-content:not(:empty)) > .gsa-analyzer-workspace {
        grid-area: workspace;
        min-width: 0;
    }

    .gsa-analyzer-shell:has(.gsa-sub-menu-content:not(:empty)) > .gsa-main-menu {
        grid-area: menu;
    }

    .gsa-analyzer-shell:has(.gsa-sub-menu-content:not(:empty)) > .gsa-sub-menu {
        grid-area: submenu;
        min-width: 0;
        border-top: 0;
        border-left: 1px solid #e2e6ea;
        background: #fff;
    }

    .gsa-analyzer-shell:has(.gsa-new-swing-form) > .gsa-sub-menu::before {
        content: "Project Information";
        display: block;
        padding: 14px 14px 0;
        color: #27313b;
        font-size: 16px;
        font-weight: 700;
    }

    .gsa-new-swing-form {
        grid-template-columns: 1fr;
    }

    .gsa-checkbox-row,
    .gsa-action-row,
    .gsa-inline-status {
        grid-column: 1;
    }

    .gsa-view-stage {
        width: auto;
        height: min(58vh, 590px);
        max-width: 100%;
        aspect-ratio: 9 / 16;
    }

    .gsa-video-meta,
    .gsa-phase-readout,
    .gsa-phase-comment-view {
        width: min(100%, 560px);
    }

    .gsa-menu-scroll {
        overflow-x: visible;
    }

    .gsa-main-menu .gsa-menu-button {
        flex: 1 1 0;
        min-width: 0;
        padding-inline: 8px;
        white-space: nowrap;
    }

    .gsa-analyzer.is-compare-active .gsa-analyzer-shell {
        display: block;
    }

    .gsa-analyzer.is-compare-active .gsa-analyzer-workspace {
        padding: 12px;
    }
}

/* Stage 7-B-2: centered phase navigation + responsive icon main menu. */
.gsa-phase-menu {
    display: grid;
    gap: 6px;
}

.gsa-phase-track {
    justify-content: center;
    flex-wrap: nowrap;
}

.gsa-phase-item {
    gap: 0;
}

.gsa-phase-current-name {
    min-height: 18px;
    color: #16803a;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.gsa-main-menu {
    position: relative;
    overflow: visible;
}

.gsa-menu-scroll {
    align-items: stretch;
    justify-content: center;
    overflow: visible;
}

.gsa-menu-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
}

.gsa-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.gsa-menu-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gsa-menu-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
}

@media (min-width: 1024px) {
    .gsa-analyzer-shell {
        max-width: 1120px;
    }

    .gsa-analyzer-workspace {
        padding: 10px 12px;
    }

    .gsa-view-stage {
        width: auto;
        height: min(50vh, 500px);
        max-width: 100%;
        aspect-ratio: 9 / 16;
    }

    .gsa-menu-scroll {
        display: grid;
        grid-template-columns: repeat(7, minmax(52px, 1fr));
        gap: 8px;
        padding: 9px 12px;
    }

    .gsa-main-menu .gsa-menu-button {
        width: 100%;
        min-height: 48px;
        padding: 8px;
        overflow: visible;
    }

    .gsa-main-menu .gsa-menu-icon {
        width: 24px;
        height: 24px;
        flex-basis: 24px;
    }

    .gsa-main-menu .gsa-menu-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .gsa-main-menu .gsa-menu-button::after {
        content: attr(data-gsa-tooltip);
        position: absolute;
        left: 50%;
        bottom: calc(100% + 8px);
        z-index: 30;
        transform: translate(-50%, 4px);
        padding: 6px 8px;
        border-radius: 6px;
        background: #27313b;
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
    }

    .gsa-main-menu .gsa-menu-button:hover::after,
    .gsa-main-menu .gsa-menu-button:focus-visible::after {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, 0);
    }

    .gsa-main-menu .gsa-menu-button:focus-visible {
        outline: 2px solid #16803a;
        outline-offset: 2px;
    }
}
