:root {
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
    --neutral-1000: #090b0d;
    --neutral-950: #0d1012;
    --neutral-900: #111416;
    --neutral-850: #181d20;
    --neutral-800: #1d2326;
    --neutral-700: #30373a;
    --neutral-650: #3b4447;
    --neutral-600: #596467;
    --neutral-500: #899395;
    --neutral-300: #c5cbcd;
    --neutral-100: #f2f4f5;
    --viewport-dark-bg: #2d3333;
    --viewport-light-bg: #ffffff;
    --axis-x: #f05b55;
    --axis-y: #69b942;
    --axis-z: #408cd5;
    --teal: #58d5bd;
    --teal-soft: rgba(88, 213, 189, 0.14);
    --teal-border: rgba(88, 213, 189, 0.52);
    --amber: #f3be57;
    --line: rgba(225, 234, 230, 0.12);
    --line-strong: rgba(225, 234, 230, 0.20);
    color-scheme: dark;
    font-family: var(--font-ui);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--neutral-1000);
    color: var(--neutral-100);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

#standalone-app {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--v-ase-export-bg, #ffffff);
}

.viewer-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 24px);
    min-width: 0;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: rgba(15, 20, 21, 0.90);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 120ms ease, transform 120ms ease;
    backdrop-filter: blur(12px);
}

html[data-v-ase-ui="visible"] .viewer-toolbar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.document-title {
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(38vw, 360px);
    padding: 0 6px;
    overflow: hidden;
    color: var(--neutral-100);
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-only-badge {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid var(--teal-border);
    border-radius: 4px;
    background: var(--teal-soft);
    color: #d9fff7;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
}

.icon-button,
.text-button,
.timeline button {
    display: inline-grid;
    place-items: center;
    height: 36px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--neutral-800);
    cursor: pointer;
}

.icon-button {
    width: 36px;
    padding: 0;
}

.text-button {
    grid-auto-flow: column;
    gap: 7px;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 600;
}

.icon-button:hover,
.text-button:hover,
.timeline button:hover {
    border-color: var(--teal-border);
    background: #263130;
}

.icon-button svg,
.text-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.viewer-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--v-ase-export-bg, #ffffff);
}

#viewer-frame {
    position: relative;
    overflow: hidden;
    background: var(--v-ase-export-bg, #ffffff);
}

#standalone-poster {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    background: var(--v-ase-export-bg, #ffffff);
    opacity: 1;
    pointer-events: none;
    will-change: opacity;
    transition: opacity 110ms linear;
}

#standalone-poster.is-releasing {
    opacity: 0;
}

#standalone-poster[hidden] {
    display: none;
}

#viewer-frame canvas {
    position: relative;
    z-index: 2;
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
    touch-action: none;
}

#viewer-frame canvas:active {
    cursor: grabbing;
}

.timeline {
    position: absolute;
    bottom: 16px;
    left: 50%;
    z-index: 15;
    display: grid;
    grid-template-columns: 36px 36px 36px auto minmax(160px, 420px) auto;
    align-items: center;
    gap: 7px;
    width: min(760px, calc(100% - 32px));
    min-height: 50px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: rgba(15, 20, 21, 0.92);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 5px);
    transition: opacity 120ms ease, transform 120ms ease;
    backdrop-filter: blur(12px);
}

.timeline[hidden] {
    display: none;
}

html[data-v-ase-ui="visible"] .timeline {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.timeline button {
    width: 36px;
    padding: 0;
}

.timeline input[type="range"] {
    width: 100%;
    accent-color: var(--teal);
}

.frame-label,
.fps-label {
    color: var(--neutral-300);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: nowrap;
}

.fps-label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.fps-label input {
    width: 48px;
    height: 28px;
    padding: 0 5px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--neutral-950);
    color: var(--neutral-100);
    text-align: right;
}

.metadata-popover {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 18;
    width: min(330px, calc(100% - 24px));
    padding: 13px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: rgba(15, 20, 21, 0.95);
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34);
}

.metadata-popover[hidden] {
    display: none;
}

.metadata-popover h2 {
    margin: 0 0 10px;
    font-size: 15px;
}

.metadata-grid {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px 12px;
    margin: 0;
    font-size: 12px;
}

.metadata-grid dt {
    color: var(--neutral-500);
}

.metadata-grid dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--neutral-100);
}

#boot-error {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 40;
    width: min(520px, calc(100% - 32px));
    padding: 18px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 114, 105, 0.46);
    border-radius: 6px;
    background: var(--neutral-900);
    color: #ffd4d0;
    font-size: 13px;
    line-height: 1.5;
}

#boot-error[hidden] {
    display: none;
}

#download-project[hidden] {
    display: none;
}

@media (max-width: 680px) {
    .viewer-toolbar {
        top: 8px;
        right: 8px;
        max-width: calc(100% - 16px);
    }

    .document-title,
    #download-project-label {
        display: none;
    }

    .timeline {
        grid-template-columns: 30px 30px 30px auto minmax(80px, 1fr);
    }

    .fps-label {
        display: none;
    }

}
