/* ==============================================================================
   AnonBox Telegram WebApp Aesthetics (Dark & Modern)
   ============================================================================== */

:root {
    --bg-main: #0e1621;
    --bg-card: #17212b;
    --bg-input: #242f3d;
    --text-primary: #f5f5f5;
    --text-secondary: #7f91a4;
    --tg-blue: #2481cc;
    --tg-blue-hover: #2ea6ff;
    --border-color: rgba(255, 255, 255, 0.08);
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --radius-card: 16px;
    --radius-input: 10px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-stack);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    position: relative;
    overflow-x: hidden;
}

.background-decor {
    position: fixed;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: radial-gradient(circle at 50% 20%, rgba(36, 129, 204, 0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.app-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--tg-blue), #1d69a6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
}

.brand-badge {
    font-size: 0.72rem;
    color: var(--tg-blue-hover);
    font-weight: 500;
}

.lang-switch {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* Card Container */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 24px 22px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

/* Steps Management */
.step {
    display: none;
    flex-direction: column;
    gap: 20px;
}

.step.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

/* ==============================================================================
   NATIVE TELEGRAM INCOMING MESSAGE BUBBLE
   ============================================================================== */
.tg-incoming-bubble {
    background: #17212b;
    border: 1px solid rgba(46, 166, 255, 0.22);
    border-radius: 16px;
    padding: 16px 16px 14px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
}

/* Header */
.tg-bubble-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tg-sender-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2481cc, #1d6fa5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 4px 10px rgba(36, 129, 204, 0.3);
}

.avatar-lock-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    font-size: 11px;
    background: #0f161e;
    border-radius: 50%;
    padding: 1px;
    line-height: 1;
}

.tg-sender-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
    min-width: 0;
}

.tg-sender-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #54a9eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.tg-sender-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #7f91a4;
}

.status-badge {
    color: #ff9f43;
    font-weight: 600;
}

.status-dot {
    opacity: 0.5;
}

.tg-bubble-timer {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 75, 43, 0.12);
    border: 1px solid rgba(255, 75, 43, 0.3);
    color: #ff6b6b;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Quote Body (Telegram Native Style) */
.tg-bubble-body {
    display: flex;
    gap: 10px;
    background: rgba(14, 22, 33, 0.65);
    border-radius: 10px;
    padding: 10px 12px;
    position: relative;
}

.tg-quote-bar {
    width: 3px;
    border-radius: 3px;
    background: #54a9eb;
    flex-shrink: 0;
}

.tg-quote-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.tg-quote-author {
    font-size: 0.75rem;
    font-weight: 600;
    color: #54a9eb;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tg-message-text {
    font-size: 0.92rem;
    line-height: 1.45;
    color: #f5f5f5;
    margin: 0;
    word-break: break-word;
}

.text-visible {
    color: #ffffff;
    font-weight: 400;
}

/* Telegram Native Spoiler Shimmer */
.tg-spoiler {
    display: inline;
    color: transparent;
    text-shadow: 0 0 9px rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 1px 4px;
    filter: blur(2px);
    user-select: none;
    -webkit-user-select: none;
    animation: spoilerShimmer 2.5s infinite alternate;
}

@keyframes spoilerShimmer {
    0% { filter: blur(2px); text-shadow: 0 0 8px rgba(255, 255, 255, 0.7); }
    100% { filter: blur(3px); text-shadow: 0 0 12px rgba(46, 166, 255, 0.9); }
}

/* Lock Banner */
.tg-lock-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(36, 129, 204, 0.12);
    border: 1px solid rgba(46, 166, 255, 0.25);
    border-radius: 8px;
    padding: 7px 12px;
    color: #bce0fd;
    font-size: 0.78rem;
    font-weight: 500;
}

.tg-lock-banner svg {
    color: #54a9eb;
    flex-shrink: 0;
}

/* Footer */
.tg-bubble-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #799ab7;
    font-weight: 500;
    padding-left: 2px;
}

/* Alert Banner (Legacy/Fallback) */
.msg-alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(36, 129, 204, 0.12);
    border: 1px solid rgba(36, 129, 204, 0.3);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #bce0fd;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--tg-blue-hover);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(46, 166, 255, 0.7);
    animation: pulse 1.8s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 166, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(46, 166, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 166, 255, 0); }
}

/* Headers */
.step-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.step-header p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.phone-input-wrapper {
    display: flex;
    gap: 8px;
}

.country-dropdown {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 10px;
    border-radius: var(--radius-input);
    font-size: 0.92rem;
    outline: none;
    cursor: pointer;
}

.phone-input-wrapper input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: var(--radius-input);
    font-size: 1.05rem;
    outline: none;
    letter-spacing: 0.5px;
    transition: border-color 0.2s;
}

.phone-input-wrapper input:focus,
.password-wrapper input:focus {
    border-color: var(--tg-blue);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 13px;
    border-radius: var(--radius-input);
    border: none;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.985);
}

.btn-primary {
    background: var(--tg-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--tg-blue-hover);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--tg-blue-hover);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    cursor: pointer;
    margin-bottom: -6px;
    align-self: flex-start;
}

/* Digit Inputs */
.digits-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.digit-box {
    width: 54px;
    height: 58px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all 0.2s;
}

.digit-box:focus {
    border-color: var(--tg-blue);
    box-shadow: 0 0 10px rgba(36, 129, 204, 0.4);
    transform: scale(1.04);
}

.resend-block {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--tg-blue-hover);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.btn-link:hover {
    opacity: 0.85;
}

.email-hint {
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.76rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.4;
}

/* Password Input */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 42px 12px 14px;
    border-radius: var(--radius-input);
    font-size: 1rem;
    outline: none;
}

.toggle-pass-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
}

.lock-icon-wrap {
    width: 52px;
    height: 52px;
    background: rgba(36, 129, 204, 0.15);
    color: var(--tg-blue-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

/* Success Card */
.success-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.success-icon-wrap {
    width: 64px;
    height: 64px;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.revealed-message-card {
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.revealed-tag {
    display: flex;
    justify-content: space-between;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.revealed-content {
    font-size: 0.96rem;
    line-height: 1.5;
    color: #e2e8f0;
    font-style: italic;
}

.safe-note {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    justify-content: center;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(127, 145, 164, 0.6);
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    transition: all 0.3s ease;
}

.toast.error {
    background: #450a0a;
    border-color: var(--accent-red);
    color: #fca5a5;
}

.toast.success {
    background: #052e16;
    border-color: var(--accent-green);
    color: #86efac;
}

/* ==============================================================================
   Giveaway / Contest Mode Dynamic Styles
   ============================================================================== */

body.mode-giveaway .anon-only {
    display: none !important;
}

body.mode-anon .giveaway-only {
    display: none !important;
}

.giveaway-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 12px;
}

.giveaway-nav-title {
    font-size: 1.12rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.btn-more-options {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-more-options:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}

.giveaway-hero {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 6px;
}

.giveaway-banner {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.giveaway-status-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.status-pill {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-win {
    background: #141c28;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.status-win strong {
    color: #ffffff;
    letter-spacing: 0.3px;
}

.status-reserve {
    background: linear-gradient(135deg, #e11d48, #db2777);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

.status-reserve strong {
    font-family: monospace;
    font-size: 0.88rem;
    letter-spacing: 0.5px;
}

.giveaway-congrats-card {
    background: #131c2a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid #f43f5e;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.congrats-badge {
    font-size: 0.8rem;
    font-weight: 800;
    color: #f43f5e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.prize-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.35;
    margin-bottom: 6px;
}

.prize-desc {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
}

.giveaway-step-indicator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.84rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 12px;
}

.active-dot {
    color: #22c55e;
    font-weight: 600;
}

.giveaway-label {
    font-size: 0.94rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 10px;
    line-height: 1.35;
}

.giveaway-security-note {
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.4;
    margin-top: 10px;
    margin-bottom: 16px;
}

.btn-giveaway {
    background: linear-gradient(135deg, #e11d48, #db2777) !important;
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4) !important;
    border: none !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

.btn-giveaway:hover {
    background: linear-gradient(135deg, #f43f5e, #e11d48) !important;
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.5) !important;
}

.giveaway-won-box {
    text-align: center;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.won-icon {
    font-size: 3rem;
    animation: bounce 1s infinite alternate ease-in-out;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-8px); }
}

.giveaway-won-box h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}

.won-prize-text {
    font-size: 1.05rem;
    color: #f43f5e;
    font-weight: 600;
}

.won-subtext {
    font-size: 0.84rem;
    color: #94a3b8;
    line-height: 1.45;
    max-width: 320px;
}

.giveaway-footer {
    text-align: center;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.45;
    padding: 6px 10px 24px;
}

.giveaway-footer .delivery-line {
    color: #cbd5e1;
    font-size: 0.8rem;
}

.giveaway-footer .org-line {
    color: #64748b;
    font-size: 0.74rem;
    margin-top: 4px;
}
