.gh-header:has(+ .aimtrace-tool-page) {
    background-color: #fff;
}

.aimtrace-tool {
    min-height: calc(100vh - 62px);
    font-family: Arial, sans-serif;
    color: #fff;
}

.gh-trace-demo-page {
    background: var(--gh-black);
}

.gh-trace-demo.aimtrace-tool {
    font-family: inherit;
    padding-block: clamp(1.5rem, 4vw, 4rem);
}

.gh-trace-demo .gh-content {
    margin-bottom: clamp(1rem, 2vw, 2rem);
}

.tool-subtitle {
    font-size: 19px;
    font-weight: 700;
    color: #f0f0f0;
    margin: 0 0 12px;
}

.tool-error {
    background-color: rgba(120, 0, 0, 0.65);
    color: #ffffff;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 120, 120, 0.35);
    margin-bottom: 14px;
    font-size: 15px;
}

.tool-canvas-surface {
    background: #ffffff;
    border: 1px solid #2f2f2f;
    border-radius: 8px;
}

.tool-table-wrap {
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    background: #1b1b1b;
    overflow: hidden;
}

.material-inventory-bg {
    background: #121416;
}

.material-inventory-page {
    min-height: calc(100vh - 62px);
    padding: 24px;
    color: #f4f4f4;
}

.material-inventory-shell {
    width: min(1280px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.material-inventory-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #34383c;
    padding-bottom: 16px;
}

.material-inventory-header h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.material-inventory-header p {
    margin: 6px 0 0;
    color: #bfc6cc;
    font-size: 15px;
}

.material-inventory-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 80px;
}

.material-inventory-status {
    min-height: 20px;
    color: #bfc6cc;
    font-size: 14px;
    font-weight: 700;
}

.material-inventory-status[data-tone="success"] {
    color: #9ad7a9;
}

.material-inventory-status[data-tone="pending"] {
    color: #e5c474;
}

.material-inventory-status[data-tone="error"] {
    color: #ffb3a8;
}

.material-inventory-export-button {
    border: 1px solid #7d98ad;
    border-radius: 6px;
    padding: 9px 14px;
    background: #202b35;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.material-inventory-export-button:hover {
    background: #2e4963;
    border-color: #9fb9cf;
}

.material-inventory-export-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.material-inventory-tables {
    display: grid;
    gap: 18px;
}

.material-inventory-table-card {
    display: grid;
    gap: 10px;
}

.material-inventory-table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.material-inventory-table-card h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

.material-inventory-table-title {
    min-width: 120px;
    outline: none;
}

.material-inventory-table-title:focus {
    border-radius: 4px;
    background: #263241;
    box-shadow: 0 0 0 2px #87a6c1;
}

.material-inventory-remove-table-link {
    flex: 0 0 auto;
    color: #ffb3a8;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.material-inventory-remove-table-link:hover {
    color: #ffd5cf;
    text-decoration: underline;
}

.material-inventory-table-wrap {
    overflow-x: auto;
    border: 1px solid #34383c;
    border-radius: 8px;
    background: #191b1e;
}

.material-inventory-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    table-layout: fixed;
}

.material-inventory-col-1 {
    width: 64px;
}

.material-inventory-col-2 {
    width: 38%;
}

.material-inventory-col-3 {
    width: 18%;
}

.material-inventory-col-4 {
    width: auto;
}

.material-inventory-col-actions {
    width: 118px;
}

.material-inventory-table th,
.material-inventory-table td {
    border-bottom: 1px solid rgba(180, 190, 200, 0.22);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.material-inventory-table th {
    background: #202429;
    color: #ffffff;
    font-weight: 700;
}

.material-inventory-table td {
    color: #f0f0f0;
    min-height: 38px;
}

.material-inventory-table tbody tr:last-child td {
    border-bottom-color: rgba(180, 190, 200, 0.28);
}

.material-inventory-table td[contenteditable="true"] {
    outline: none;
}

.material-inventory-table td[contenteditable="true"]:focus {
    background: #263241;
    box-shadow: inset 0 0 0 2px #87a6c1;
}

.material-inventory-table tbody tr:nth-child(even) td {
    background: #17191c;
}

.material-inventory-table tbody tr:nth-child(even) td[contenteditable="true"]:focus {
    background: #263241;
}

.material-inventory-number-cell,
.material-inventory-table th:first-child {
    color: #bfc6cc;
    text-align: center;
    font-weight: 700;
}

.material-inventory-remove-cell {
    text-align: right;
    white-space: nowrap;
}

.material-inventory-remove-cell a {
    color: #ffb3a8;
    font-weight: 700;
    text-decoration: none;
}

.material-inventory-remove-cell a:hover {
    color: #ffd5cf;
    text-decoration: underline;
}

.material-inventory-table tfoot td {
    border-bottom: 0;
    padding: 10px 12px;
    background: #191b1e;
}

.material-inventory-add-button {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #7d98ad;
    border-radius: 50%;
    background: #202b35;
    color: #ffffff;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
}

.material-inventory-add-button:hover {
    background: #2e4963;
    border-color: #9fb9cf;
}

.material-inventory-page-actions {
    display: flex;
    justify-content: flex-start;
}

.material-inventory-add-table-button {
    border: 1px solid #7d98ad;
    border-radius: 6px;
    padding: 9px 14px;
    background: #202b35;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.material-inventory-add-table-button:hover {
    background: #2e4963;
    border-color: #9fb9cf;
}

@media (max-width: 720px) {
    .material-inventory-page {
        padding: 18px 14px;
    }

    .material-inventory-header {
        align-items: stretch;
        flex-direction: column;
    }

    .material-inventory-actions {
        justify-content: space-between;
    }
}

.shots-list-wrap {
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
}

.shots-list-panel {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.last-second-panel {
    width: 100%;
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 16px 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.last-second-title {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.shots-list-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    font-size: 16px;
}

.shots-list-summary-column {
    display: grid;
    gap: 8px;
    align-content: start;
}

.shots-list-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
}

.shots-list-summary-subtitle {
    color: #87a6c1;
    font-weight: 700;
    margin-top: 6px;
}

.shots-list-summary-subtitle:first-child {
    margin-top: 0;
}

.last-second-label {
    color: #cfcfcf;
}

.last-second-value {
    color: #ffffff;
    font-weight: 600;
    text-align: right;
    min-width: 120px;
}

.series-table-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: start;
}

.series-table-wrap {
    overflow: hidden;
}

.series-table {
    width: 100%;
    border-collapse: collapse;
    background: #1b1b1b;
}

.series-table td {
    padding: 8px 10px;
    text-align: left;
    font-size: 1rem;
    border-bottom: 1px solid #2f2f2f;
    color: #e6e6e6;
}

.series-table tbody tr {
    cursor: pointer;
    user-select: none;
}

.series-table tbody tr.selected td {
    background: #2a3a4a;
}

.series-table td:last-child {
    text-align: right;
    color: #fff;
    font-weight: 600;
}

.shots-table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.shots-table {
    width: 100%;
    border-collapse: collapse;
    background: #1b1b1b;
}

.shots-table th,
.shots-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #2f2f2f;
    text-align: center;
    vertical-align: middle;
    font-size: 1rem;
}

.shots-table th {
    background: #222;
    color: #87a6c1;
    font-weight: 600;
    white-space: normal;
    line-height: 1.2;
}

.shots-table td {
    color: #e6e6e6;
}

.shots-table thead tr {
    border-bottom: 0;
}

.shots-table thead tr:first-child th {
    vertical-align: middle;
    border-bottom: 0;
}

.shots-table thead tr:first-child th[colspan] {
    position: relative;
    padding-bottom: 14px;
}

.shots-table thead tr:first-child th[colspan]::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    background: #87a6c1;
    border-radius: 2px;
}

.shots-table tbody tr:nth-child(even) td {
    background: #1f1f1f;
}

.shots-table tbody tr {
    cursor: pointer;
    user-select: none;
}

.shots-table tbody tr.selected td {
    background: #2a3a4a;
}

.gh-trace-demo :is(.series-table, .shots-table) tbody tr:hover td {
    background: var(--gh-red);
    color: var(--gh-white);
}

.shots-direction-arrow {
    display: inline-block;
    transform: rotate(var(--angle, 0deg));
    transform-origin: center;
    font-size: 16px;
    line-height: 1;
    color: inherit;
}

.shots-list-content {
    display: block;
}

.shots-big-target-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.trace-target-frame {
    width: min(100%, 80rem);
    margin-inline: auto;
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 14px 16px;
    box-sizing: border-box;
}

@media (max-width: 520px) {
    .tool-subtitle {
        font-size: 18px;
    }
}

/* Trace analysis demo */
    .tt-frame-shell {
        position: relative;
        width: 100%;
        aspect-ratio: 1 / 1;
    }

    .shots-big-target-shell {
        width: 100%;
    }

    .review-shots-controls {
        position: absolute;
        left: 10px;
        bottom: 12px;
        z-index: 3;
        display: flex;
        gap: 8px;
    }

    .review-shots-navigation {
        position: absolute;
        right: 12px;
        bottom: 14px;
        z-index: 3;
        display: flex;
        gap: 10px;
    }

    .review-shots-navigation .gh-btn,
    .review-shots-controls .gh-btn {
        justify-content: center;
        min-width: 0;
        min-height: 38px;
        margin: 0;
    }

    .review-shots-nav-btn {
        font-size: clamp(0.6875rem, 1vw, 0.875rem);
        padding: 7px 12px;
    }

    .review-shots-play-btn {
        width: 38px;
        height: 38px;
        padding: 0;
    }

    .review-shots-icon {
        position: relative;
        display: block;
        width: 16px;
        height: 16px;
    }

    .review-shots-icon-play::before {
        content: "";
        position: absolute;
        left: 4px;
        top: 2px;
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 9px solid #fff;
    }

    .review-shots-play-btn.is-pause .review-shots-icon-play::before,
    .review-shots-play-btn.is-pause .review-shots-icon-play::after {
        content: "";
        position: absolute;
        top: 2px;
        width: 4px;
        height: 12px;
        background: #fff;
        border-radius: 1px;
    }

    .review-shots-play-btn.is-pause .review-shots-icon-play::before {
        left: 3px;
        border: 0;
    }

    .review-shots-play-btn.is-pause .review-shots-icon-play::after {
        right: 3px;
    }

    .review-shots-icon-stop::before {
        content: "";
        position: absolute;
        left: 3px;
        top: 3px;
        width: 10px;
        height: 10px;
        background: #fff;
        border-radius: 1px;
    }

    .shots-big-target-canvas {
        width: 100%;
        height: 100%;
        display: block;
        background: #ffffff;
        border-radius: 8px;
        border: 1px solid #2f2f2f;
    }

    .shots-legend {
        margin-top: 10px;
        background: #1b1b1b;
        border: 1px solid #323232;
        border-radius: 8px;
        padding: 10px 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .shots-legend-title {
        font-size: 1.125rem;
        font-weight: 700;
        color: #ececec;
        margin-bottom: 6px;
    }

    .shots-legend-list {
        margin: 0;
        padding-left: 18px;
        color: #d6d6d6;
        font-size: 1rem;
        line-height: 1.35;
    }

    .shots-legend-list li + li {
        margin-top: 4px;
    }

    .legend-swatch {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 2px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        vertical-align: -1px;
        margin-right: 5px;
    }

    .legend-swatch.pre {
        background: linear-gradient(90deg, #0a63d1 0%, #1fae70 100%);
    }

    .legend-swatch.last-second {
        background: #f2bc2e;
    }

    .legend-swatch.after-shot {
        background: #c93a33;
    }

    .legend-crosshair {
        color: #2c9cff;
        font-weight: 700;
        margin-right: 5px;
    }

    .shot-diagnostics {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 14px;
        width: min(100%, 56rem);
        margin: 14px auto 0;
    }

    .shot-diagnostic-panel {
        background: #1f1f1f;
        border: 1px solid #3a3a3a;
        border-radius: 8px;
        padding: 12px;
        min-width: 0;
        box-sizing: border-box;
    }

    .shot-diagnostic-title {
        color: #ececec;
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 10px;
    }

    .shot-diagnostic-title-stacked {
        margin-top: 14px;
    }

    .shot-image-wrap {
        position: relative;
        width: 100%;
        aspect-ratio: 1 / 1;
        background: #111;
        border: 1px solid #3a3a3a;
        border-radius: 8px;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .shot-image-canvas {
        display: none;
        width: 100%;
        height: 100%;
        object-fit: contain;
        aspect-ratio: 1 / 1;
    }

    .shot-image-empty {
        color: #bdbdbd;
        font-size: 1rem;
        padding: 0 12px;
        text-align: center;
    }

    .imu-graph-canvas {
        width: 100%;
        height: 178px;
        display: block;
        background: #111;
        border: 1px solid #3a3a3a;
        border-radius: 8px;
    }

    .analyze-session-target-panel {
        width: min(100%, calc(64rem + 34px));
        margin-inline: auto;
        background: #1f1f1f;
        border: 1px solid #3a3a3a;
        border-radius: 12px;
        padding: 14px 16px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .session-target-canvas {
        width: 100%;
        aspect-ratio: 1 / 1;
        display: block;
        background: #ffffff;
        border-radius: 8px;
        border: 1px solid #2f2f2f;
    }

    @media (max-width: 900px) {
        .shots-list-summary-grid {
            grid-template-columns: minmax(0, 1fr);
        }

        .shot-diagnostics {
            grid-template-columns: minmax(0, 1fr);
        }

        .series-table-row {
            grid-template-columns: 1fr;
        }
    }

.shot-target-page .gh-section {
    padding-block: clamp(1.5rem, 4vw, 4rem);
}

.shot-target-page :is(h1, h2, p) {
    overflow-wrap: anywhere;
}

.shot-target-image-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.shot-target-dropzone {
    display: block;
    min-width: 0;
    max-width: min(100%, 22rem);
    padding: 0.75rem;
    margin-inline-start: auto;
    border: 2px dashed var(--gh-dark-grey);
    background: var(--gh-light-grey);
    font: inherit;
    color: var(--gh-black);
    text-align: center;
    cursor: pointer;
}

.shot-target-dropzone:is(:hover, :focus-visible, .dragover) {
    border-color: var(--gh-red);
}

.shot-target-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1rem, 3vw, 3rem);
    align-items: start;
}

.shot-target-image-frame {
    width: min(100%, 56.25rem);
    margin-inline: auto;
    overflow: hidden;
    background: var(--gh-light-grey);
}

.shot-target-image-frame p {
    padding: 1rem;
    text-align: center;
}

.shot-target-canvas:not([hidden]) {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

.shot-target-field select {
    margin-bottom: 0;
}

.shot-target-edge-actions {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
}

.shot-target-edge-actions .gh-btn,
.shot-target-results .gh-btn {
    justify-content: center;
    text-align: center;
    min-width: 0;
    min-height: 3rem;
    margin: 0;
    padding: 0.5rem 1rem;
    white-space: normal;
}

.shot-target-edge-actions .gh-btn {
    width: 100%;
}

.shot-target-edge-actions .gh-btn.active,
#add-shot-btn.active {
    background-color: var(--gh-red);
    border-color: var(--gh-red);
}

.shot-target-summary {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.shot-target-summary dt {
    font-weight: 700;
}

.shot-target-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.shot-target-results {
    margin-top: clamp(2.5rem, 6vw, 6rem);
}

.shot-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.shot-table-toolbar h2 {
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

.shot-table-toolbar .gh-btn {
    align-self: center;
}

.shot-table-toolbar + p {
    margin-top: 1rem;
}

.shot-table-wrap {
    width: 100%;
    overflow: auto;
    margin-block: 1.5rem;
}

.shot-target-table {
    width: 100%;
}

.shot-target-session-canvas {
    display: block;
    width: min(100%, 64rem);
    margin-inline: auto;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--gh-light-grey);
}

.shot-direction {
    display: inline-block;
    font-weight: 700;
    transform: rotate(var(--shot-angle, 0deg));
}

.shot-delete-link {
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.shot-target-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

@media (min-width: 900px) {
    .shot-target-workspace {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }

    .shot-target-image-controls {
        flex-wrap: nowrap;
    }
}
