/* ==========================================================================
   Contador
   Todo lo que se ve sale de variables que fija timer.js desde la URL, porque
   aqui los colores los elige el usuario y no la marca.
   ========================================================================== */

.tm {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;

    --tm-color: #FEF3D9;
    --tm-label: #A49E8F;
    --tm-warn:  #F32146;
    --tm-bg:    rgba(6, 5, 4, 0);
    --tm-size:  72px;
}

.tm-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 30px;
    background: var(--tm-bg);
    border-radius: 14px;
    max-width: 100%;
}

.tm-label {
    font-size: calc(var(--tm-size) * 0.2);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--tm-label);
    text-align: center;
    line-height: 1.2;
}
.tm-label[hidden] { display: none; }

.tm-time {
    font-size: var(--tm-size);
    font-weight: 800;
    line-height: 1;
    color: var(--tm-color);
    /* Cifras de ancho fijo: sin esto el reloj baila cada vez que cambia un 1. */
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: -1px;
    text-align: center;
    /* Contorno corto para que se lea sobre cualquier gameplay. */
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
    transition: color 300ms ease;
}

.tm[data-font="mono"] .tm-time  { font-family: 'JetBrains Mono', Consolas, monospace; font-weight: 700; }
.tm[data-font="mono"] .tm-label { font-family: 'JetBrains Mono', Consolas, monospace; font-weight: 500; }

/* Los ultimos segundos: cambia de color y late una vez por segundo. */
.tm.is-warn .tm-time {
    color: var(--tm-warn);
    animation: tmBeat 1s ease-in-out infinite;
}
@keyframes tmBeat {
    0%, 100% { transform: scale(1); }
    12%      { transform: scale(1.045); }
    30%      { transform: scale(1); }
}

/* En pausa, el numero baja de intensidad: se ve que esta parado. */
.tm.is-paused .tm-time { opacity: 0.55; }

.tm.is-done .tm-time {
    color: var(--tm-warn);
    animation: tmDone 620ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes tmDone {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Tarjeta de estado (F2 en OBS)
   -------------------------------------------------------------------------- */

.tm-status {
    position: fixed;
    left: 14px;
    top: 14px;
    z-index: 999;
    background: rgba(6, 5, 4, 0.96);
    border: 1px solid #302E27;
    border-radius: 8px;
    padding: 14px 16px;
    min-width: 236px;
    font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;
    display: none;
}
.tm-status.is-on { display: block; }

.tm-status .row { display: flex; align-items: center; gap: 9px; font-size: 12px; color: #A49E8F; padding: 3px 0; }
.tm-status .row b { color: #FEF3D9; font-weight: 600; }
.tm-status .row .mono { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; }
.tm-status .dot { width: 7px; height: 7px; border-radius: 50%; background: #615D54; flex: none; }
.tm-status .dot[data-state="ok"]         { background: #F32146; }
.tm-status .dot[data-state="connecting"] { background: #F2A618; }
.tm-status .dot[data-state="error"]      { background: #F2A618; }
.tm-status hr { border: none; border-top: 1px solid #201E19; margin: 9px 0; }
.tm-status .hint { font-size: 10px; color: #615D54; line-height: 1.5; }

/* --------------------------------------------------------------------------
   Mandos de la fuente (F3 dentro de «Interactuar» de OBS)
   No hay servidor por medio: /config no puede tocar lo que ve OBS, asi que los
   botones tienen que vivir aqui dentro.
   -------------------------------------------------------------------------- */

.tm-ctrl {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 999;
    display: none;
    flex-direction: column;
    gap: 7px;
    width: 210px;
    padding: 13px;
    background: rgba(6, 5, 4, 0.96);
    border: 1px solid #302E27;
    border-radius: 10px;
    font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;
}
.tm-ctrl.is-on { display: flex; }

.tm-ctrl-h {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 9px; letter-spacing: 1.8px; text-transform: uppercase;
    color: #615D54;
}

.tm-ctrl-row { display: flex; gap: 7px; }

.tm-ctrl button {
    flex: 1;
    padding: 9px 4px;
    border: 1px solid #302E27;
    border-radius: 6px;
    background: none;
    color: #A49E8F;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 140ms ease, color 140ms ease;
}
.tm-ctrl button:hover  { border-color: #F32146; color: #F32146; }
.tm-ctrl button:active { transform: scale(0.97); }

.tm-ctrl-hint { font-size: 10px; color: #615D54; }
