:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --color-green: #10b981;
    --color-red: #ef4444;
    --color-yellow: #f59e0b;
    --color-blue: #3b82f6;
    --color-purple: #8b5cf6;
    
    --font-ui: 'Outfit', sans-serif;
    --font-heading: 'ZCOOL KuaiLe', cursive;
    
    --radius-md: 12px;
    --radius-lg: 20px;
}

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

body {
    font-family: var(--font-ui);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Utilities */
.text-green { color: var(--color-green); }
.text-red { color: var(--color-red); }
.text-yellow { color: var(--color-yellow); }
.text-blue { color: var(--color-blue); }
.text-purple { color: var(--color-purple); }
.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.w-100 { width: 100%; }
.small-text { font-size: 0.85rem; color: var(--text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-row { display: flex; gap: 0.5rem; align-items: center; }
.hidden { display: none !important; }

/* Glassmorphism Classes */
.glass-header {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.glass-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.glass-input:focus {
    border-color: var(--color-blue);
}
select.glass-input option {
    background: #1e1b4b;
    color: white;
}

/* Header & Dashboard */
.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: transparent;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.currency-dashboard {
    display: flex;
    gap: 1.5rem;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Layout */
#game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar Nav */
.side-nav {
    width: 200px;
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 1rem;
    text-align: left;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-btn.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-blue);
    border-left: 3px solid var(--color-blue);
}

/* Panels */
.panels-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
}

.panel {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.panel.active {
    display: block;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: white;
}

.panel-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Buttons */
button {
    cursor: pointer;
    font-family: inherit;
}

.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-exchange, .btn-small {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    color: white;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.btn-success { background: linear-gradient(135deg, #10b981, #34d399); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #f87171); }
.btn-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.btn-exchange {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    width: 100%;
    margin-top: 1rem;
}

.btn-exchange:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
}

.btn-primary:active, .btn-success:active, .btn-danger:active {
    transform: scale(0.95);
}

.btn-large {
    font-size: 1.2rem;
    padding: 1rem 3rem;
    border-radius: 30px;
}
.btn-large:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.glow-effect {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    animation: pulseGlow 2s infinite;
}

/* Grids */
.stats-grid, .exchange-grid, .items-grid, .inventory-grid {
    display: grid;
    gap: 1.5rem;
}
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.exchange-grid { grid-template-columns: repeat(3, 1fr); }
.items-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.inventory-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    color: var(--color-blue);
}

.exchange-card {
    text-align: center;
}
.exchange-card .ex-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Shop item card */
.shop-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.item-icon {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 1rem;
}
.item-price {
    background: rgba(0,0,0,0.3);
    padding: 0.3rem;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Inventory Item */
.inventory-item {
    text-align: center;
    padding: 1rem;
}
.inventory-item .qty {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ef4444;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* PK CSS */
.pvp-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}
.vs-text {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: transparent;
    background: linear-gradient(to bottom, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    animation: flash 1s infinite alternate;
}

.subject-select {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.btn-subject {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1.2rem;
    color: white;
}
.btn-subject.selected {
    border-color: var(--color-blue);
    background: rgba(59, 130, 246, 0.2);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.player {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
}
.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.bg-blue { background: var(--color-blue); }
.bg-red { background: var(--color-red); }

.timer {
    font-size: 2rem;
    font-family: var(--font-heading);
    font-weight: bold;
    color: var(--color-yellow);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.btn-option {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    font-size: 1.2rem;
    border-radius: var(--radius-md);
    color: white;
    transition: all 0.2s;
}
.btn-option:hover {
    background: rgba(255,255,255,0.1);
}
.btn-option.correct {
    background: rgba(16, 185, 129, 0.3);
    border-color: var(--color-green);
}
.btn-option.wrong {
    background: rgba(239, 68, 68, 0.3);
    border-color: var(--color-red);
}

.progress-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.5);
    border-radius: 5px;
    margin-top: 0.5rem;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--color-blue);
    width: 0%;
    transition: width 0.3s;
}

.reward-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    font-size: 1.5rem;
    border: 1px solid var(--color-yellow);
}


/* Robot Chat */
.robot-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.robot-avatar {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Robot Styles - CSS Art */
.bot-face {
    width: 120px;
    height: 90px;
    border-radius: 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.5s ease;
    animation: bob 3s ease-in-out infinite;
}
.bot-eyes {
    display: flex;
    gap: 30px;
}
.bot-eyes::before, .bot-eyes::after {
    content: '';
    width: 15px;
    height: 20px;
    border-radius: 50%;
    background: white;
    transition: all 0.3s;
}
.bot-mouth {
    width: 30px;
    height: 10px;
    border-radius: 0 0 15px 15px;
    background: white;
    transition: all 0.3s;
}

/* Style variants */
.bot-style-cute {
    background: var(--color-blue);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.bot-style-cyberpunk {
    background: #000;
    border: 2px solid var(--color-purple);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}
.bot-style-cyberpunk .bot-eyes::before, .bot-style-cyberpunk .bot-eyes::after {
    background: var(--color-purple);
    width: 25px; height: 5px; border-radius: 0;
}
.bot-style-cyberpunk .bot-mouth {
    width: 40px; height: 2px; background: var(--color-purple); border-radius: 0;
}

.bot-style-retro {
    background: #a3e635;
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.bot-style-retro .bot-eyes::before, .bot-style-retro .bot-eyes::after {
    background: #000; border-radius: 0; width: 12px; height: 12px;
}
.bot-style-retro .bot-mouth {
    background: #000; width: 20px; height: 4px; border-radius: 0;
}

.chat-window {
    height: 300px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Knowledge Stickers */
.sticker-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.btn-filter, .btn-sticker-type {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-filter:hover, .btn-sticker-type:hover {
    background: rgba(255,255,255,0.1);
}
.btn-filter.active, .btn-sticker-type.active {
    background: rgba(59, 130, 246, 0.3);
    border-color: var(--color-blue);
}
.stickers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.sticker-card {
    position: relative;
    padding-top: 2rem;
}
.sticker-badge {
    position: absolute;
    top: -10px;
    left: 20px;
    padding: 0.3rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.sticker-badge.type-重点 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.sticker-badge.type-难点 { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.sticker-badge.type-凝固点 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }

.sticker-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}
.sticker-content {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}
.sticker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 0.5rem;
}
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.3rem;
    border-radius: 4px;
}
.btn-icon:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}
.block { display: block; }
textarea.glass-input { resize: vertical; }

.message {
    display: flex;
}
.message.bot { justify-content: flex-start; }
.message.user { justify-content: flex-end; }
.message.system { justify-content: center; }

.msg-bubble {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    line-height: 1.4;
}
.message.bot .msg-bubble {
    background: rgba(255,255,255,0.1);
    border-bottom-left-radius: 4px;
}
.message.user .msg-bubble {
    background: var(--color-blue);
    border-bottom-right-radius: 4px;
}
.message.system .msg-bubble {
    background: transparent;
    font-size: 0.85rem;
    color: var(--color-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
}
.chat-input-area input {
    flex: 1;
}

/* Modals & Toasts */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    max-width: 500px;
    width: 90%;
    text-align: center;
}

#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--color-blue);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    color: white;
    min-width: 250px;
    animation: slideInRight 0.3s ease forwards;
}
.toast.success { border-left-color: var(--color-green); }
.toast.error { border-left-color: var(--color-red); }
.toast.warning { border-left-color: var(--color-yellow); }

/* Payment Modal Specific */
.payment-methods {
    display: flex;
    gap: 1rem;
    justify-content: center;
}
.btn-pay-method {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}
.btn-pay-method.active {
    background: rgba(255,255,255,0.15);
    border-color: var(--color-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.qr-code-box {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: inline-block;
    color: #333;
}
.mock-qr-code {
    width: 150px;
    height: 150px;
    background: 
        repeating-linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000),
        repeating-linear-gradient(45deg, #000 25%, #fff 25%, #fff 75%, #000 75%, #000);
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
    border: 5px solid white;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    margin: 0 auto;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
    0% { box-shadow: 0 0 15px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 25px rgba(59, 130, 246, 0.8); }
    100% { box-shadow: 0 0 15px rgba(59, 130, 246, 0.5); }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
.pulse { animation: pulse 2s infinite; }
@keyframes flash {
    from { opacity: 0.5; }
    to { opacity: 1; }
}
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes bounce-in {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.bounce-in { animation: bounce-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .content-area { flex-direction: column; }
    .side-nav { width: 100%; flex-direction: row; overflow-x: auto; padding: 1rem; border-right: none; border-bottom: 1px solid var(--glass-border); }
    .nav-btn span { display: none; } /* Icon only on mobile */
    .nav-btn { justify-content: center; }
    .exchange-grid { grid-template-columns: 1fr; }
    .robot-layout { grid-template-columns: 1fr; }
}
