/* ==========================================
   Hero-style premium 3D buttons (color preserved per tone)
   ========================================== */

.premium-btn {
    background: none !important;
    border: none !important;
    outline: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    border-radius: 14px;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    transition: transform 0.05s linear;
    padding: 8px 14px;
    flex-shrink: 0;
    color: #fff;
    font-size: inherit;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
    --btn-grad-start: #667eea;
    --btn-grad-end: #764ba2;
    --btn-hover-glow: rgba(102, 126, 234, 0.55);
}

.premium-btn::after {
    content: "";
    position: absolute;
    z-index: 0;
    width: calc(100% + 0.3em);
    height: calc(100% + 0.3em);
    top: -0.15em;
    left: -0.15em;
    border-radius: inherit;
    background: linear-gradient(-135deg, rgba(5, 5, 5, 0.5), transparent 20%, transparent 100%);
    filter: blur(0.0125em);
    opacity: 0.25;
    mix-blend-mode: multiply;
    pointer-events: none;
}

.premium-btn::before {
    content: "";
    position: absolute;
    inset: 0.035em;
    border-radius: inherit;
    background-image: linear-gradient(135deg, var(--btn-grad-start), var(--btn-grad-end));
    z-index: 0;
    box-shadow:
        0 0.05em 0.05em -0.01em rgba(5, 5, 5, 1),
        0 0.01em 0.01em -0.01em rgba(5, 5, 5, 0.5),
        0.15em 0.3em 0.1em -0.01em rgba(5, 5, 5, 0.25),
        -0.05em -0.05em 0.05em 0 inset rgba(5, 5, 5, 0.25),
        0 0 0.05em 0.2em inset rgba(255, 255, 255, 0.25),
        0.025em 0.05em 0.1em 0 inset rgba(255, 255, 255, 1),
        0.12em 0.12em 0.12em inset rgba(255, 255, 255, 0.25),
        -0.075em -0.25em 0.25em 0.1em inset rgba(5, 5, 5, 0.25);
    pointer-events: none;
}

/* 文字/emoji 必須在 ::before 3D 層之上（見 wrapPremiumButtonFaces） */
.premium-btn-face,
.premium-btn > .speak-btn-inner,
.premium-btn > span:not(:empty) {
    position: relative;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 700;
    line-height: 1.2;
}

.lang-btn.premium-btn:not(.active) .premium-btn-face {
    color: #e8e8e8;
}

.lang-btn.premium-btn.active .premium-btn-face {
    color: #fff;
}

.timeline-era-btn.premium-btn:not(.active) .premium-btn-face {
    color: #e8e8e8;
}

.timeline-era-btn.premium-btn.active .premium-btn-face {
    color: #fff;
}

.premium-btn:active {
    transform: scale(0.95);
    transition: transform 0.01s linear;
}

/* --- Color tones (original KMS_Element palette) --- */

.btn-tone-primary {
    --btn-grad-start: #667eea;
    --btn-grad-end: #764ba2;
    --btn-hover-glow: rgba(102, 126, 234, 0.55);
}

.btn-tone-reset {
    --btn-grad-start: #f093fb;
    --btn-grad-end: #f5576c;
    --btn-hover-glow: rgba(245, 87, 108, 0.55);
}

.btn-tone-muted {
    --btn-grad-start: rgba(255, 255, 255, 0.14);
    --btn-grad-end: rgba(255, 255, 255, 0.08);
    --btn-hover-glow: rgba(255, 255, 255, 0.25);
}

.btn-tone-muted .premium-btn-face {
    color: #e8e8e8;
}

.btn-tone-cyan {
    --btn-grad-start: rgba(0, 212, 255, 0.35);
    --btn-grad-end: rgba(0, 150, 200, 0.45);
    --btn-hover-glow: rgba(0, 212, 255, 0.65);
}

.btn-tone-cyan .speak-btn-inner,
.btn-tone-cyan .premium-btn-face {
    color: #00d4ff;
}

/* Inactive lang / timeline (original translucent style) */
.lang-btn.premium-btn:not(.active),
.timeline-era-btn.premium-btn:not(.active) {
    --btn-grad-start: rgba(255, 255, 255, 0.14);
    --btn-grad-end: rgba(255, 255, 255, 0.08);
    --btn-hover-glow: rgba(255, 255, 255, 0.25);
}

/* Active / selected states */
.premium-btn.active,
.lang-btn.premium-btn.active,
.timeline-era-btn.premium-btn.active,
.filter-toggle-btn.premium-btn.active {
    --btn-grad-start: #667eea;
    --btn-grad-end: #764ba2;
    --btn-hover-glow: rgba(102, 126, 234, 0.55);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.65);
}

/* Round icon-only control */
.premium-btn.btn-round {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    border-radius: 50%;
}

.premium-btn.btn-round::before,
.premium-btn.btn-round::after {
    border-radius: 50%;
}

.premium-btn.btn-round svg {
    position: relative;
    z-index: 4;
    stroke: #00d4ff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

/* Modal speak button (icon + label) */
.speak-btn.premium-btn .speak-btn-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    z-index: 4;
}

.speak-btn.premium-btn .speak-btn-icon {
    flex-shrink: 0;
    stroke: #00d4ff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.speak-btn.premium-btn .speak-btn-label {
    position: relative;
    z-index: 4;
    color: #00d4ff;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

@media (hover: hover) {
    .speak-btn.premium-btn:hover .speak-btn-label {
        color: #fff;
    }

    .speak-btn.premium-btn:hover .speak-btn-icon {
        stroke: #fff;
    }
}

.speak-btn.premium-btn.speaking {
    animation: speakPulse 1s ease-in-out infinite;
}

@keyframes speakPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(0, 212, 255, 0); }
}

@media (hover: hover) {
    .premium-btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 0 18px var(--btn-hover-glow), -0.15em -0.15em 0.15em -0.075em rgba(5, 5, 5, 0.25);
    }

    .btn-tone-primary:hover::before {
        background-image: linear-gradient(135deg, #7b8ef0, #8a5cb8);
    }

    .btn-tone-reset:hover::before {
        background-image: linear-gradient(135deg, #f5a8fc, #f76f82);
    }

    .btn-tone-muted:hover::before {
        background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12));
    }

    .btn-tone-cyan:hover::before {
        background-image: linear-gradient(135deg, rgba(0, 212, 255, 0.55), rgba(0, 170, 220, 0.65));
    }

    .btn-tone-cyan:hover svg {
        stroke: #fff;
    }

    .lang-btn.premium-btn:not(.active):hover::before,
    .timeline-era-btn.premium-btn:not(.active):hover::before {
        background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12));
    }
}
