:root {
    --bg: #0B1F3A;
    /* azul-escuro inicial */
    --fg: #ffffff;
    --accent: #ffffff;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial;
    color: var(--fg);
    background: var(--bg);
    transition: background-color .45s ease;
}

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 16px 14px 22px;
    gap: 16px;
}

/* ===== TOP BAR ===== */
.topbar {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
}

.chakra-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-gutter: stable both-edges;
}

.chakra-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    cursor: pointer;
    outline: none;
    transition: transform .06s ease, box-shadow .2s ease, filter .2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    filter: saturate(110%);
    scroll-snap-align: start;
}

.chakra-tab:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.chakra-tab:active {
    transform: translateY(1px);
}

.tab-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    object-fit: contain;
    display: block;
}

.tab-label {
    line-height: 1;
}

/* ===== LANG SWITCHER — FIXO NO RODAPÉ ESQUERDO (compacto) ===== */
.lang-switcher {
    position: fixed;
    left: 16px;
    bottom: 20px;
    z-index: 1201;
    /* acima do modal/timer */
}

.lang-current {
    border: 0;
    border-radius: 10px;
    padding: 6px 10px;
    background: #ffffff20;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    line-height: 1;
    font-size: 14px;
    height: 32px;
    /* evita cortar embaixo */
}

/* ícone pequeno (bandeira) */
.lang-flag {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

/* menu abre para cima, compacto */
.lang-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    background: #0f1f38;
    color: #fff;
    min-width: 140px;
    /* apenas sigla */
    border-radius: 10px;
    padding: 6px;
    margin: 0;
    list-style: none;
    display: none;
    /* controlado pelo JS */
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}

.lang-item {
    width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    border: 0;
    background: transparent;
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
    font-size: 14px;
}

.lang-item:hover {
    background: #ffffff22;
}

.lang-item.is-active {
    background: #ffffff33;
}

.lang-item-sigla {
    letter-spacing: .02em;
}

@media (max-width: 380px) {
    .lang-current {
        padding: 6px 9px;
        font-size: 13px;
        height: 30px;
    }

    .lang-menu {
        min-width: 128px;
    }

    .lang-flag {
        width: 15px;
        height: 15px;
    }
}

/* -------- STAGE -------- */
.stage {
    position: relative;
    flex: 1;
    width: min(380px, 100%);
    display: grid;
    place-items: center;
}

.meditator {
    width: min(95%, 380px);
    opacity: .95;
    filter: drop-shadow(0 10px 30px #00000035);
    user-select: none;
    pointer-events: none;
}

/* -------- CHAKRA STRIP SOBRE A IMAGEM -------- */
.chakra-strip {
    position: absolute;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    gap: 8px;
    z-index: 2;
}

/* Botões */
.chakra-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: #ffffff20;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    outline-offset: 3px;
    transition: transform .14s ease, background-color .2s ease, box-shadow .2s ease;
    box-shadow: 0 2px 10px #00000020 inset, 0 1px 0 #ffffff33 inset;
    position: relative;
    overflow: visible;
    /* ondas podem ultrapassar o botão */
}

.chakra-btn[aria-current="true"] {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 0 0 2px #ffffff, 0 8px 24px #00000035;
    background: #ffffff33;
}

/* swatch */
.chakra-swatch {
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    z-index: -1;
    filter: saturate(110%) contrast(105%);
    opacity: .85;
}

/* Ícone dentro do botão */
.chakra-icon {
    width: 70%;
    height: 70%;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* ======= ONDAS ======= */
.ring {
    position: absolute;
    inset: -6px;
    border-radius: 999px;
    border: 2px solid #fff;
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    z-index: 1;
    animation: chakra-ripple 2.8s ease-out infinite;
    animation-play-state: paused;
    display: none;
}

.ring1 {
    animation-delay: 0s;
}

.ring2 {
    animation-delay: 1.2s;
}

.chakra-btn[aria-current="true"] .ring {
    display: block;
    animation-play-state: running;
}

@keyframes chakra-ripple {
    0% {
        opacity: .45;
        transform: scale(1);
    }

    60% {
        opacity: .12;
        transform: scale(1.9);
    }

    100% {
        opacity: 0;
        transform: scale(2.1);
    }
}

/* -------- LEGENDA -------- */
.legend {
    width: 100%;
    max-width: 640px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mantra {
    font-size: clamp(28px, 7vw, 44px);
    font-weight: 800;
    letter-spacing: .1em;
}

.caption {
    font-size: clamp(14px, 3.6vw, 18px);
    opacity: .95;
}

/* acessibilidade: reduzir movimento */
@media (prefers-reduced-motion: reduce) {
    .ring {
        animation: none;
        opacity: 0;
        display: none;
    }
}

/* desktop */
@media (min-width:768px) {
    .app {
        padding: 22px 24px 28px;
        gap: 20px;
    }
}

/* ===== MODAL ===== */
.modal {
    --chakra: #6C5CE7;
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}

.modal[aria-hidden="false"] {
    display: block;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
}

.modal__dialog {
    position: relative;
    width: min(720px, 92vw);
    margin: 8vh auto 0;
    background: #fff;
    color: #222;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    overflow: hidden;
    animation: modalIn .18s ease-out;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalIn {
    from {
        transform: translateY(8px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--chakra);
    color: #fff;
    padding: 12px 16px;
}

.modal__header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.modal__icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.modal__title {
    margin: 0;
    font-size: clamp(1.1rem, 2.6vw, 1.4rem);
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #ffffff33;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.modal__close:hover {
    background: #ffffff4d;
}

.modal__body {
    padding: 16px 16px 18px;
    overflow: auto;
    background: #fff;
    color: #222;
    scrollbar-width: thin;
    scrollbar-color: var(--chakra) #f0f0f0;
}

/* WebKit */
.modal__body::-webkit-scrollbar {
    width: 10px;
}

.modal__body::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 8px;
}

.modal__body::-webkit-scrollbar-thumb {
    background: var(--chakra);
    border-radius: 8px;
}

.modal__body::-webkit-scrollbar-thumb:hover {
    filter: brightness(.95);
}

.modal__content {
    line-height: 1.6;
    font-size: 1rem;
    color: #333;
}

.modal__content h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.modal__content h4 {
    margin: 10px 0 6px;
    font-size: 1rem;
}

.modal__content p {
    margin: 0;
    padding-bottom: 20px;
    line-height: 25px;
}

.modal__content ul {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.modal__content ul li {
    line-height: 25px;
}

/* ===== IMAGEM ACIMA DA MANTRA ===== */
.mantra-icon {
    width: 75px;
    height: 75px;
    display: block;
    margin: 0 auto 6px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease;
}

.mantra-icon.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== TIMER (bolinha) ===== */
.chakra-timer {
    width: 76px;
    height: 76px;
    box-shadow: 2px 2px 14px 1px #33333361;
    border-radius: 100%;
}

/* Botão Play/Pause CENTRAL */
.timer-toggle {
    position: absolute;
    inset: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: #fff;
    font-weight: 900;
    font-size: 18px;
    display: grid;
    place-items: center;
    cursor: pointer;
    outline: none;
    border-radius: 100%;
}

.timer-toggle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}