.runy-container {
    margin: 20px auto;
    width: 100%;
    max-width: 600px;
    min-height: 250px;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: relative;
}

.runy-btn {
    display: block;
    min-width: 180px;
    height: 30px;
    margin: 0 auto;
    font-size: 13pt;
    background-color: #645a72;
    color: #fff;
    border-radius: 3px;
    border: 1px solid #3c3548;
    cursor: pointer;
}

.runy-btn-2 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 235px;
    height: 65px;
    margin: 10px auto 0;
    background-color: #f1e7d4;
    background-image: url('/wp-content/themes/gadanie-online/assets/images/knopka.webp');
    background-size: cover;
    background-position: center;
    color: #4a3828;
    font-size: 17px;
    font-weight: 400;
    font-family: 'EB Garamond', 'Georgia', serif;
    border: none;
    border-radius: 0;
    padding: 0 0 4px 0;
    outline: none;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.runy-btn-2:hover {
    transform: translateY(-2px);
}

.runy-btn-2:active,
.runy-btn-2.runy-btn-2--active {
    background-image: url('/wp-content/themes/gadanie-online/assets/images/knopka-1.webp');
    transform: translateY(2px);
}

#runy-getanswer {
    margin: 20px auto;
    display: block;
}

#runy-ask-again {
    margin: 20px auto;
    display: block;
}

.runy-instruction-text {
    text-align: center;
    font-size: 18px;
    color: #555;
    margin: 15px 0;
    line-height: 1.6;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.runy-question {
    display: flex;
}

.runy-question__text {
    font-weight: 600;
    margin-right: 1em;
    white-space: nowrap;
}

.runy-question__input {
    width: 100%;
}

.runy-question input {
    line-height: normal;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: 100%;
}

.runy-question input {
    background-color: transparent !important;
    border: none;
    border-bottom: 1px solid #9e9e9e;
    border-radius: 0;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
    -webkit-box-sizing: content-box;
    box-sizing: content-box;
    -webkit-transition: border .3s, -webkit-box-shadow .3s;
    transition: border .3s, -webkit-box-shadow .3s;
    transition: box-shadow .3s, border .3s;
    transition: box-shadow .3s, border .3s, -webkit-box-shadow .3s;
}

.runy-question input:focus:not([readonly]) {
    border-bottom-color: #72b84d;
    -webkit-box-shadow: 0 1px 0 0 #72b84d;
    box-shadow: 0 1px 0 0 #72b84d;
}

.runy-question input:disabled {
    color: #666;
    background-color: transparent !important;
    cursor: not-allowed;
    opacity: 0.7;
}

#runy-question__repeat {
    text-align: center;
    margin-bottom: 10px;
}

.runy-question__repeat-red {
    color: red;
}

/* Новые стили для webhook интеграции */
#runy-answer-block {
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    border: 2px solid #72b84d;
    font-size: 18px;
    font-family: 'EB Garamond', 'Georgia', serif;
    line-height: 1.5;
    text-align: center;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

.runy-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0 0 0;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.runy-invisible {
    display: none !important;
}

.runy-loading .loading-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #72b84d;
    animation: igrLoadingAnimation 1.5s infinite ease-in-out;
}

.runy-loading .loading-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.runy-loading .loading-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes igrLoadingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.runy-question.shake {
    animation: igrShake 0.6s ease-in-out;
}

@keyframes igrShake {
    0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
}

/* Темная тема */
[data-theme="dark"] .runy-container {
    color: #dbdbdb;
}

[data-theme="dark"] #runy-answer-block {
    background: rgb(207 207 207 / 90%) !important;
    border: 2px solid #72b84d !important;
    color: #656565 !important;
}

[data-theme="dark"] .runy-question input {
    background-color: transparent !important;
    border-bottom-color: #555 !important;
    color: #dbdbdb !important;
}

[data-theme="dark"] .runy-question input:focus:not([readonly]) {
    border-bottom-color: #72b84d !important;
    -webkit-box-shadow: 0 1px 0 0 #72b84d !important;
    box-shadow: 0 1px 0 0 #72b84d !important;
}

[data-theme="dark"] .runy-question input:disabled {
    background-color: transparent !important;
    color: #999 !important;
    border-bottom-color: #444 !important;
}

[data-theme="dark"] .runy-question input::placeholder {
    color: #999 !important;
}

[data-theme="dark"] .runy-loading .loading-dot {
    background-color: #72b84d !important;
}

[data-theme="dark"] .runy-btn-2 {
    color: #4a3828;
}

[data-theme="dark"] .runy-btn-2:hover {
    transform: translateY(-2px);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .runy-question {
        flex-direction: column;
        align-items: center;
    }

    .runy-question__text {
        margin-right: 0;
        margin-bottom: 10px;
        text-align: center;
        width: 100%;
    }

    .runy-question__input {
        width: 100%;
    }
}

/* ===== Стили для веера карт ===== */

.runy-wrapper {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 1s ease;
    margin-top: 0 !important;
    padding-top: 20px !important;
}

.runy-wrapper.show {
    display: flex;
    opacity: 1;
}

.runy-choose-card-text {
    display: none !important;
}

.runy-fan {
    order: 1;
}

.runy-choose-card-text.show {
    opacity: 1;
}

.runy-choose-card-text.hide {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.runy-fan {
    position: relative;
    height: 10px;
    width: 0;
    margin-top: 10px !important;
}

.runy-card {
    position: absolute;
    width: 92px;
    height: 126px;
    left: -46px;
    top: 0;
    transform-origin: center bottom;
    opacity: 0;
    transition: transform 0.6s ease, opacity 0.6s ease;
    cursor: pointer;
    perspective: 800px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.runy-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.runy-card:focus-visible .runy-card-inner {
    transform: translateY(-11px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.5), 0 0 0 2px #667eea;
}

/* Hover эффект только на десктопах */
@media (hover: hover) and (pointer: fine) {
    .runy-card:hover .runy-card-inner {
        transform: translateY(-11px);
        box-shadow: 0 12px 20px rgba(0, 0, 0, 0.5);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
}

/* Мобильные устройства - легкое затемнение при нажатии */
@media (hover: none) and (pointer: coarse) {
    .runy-card:active .runy-card-inner {
        opacity: 0.9;
    }
}

.runy-card-inner .runy-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 7px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.runy-card-inner .runy-back {
    background-color: #4a5568;
}

.runy-card-inner .runy-front {
    transform: rotateY(180deg);
    background-color: #764ba2;
}

/* Адаптивные размеры карт */
@media (max-width: 768px) {
    .runy-card {
        width: 80px;
        height: 110px;
        left: -40px;
    }
}

@media (max-width: 390px) {
    .runy-card {
        width: 67px;
        height: 92px;
        left: -33.5px;
    }
}

@media (max-width: 320px) {
    .runy-card {
        width: 60px;
        height: 82px;
        left: -30px;
    }
}

.runy-revealed-wrapper {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}

.runy-revealed-card {
    width: 184px;
    height: 252px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 17px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.runy-revealed-card.show {
    opacity: 1 !important;
    transform: translateY(0) scale(1) rotate(0deg) !important;
    transition: all 2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.runy-reveal-text {
    opacity: 0;
    transition: opacity 0.8s ease-in;
    margin-top: 16px;
    color: #000;
    font-size: 18px;
    font-family: 'EB Garamond', 'Georgia', serif;
    text-align: center;
    max-width: 400px;
    text-shadow: none;
    line-height: 1.5;
    white-space: pre-line; /* Поддержка переносов строк из PHP и <br> из webhook */
}

.runy-reveal-text.show {
    opacity: 1;
}

/* Темная тема для веера карт */
[data-theme="dark"] .runy-choose-card-text {
    color: #dbdbdb;
}

[data-theme="dark"] .runy-reveal-text {
    color: #dbdbdb;
}
