/* ======================================================
   Overall
   ====================================================== */

html,
body {
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
}

body {
    height: 100%;
    background: radial-gradient(circle at top, #ffffff 0%, #f1f5f9 45%, #e2e8f0 100%);
    background-attachment: fixed;
    color: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

.form-control::placeholder {
    color: #9ca3af !important;
    opacity: 1;
}

.layout-spacer {
    display: none !important;
}

.level-wrapper {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.level-stack {
    margin-top: auto;
    margin-bottom: auto;
}

.level-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pill {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #4338ca;
    background: rgba(99,102,241,0.06);
}

.pill-you {
    color: #a5b4fc;
}

.pill-session {
    border-color: rgba(148, 163, 184, 0.6);
    color: #9ca3af;
}

.info-bar {
    font-size: 0.82rem;
    color: #475569;
}

.info-bar ul {
    margin-bottom: 0;
}

.chat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    font-weight: 600;
}

.chat-label-right {
    text-align: right;
}

.bubble-sub {
    font-size: 0.75rem;
    color: #9ca3af;
}

.empty-note {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
}

.profile-text-main {
    color: #0f172a !important;
    font-weight: 600;
}

.profile-text-sub {
    color: #475569 !important;
}

.back-link {
    font-size: 0.85rem;
}

.back-link a {
    color: #7c3aed;
    font-weight: 500;
}

.level-card {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.97),
        rgba(248, 250, 252, 0.95)
    );
    border-radius: 28px;
    border: 1px solid rgba(99, 102, 241, 0.18);
    box-shadow:
        0 40px 90px rgba(15, 23, 42, 0.18),
        0 10px 24px rgba(15, 23, 42, 0.10),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    padding: 28px 28px 20px 28px;
}

.profile-box {
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid rgba(99,102,241,0.18);
    width: 48%;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(6px);
    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.12),
        0 2px 6px rgba(15, 23, 42, 0.06),
        inset 0 0 0 1px rgba(255,255,255,0.6);
}

.profile-blur-frame {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(148,163,184,0.35);
    flex-shrink: 0;
}

.profile-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.profile-box.right {
    justify-content: flex-end;
    text-align: right;
}

.profile-text-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 52px;
    line-height: 1.2;
}

.profile-text-wrap.right {
    text-align: right;
}

.profile-partner {
    cursor: pointer;
    padding-left: 42px;
    position: relative;
}

.profile-top-anchor {
    position: relative;
}

.partner-arrow {
    position: absolute;
    left: 14px;
    bottom: 14px;
    width: 10px;
    height: 10px;
    opacity: 0.8;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.partner-arrow::before {
    content: "";
    position: absolute;
    inset: 0;
    border-right: 2px solid #7c3aed;
    border-bottom: 2px solid #7c3aed;
    transform: rotate(45deg);
}

.profile-partner:hover .partner-arrow {
    opacity: 1;
}

.profile-partner.open .partner-arrow::before {
    transform: rotate(225deg);
}

.level-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.chat-wrapper {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 18px;
    margin-bottom: 12px;
    max-height: none;
    overflow: visible;
    padding-right: 6px;
    scrollbar-gutter: stable;
    min-height: 360px;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,92,246,0.7) rgba(99,102,241,0.08);
}

.chat-wrapper::-webkit-scrollbar {
    width: 10px;
}

.chat-wrapper::-webkit-scrollbar-track {
    background: rgba(99, 102, 241, 0.06);
    border-radius: 999px;
}

.chat-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(99,102,241,0.45),
        rgba(139,92,246,0.55)
    );
    border-radius: 999px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.35),
        0 4px 10px rgba(99,102,241,0.35);
}

.chat-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(99,102,241,0.7),
        rgba(139,92,246,0.8)
    );
}

.chat-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-row.is-hidden {
    visibility: hidden;
    opacity: 0;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.chat-row.is-visible {
    visibility: visible;
    opacity: 1;
    height: auto;
}

.btn-primary {
    border-radius: 999px;
    padding-inline: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    box-shadow: 0 10px 26px rgba(99,102,241,0.35);
}

.btn-success {
    border-radius: 999px;
    padding-inline: 20px;
    font-weight: 600;
    font-size: 0.95rem;

    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #ffffff;

    border: none;
    box-shadow:
        0 10px 26px rgba(99,102,241,0.45),
        inset 0 1px 0 rgba(255,255,255,0.35);

    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 34px rgba(99,102,241,0.55),
        inset 0 1px 0 rgba(255,255,255,0.45);
}

.btn-success:active {
    transform: scale(0.97);
}


.btn-primary:disabled,
.btn-success:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-enter {
    opacity: 0;
    filter: blur(6px);
    transition:
        opacity 0.6s ease,
        filter 0.6s ease;
}

.page-enter.page-visible {
    opacity: 1;
    filter: blur(0);
}

@keyframes softPop {
    0%   { opacity: 0; transform: translateY(6px) scale(0.92); }
    70%  { opacity: 1; transform: translateY(0) scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes slideUpSoftDesktop {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUpSoftMobile {
    from { opacity: 0; bottom: -20px; }
    to   { opacity: 1; bottom: 14px; }
}

@keyframes softPremiumIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ======================================================
   LEVEL 1
   ====================================================== */


.bubble-row {
    display: flex;
    width: 100%;
}

.bubble-left {
    justify-content: flex-start;
    text-align: left;
}

.bubble-right {
    justify-content: flex-end;
    text-align: right;
}

.bubble-right .chat-bubble {
    text-align: left;
}

.chat-bubble {
    max-width: 90%;
    display: inline-block;
    padding: 14px 18px;
    border-radius: 34px;
    font-size: 0.95rem;
    line-height: 1.55;
    border: 1px solid rgba(255,255,255,0.35);
    color: #ffffff;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(6px);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.45);
}

.chat-bubble::after {
    content: "";
    position: absolute;
    top: -40%;
    left: -30%;
    width: 160%;
    height: 80%;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0.25),
        rgba(255,255,255,0.08),
        rgba(255,255,255,0)
    );
    opacity: 0.18;
    pointer-events: none;
}

.bubble-you {
    background: linear-gradient(135deg, #6f6af2, #4c4fe6);
}

.bubble-partner {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.typing-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 14px;
    background: #22c55e;
    color: white;

    box-shadow:
        0 6px 14px rgba(34, 197, 94, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.35);
}

.typing-bubble .dots span {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 0.8;
    display: inline-block;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 0.8;
    opacity: 0.4;
    animation: typingJumpSmooth 0.65s infinite ease-in-out alternate;
}

.typing-bubble .dots span:nth-child(1) { animation-delay: 0s; }
.typing-bubble .dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-bubble .dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingJumpSmooth {
    0%   { transform: translateY(0);    opacity: 0.4; }
    100% { transform: translateY(-4px); opacity: 1;   }
}

.typing-only {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin-left: 4px;
}

.typing-only .badge-like.no .dots span {
    font-size: 2.15em;
    font-weight: 700;
}

textarea.form-control {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(99,102,241,0.25);
    color: #020617;
    font-size: 0.9rem;
    resize: vertical;
}

textarea.form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
}

.input-block {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(55, 65, 81, 0.7);
}

.input-label {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-bottom: 4px;
}

.input-label strong {
    color: #e5e7eb;
}

.form-select {
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    color: #e5e7eb;
    padding-inline: 14px;
    padding-block: 6px;
    font-size: 0.85rem;
}

#level-saved-state {
    margin-top: 64px;
    text-align: center;
}

@keyframes bubbleInRight {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes bubbleInLeft {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes softPopGloss {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.94);
        filter: brightness(1.15);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
}

/* ======================================================
   LEVEL 2
   ====================================================== */

.back-link a:hover {
    opacity: 1;
    text-decoration: none;
}

.chat-wrapper.only-generating {
    justify-content: flex-start;
}

.chat-wrapper.only-generating .generating-row {
    margin-top: 150px;
}

.chat-wrapper.only-generating #my-can-ask-row {
    margin-top: 220px;
}

.generate-btn {
    width: auto !important;
    padding-inline: 22px;
    white-space: nowrap;
}

.generate-center-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 14px;
    margin-bottom: 14px;
}

.question-generate-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.question-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.98),
        rgba(248,250,252,0.94)
    );

    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.55);
    outline: 1px solid rgba(255,255,255,0.6);
    outline-offset: -2px;
    padding: 8px 18px;
    text-align: center;
    text-align-last: center;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #64748b;
    cursor: pointer;
    background-image: none;
    min-width: 220px;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 0 rgba(148,163,184,0.15),
        0 6px 18px rgba(15,23,42,0.12);
}

.question-select option {
    text-align: center;
    color: #475569;
    font-weight: 500;
}

.question-select option:disabled {
    color: #94a3b8;
}

.question-select:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow:
        0 0 0 1px rgba(167,139,250,0.8),
        0 10px 26px rgba(167,139,250,0.35);
}

.is-hidden {
    display: none !important;
}


.generating-row .chat-label,
.generating-row .chat-label-right {
    text-align: center !important;
    justify-content: center !important;
}

.generating-row {
    order: 999;
}

@media (min-width: 769px) {
    #my-can-ask-row.ask-row-hidden {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
}

@media (min-width: 769px) {
    #my-can-ask-row {
        min-height: 260px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.chat-wrapper.has-qa #my-can-ask-row {
    margin-top: 16px;
}


.chat-wrapper.has-qa .generating-row {
    margin-top: 24px;
}

/* ======================================================
   LEVEL 3
   ====================================================== */

#level-saved-state {
    margin-top: 64px;
}

body.profile-open {
    overflow: hidden;
}

.level-options-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0;
    list-style: none;
}

.level-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 18px;
    border-radius: 18px;
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.96),
        rgba(248,250,252,0.92)
    );

    border: 1px solid rgba(99,102,241,0.18);
    box-shadow:
        0 10px 26px rgba(15,23,42,0.10),
        inset 0 0 0 1px rgba(255,255,255,0.55);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.level-option:hover {
    transform: translateY(-1px);
    box-shadow:
        0 16px 34px rgba(15,23,42,0.14),
        inset 0 0 0 1px rgba(255,255,255,0.6);
}

.level-option:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.level-option.dragging {
    opacity: 0.6;
    transform: scale(1.03);
    box-shadow:
        0 24px 60px rgba(15,23,42,0.25),
        inset 0 0 0 1px rgba(255,255,255,0.7);
}

.drag-handle {
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    color: #64748b;
    opacity: 0.55;
    user-select: none;
    cursor: grab;
}

.level-option:hover .drag-handle {
    opacity: 1;
    color: #6366f1;
}

.option-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0f172a;
    user-select: none;
    pointer-events: none;
}

.mobile-move-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-move-buttons button {
    all: unset;
    width: 28px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.mobile-move-buttons .move-up::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #64748b; /* hall */
}

.mobile-move-buttons .move-down::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #64748b; /* hall */
}

.mobile-move-buttons button:hover {
    opacity: 1;
}

.mobile-move-buttons button:active {
    transform: scale(0.9);
}

.mobile-move-buttons button:hover::before {
    border-bottom-color: #6366f1;
    border-top-color: #6366f1;
}

@media (min-width: 769px) {
    .mobile-move-buttons {
        display: none !important;
    }
}

.level-question {
    text-align: center;
    margin-bottom: 18px;
}

.level-question-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    color: #64748b;
    margin-bottom: 6px;
}

.question-text {
    font-size: 1.15rem;
    font-weight: 500; 
    color: #475569;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Inter, system-ui, sans-serif;
}

.check-purple {
    margin-left: 6px;
    font-weight: 800;
    font-size: 1.1em;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-wrapper:has(#level-saved-state[style*="display:block"]) {
    justify-content: center;
}

#level-saved-state .question-text {
    font-size: 1.15rem;
    font-weight: 500;
    color: #475569;
    text-align: center;
}

.chat-wrapper.centered-state {
    justify-content: center;
}

#level-saved-state {
    text-align: center;
}

.level3-options-list li,
.answer-inline {
    font-size: 0.95rem;
    font-weight: 500;
    color: #0f172a;
}

.level3-results-grid h6 {
    font-size: 1.15rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Inter, system-ui, sans-serif;
    text-transform: none;
    letter-spacing: 0;
}


@keyframes glowLikeInner {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.badge-like {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;

    color: #64748b;
}

.badge-like.no {
    background: none;
    border: none;
    padding: 0;
}

.badge-like.no .dots {
    display: inline-flex;
}

.badge-like.no .dots span {
    opacity: 0;
    animation: dotBlink 1.4s infinite;
}

.badge-like.no .dots span:nth-child(1) { animation-delay: 0s; }
.badge-like.no .dots span:nth-child(2) { animation-delay: 0.2s; }
.badge-like.no .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBlink {
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

/* ======================================================
   LEVEL 4
   ====================================================== */

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounceSmooth {
    0%   { opacity: .25; transform: translateY(0); }
    25%  { opacity: 1;   transform: translateY(-4px); }
    50%  { opacity: .35; transform: translateY(0); }
    75%  { opacity: 1;   transform: translateY(-4px); }
    100% { opacity: .25; transform: translateY(0); }
}

.answer-saved-note {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 20px;

    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 0.9rem;
    color: #475569;
    text-align: center;
}

.answer-saved-note .tick {
    font-weight: 900;
    margin-left: 6px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-question .question-text {
    font-size: 1.15rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.4;
}

.answer-premium-box {
    width: 100%;
    padding: 16px 20px;
    border-radius: 20px;
    background: linear-gradient(
        180deg,
        #ffffff,
        #f1f5f9
    );
    border: 1px solid rgba(99,102,241,0.18);
    box-shadow:
        0 4px 10px rgba(15,23,42,0.04),
        inset 0 0 0 1px rgba(255,255,255,0.40);
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.55;
    animation: softPremiumIn 0.25s ease;
}

.answer-inline {
    line-height: 1.55;
}

.answer-who {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 6px;
    letter-spacing: 0.05em;
}

/* kindel: üks mull rea kohta */
.answer-premium-box {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* vahe mullide vahele */
.answer-premium-box + .answer-premium-box {
    margin-top: 5px !important;
}

@keyframes dotBlink {
    0%   { opacity: 0; }
    30%  { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes shineSweep {
    0%   { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

/* ======================================================
   LEVEL 5
   ====================================================== */

.waiting-block {
    margin-top: auto;
    padding-bottom: 130px;
}

/* ======================================================
   LEVEL 6
   ====================================================== */

   /* ======================================================
   MOBILE (max-width: 768px)
   ====================================================== */

@media (max-width: 768px) {

    html,
    body {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .chat-bubble {
        max-width: 100%;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
        gap: 6px;
    }

    .question-text {
        font-size: 1.05rem;
        font-weight: 500;
        color: #475569;
        text-align: center;
    }

    .level-question {
        margin-top: 0;
        margin-bottom: 18px;
        text-align: center;
    }

    .answer-premium-box {
        width: 100%;
        padding: 16px 20px;
        border-radius: 20px;
        margin-bottom: 5px;
        font-size: 0.80rem;
        color: #475569;
        line-height: 1.5;
    }

    .answer-premium-box:last-child {
        margin-bottom: 0;
    }

}