body {
    font-family: system-ui, sans-serif;
    background: #121212;
    color: #e0e0e0;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

.title {
    margin: 0;
}

.app-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background: #1e1e1e;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.controls-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
    background: #252525;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #333;
}

.controls-divider {
    text-align: center;
    color: #777;
    font-size: 0.9rem;
    font-weight: bold;
}

.drop-zone {
    margin: 1.5rem 0;
    background: #252525;
    border: 1px solid #4d4d4d;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #bfbfbf;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.drop-zone[data-state="idle"] {
    border-style: dashed;
}

.drop-zone[data-state="loading"] {
    border-color: #297dbd;
    background: #1f2f3d;
}

.drop-zone[data-state="loaded"] {
    border-color: #666;
    background: #2b2b2b;
}

.drop-zone[data-state="failed"] {
    border-color: #a44141;
    background: #392323;
}

.drop-zone:not([data-state="idle"]) .drop-prompt {
    display: none;
}

.drop-zone[data-state="idle"] .drop-state-text,
.drop-zone[data-state="idle"] .drop-meta,
.drop-zone[data-state="idle"] .drop-actions {
    display: none;
}

.drop-state-text {
    color: #d2d2d2;
    font-size: 0.92rem;
    font-weight: 600;
}

.drop-meta {
    margin-top: 0.35rem;
    color: #dfdfdf;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.drop-meta-sep {
    width: 1px;
    height: 12px;
    background: #737373;
}

.drop-actions {
    margin-top: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.icon-action {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: #cfd7df;
    text-decoration: none;
    cursor: pointer;
}

.icon-action svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.1;
}

.icon-action:hover:not(:disabled) {
    color: #ffffff;
    background: none!important;
}

.icon-action:disabled {
    color: #7a7a7a;
    cursor: not-allowed;
}

.drop-zone.drag-over {
    border-color: #0078d4;
    background: #1b2b39;
}

.drop-zone.disabled {
    opacity: 0.75;
}

.drop-zone.disabled .drop-action,
.drop-zone.disabled .drop-link {
    pointer-events: none;
}

.drop-zone.disabled .icon-action,
.drop-zone.disabled .drop-link {
    pointer-events: none;
}

.drop-link {
    border: none;
    background: transparent;
    color: #62b7ff;
    text-decoration: underline;
    text-underline-offset: 0.15rem;
    font: inherit;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s;
}

.drop-link:hover {
    color: #9ed2ff;
    background: none!important;
}

.drop-link:disabled {
    color: #6f8496;
    cursor: not-allowed;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

select,
input[type="file"] {
    padding: 0.6rem;
    background: #2a2a2a;
    color: white;
    border-radius: 4px;
    border: 1px solid #444;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

button {
    background: #0078d4;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    font-weight: bold;
    transition: background 0.2s;
}

button:hover:not(:disabled) {
    background: #0086ed;
}

button:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.result-table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 1.5rem;
}

.render-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.render-header h3 {
    margin: 0;
}

.render-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.render-tab {
    border: 1px solid #444;
    border-radius: 999px;
    background: #2a2a2a;
    color: #ddd;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
    line-height: 1.2;
}

.render-tab.active {
    background: #0d5ea3;
    border-color: #0d5ea3;
    color: #fff;
}

.render-tab:disabled {
    opacity: 0.7;
}

.canvas-shell {
    margin-top: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.backset {
    position: fixed;
    left: 8px;
    bottom: 0;
    z-index: -1;
    color: #777;
}

.backset a {
    color: #888;
}

.backset a:hover {
    color: #eee;
}

.m\-0 {
    margin: 0;
}

.light-text {
    color: #bbb;
    font-style: italic;
}

@media (max-width: 1750px) {
    .backset {
        position: initial;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
}

.modal-overlay[hidden] {
    display: none;
}

.modal-card {
    width: min(560px, 100%);
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    padding: 1rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-header h4 {
    margin: 0;
}

.modal-close {
    width: auto;
    padding: 0.45rem 0.7rem;
    font-size: 0.9rem;
}

.gallery-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gallery-item {
    width: auto;
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    background: #2d2d2d;
    border: 1px solid #444;
    color: #e0e0e0;
}

.gallery-item:hover:not(:disabled) {
    background: #2d2d2d;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #333;
}

th {
    background: #2a2a2a;
    color: #aaa;
    font-weight: 600;
    white-space: nowrap;
}

td.time {
    font-family: monospace;
    color: #00ffcc;
    font-size: 1.05em;
    white-space: nowrap;
}

td.ops {
    font-family: monospace;
    color: #ffb900;
    font-weight: bold;
    white-space: nowrap;
}

.metric-skeleton {
    display: inline-block;
    height: 0.85rem;
    border-radius: 999px;
    vertical-align: middle;
    min-width: 3.5rem;
    width: 60%;
    background: linear-gradient(90deg, #4a4a4a 0%, #5a5a5a 50%, #4a4a4a 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.25s linear infinite;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.status-panel {
    background: #2a2a2a;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #0078d4;
}

.status {
    color: #ccc;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.load-times {
    margin: 0;
    padding-left: 1.5rem;
    color: #aaa;
    font-size: 0.9em;
}

.converted-warning {
    color: #db4d4d;
    font-weight: bold;
    font-size: 0.8em;
}

canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1px solid #444;
    margin-top: 1.5rem;
    background: #000;
    image-rendering: pixelated;
}

@media (min-width: 768px) {
    body {
        padding: 2rem;
    }

    .card {
        padding: 2rem;
        display: flex;
        flex-direction: column;
    }

    .controls-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .controls-divider {
        margin: 0 1rem;
    }

    select,
    input[type="file"] {
        width: auto;
        flex: 1;
    }

    button {
        width: auto;
    }
}

@media (max-width: 767px) {
    .drop-zone {
        min-height: 128px;
        padding: 1rem 0.95rem;
        justify-content: center;
    }

    .drop-prompt {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.15rem 0.35rem;
    }

    .drop-link {
        font-size: 1rem;
    }

    .drop-state-text {
        font-size: 0.95rem;
    }

    .drop-meta {
        font-size: 0.92rem;
    }

    .drop-actions {
        justify-content: flex-start;
    }

    .drop-prompt {
        margin-bottom: 0.4rem;
    }
}

@media (min-width: 1200px) {
    .app-layout {
        display: grid;
        grid-template-columns: minmax(700px, 780px) minmax(0, 1fr);
        align-items: stretch;
        height: calc(100vh - 4rem);
    }

    .benchmark-pane {
        max-width: 780px;
        height: 100%;
        overflow: auto;
    }

    .benchmark-pane .drop-zone {
        min-height: 64px;
    }

    .benchmark-pane .drop-zone:not([data-state="idle"]) {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .benchmark-pane .drop-zone:not([data-state="idle"]) .drop-state-text {
        margin-right: 0.2rem;
        max-width: calc(100% - 80px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .benchmark-pane .drop-zone:not([data-state="idle"]) .drop-meta {
        margin-top: 0;
    }

    .benchmark-pane .drop-zone:not([data-state="idle"]) .drop-actions {
        margin-top: 0;
        margin-left: auto;
    }

    .benchmark-pane .result-table-container {
        overflow-x: hidden;
    }

    .render-pane {
        height: 100%;
        overflow: auto;
    }
}
