:root {
    --bg-color: #0a0a0a;
    --card-bg: rgba(30, 30, 30, 0.8);
    --primary-color: #ffd700; /* Gold */
    --secondary-color: #00bcd4; /* Cyan/Spirit */
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #333;
    --success-color: #4ecca3;
    --danger-color: #ff4e4e;
    --font-main: 'Noto Serif SC', serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
}

.app-container {
    max-width: 480px; /* Mobile first constraint */
    margin: 0 auto;
    background-image: url('https://images.unsplash.com/photo-1518709268805-4e9042af9f23?ixlib=rb-1.2.1&auto=format&fit=crop&w=668&q=80'); /* Subtle mist/mountain texture if available, or just fallback color */
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Overlay to darken background image */
.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.85);
    z-index: 0;
}

/* Ensure content sits above overlay */
.navbar, .main-content, .bottom-nav {
    position: relative;
    z-index: 1;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

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

.logo-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.logo-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.logo .icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), #fff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #d4af37, #ffd700);
    border: none;
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-main);
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.2);
    transition: transform 0.2s;
}

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

/* Main Content */
.main-content {
    padding: 20px;
    flex: 1;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Status Panel */
.status-panel {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.avatar-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 2px solid var(--primary-color);
}

.level-badge {
    background: rgba(255, 215, 0, 0.1);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

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

.stat-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.tag {
    font-size: 0.7rem;
    background: rgba(0, 188, 212, 0.1);
    color: var(--secondary-color);
    padding: 2px 8px;
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
}

.sub-text {
    font-size: 0.8rem;
    margin-bottom: 15px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(0, 188, 212, 0.1);
}

/* Cultivation Animation */
.cultivation-card {
    text-align: center;
}

.cultivation-animation {
    position: relative;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.meditating-horse {
    font-size: 4rem;
    z-index: 2;
}

.pulse-circle {
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(0, 188, 212, 0.2);
    border-radius: 50%;
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.7; }
    50% { transform: scale(1.2); opacity: 0.3; }
    100% { transform: scale(0.8); opacity: 0.7; }
}

#cultivation-status {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: var(--secondary-color);
    height: 100%;
    width: 0%;
    transition: width 0.5s;
    box-shadow: 0 0 10px var(--secondary-color);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #0f0f0f;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
}

/* Limit bottom nav width on desktop */
@media (min-width: 480px) {
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    gap: 4px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 1.2rem;
}

/* =========================================
   MODAL STYLES (Restored)
   ========================================= */
.modal {
    display: none; 
    position: fixed; 
    z-index: 200; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1a1a1a;
    margin: 15% auto; /* Mobile vertical center adjustment */
    padding: 20px;
    border: 1px solid var(--primary-color);
    width: 90%; 
    max-width: 400px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.close-btn {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

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

.modal-title {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.market-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile for better visibility */
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 5px; /* Space for scrollbar */
}

/* Custom Scrollbar for modal */
.market-grid::-webkit-scrollbar {
    width: 6px;
}
.market-grid::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.market-card {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: auto 1fr auto; /* Icon - Info - Button */
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.card-image {
    font-size: 2.5rem;
}

.market-info {
    text-align: left;
}

.market-card h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.rate-badge {
    display: inline-block;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.buy-btn {
    background-color: #2b9bb8;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    min-width: 80px;
}

.buy-btn:hover {
    background-color: #3bc0e0;
}

.buy-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* Rarity Styles */
.market-card.common { border-left: 4px solid #a0a0a0; }
.market-card.rare { border-left: 4px solid #4ecca3; }
.market-card.epic { border-left: 4px solid #b04ecc; }
.market-card.legendary { border-left: 4px solid #ffd700; }
.market-card.mythic { border-left: 4px solid #ff4e4e; box-shadow: 0 0 10px rgba(255, 78, 78, 0.2); }
