/* Lấy MST: mọi hiệu ứng trên trang đều dùng CSS, không dùng JavaScript. */
@property --lay-mst-count {
    syntax: "<integer>";
    inherits: false;
    initial-value: 60;
}

.lay-mst {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45em;
    max-width: 100%;
    vertical-align: baseline;
    --lay-mst-seconds: 60;
    --lay-mst-duration: 60s;
}

.lay-mst-label {
    font-weight: 700;
}

.lay-mst-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.lay-mst-trigger {
    display: inline-block;
    margin: 0;
    padding: 0;
    color: #0073aa;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    user-select: none;
}

.lay-mst-trigger:hover {
    color: #005177;
}

.lay-mst-toggle:focus-visible + .lay-mst-trigger {
    outline: 2px solid #0073aa;
    outline-offset: 4px;
}

.lay-mst-status {
    display: none;
    position: relative;
    min-width: 0;
    align-items: center;
}

.lay-mst-counter,
.lay-mst-result {
    grid-area: 1 / 1;
    white-space: nowrap;
}

.lay-mst-counter {
    --lay-mst-count: var(--lay-mst-seconds);
    counter-reset: lay-mst-remaining var(--lay-mst-count);
    color: #b45309;
}

.lay-mst-counter::after {
    content: "Vui lòng chờ " counter(lay-mst-remaining) " giây";
}

.lay-mst-result {
    visibility: hidden;
    color: #15803d;
    font-weight: 700;
}

.lay-mst-toggle:checked + .lay-mst-trigger {
    display: none;
}

.lay-mst-toggle:checked ~ .lay-mst-status {
    display: inline-grid;
}

.lay-mst-toggle:checked ~ .lay-mst-status .lay-mst-counter {
    animation:
        lay-mst-countdown var(--lay-mst-duration) steps(var(--lay-mst-seconds), end) forwards,
        lay-mst-hide 0s linear var(--lay-mst-duration) forwards;
}

.lay-mst-toggle:checked ~ .lay-mst-status .lay-mst-result {
    animation: lay-mst-reveal 0s linear var(--lay-mst-duration) forwards;
}

@keyframes lay-mst-countdown {
    from { --lay-mst-count: var(--lay-mst-seconds); }
    to   { --lay-mst-count: 0; }
}

@keyframes lay-mst-hide {
    to { visibility: hidden; }
}

@keyframes lay-mst-reveal {
    to { visibility: visible; }
}
