:root {
    --fondo: #eef1f0; --tinta: #1f2430; --suave: #5f6673; --linea: rgba(31, 36, 48, .12);
    --panel: rgba(255, 255, 255, .86); --activo: #1f2430; --activo-tinta: #fff;
    --borde-px: 0 0 0 1.5px var(--tinta), 4px 4px 0 0 rgba(0, 0, 0, .14);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --fondo: #12141b; --tinta: #e9ebf0; --suave: #9aa1ae; --linea: rgba(233, 235, 240, .14); --panel: rgba(24, 27, 36, .86); --activo: #e9ebf0; --activo-tinta: #12141b; }
}
:root[data-theme="dark"] { --fondo: #12141b; --tinta: #e9ebf0; --suave: #9aa1ae; --linea: rgba(233, 235, 240, .14); --panel: rgba(24, 27, 36, .86); --activo: #e9ebf0; --activo-tinta: #12141b; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--tinta); font: 400 13px/1.4 Poppins, system-ui, sans-serif; }
#lienzo { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; cursor: grab; }
#lienzo:active { cursor: grabbing; }

.titulo { position: fixed; top: 20px; left: 20px; max-width: 262px; padding: 10px 12px; background: var(--panel); backdrop-filter: blur(8px); box-shadow: var(--borde-px); border-radius: 12px; pointer-events: none; }
.titulo .pre { margin: 0 0 4px; font: 9px/1 Silkscreen, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); }
.titulo h1 { margin: 0 0 6px; font: 28px/1 Silkscreen, monospace; letter-spacing: .06em; text-transform: uppercase; }
.titulo .txt { margin: 0; color: var(--suave); font-size: 14px; }

.reloj { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: baseline; padding: 6px 14px; background: #161a26; color: #f2f2f2; border-radius: 6px; font: 12px/1 Silkscreen, monospace; pointer-events: none; }
.reloj b { font-size: 16px; font-weight: 400; }
.reloj span { color: #b9c0d0; }

.panel { position: fixed; top: 20px; right: 20px; width: 224px; padding: 12px; background: var(--panel); backdrop-filter: blur(8px); box-shadow: var(--borde-px); border-radius: 14px; max-height: calc(100vh - 40px); overflow: auto; }
.panel section + section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--linea); }
.panel h2 { margin: 0 0 7px; font: 10px/1 Silkscreen, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--suave); font-weight: 400; }
.fila2, .fila3 { display: grid; gap: 4px; margin-bottom: 6px; }
.fila2 { grid-template-columns: 1fr 1fr; }
.fila3 { grid-template-columns: 1fr 1fr 1fr; }
.panel button { font: 500 12.5px/1 Poppins, system-ui, sans-serif; color: var(--tinta); background: transparent; border: 0; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--linea); padding: 7px 4px 6px; cursor: pointer; }
.panel button:hover { box-shadow: inset 0 0 0 1px var(--suave); }
.panel button[aria-pressed="true"] { background: var(--activo); color: var(--activo-tinta); box-shadow: inset 0 0 0 2px var(--activo), inset 0 -3px 0 2px rgba(0, 0, 0, .25); }
.panel button:focus-visible, .panel input:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
.panel input[type="range"] { width: 100%; accent-color: var(--activo); margin: 4px 0 6px; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; color: var(--suave); cursor: pointer; }
.check input { accent-color: var(--activo); margin: 0; }
.panel button.ancho { width: 100%; margin-top: 4px; }
.panel .nota { margin: 2px 0 0; color: var(--suave); font-size: 13px; }
.pie-panel { display: grid; grid-template-columns: auto 1fr; gap: 6px; margin-top: 12px; }
.panel .inicio { display: grid; place-items: center; padding: 0 10px; color: var(--tinta); text-decoration: none; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--linea); }
.panel .inicio:hover { background: var(--activo); color: var(--activo-tinta); }
.panel.cerrado section { display: none; }
.panel.cerrado { width: auto; }
.panel.cerrado .pie-panel { margin: 0; }
.panel.cerrado .ocultar { padding: 7px 10px 6px; }

.ayuda { position: fixed; left: 20px; bottom: 16px; margin: 0; padding: 5px 9px 4px; background: var(--panel); box-shadow: var(--borde-px); border-radius: 10px; color: var(--suave); font-size: 13px; pointer-events: none; }
kbd { font: 9px/1 Silkscreen, monospace; padding: 2px 4px; border: 1px solid var(--linea); border-radius: 3px; background: var(--panel); color: var(--tinta); }

body.limpio .titulo, body.limpio .reloj, body.limpio .panel, body.limpio .ayuda { display: none; }
.etiqueta-web { position: fixed; z-index: 20; padding: 6px 10px; border-radius: 8px; background: #0a0f1d; color: #e6ebf5; font: 600 13px/1 Poppins, system-ui, sans-serif; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; box-shadow: 0 0 0 1px rgba(255,193,7,.5); }
.etiqueta-web.visible { opacity: 1; transform: none; }

/* Cronómetro, estilo pixel art: pantalla de cristal líquido con borde escalonado */
.crono-pantalla { margin: 2px 4px 10px; padding: 10px 8px 7px; text-align: center; background: #161a26; color: #ffd166;
    font: 26px/1 Silkscreen, monospace; letter-spacing: .06em; text-shadow: 2px 2px 0 #7a4b12;
    box-shadow: 0 -3px 0 0 #0b0d14, 0 3px 0 0 #0b0d14, -3px 0 0 0 #0b0d14, 3px 0 0 0 #0b0d14, inset 0 0 0 2px #2a3047; }
#reloj-ciudad i { font-style: normal; animation: crono-latido 1s steps(1) infinite; }
.reloj-ciudad .nota { text-align: center; margin: -4px 0 0 !important; }
.crono.parado .crono-pantalla { color: #8a8fa3; text-shadow: 2px 2px 0 #2a2e3e; }
.panel .crono-btn { font: 11px/1 Silkscreen, monospace; letter-spacing: .04em; border-radius: 0; border: 0; padding: 9px 4px 7px;
    background: #f4ecd8; color: #1c1a2e; box-shadow: inset 0 0 0 2px #1c1a2e, inset 0 -4px 0 2px #d9cdb0; }
.panel .crono-btn:hover { background: #fff; box-shadow: inset 0 0 0 2px #1c1a2e, inset 0 -4px 0 2px #d9cdb0; }
.panel .crono-btn:active { box-shadow: inset 0 0 0 2px #1c1a2e; transform: translateY(1px); }
#crono-marcha { background: #d64541; color: #fff; box-shadow: inset 0 0 0 2px #1c1a2e, inset 0 -4px 0 2px #a8322f; }
.crono.andando #crono-marcha { background: #ffd166; color: #1c1a2e; box-shadow: inset 0 0 0 2px #1c1a2e, inset 0 -4px 0 2px #d9a93c; }
/* versión pequeña en una esquina, visible con la interfaz oculta mientras corre */
.crono-mini { position: fixed; left: 16px; bottom: 16px; z-index: 5; display: none; align-items: center; gap: 8px; padding: 7px 10px 5px; background: #161a26; color: #ffd166;
    font: 16px/1 Silkscreen, monospace; box-shadow: 0 -3px 0 0 #0b0d14, 0 3px 0 0 #0b0d14, -3px 0 0 0 #0b0d14, 3px 0 0 0 #0b0d14, 5px 5px 0 2px rgba(0,0,0,.3); pointer-events: none; }
.crono-mini i { width: 8px; height: 8px; background: #d64541; animation: crono-latido 1s steps(1) infinite; }
@keyframes crono-latido { 50% { opacity: 0; } }
body.limpio .crono-mini.andando { display: flex; }
@media (max-width: 640px) {
    .titulo { display: none; }
    .reloj { top: 12px; }
    .panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 45vh; }
    .ayuda { display: none; }
}
