/* Học Đồng Hồ - frontend */
.hdh-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    gap: 16px;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

.hdh-clock {
    --clock-size: min(80vw, 420px);

    position: relative;
    width: var(--clock-size);
    height: var(--clock-size);
    max-width: 420px;
    max-height: 420px;
    border: 8px solid #222;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 5px 20px rgba(0,0,0,.12),
        inset 0 0 0 2px #ddd;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

.hdh-ticks {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.hdh-tick-pivot {
    position: absolute;
    inset: 0;
}

.hdh-tick {
    position: absolute;
    left: 50%;
    top: 2%;
    width: 3px;
    height: 5%;
    background: #ccc;
    border-radius: 2px;
    transform: translateX(-50%);
}

.hdh-tick--major {
    background: #222;
}

.hdh-number {
    position: absolute;
    width: 12%;
    height: 12%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 5vw, 30px);
    font-weight: 700;
    color: #111;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.hdh-n12 { left: 50%; top: 10%; }
.hdh-n1  { left: 70%; top: 15.4%; }
.hdh-n2  { left: 84.6%; top: 30%; }
.hdh-n3  { left: 90%; top: 50%; }
.hdh-n4  { left: 84.6%; top: 70%; }
.hdh-n5  { left: 70%; top: 84.6%; }
.hdh-n6  { left: 50%; top: 90%; }
.hdh-n7  { left: 30%; top: 84.6%; }
.hdh-n8  { left: 15.4%; top: 70%; }
.hdh-n9  { left: 10%; top: 50%; }
.hdh-n10 { left: 15.4%; top: 30%; }
.hdh-n11 { left: 30%; top: 15.4%; }

.hdh-hand {
    position: absolute;
    left: 50%;
    bottom: 50%;
    transform-origin: 50% 100%;
    border-radius: 999px;
    z-index: 4;
    transform: translateX(-50%) rotate(0deg);
}

.hdh-hour {
    width: 7px;
    height: 27%;
    background: #111;
}

.hdh-minute {
    width: 5px;
    height: 37%;
    background: #333;
}

.hdh-second {
    width: 2px;
    height: 41%;
    background: #d00;
    z-index: 5;
}

.hdh-center {
    position: absolute;
    width: 18px;
    height: 18px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #111;
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px #111;
    z-index: 10;
}

.hdh-digital {
    font-size: clamp(20px, 6vw, 32px);
    font-weight: 700;
    letter-spacing: 2px;
    color: #111;
    background: #f4f4f4;
    border: 2px dashed #bbb;
    border-radius: 10px;
    padding: 8px 18px;
    min-width: 160px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease;
}

.hdh-digital--visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.hdh-controls {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 280px;
    gap: 10px;
}

.hdh-snap5-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
}

.hdh-snap5-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.hdh-btn {
    display: block;
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #2271b1;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
    transition: transform .1s ease, background .15s ease;
    box-sizing: border-box;
}

.hdh-btn:hover {
    background: #195a8c;
}

.hdh-btn:active {
    transform: scale(0.96);
}

.hdh-btn-random {
    background: #d9534f;
}

.hdh-btn-random:hover {
    background: #b83a37;
}

.hdh-btn-show {
    background: #4a934a;
}

.hdh-btn-show:hover {
    background: #3a7a3a;
}

@media (max-width: 480px) {
    .hdh-wrap {
        padding: 10px;
    }

    .hdh-clock {
        border-width: 6px;
    }

    .hdh-center {
        width: 14px;
        height: 14px;
        border-width: 3px;
    }
}
