* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a0f14;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Уменьшаем общий текст только внутри тестов агрегатора */
html.in-test {
    font-size: 15px;
}

@media (max-width: 480px) {
    html.in-test {
        font-size: 14px;
    }
}

/* Фон «отношения»: любовь, близость, романтика */
.catalog-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.catalog-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(225, 29, 72, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse 100% 100% at 25% 100%, rgba(236, 72, 153, 0.38) 0%, transparent 45%),
        radial-gradient(ellipse 80% 60% at 80% 20%, rgba(167, 139, 250, 0.28) 0%, transparent 40%),
        linear-gradient(180deg, #2d1b24 0%, #451a3a 40%, #1a0f14 100%);
    animation: backgroundPulse 12s ease-in-out infinite;
}

.catalog-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle 8vmin at 22% 28%, rgba(244, 63, 94, 0.22) 0%, transparent 50%),
        radial-gradient(circle 6vmin at 78% 18%, rgba(236, 72, 153, 0.2) 0%, transparent 50%),
        radial-gradient(circle 10vmin at 52% 72%, rgba(225, 29, 72, 0.18) 0%, transparent 50%),
        radial-gradient(circle 5vmin at 85% 55%, rgba(167, 139, 250, 0.2) 0%, transparent 50%),
        radial-gradient(circle 7vmin at 18% 78%, rgba(244, 114, 182, 0.2) 0%, transparent 50%);
    opacity: 0.9;
    animation: themeGlow 8s ease-in-out infinite;
}

.catalog-background {
    background-image:
        linear-gradient(rgba(244, 114, 182, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(244, 114, 182, 0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: 0 0, 0 0;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.92; }
}

@keyframes themeGlow {
    0%, 100% { opacity: 0.9; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.catalog-header { display: none; }

.catalog-screen {
    display: none;
}

.catalog-screen.active {
    display: block;
}

.main-menu {
    margin: 20px auto 18px;
    padding: 0;
    animation: fadeInDown 0.6s ease-out;
}

.menu-hero {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 22px;
    padding: 18px 18px;
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.menu-title-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
}

.menu-title {
    font-size: 2.1rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.35);
    margin-bottom: 6px;
    text-align: center;
}

.menu-title-text {
    display: inline-block;
}

.menu-heart {
    margin: 0 8px;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.25));
}

.menu-side-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.menu-desc {
    font-size: 1.02rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    line-height: 1.35;
    margin: 0;
}

.menu-controls {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.menu-music-btn {
    min-width: 44px;
    min-height: 44px;
}

.menu-cta {
    margin-top: 14px;
    display: flex;
    justify-content: center;
}

.cta-btn {
    background: linear-gradient(135deg, #e11d48 0%, #ec4899 50%, #a78bfa 100%);
    color: #fff;
    border: none;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(225, 29, 72, 0.35);
}

.cta-btn:active {
    transform: translateY(1px);
}

.menu-icons { display: none; }

.test-top-controls {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    z-index: 25;
    display: none;
    gap: 10px;
    align-items: center;
    padding: 6px;
    border-radius: 14px;
    background: rgba(31, 42, 68, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
}

.test-top-controls.active {
    display: flex;
}

.top-icon-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.tests-section {
    margin-top: 6px;
}

.tests-heading {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
    margin: 8px 4px 10px;
    text-align: left;
}

/* ПК: центрируем список тестов и делаем компактнее */
@media (min-width: 900px) {
    .tests-section {
        max-width: 920px;
        margin-left: auto;
        margin-right: auto;
    }

    .tests-heading {
        text-align: center;
        margin: 10px 0 14px;
    }
}

.ghost-back {
    background: rgba(255,255,255,0.10);
    color: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.18);
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    margin: 0 0 12px 2px;
}

.ads-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ads-reward-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    border: none;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(34, 197, 94, 0.35);
}

.ads-timer {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.ads-timer.hidden {
    display: none;
}

.tests-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 10px 0 20px;
}

.test-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    padding: 16px 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
    border: 1px solid rgba(255,255,255,0.22);
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #e11d48, #ec4899, #a78bfa);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.test-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--card-bg, linear-gradient(135deg, rgba(225,29,72,0.18), rgba(167,139,250,0.12)));
    opacity: 1;
    pointer-events: none;
}

.test-row {
    position: relative;
    z-index: 1;
}

.test-card.theme-love { --card-bg: radial-gradient(circle at 18% 20%, rgba(244,114,182,0.35), transparent 55%),
                                   radial-gradient(circle at 85% 65%, rgba(225,29,72,0.30), transparent 58%),
                                   linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-relationship { --card-bg: radial-gradient(circle at 20% 30%, rgba(167,139,250,0.30), transparent 55%),
                                          radial-gradient(circle at 85% 70%, rgba(236,72,153,0.22), transparent 58%),
                                          linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-attachment { --card-bg: radial-gradient(circle at 22% 20%, rgba(56,189,248,0.26), transparent 55%),
                                        radial-gradient(circle at 85% 70%, rgba(167,139,250,0.26), transparent 58%),
                                        linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-redflags { --card-bg: radial-gradient(circle at 20% 25%, rgba(239,68,68,0.26), transparent 55%),
                                      radial-gradient(circle at 85% 70%, rgba(245,158,11,0.18), transparent 58%),
                                      linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-match { --card-bg: radial-gradient(circle at 20% 25%, rgba(34,197,94,0.22), transparent 55%),
                                   radial-gradient(circle at 85% 70%, rgba(236,72,153,0.22), transparent 58%),
                                   linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-jealousy { --card-bg: radial-gradient(circle at 20% 25%, rgba(245,158,11,0.22), transparent 55%),
                                      radial-gradient(circle at 85% 70%, rgba(239,68,68,0.20), transparent 58%),
                                      linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card.theme-default { --card-bg: radial-gradient(circle at 18% 20%, rgba(236,72,153,0.18), transparent 55%),
                                     radial-gradient(circle at 85% 70%, rgba(167,139,250,0.16), transparent 58%),
                                     linear-gradient(135deg, rgba(255,255,255,0.86), rgba(255,255,255,0.74)); }

.test-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.test-card:hover::before {
    transform: scaleX(1);
}

.test-card:nth-child(1) { animation-delay: 0.1s; }
.test-card:nth-child(2) { animation-delay: 0.2s; }
.test-card:nth-child(3) { animation-delay: 0.3s; }
.test-card:nth-child(4) { animation-delay: 0.4s; }
.test-card:nth-child(5) { animation-delay: 0.5s; }
.test-card:nth-child(6) { animation-delay: 0.6s; }
.test-card:nth-child(7) { animation-delay: 0.7s; }
.test-card:nth-child(8) { animation-delay: 0.8s; }
.test-card:nth-child(9) { animation-delay: 0.9s; }
.test-card:nth-child(10) { animation-delay: 1.0s; }
.test-card:nth-child(11) { animation-delay: 1.1s; }
.test-card:nth-child(12) { animation-delay: 1.2s; }
.test-card:nth-child(13) { animation-delay: 1.3s; }
.test-card:nth-child(14) { animation-delay: 1.4s; }
.test-card:nth-child(15) { animation-delay: 1.5s; }
.test-card:nth-child(16) { animation-delay: 1.6s; }
.test-card:nth-child(17) { animation-delay: 1.7s; }

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.test-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.test-row-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.test-row-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
}

.test-row-icon {
    font-size: 1.6rem;
    flex: 0 0 auto;
}

.test-row-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2d3748;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    display: block;
    line-height: 1.2;
}

.test-row-desc {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.35;
    white-space: normal;
}

.test-card:nth-child(1) .test-icon { animation-delay: 0s; }
.test-card:nth-child(2) .test-icon { animation-delay: 0.5s; }
.test-card:nth-child(3) .test-icon { animation-delay: 1s; }
.test-card:nth-child(4) .test-icon { animation-delay: 1.5s; }
.test-card:nth-child(5) .test-icon { animation-delay: 2s; }
.test-card:nth-child(6) .test-icon { animation-delay: 2.5s; }
.test-card:nth-child(7) .test-icon { animation-delay: 3s; }
.test-card:nth-child(8) .test-icon { animation-delay: 3.5s; }
.test-card:nth-child(9) .test-icon { animation-delay: 4s; }
.test-card:nth-child(10) .test-icon { animation-delay: 4.5s; }
.test-card:nth-child(11) .test-icon { animation-delay: 5s; }
.test-card:nth-child(12) .test-icon { animation-delay: 5.5s; }
.test-card:nth-child(13) .test-icon { animation-delay: 6s; }
.test-card:nth-child(14) .test-icon { animation-delay: 6.5s; }
.test-card:nth-child(15) .test-icon { animation-delay: 7s; }
.test-card:nth-child(16) .test-icon { animation-delay: 7.5s; }
.test-card:nth-child(17) .test-icon { animation-delay: 8s; }

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.test-title,
.test-description,
.test-icon {
    display: none;
}

.test-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e11d48 0%, #ec4899 50%, #a78bfa 100%);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 0 0 auto;
    white-space: nowrap;
}

.test-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.test-link:hover::before {
    width: 300px;
    height: 300px;
}

.test-link:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(225, 29, 72, 0.45);
}

.test-link:active {
    transform: scale(0.98);
}

.test-link-text {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .menu-title { font-size: 1.75rem; }
    .menu-desc { font-size: 0.98rem; }
    .test-card { padding: 14px 14px; }
    .test-row-name { font-size: 1.05rem; }
    .test-row-desc { font-size: 0.9rem; }
    .test-link { padding: 10px 12px; font-size: 0.95rem; }
    .menu-controls { justify-content: center; }
    .ads-controls { width: 100%; align-items: center; }
    .test-top-controls { gap: 8px; }
    .top-icon-btn { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    body { padding: 10px; }
    .catalog-header { margin-bottom: 30px; padding: 15px; }
    .main-title { font-size: 1.8rem; }
    .test-card { padding: 20px; }
}


.hidden { display: none !important; }

/* Кнопки «Начать тест» в тестах: убираем задержку тапа на мобильных */
.test-root #start-btn,
.test-root #startTestBtn,
.test-root .start-btn,
.test-root .btn-primary {
  touch-action: manipulation;
  cursor: pointer;
}

.test-root {
    display: none;
    min-height: 100vh;
}

.test-root.active {
    display: block;
    padding-top: calc(env(safe-area-inset-top, 0px) + 66px);
}

/* ПК: меньше верхний отступ, чтобы карточка была выше */
@media (min-width: 900px) {
    .test-root.active {
        padding-top: 26px;
    }
}

.back-button {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: calc(env(safe-area-inset-left, 0px) + 10px);
    z-index: 20;
    background: rgba(31, 42, 68, 0.95);
    color: #ffffff;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    cursor: pointer;
    display: none;
}

.back-button.active {
    display: block;
}

.subtitle.app-subtitle {
    order: 2;
    flex: 1;
    text-align: center;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-1 { 
    order: 1;
    flex-shrink: 0;
}
.btn-2 { 
    order: 3;
    flex-shrink: 0;
}
.actions {
    display: flex !important;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 900px;
    margin: 12px auto 0;
    position: relative;
}

.neutral-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.1) !important;
    backdrop-filter: blur(10px);
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    min-width: 44px;
    min-height: 44px;
    opacity: 1 !important;
    visibility: visible !important;
}

.neutral-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.neutral-btn:active {
    transform: translateY(0);
}

.neutral-btn svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .btn-1 { order: 1; }
    .btn-2 { order: 2; }
    .subtitle.app-subtitle {
        order: 3;
        width: 100%;
        margin-top: 8px;
        flex: none;
        white-space: normal;
    }
    .neutral-btn {
        padding: 10px 14px;
        min-width: 40px;
        min-height: 40px;
    }
    .neutral-btn svg {
        width: 18px;
        height: 18px;
    }
}
