:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --bg-card: rgba(22, 31, 53, 0.7);
    --bg-card-hover: rgba(28, 40, 68, 0.85);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-violet: #6366f1;
    --accent-cyan: #06b6d4;
    --accent-gold: #f59e0b;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(245, 158, 11, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
}

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    flex-wrap: wrap;
    gap: 16px;
}

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

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fe2c55, #25f4ee);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    box-shadow: 0 4px 20px rgba(254, 44, 85, 0.35);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.version-badge {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(129, 140, 248, 0.3);
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

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

.input-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 14px;
    height: 44px;
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--accent-violet);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-prefix {
    color: var(--accent-cyan);
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 4px;
}

.input-group input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    width: 160px;
}

/* Status Indicator */
.status-indicator-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: var(--transition);
}

.status-dot.live {
    background-color: var(--accent-emerald);
    box-shadow: 0 0 12px var(--accent-emerald);
    animation: pulse 1.8s infinite;
}

.status-dot.connecting {
    background-color: var(--accent-gold);
    animation: pulse 1s infinite;
}

.status-dot.error {
    background-color: var(--accent-rose);
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-violet), #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2);
    color: #fff;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 18px rgba(245, 158, 11, 0.4);
}

.btn-gold:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-rose), #e11d48);
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    height: 52px;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    height: 34px;
    padding: 0 12px;
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

/* Tabs Navigation */
.nav-tabs {
    display: flex;
    gap: 10px;
    padding: 8px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.15));
    color: var(--text-primary);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-giveaway {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Tab Panels */
.tab-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tab-panel {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: flex;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-title h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* CHAT FEED */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 280px);
    min-height: 480px;
    overflow: hidden;
}

.chat-feed {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    max-width: 85%;
    animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-msg.bot-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(99, 102, 241, 0.15));
    border-color: rgba(6, 182, 212, 0.4);
}

.chat-msg.match-kw {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.1);
}

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    object-fit: cover;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
}

.msg-nickname {
    font-weight: 700;
    color: var(--text-primary);
}

.msg-username {
    color: var(--text-muted);
}

.msg-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.msg-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    line-height: 1.4;
    word-break: break-word;
}

.chat-sender-bar {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid var(--border-color);
}

.chat-sender-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
}

.chat-sender-bar input:focus {
    border-color: var(--accent-cyan);
}

/* Data Tables (Commands) */
.commands-grid {
    padding: 20px;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.trigger-tag {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-family: monospace;
    font-size: 0.95rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-weight: 700;
}

/* Giveaway Arena Layout */
.giveaway-workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .giveaway-workspace {
        grid-template-columns: 1fr;
    }
}

.giveaway-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.giveaway-card h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-gold);
}

.input-with-icon input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
}

.form-select {
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

.giveaway-participants-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 520px;
}

.giveaway-participants-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.participants-scroll-list {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding-right: 6px;
}

.participant-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: scaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.part-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.part-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-window {
    width: 100%;
    max-width: 520px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

/* DRAMATIC WINNER REVEAL STAGE OVERLAY */
.dramatic-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(19, 27, 46, 0.96) 0%, rgba(11, 15, 25, 0.98) 100%);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#confettiCanvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.dramatic-container {
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 2001;
    text-align: center;
}

.dramatic-badge {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    color: #fff;
    padding: 6px 20px;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
}

.dramatic-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-top: 8px;
    color: var(--text-secondary);
}

.winners-stage {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.winner-reveal-card {
    background: linear-gradient(135deg, rgba(22, 31, 53, 0.9), rgba(30, 41, 69, 0.9));
    border: 2px solid var(--accent-gold);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 10px 40px rgba(245, 158, 11, 0.25);
    animation: dramaticEntrance 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

@keyframes dramaticEntrance {
    0% { opacity: 0; transform: scale(0.4) translateY(40px); filter: blur(10px); }
    70% { transform: scale(1.05) translateY(-5px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

.winner-place-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.place-1 {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
}
.place-2 {
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    box-shadow: 0 0 20px rgba(226, 232, 240, 0.4);
}
.place-3 {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
}
.place-other {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.winner-info {
    text-align: left;
    flex: 1;
}

.winner-place-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-gold);
    font-weight: 700;
}

.winner-full-str {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 2px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 10px;
    height: 100%;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}
