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

body {
    font-family: 'Comic Sans MS', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #8e24aa 0%, #ab47bc 50%, #8e24aa 100%);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Minecraft-style background blocks */
body::before {
    content: '🌸 ✨ 🦋 💖 🎨 🌺';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(236,64,122,0.03) 20px, rgba(236,64,122,0.03) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(186,104,200,0.03) 20px, rgba(186,104,200,0.03) 40px);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 50%, #ec407a 100%);
    padding: 30px;
    text-align: center;
    border-bottom: 6px solid #d81b60;
    position: relative;
}

header::after {
    content: '✨🌸🎨🦋💖🌺';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    opacity: 0.1;
    pointer-events: none;
}

.logo {
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 4px 4px 0 #d81b60, 8px 8px 0 rgba(0,0,0,0.2);
    letter-spacing: 2px;
    position: relative;
    z-index: 1;
}

.subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 10px;
    font-weight: bold;
    position: relative;
    z-index: 1;
}

/* Tabs */
.tabs {
    display: flex;
    background: #ab47bc;
    border-bottom: 4px solid #8e24aa;
}

.tab-btn {
    flex: 1;
    padding: 20px;
    font-size: 20px;
    font-weight: bold;
    background: transparent;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.tab-btn.active {
    background: #8e24aa;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

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

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: 600px;
}

/* Model Sidebar */
.model-sidebar {
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%);
    padding: 20px;
    border-radius: 15px;
    border: 4px solid #ab47bc;
    overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.model-sidebar h3 {
    color: #8e24aa;
    margin-bottom: 15px;
    font-size: 22px;
    text-align: center;
}

.random-btn {
    width: 100%;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    background: linear-gradient(135deg, #ba68c8 0%, #ab47bc 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.random-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.filter-btn {
    padding: 8px 12px;
    font-size: 14px;
    background: white;
    color: #ab47bc;
    border: 2px solid #ab47bc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.filter-btn:hover {
    background: #ab47bc;
    color: white;
}

.filter-btn.active {
    background: #8e24aa;
    color: white;
    border-color: #8e24aa;
}

.search-box {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 3px solid #ab47bc;
    border-radius: 10px;
    margin-bottom: 15px;
    font-family: inherit;
}

.selected-models-label {
    font-size: 13px;
    font-weight: bold;
    color: #8e24aa;
    margin-bottom: 8px;
}

.selected-models-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    border: 3px dashed rgba(171, 71, 188, 0.35);
    background: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
    min-height: 54px;
    align-items: center;
}

.selected-model-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(171, 71, 188, 0.12);
    border: 2px solid rgba(171, 71, 188, 0.25);
    color: #8e24aa;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

.selected-model-chip:hover {
    background: rgba(171, 71, 188, 0.18);
}

.start-chat-btn {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #f48fb1 0%, #ec407a 100%);
    color: white;
    border: 3px solid #d81b60;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
}

.start-chat-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.model-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 3px solid #f48fb1;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.model-card:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    border-color: #ab47bc;
}

.model-card.selected {
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    color: white;
    border-color: #d81b60;
}

.model-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.model-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tag {
    padding: 4px 8px;
    font-size: 11px;
    background: rgba(21, 101, 192, 0.2);
    border-radius: 5px;
    font-weight: bold;
}

/* Chat Area */
.chat-area {
    background: white;
    border-radius: 15px;
    border: 4px solid #ab47bc;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.chat-header {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    color: white;
    padding: 20px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    border-radius: 11px 11px 0 0;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.message {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 12px;
    max-width: 80%;
    animation: slideIn 0.3s;
}

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

.message.user {
    background: linear-gradient(135deg, #ba68c8 0%, #ab47bc 100%);
    color: white;
    margin-left: auto;
    border: 3px solid #9c27b0;
}

.message.ai {
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    color: white;
    border: 3px solid #d81b60;
}

.message-label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    opacity: 0.9;
}

.input-area {
    padding: 20px;
    background: #fce4ec;
    border-top: 4px solid #ab47bc;
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 15px;
    font-size: 16px;
    border: 3px solid #ab47bc;
    border-radius: 10px;
    resize: none;
    font-family: inherit;
}

.send-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.send-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Math Container */
.math-container {
    max-width: 900px;
    margin: 0 auto;
}

.math-container h2 {
    text-align: center;
    color: #8e24aa;
    font-size: 36px;
    margin-bottom: 15px;
    text-shadow: 3px 3px 0 rgba(0, 200, 83, 0.3);
}

.game-desc {
    text-align: center;
    font-size: 18px;
    color: #ab47bc;
    margin-bottom: 20px;
    font-weight: bold;
}

/* Times Table */
.table-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.game-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.times-table {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
    margin-bottom: 20px;
    background: #ab47bc;
    padding: 4px;
    border-radius: 10px;
}

.table-cell {
    background: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border-radius: 5px;
    font-size: 16px;
}

.table-header {
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    color: white;
    font-size: 18px;
}

.table-input {
    width: 100%;
    height: 40px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    border: 3px solid #ab47bc;
    border-radius: 5px;
    font-family: inherit;
}

.table-input.correct {
    background: #f8bbd0;
    border-color: #ec407a;
}

.table-input.incorrect {
    background: #ffcdd2;
    border-color: #ba68c8;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
}

.stat-box {
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%);
    padding: 20px 40px;
    border-radius: 15px;
    border: 4px solid #ab47bc;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #ab47bc;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 32px;
    color: #8e24aa;
    font-weight: bold;
}

/* Math Challenge */
.screen-time-display {
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.screen-time-earned {
    margin-bottom: 20px;
}

.big-number {
    display: block;
    font-size: 72px;
    font-weight: bold;
    color: white;
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

.time-label {
    display: block;
    font-size: 24px;
    color: white;
    font-weight: bold;
}

.progress-bar {
    background: rgba(0, 0, 0, 0.2);
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd54f 0%, #ffb300 100%);
    transition: width 0.5s;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.problem-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.type-btn {
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    background: white;
    color: #ab47bc;
    border: 4px solid #ab47bc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.type-btn:hover {
    background: #fce4ec;
}

.type-btn.active {
    background: linear-gradient(135deg, #ab47bc 0%, #8e24aa 100%);
    color: white;
}

.problem-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    border: 5px solid #ab47bc;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.problem-text {
    font-size: 48px;
    font-weight: bold;
    color: #8e24aa;
    margin-bottom: 20px;
}

.answer-input {
    width: 200px;
    height: 80px;
    text-align: center;
    font-size: 42px;
    font-weight: bold;
    border: 4px solid #ab47bc;
    border-radius: 12px;
    margin: 20px auto;
    display: block;
    font-family: inherit;
}

.submit-btn {
    padding: 20px 50px;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, #ec407a 0%, #d81b60 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.submit-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.feedback {
    font-size: 32px;
    font-weight: bold;
    margin-top: 20px;
    min-height: 40px;
}

.feedback.correct {
    color: #ec407a;
    animation: bounce 0.5s;
}

.feedback.incorrect {
    color: #ba68c8;
    animation: shake 0.5s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    font-size: 18px;
    color: #ab47bc;
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #fce4ec;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #ab47bc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8e24aa;
}
