/* ==================== APPS / MANTRAS ====================
   Персональные стили пользовательского приложения «Мантры».
   Файл намеренно отделён от общего app.css: всё, что относится только к
   экрану «Мантр», должно жить здесь, чтобы другие приложения не наследовали
   случайные стили и чтобы общий stylesheet не превращался в монолит. */

.app.mantras-fullscreen {
    grid-template-rows: 1fr;
}

.app.mantras-fullscreen > .header,
.app.mantras-fullscreen > .nav {
    display: none;
}

.apps-catalog {
    display: grid;
    gap: 12px;
    padding: 10px;
}

.apps-card,
.mantras-card,
.mantras-list-item,
.mantras-audio-card,
.mantras-text-block,
.mantras-detail-head,
.mantras-item-screen,
.mantras-next-stage {
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
}

.apps-card {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.apps-card:hover {
    border-color: var(--stroke-hover);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.apps-card-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    font-size: 28px;
}

.apps-card-title,
.mantras-app-title,
.mantras-card-title {
    margin: 0;
    color: var(--text-primary);
}

.apps-card-description {
    margin: 5px 0 8px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.apps-card-action,
.mantras-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    border: 1px solid rgba(139, 125, 255, 0.35);
    background: var(--accent-light);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
}

.mantras-app {
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    background: var(--bg-primary);
}

.mantras-app-header {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 10px;
    align-items: center;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    border-bottom: 1px solid var(--stroke);
    background: var(--bg-secondary);
}

.mantras-app-back,
.mantras-app-menu {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    background: transparent;
    color: var(--text-primary);
    font-size: 18px;
}

.mantras-app-titlebox {
    min-width: 0;
    text-align: center;
}

.mantras-app-subtitle {
    margin: 3px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.mantras-app-menu-panel {
    position: absolute;
    top: 58px;
    right: 12px;
    z-index: 20;
    display: grid;
    gap: 6px;
    width: min(260px, calc(100vw - 24px));
    padding: 8px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
}

.mantras-app-menu-item {
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    padding: 9px 10px;
}

.mantras-app-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
}

.mantras-garden {
    position: relative;
    min-height: min(720px, calc(100vh - 118px));
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 14px;
    background:
        var(--mantras-garden-bg, none) center / cover no-repeat,
        radial-gradient(circle at 18% 14%, rgba(255, 237, 180, 0.22), transparent 28%),
        radial-gradient(circle at 82% 10%, rgba(147, 197, 253, 0.24), transparent 30%),
        radial-gradient(circle at 16% 82%, rgba(52, 211, 153, 0.20), transparent 34%),
        radial-gradient(circle at 88% 78%, rgba(244, 114, 182, 0.16), transparent 30%),
        linear-gradient(145deg, rgba(18, 32, 46, 0.96), rgba(20, 44, 55, 0.92) 48%, rgba(31, 61, 43, 0.92));
    box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.05);
}

.mantras-garden-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(9, 18, 30, 0.12), rgba(5, 10, 18, 0.34)),
        radial-gradient(circle at 18% 16%, rgba(255, 247, 210, 0.34), transparent 26%),
        radial-gradient(circle at 78% 20%, rgba(190, 231, 255, 0.22), transparent 28%);
    backdrop-filter: saturate(1.08);
}

.mantras-garden-intro {
    position: relative;
    z-index: 2;
    max-width: 620px;
    margin: 0 auto 14px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-lg);
    background: rgba(8, 16, 26, 0.40);
    backdrop-filter: blur(8px);
    text-align: center;
}

.mantras-garden-intro h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 17px;
}

.mantras-garden-intro p {
    margin: 6px 0 0;
    color: rgba(228, 233, 255, 0.78);
    font-size: 13px;
    line-height: 1.45;
}

.mantras-floating-field {
    position: relative;
    z-index: 2;
    height: clamp(var(--mantras-field-min-height, 430px), 64vh, 720px);
    min-height: var(--mantras-field-min-height, 430px);
}

.mantras-list {
    display: grid;
    gap: 10px;
}

.mantras-card,
.mantras-list-item {
    padding: 12px;
    cursor: pointer;
}

.mantras-card {
    display: flex;
    flex-direction: column;
    position: absolute;
    left: 0;
    top: 0;
    width: var(--mantras-card-size, clamp(96px, 27vw, 138px));
    height: var(--mantras-card-size, clamp(96px, 27vw, 138px));
    justify-content: flex-start;
    gap: 0;
    aspect-ratio: 1 / 1;
    min-height: 0;
    padding: 2px;
    overflow: hidden;
    text-align: center;
    will-change: transform;
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    touch-action: manipulation;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.mantras-card:hover {
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
    filter: brightness(1.05);
}

.mantras-card-symbol {
    width: 100%;
    height: 88%;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
    font-size: 26px;
}

.mantras-card-symbol img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mantras-card-title {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12%;
    width: 100%;
    margin: 0;
    padding: 2px 5px;
    color: #1f2937;
    background: rgba(255, 255, 255, 0.92);
    font-size: 11px;
    line-height: 1.08;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mantras-card-text,
.mantras-list-item p,
.mantras-detail-head p,
.mantras-text-block p,
.mantras-muted {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.mantras-card-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mantras-list-item h4,
.mantras-detail-head h4,
.mantras-text-block h4,
.mantras-audio-card h4,
.mantras-item-screen h3 {
    margin: 0;
    color: var(--text-primary);
}

.mantras-detail-head,
.mantras-text-block,
.mantras-item-screen,
.mantras-next-stage {
    padding: 12px;
    margin-bottom: 10px;
}

.mantras-deity-head {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 14px;
}

.mantras-deity-avatar {
    width: 104px;
    height: 104px;
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
    font-size: 36px;
}

.mantras-deity-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mantras-deity-info {
    min-width: 0;
}

@media (max-width: 520px) {
    .mantras-deity-head {
        grid-template-columns: 82px minmax(0, 1fr);
        gap: 10px;
    }

    .mantras-deity-avatar {
        width: 82px;
        height: 82px;
        border-radius: 18px;
    }
}

.mantras-audio-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    margin-top: 8px;
}

.mantras-audio-card audio {
    width: 100%;
}

.mantras-next-stage {
    border-style: dashed;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
    .mantras-card {
        animation: none;
    }
}
