/* ========================================
   Aviator AI - Split Screen + Telegram Chat
   ======================================== */

#aviator-split-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    z-index: 100001;
    background: #0d0d15;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Game Section (top half) */
#game-section {
    width: 100%;
    height: 55vh;
    min-height: 320px;
    position: relative;
    background: #000;
    flex-shrink: 0;
}

#game-section iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Orya login / loading */
.orya-panel {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0d0d15 0%, #1a0d18 100%);
    z-index: 2;
}
.orya-panel-inner { width: 100%; max-width: 320px; padding: 24px; }
.orya-logo { font-size: 1.8rem; font-weight: 800; color: #fff; text-align: center; margin-bottom: 4px; letter-spacing: 1px; }
.orya-desc { font-size: 0.85rem; color: rgba(255,255,255,0.5); text-align: center; margin-bottom: 20px; }
.orya-form input[type="text"], .orya-form input[type="password"] {
    width: 100%; padding: 14px 16px; border: 1px solid rgba(232, 54, 93, 0.25); border-radius: 12px;
    background: rgba(255,255,255,0.04); color: #fff; font-size: 0.95rem; margin-bottom: 12px; box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}
.orya-form input::placeholder { color: rgba(255,255,255,0.35); }
.orya-password-wrap { position: relative; }
.orya-password-wrap input { padding-right: 44px; }
.orya-toggle-pw {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: rgba(255,255,255,0.4); padding: 8px; cursor: pointer;
}
.orya-error { font-size: 0.8rem; color: #ff5252; margin: 0 0 12px; min-height: 20px; }
.orya-btn {
    width: 100%; padding: 14px; border: none; border-radius: 12px;
    background: linear-gradient(135deg, #e8365d, #ff6b9d); color: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; transition: transform 0.2s;
    font-family: 'Outfit', sans-serif;
}
.orya-btn:active { transform: scale(0.98); }
.orya-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.orya-loading { flex-direction: column; gap: 16px; }
.orya-loading p { font-size: 0.9rem; color: rgba(255,255,255,0.6); }
.orya-spinner {
    width: 40px; height: 40px; border: 3px solid rgba(232, 54, 93, 0.2); border-top-color: #e8365d; border-radius: 50%;
    animation: tg-spin 0.8s linear infinite;
}
.orya-balance-wrap { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(13, 140, 71, 0.12); border: 1px solid rgba(13, 140, 71, 0.25); border-radius: 8px; }
.orya-balance-label { font-size: 0.65rem; color: #555; }
.orya-balance-value { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 700; color: #0d8c47; }
.orya-logout-btn { background: none; border: none; color: #666; padding: 4px 6px; cursor: pointer; font-size: 0.8rem; }
.orya-logout-btn:hover { color: #c62828; }

/* Divider */
.ai-divider {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #e8365d, #ff6b9d, #e8365d, transparent);
    position: relative;
}
.ai-divider-line {
    position: absolute;
    top: -1px; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, transparent, rgba(232, 54, 93, 0.5), transparent);
    filter: blur(4px);
}

/* ========================================
   TELEGRAM STYLE - AI Section
   ======================================== */

#ai-section {
    display: flex;
    flex-direction: column;
    min-height: 45vh;
    background: #e0f2e9;
}

/* Telegram Header */
.tg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #e0f2e9;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.tg-header-back {
    background: none; border: none; color: #2e7d32; font-size: 1.1rem; padding: 6px; cursor: pointer;
}
.tg-header-avatar {
    width: 38px; height: 38px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
}
.tg-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tg-header-info { flex: 1; min-width: 0; }
.tg-header-name {
    display: block; font-size: 0.95rem; font-weight: 600; color: #1a1a1a;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tg-header-status {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.72rem; color: #2e7d32;
}
.tg-header-status i { font-size: 5px; }
.tg-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Chat Area - fundo verde igual Telegram */
.tg-chat {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #e0f2e9;
    min-height: 200px;
}

/* Message bubbles */
.tg-msg {
    max-width: 88%;
    position: relative;
    animation: tg-msg-in 0.3s ease;
}

@keyframes tg-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tg-msg.bot { align-self: flex-start; }
.tg-msg.user { align-self: flex-end; }

.tg-msg-bubble {
    padding: 8px 10px 4px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

/* Bolhas do bot = fundo branco (resultados) */
.tg-msg.bot .tg-msg-bubble {
    background: #ffffff;
    color: #1a1a1a;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.tg-msg.user .tg-msg-bubble {
    background: #dcf8c6;
    color: #1a1a1a;
    border-top-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.tg-msg-time {
    display: block;
    text-align: right;
    font-size: 0.65rem;
    color: #8a8a8a;
    margin-top: 2px;
    padding-bottom: 2px;
}

/* NEW ROUND label */
.tg-new-round {
    text-align: center;
    padding: 4px 0;
}
.tg-new-round span {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #2e7d32;
    background: rgba(46, 125, 50, 0.12);
    border: 1px solid rgba(46, 125, 50, 0.2);
}

/* Probability badge on entry card */
.tg-entry-badge {
    text-align: center;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}
.tg-entry-badge.badge-safe {
    background: rgba(13, 140, 71, 0.1);
    color: #0d8c47;
    border: 1px solid rgba(13, 140, 71, 0.2);
}
.tg-entry-badge.badge-warning {
    background: rgba(230, 81, 0, 0.1);
    color: #e65100;
    border: 1px solid rgba(230, 81, 0, 0.2);
}

/* Entry result card inside bubble */
.tg-entry-card {
    width: 100%;
}

.tg-entry-row .val.orange { color: #e65100; }

.tg-entry-mul {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.8rem;
    font-weight: 800;
    text-align: center;
    padding: 12px 0 6px;
    line-height: 1;
}
.tg-entry-mul.pink { color: #e8365d; }
.tg-entry-mul.purple { color: #a855f7; }
.tg-entry-mul.blue { color: #38bdf8; }

.tg-entry-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 4px;
}

.tg-entry-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid rgba(0,0,0,0.08);
    font-size: 0.82rem;
}
.tg-entry-row:first-child { border-top: none; }
.tg-entry-row .lbl { color: #666; }
.tg-entry-row .val { font-weight: 700; color: #1a1a1a; font-family: 'JetBrains Mono', monospace; }
.tg-entry-row .val.green { color: #0d8c47; }
.tg-entry-row .val.pink { color: #c62828; }
.tg-entry-row .val.purple { color: #6a1b9a; }
.tg-entry-row .val.gold { color: #e65100; }

.tg-your-bet {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(13, 140, 71, 0.08);
    border: 1px solid rgba(13, 140, 71, 0.2);
    border-radius: 8px;
    text-align: center;
}
.tg-your-bet .bet-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #0d8c47;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.tg-your-bet .bet-id {
    font-size: 0.7rem;
    color: #666;
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}

/* Typing indicator */
.tg-typing {
    align-self: flex-start;
    padding: 10px 16px;
    background: #ffffff;
    border-radius: 12px;
    border-top-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.tg-typing-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #9e9e9e;
    animation: tg-typing-bounce 1.4s ease-in-out infinite;
}
.tg-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.tg-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes tg-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick Action Buttons */
.tg-quick-actions {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background: #e0f2e9;
    flex-shrink: 0;
}
.tg-action-btn {
    flex: 1;
    padding: 12px 8px;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.15s, opacity 0.15s;
    font-family: 'Outfit', sans-serif;
}
.tg-action-btn:active { transform: scale(0.97); }
.tg-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.tg-action-btn.pink {
    background: linear-gradient(135deg, #e8365d, #ff4d7a);
    color: #fff;
    flex-direction: column;
    gap: 4px;
    padding: 10px 8px;
    position: relative;
    overflow: hidden;
}
.tg-action-btn.pink.locked {
    background: #c5c5c5;
    color: #fff;
    opacity: 1 !important;
}
.tg-action-btn.pink.unlocked {
    animation: tg-pink-glow 1.5s ease-in-out infinite;
}
@keyframes tg-pink-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 54, 93, 0); }
    50% { box-shadow: 0 0 16px 4px rgba(232, 54, 93, 0.45); }
}

.tg-lock-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}
.tg-progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.35);
    overflow: hidden;
}
.tg-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: #fff;
    transition: width 0.5s ease;
}

.tg-action-btn.pink.cooldown .tg-progress-bar {
    background: rgba(255,255,255,0.25);
}
.tg-action-btn.pink.cooldown .tg-progress-fill {
    background: linear-gradient(90deg, #e8365d, #ff6b9d);
}

.tg-action-btn.purple {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: #fff;
}

/* Telegram Input Bar */
/* Botão Ir ao jogo (após entrada revelada) */
.tg-go-game-wrap .tg-msg-bubble { padding-bottom: 8px; }
.tg-go-game-btn {
    width: 100%;
    padding: 12px 16px;
    margin-top: 4px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e8365d, #ff4d7a);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s;
}
.tg-go-game-btn:active { transform: scale(0.98); }

/* Animations */
@keyframes tg-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-height: 700px) {
    #game-section { height: 50vh; min-height: 280px; }
}
