:root {
  --negro: #000;
  --amarillo: #FCC716;
  --blanco: #fff;
  --gris: #1a1a1a;
  --gris2: #2a2a2a;
  --texto2: #b5b5b5;
  --borde: #333;
  --fuente: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--negro); color: var(--blanco); font-family: var(--fuente); -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }

/* Cabecera */
.cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cab h1 { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: .02em; }
.cab h1 b { color: var(--amarillo); }
.icono-btn { background: none; border: 1px solid var(--borde); border-radius: 12px; width: 44px; height: 44px; display: grid; place-items: center; font-size: 20px; }
.icono-btn:active { background: var(--gris2); }

/* Tarjetas */
.tarjeta { background: var(--gris); border: 1px solid var(--borde); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.tarjeta h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--texto2); margin: 0 0 12px; }
.fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fila + .fila { margin-top: 10px; }
.etq { font-size: 15px; font-weight: 600; }
.sub { font-size: 13px; color: var(--texto2); }

/* Botones */
.btn { border: none; border-radius: 14px; padding: 14px 18px; font-weight: 800; font-size: 16px; background: var(--gris2); }
.btn:active { transform: scale(.98); }
.btn.prim { background: var(--amarillo); color: var(--negro); }
.btn.ancho { width: 100%; }
.btn.chico { padding: 9px 12px; font-size: 14px; border-radius: 10px; }
.btn.borde { background: none; border: 1px solid var(--borde); }
.btn.peligro { background: none; border: 1px solid #5a2020; color: #ff8a8a; }
.botones { display: flex; gap: 10px; margin-top: 14px; }
.botones > * { flex: 1; }

/* Selector de tiempo y números */
.paso { display: flex; align-items: center; gap: 6px; }
.paso button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--borde); background: var(--negro); font-size: 20px; font-weight: 700; line-height: 1; }
.paso button:active { background: var(--gris2); }
.paso input { width: 72px; text-align: center; background: var(--negro); border: 1px solid var(--borde); border-radius: 10px; height: 40px; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.paso input:focus, .campo:focus { outline: 2px solid var(--amarillo); outline-offset: 1px; }
.campo { width: 100%; background: var(--negro); border: 1px solid var(--borde); border-radius: 10px; padding: 11px 12px; font-size: 16px; }

/* Lista de temporizadores */
.timer { display: flex; align-items: center; gap: 12px; background: var(--gris); border: 1px solid var(--borde); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
.timer .info { flex: 1; min-width: 0; }
.timer .nom { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer .det { font-size: 13px; color: var(--texto2); margin-top: 3px; }
.play { width: 52px; height: 52px; border-radius: 50%; border: none; background: var(--amarillo); color: var(--negro); font-size: 22px; display: grid; place-items: center; flex: none; }
.vacio { color: var(--texto2); text-align: center; padding: 18px; }

/* Intervalos en el editor */
.intervalo { background: var(--negro); border: 1px solid var(--borde); border-left: 6px solid var(--c, var(--amarillo)); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.intervalo .fila:first-child { margin-bottom: 10px; }
.colores { display: flex; gap: 6px; }
.color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.color.sel { border-color: var(--blanco); box-shadow: 0 0 0 2px var(--negro) inset; }
.mini { background: none; border: 1px solid var(--borde); border-radius: 8px; width: 34px; height: 34px; font-size: 15px; }
.mini:disabled { opacity: .3; }
.intervalo .paso button { width: 36px; }
.intervalo .paso input { width: 64px; }

/* Interruptor */
.sw { position: relative; width: 50px; height: 30px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: var(--gris2); border-radius: 30px; transition: .2s; }
.sw span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: var(--blanco); border-radius: 50%; transition: .2s; }
.sw input:checked + span { background: var(--amarillo); }
.sw input:checked + span::before { transform: translateX(20px); background: var(--negro); }
.sw input:focus-visible + span { outline: 2px solid var(--amarillo); outline-offset: 2px; }

/* Pantalla del temporizador */
.correr { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--fondo, var(--negro)); color: var(--tinta, var(--blanco)); transition: background .25s; padding: calc(14px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); user-select: none; -webkit-user-select: none; }
.correr .arriba { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 15px; }
.correr .arriba button { background: none; border: 2px solid currentColor; color: inherit; border-radius: 12px; height: 40px; padding: 0 14px; font-weight: 800; opacity: .85; }
.correr .centro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 0; }
.correr .fase { font-size: clamp(26px, 8vw, 44px); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; line-height: 1.1; max-width: 100%; overflow-wrap: anywhere; }
.correr .reloj { font-size: clamp(96px, 34vw, 240px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.02em; }
.correr .cuenta { font-size: 18px; font-weight: 700; opacity: .85; }
.correr .sig { font-size: 15px; font-weight: 600; opacity: .75; margin-top: 8px; }
.correr .barra { height: 8px; border-radius: 8px; background: color-mix(in srgb, currentColor 22%, transparent); overflow: hidden; margin: 10px 0 14px; }
.correr .barra i { display: block; height: 100%; width: 0; background: currentColor; }
.correr .total { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; opacity: .85; margin-bottom: 12px; }
.correr .controles { display: flex; gap: 12px; justify-content: center; align-items: center; }
.correr .controles button { border: 2px solid currentColor; background: none; color: inherit; border-radius: 50%; width: 64px; height: 64px; font-size: 22px; display: grid; place-items: center; }
.correr .controles .grande { width: 88px; height: 88px; font-size: 32px; background: var(--tinta, var(--blanco)); color: var(--fondo, var(--negro)); border-color: var(--tinta, var(--blanco)); }
.correr.pausa .reloj { opacity: .45; }
.fin { text-align: center; }
.fin .reloj { font-size: 64px !important; }

.aviso { font-size: 13px; color: var(--texto2); line-height: 1.5; }
.pie { text-align: center; font-size: 12px; color: #777; margin-top: 22px; }

/* Volver a RAMS Entrena (cuando se abre desde ahí) */
.volver-entrena { display: inline-block; color: var(--amarillo); text-decoration: none; font-weight: 700; font-size: 14px; padding: 4px 0 10px; }
