:root {
    --accent: #FFD700;
    --bg: #000000;
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.7);
    --text-faint: rgba(255, 255, 255, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --ok: #3ad18c;
    --err: #ff6b6b;
    --font: 'Urbanist', sans-serif;
    --font-mono: 'Consolas', 'Menlo', 'SFMono-Regular', monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

::selection {
    background: var(--accent);
    color: #000;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* ---------- Grid canvas background ---------- */
#grid-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

/* ---------- Loader (idéntico a HATCH.it) ---------- */
#loader {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.loader-mark {
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    animation: loader-pulse 1.6s ease-in-out infinite;
}

.loader-mark .icon {
    width: 28px;
    height: 28px;
}

@keyframes loader-pulse {
    0%,
    100% {
        transform: scale(0.94);
        opacity: 0.55;
    }

    50% {
        transform: scale(1);
        opacity: 1;
    }
}

.loader-name {
    font-size: 1.15rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-weight: 300;
}

.loader-dot {
    color: var(--accent);
}

.loader-bar {
    width: 180px;
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.loader-bar-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
}

/* ---------- Header ---------- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 28px;
    pointer-events: none;
}

body.is-embedded .site-header {
    padding: 24px 28px;
}

@media (min-width: 1024px) {
    body.is-embedded .site-header {
        padding-top: 32px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    min-height: 40px;
    pointer-events: auto;
}

body.is-embedded .header-left,
body.is-embedded .header-right {
    min-height: 48px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.logo-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--accent);
    background: rgba(0, 0, 0, 0.55);
}

.logo-mark .icon {
    width: 18px;
    height: 18px;
}

.logo-name {
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-left: 0.2em;
}

.logo-dot {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 40px;
    flex-shrink: 0;
}

body.is-embedded .header-right {
    padding-right: clamp(56px, 5vw, 96px);
}

.header-drawer-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 2px;
    border: none;
    background: none;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.25s var(--ease);
}

.header-drawer-btn .icon {
    width: 15px;
    height: 15px;
}

.header-drawer-btn:hover,
.header-drawer-btn.is-active {
    color: var(--accent);
}

.site-x {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
    border-radius: 10px;
    pointer-events: auto;
}

.site-x .icon {
    width: 22px;
    height: 22px;
}

.site-x:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

/* ---------- Language switch ---------- */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switch-fixed {
    position: fixed;
    bottom: 22px;
    left: 22px;
    z-index: 200;
    padding: 8px 15px;
    border-radius: 12px;
    background: rgba(8, 8, 8, 0.78);
    border: 1px solid var(--border-strong);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: color 0.25s var(--ease);
    padding: 4px 2px;
}

.lang-btn:hover {
    color: var(--text);
}

.lang-btn.is-active {
    color: var(--accent);
}

.lang-sep {
    width: 1px;
    height: 14px;
    background: var(--border-strong);
}

/* ---------- Glass ---------- */
.glass {
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: clamp(16px, 1.4vw, 24px);
    padding: clamp(16px, 1.5vw, 28px);
}

/* ---------- Full-Width App Shell (100% Window Width) ---------- */
.app-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100dvh;
    min-height: 620px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewport-stage-shell {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.viewer-stage {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.3s var(--ease), box-shadow 0.2s var(--ease);
}

.viewer-stage.has-cloud {
    background: rgba(0, 0, 0, 0.56);
    cursor: default;
}

.viewer-stage.is-dragover {
    box-shadow: inset 0 0 0 2px var(--accent);
}

#viewer3d-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.viewer-stage.has-cloud #viewer3d-canvas {
    opacity: 1;
    pointer-events: auto;
}

#viewer3d-canvas.is-dragging {
    cursor: grabbing;
}

#viewer3d-canvas.is-selecting {
    cursor: crosshair;
}

#select-overlay-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

/* Aviso inicial de carga: solo visible antes de la primera carga */
.viewer-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 72px 24px 24px;
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.viewer-empty-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: transform 0.3s var(--ease);
}

.viewer-empty-plus .plus-icon {
    width: 42px;
    height: 42px;
    stroke: var(--accent);
    transition: transform 0.3s var(--ease), stroke 0.3s var(--ease);
}

.viewer-empty:hover .viewer-empty-plus .plus-icon {
    stroke: #ffffff;
    transform: rotate(90deg);
}

.viewer-empty-title {
    font-size: 1.15rem;
    font-weight: 300;
    letter-spacing: 0.06em;
    color: var(--text);
}

.viewer-empty-formats {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    color: var(--text-faint);
    text-transform: uppercase;
}

/* Archivo activo alineado junto al título en cabecera */
.dropzone-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 18px;
    border-left: 1px solid var(--border-strong);
    max-width: 380px;
    min-width: 0;
}

.dropzone-file .icon {
    width: 14px;
    height: 14px;
    color: var(--accent);
}

.file-name {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 0.7rem;
    color: var(--text-faint);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.file-deleted {
    font-size: 0.7rem;
    color: var(--accent);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.file-clear {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.file-clear:hover {
    color: var(--accent);
}

/* Barra inferior del visor 3D: contador acumulado izq + controles 3D der */
.viewer-bottom-bar {
    position: absolute;
    left: 28px;
    right: 28px;
    bottom: 16px;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    pointer-events: none;
}

.global-counter {
    pointer-events: auto;
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: var(--text-faint);
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.3s var(--ease);
}

.global-counter.is-updating {
    color: var(--text-dim);
}

.global-counter-value,
.global-counter-label {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    color: inherit;
}

.global-counter-value {
    font-variant-numeric: tabular-nums;
}

.cad-toolbar {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.cad-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cad-aux {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cad-toolbar > :not(.hidden) ~ .cad-aux {
    padding-left: 12px;
    border-left: 1px solid var(--border-strong);
}

.cad-measure-readout {
    color: var(--accent);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1;
}

.cad-btn.is-danger {
    color: var(--accent);
    font-weight: 600;
}

.cad-btn.is-danger:hover:not(:disabled) {
    color: #ffffff;
}

.cad-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 2px;
    border: none;
    background: none;
    color: var(--text-faint);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    cursor: pointer;
    transition: color 0.2s var(--ease);
    line-height: 1;
}

.cad-btn.cad-btn-icon {
    padding: 4px 4px;
}

.cad-btn .icon {
    width: 14px;
    height: 14px;
}

.cad-btn:hover:not(:disabled) {
    color: var(--text);
}

.cad-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

.cad-btn.is-active {
    color: var(--accent);
    font-weight: 600;
}

/* ---------- Panel lateral deslizable (Ajustes) — nunca tapa barra 3D inferior ---------- */
.inspector-drawer {
    position: absolute;
    top: 86px;
    right: 20px;
    bottom: auto;
    max-height: calc(100% - 144px);
    width: min(340px, calc(100vw - 40px));
    z-index: 15;
    display: flex;
    flex-direction: column;
    background: rgba(6, 6, 6, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 16px 18px;
    transform: translateX(calc(100% + 28px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.32s var(--ease), opacity 0.22s var(--ease);
}

.inspector-drawer.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.drawer-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.drawer-title {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    color: var(--accent);
    text-transform: uppercase;
}

.drawer-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text-dim);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.drawer-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.drawer-close .icon {
    width: 15px;
    height: 15px;
}

.controls.workbench-controls {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.25) transparent;
    padding-right: 4px;
}

.controls-group {
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}

.controls-group:last-child {
    border-bottom: none;
}

.group-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 2px;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
}

.group-num {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.28em;
    color: var(--accent);
}

.group-title {
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    flex: 1;
}

.group-chevron {
    width: 15px;
    height: 15px;
    transition: transform 0.32s var(--ease);
    color: var(--text-dim);
}

.group-header[aria-expanded="true"] .group-chevron {
    transform: rotate(180deg);
}

.group-collapse {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    overflow: hidden;
    transition: grid-template-rows 0.32s var(--ease), opacity 0.22s var(--ease);
}

.group-header[aria-expanded="true"] + .group-collapse {
    grid-template-rows: 1fr;
    opacity: 1;
}

.group-collapse > .group-body {
    min-height: 0;
    overflow: hidden;
    padding: 0 2px;
    transition: padding 0.32s var(--ease);
}

.group-header[aria-expanded="true"] + .group-collapse > .group-body {
    padding: 2px 2px 14px;
}

.field {
    margin-bottom: 12px;
}

.field:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.text-input,
select {
    width: 100%;
    padding: 8px 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 300;
    outline: none;
    transition: border-color 0.25s var(--ease);
}

.text-input:focus,
select:focus {
    border-color: var(--accent);
}

.text-input::placeholder {
    color: var(--text-faint);
}

select {
    appearance: none;
    color-scheme: dark;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23FFD700' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

select option {
    background: #000000;
    color: var(--text);
}

.xyz-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.xyz-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.xyz-tag {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 600;
}

.xyz-cell .text-input {
    padding: 7px 8px;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-val {
    min-width: 44px;
    text-align: right;
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 2px;
    background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--border-strong) var(--fill, 0%));
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #000;
    border: 2px solid var(--accent);
    transition: transform 0.2s var(--ease);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.18);
}

input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #000;
    border: 2px solid var(--accent);
}

/* ---------- Toggles ---------- */
.toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle:last-child {
    margin-bottom: 0;
}

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-strong);
    position: relative;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
    flex-shrink: 0;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.toggle input:checked + .toggle-track {
    background: rgba(255, 215, 0, 0.18);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(16px);
    background: var(--accent);
}

.toggle-label {
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--text-dim);
    line-height: 1.35;
}

/* ---------- Meta & Output Tree ---------- */
.meta-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.76rem;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.meta-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.meta-key {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    text-transform: uppercase;
    flex-shrink: 0;
}

.meta-val {
    color: var(--text);
    font-weight: 400;
    text-align: right;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.output-tree {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}

.tree-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tree-line.is-indent {
    padding-left: 14px;
    color: var(--text-faint);
}

.tree-path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-path strong {
    color: var(--accent);
    font-weight: 500;
}

.tree-size {
    color: var(--text-faint);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Alerta flotante */
.alert-box {
    position: absolute;
    left: 50%;
    bottom: 64px;
    transform: translateX(-50%);
    z-index: 20;
    max-width: min(640px, calc(100vw - 48px));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid rgba(255, 90, 90, 0.45);
    border-radius: 12px;
    background: rgba(16, 6, 6, 0.94);
    color: #ffb8b8;
    font-size: 0.8rem;
    line-height: 1.45;
}

.alert-box .icon {
    width: 16px;
    height: 16px;
    color: var(--err);
    margin-top: 1px;
}

.alert-box.is-warning {
    border-color: rgba(255, 215, 0, 0.42);
    background: rgba(18, 15, 4, 0.94);
    color: #ffe999;
}

.alert-box.is-warning .icon {
    color: var(--accent);
}

/* ---------- Dock inferior traslúcido (separado de ES | EN) ---------- */
.workbench-dock {
    position: relative;
    z-index: 12;
    flex: 0 0 auto;
    width: 100%;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-strong);
    padding: 14px 28px 16px 156px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: clamp(18px, 2vw, 36px);
}

/* Zona 1: Progreso + Métricas planas */
.dock-telemetry {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-pct {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.progress-track {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.progress-fill {
    width: 100%;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.2s var(--ease);
}

.dock-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dock-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.metric-label {
    font-size: 0.56rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    color: var(--text-faint);
    text-transform: uppercase;
    white-space: nowrap;
}

.metric-value {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value.is-accent {
    color: var(--accent);
}

/* Zona 2: Cronómetro puro */
.exec-timer-box {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding: 0 22px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    user-select: none;
}

.timer-value {
    font-size: clamp(1.65rem, 2.2vw, 2.6rem);
    font-weight: 300;
    letter-spacing: 0.03em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.timer-unit {
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent);
}

/* Zona 3: Selector a la izquierda del botón compacto, en una sola fila */
.workbench-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    min-width: 0;
}

.pattern-type-options {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.circular-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.circular-check input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.circular-check .check-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.03);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s var(--ease);
    flex-shrink: 0;
}

.circular-check .check-circle::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.circular-check input[type="radio"]:checked + .check-circle {
    border-color: var(--accent);
    background: rgba(255, 215, 0, 0.12);
}

.circular-check input[type="radio"]:checked + .check-circle::after {
    transform: scale(1);
}

.circular-check .check-label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    color: var(--text-dim);
    text-transform: uppercase;
    transition: color 0.25s var(--ease);
}

.circular-check input[type="radio"]:checked ~ .check-label {
    color: var(--text);
    font-weight: 600;
}

.circular-check:hover .check-circle {
    border-color: var(--accent);
}

.sim-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ghost-btn,
.gold-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 22px;
    border-radius: 999px;
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s var(--ease);
}

.gold-btn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #000000;
}

.gold-btn:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.22);
    transform: translateY(-1px);
}

.gold-btn:disabled,
.ghost-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ghost-btn {
    background: none;
    border: 1px solid var(--border-strong);
    color: var(--text);
}

.ghost-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.gold-btn .icon,
.ghost-btn .icon {
    width: 15px;
    height: 15px;
}

/* ---------- Hero (idéntico a HATCH.it) ---------- */
.hero {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

.hero-eyebrow {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.45em;
    color: var(--text-dim);
    margin-bottom: 22px;
}

.hero-title {
    font-size: clamp(3.8rem, 13vw, 11rem);
    font-weight: 200;
    letter-spacing: 0.08em;
    line-height: 1;
    user-select: none;
}

.hero-dot {
    color: var(--accent);
}

.hero-sub {
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

/* ---------- FAQ (idéntico a HATCH.it) ---------- */
.faq-section {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 80px;
}

.faq-title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 200;
    letter-spacing: 0.06em;
    text-align: center;
    margin-bottom: 36px;
}

.faq-card {
    padding: 12px clamp(24px, 4vw, 48px) clamp(24px, 4vw, 48px);
}

.faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    cursor: pointer;
    list-style: none;
    padding: 22px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.faq-question::-webkit-details-marker {
    display: none;
}

.faq-question h3 {
    font-size: 1.05rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.92);
    margin: 0;
}

.faq-question::after {
    content: "+";
    font-size: 1.4rem;
    font-weight: 200;
    color: var(--accent);
    transition: transform 0.35s var(--ease);
    flex-shrink: 0;
}

.faq-item[open] .faq-question::after {
    transform: rotate(45deg);
}

.faq-answer {
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.65);
    text-align: justify;
    padding: 0 0 22px 16px;
    border-left: 2px solid rgba(255, 215, 0, 0.3);
}

/* ---------- Footer ---------- */
.site-footer {
    position: relative;
    z-index: 1;
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 24px 72px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-faint);
    letter-spacing: 0.12em;
}

.footer-hint {
    color: var(--text-dim);
}

.site-footer a,
.footer-brand,
.footer-designer {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover,
.footer-brand:hover,
.footer-designer:hover {
    color: var(--accent);
}

.footer-copy {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.footer-sep {
    color: var(--border-strong);
    margin: 0 4px;
}

/* ---------- Focus ---------- */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .app-shell {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .viewport-stage-shell {
        height: 64vh;
        min-height: 420px;
    }

    .workbench-dock {
        grid-template-columns: 1fr;
        padding: 16px 20px 68px;
        gap: 16px;
    }

    .exec-timer-box {
        border-left: none;
        border-right: none;
        justify-content: flex-start;
        padding: 0;
    }
}

@media (max-width: 760px) {
    .site-header {
        padding: 14px 16px;
        gap: 10px;
    }

    .header-left .dropzone-file {
        display: none;
    }

    .global-counter-label {
        display: none;
    }

    .dock-metrics-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .viewer-bottom-bar {
        left: 14px;
        right: 14px;
        bottom: 12px;
    }

    .lang-switch-fixed {
        bottom: 14px;
        left: 14px;
        padding: 6px 12px;
    }

    .workbench-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 12px 18px;
    }

    .sim-actions-bar {
        flex-direction: column;
        width: 100%;
    }

    .sim-actions-bar .gold-btn,
    .sim-actions-bar .ghost-btn {
        width: 100%;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
