/* ===== Hourglass Clock Theme ===== */

.hg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(6px);
}

.hg-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted, #6b7280);
    letter-spacing: 0.02em;
    user-select: none;
}

.hg-switch {
    position: relative;
    width: 38px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.hg-switch:focus-visible {
    outline: 2px solid rgba(252, 211, 77, 0.6);
    outline-offset: 2px;
}

.hg-switch-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #94a3b8;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.25s ease,
                box-shadow 0.25s ease;
}

.hg-switch[aria-pressed="true"] {
    background: rgba(252, 211, 77, 0.18);
    border-color: rgba(252, 211, 77, 0.45);
    box-shadow: 0 0 12px rgba(252, 211, 77, 0.25);
}

.hg-switch[aria-pressed="true"] .hg-switch-thumb {
    transform: translateX(18px);
    background: #fcd34d;
    box-shadow: 0 0 8px rgba(252, 211, 77, 0.7);
}

/* ===== Stage ===== */
.hg-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 24px;
}

.hg-frame {
    position: relative;
    width: clamp(180px, 28vw, 240px);
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.5));
}

.hg-cap {
    width: 130%;
    height: 16px;
    background:
        linear-gradient(180deg, #6b4423 0%, #8b5a2b 50%, #6b4423 100%);
    border-radius: 4px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -2px 0 rgba(0, 0, 0, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.45);
    position: relative;
}

.hg-cap::before,
.hg-cap::after {
    content: '';
    position: absolute;
    top: -3px;
    width: 14px;
    height: 22px;
    background: linear-gradient(180deg, #a07142 0%, #6b4423 100%);
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.hg-cap::before { left: -6px; }
.hg-cap::after  { right: -6px; }

.hg-cap-bottom { margin-top: -2px; }

.hg-glass-wrap {
    position: relative;
    width: 100%;
    padding: 0 6px;
}

.hg-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Falling grain dots */
.hg-falling {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 50%;
    pointer-events: none;
}

.hg-grain {
    position: absolute;
    left: 50%;
    width: 2.5px;
    height: 2.5px;
    background: #fcd34d;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(252, 211, 77, 0.85);
    transform: translateX(-50%);
    animation: hg-fall 1.2s linear infinite;
    opacity: 0;
}

.hg-grain-1 { animation-delay: 0s; }
.hg-grain-2 { animation-delay: 0.3s; }
.hg-grain-3 { animation-delay: 0.6s; }
.hg-grain-4 { animation-delay: 0.9s; }

@keyframes hg-fall {
    0%   { top: 50%; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* ===== Readout ===== */
.hg-readout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 240px;
}

.hg-time {
    font-family: "Menlo", "Monaco", "Consolas", monospace;
    font-weight: 700;
    font-size: clamp(28px, 4.5vw, 40px);
    letter-spacing: 0.18em;
    color: #fcd34d;
    text-shadow: 0 0 18px rgba(252, 211, 77, 0.5);
    font-variant-numeric: tabular-nums;
}

.hg-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.hg-progress-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 10px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: rgba(252, 211, 77, 0.55);
}

.hg-progress-bar {
    width: 220px;
    height: 6px;
    border-radius: 999px;
    background: rgba(252, 211, 77, 0.1);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(252, 211, 77, 0.18);
}

.hg-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fcd34d 0%, #f59e0b 100%);
    box-shadow: 0 0 8px rgba(252, 211, 77, 0.55);
    transition: width 0.5s linear;
}

.hg-progress-val {
    font-family: "Menlo", "Monaco", monospace;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: rgba(252, 211, 77, 0.7);
}

@media (max-width: 640px) {
    .hg-toolbar { gap: 6px 12px; padding: 5px 10px; }
    .hg-toggle-label { font-size: 11px; }
    .hg-progress-bar { width: 180px; }
}