/* G*BOY BLOC Chat - Modern UI */
:root {
    --yellow: #FFE500;
    --yellow-dim: #C4B000;
    --black: #0A0A0A;
    --dark: #111111;
    --darker: #0D0D0D;
    --gray: #1A1A1A;
    --gray-light: #2A2A2A;
    --text: #FFFFFF;
    --text-dim: #888888;
    --text-muted: #555555;
    --accent: #FFE500;
    --success: #00FF88;
    --error: #FF4444;
    --gradient: linear-gradient(135deg, #FFE500 0%, #FFA500 100%);
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px rgba(255,229,0,0.15);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--black);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* Header */
header {
    background: var(--darker);
    border-bottom: 1px solid var(--gray);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

header .yellow {
    color: var(--yellow);
    text-shadow: 0 0 20px rgba(255,229,0,0.3);
}

/* Character Selector */
.selector {
    background: var(--dark);
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray);
}

.selector .label {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.bar {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-light) transparent;
    justify-content: center;
    flex-wrap: wrap;
}

.bar::-webkit-scrollbar {
    height: 6px;
}

.bar::-webkit-scrollbar-track {
    background: transparent;
}

.bar::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 3px;
}

/* Character Cards */
.card {
    flex: 0 0 280px;
    background: var(--gray);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: var(--yellow);
    box-shadow: var(--shadow-glow);
}

.card.active {
    border-color: var(--yellow);
    background: linear-gradient(180deg, rgba(255,229,0,0.1) 0%, var(--gray) 100%);
    box-shadow: var(--shadow-glow);
}

.card-content {
    padding: 20px;
    cursor: pointer;
    flex: 1;
}

.card-content:hover {
    background: rgba(255,255,255,0.02);
}

.card-avatar-wrapper {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gray-light);
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.card:hover .card-avatar {
    border-color: var(--yellow);
    box-shadow: 0 0 20px rgba(255,229,0,0.4), 0 4px 12px rgba(0,0,0,0.3);
    transform: scale(1.05);
}

.card.active .card-avatar {
    border-color: var(--yellow);
    box-shadow: 0 0 20px rgba(255,229,0,0.5);
}

.card-emoji {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.card-info {
    margin-bottom: 12px;
}

.card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.card-stat {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--yellow);
    text-transform: uppercase;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 68px;
}

.select-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--yellow);
    border: none;
    color: var(--black);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.select-btn:hover {
    background: #FFF;
    box-shadow: inset 0 0 20px rgba(255,229,0,0.5);
}

.select-btn .btn-icon {
    font-size: 1rem;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--darker);
    min-height: 0;
    position: relative;
}

.messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

/* Welcome State */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    opacity: 0.7;
}

.welcome .eye {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

.welcome h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--yellow);
    margin-bottom: 12px;
}

.welcome p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* Messages */
.msg {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 40px;
    height: 40px;
    background: var(--gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    overflow: hidden;
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-content {
    background: var(--gray);
    border-radius: var(--radius);
    padding: 14px 18px;
    border: 1px solid var(--gray-light);
}

.msg.user .msg-content {
    background: var(--yellow);
    color: var(--black);
    border-color: var(--yellow);
}

.msg-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--yellow);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.msg.user .msg-name {
    display: none;
}

.msg-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

.msg-hint {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-light);
    font-size: 0.85rem;
    color: var(--text-dim);
    font-style: italic;
}

.msg.error .msg-content {
    background: rgba(255,68,68,0.1);
    border-color: var(--error);
    color: var(--error);
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing .dot {
    width: 8px;
    height: 8px;
    background: var(--yellow);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); }
}

/* Input Area */
.input-area {
    background: var(--dark);
    border-top: 1px solid var(--gray);
    padding: 16px 24px;
}

    flex-shrink: 0;
.active-char {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--gray);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.active-char #char-emoji {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.active-char-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--yellow);
}

.active-char #char-name {
    font-weight: 600;
    color: var(--yellow);
}

.input-row {
    display: flex;
    gap: 12px;
}

#chat-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--gray);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

#chat-input:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px rgba(255,229,0,0.1);
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#send-btn {
    padding: 14px 28px;
    background: var(--yellow);
    border: none;
    border-radius: var(--radius);
    color: var(--black);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
}

#send-btn:hover:not(:disabled) {
    background: #FFF;
    transform: scale(1.02);
}

#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--dark);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.active .modal-box {
    transform: scale(1);
}

.close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--gray);
    border: none;
    border-radius: 50%;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 10;
}

.close:hover {
    background: var(--yellow);
    color: var(--black);
}

#modal-body {
    padding: 30px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray);
}

.modal-emoji {
    font-size: 4rem;
}

.modal-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--yellow);
    box-shadow: 0 0 20px rgba(255,229,0,0.3);
}

.modal-title h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.modal-stat {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--yellow);
    text-transform: uppercase;
}

.modal-intro {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 24px;
    padding: 16px;
    background: var(--gray);
    border-radius: var(--radius);
    border-left: 3px solid var(--yellow);
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--yellow);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.values-list, .style-list {
    list-style: none;
}

.values-list li, .style-list li {
    padding: 10px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-dim);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--gray);
}

.values-list li:last-child, .style-list li:last-child {
    border-bottom: none;
}

.values-list li::before, .style-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--yellow);
}

.vibe-text {
    font-size: 1rem;
    color: var(--text);
    font-style: italic;
    padding: 16px;
    background: var(--gray);
    border-radius: var(--radius);
}

.examples {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.example {
    background: var(--gray);
    border-radius: var(--radius);
    overflow: hidden;
}

.example-user, .example-bot {
    padding: 14px 16px;
    font-size: 0.9rem;
}

.example-user {
    background: rgba(255,229,0,0.1);
    border-bottom: 1px solid var(--gray-light);
}

.example-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--yellow);
    display: block;
    margin-bottom: 6px;
}

.example-bot {
    color: var(--text-dim);
}

.modal-chat-btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--yellow);
    border: none;
    border-radius: var(--radius);
    color: var(--black);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.modal-chat-btn:hover {
    background: #FFF;
    transform: scale(1.02);
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        flex: 0 0 260px;
    }
    
    .msg {
        max-width: 95%;
    }
    
    header {
        padding: 12px 16px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .selector {
        padding: 12px;
    }
    
    .bar {
        gap: 12px;
        padding: 4px 0;
    }
    
    .messages {
        padding: 16px 12px;
    }
    
    .input-area {
        padding: 12px;
    }
    
    #msg-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-box {
        max-height: 90vh;
        width: 95%;
        margin: 0 10px;
    }
    
    #modal-body {
        padding: 16px;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-avatar {
        width: 60px;
        height: 60px;
    }
    
    .modal-name {
        font-size: 1.3rem;
    }
    
    .modal-value {
        font-size: 0.7rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--darker);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
