:root {
    --math-bg: #f8fafc;
    --math-primary: #1e293b;
    --math-accent: #3b82f6;
    --math-text: #475569;
    --math-card-bg: #ffffff;
    
    --main-bg: #0f172a;
    --main-card: rgba(255, 255, 255, 0.05);
    --main-accent: #38bdf8;
    --main-text: #f8fafc;
    --main-text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.hidden {
    display: none !important;
}

/* --- MATH MODE --- */
#math-mode {
    background-color: var(--math-bg);
    min-height: 100vh;
    color: var(--math-text);
}

.math-nav {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
}

.math-nav .logo {
    font-weight: 700;
    color: var(--math-primary);
}

.math-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.math-nav a {
    text-decoration: none;
    color: #64748b;
    font-size: 0.85rem;
}

.math-content {
    padding: 4rem 0;
}

.math-content header {
    margin-bottom: 3rem;
}

.math-content h1 {
    font-size: 1.5rem;
    color: var(--math-primary);
    margin-bottom: 0.5rem;
}

.math-container {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.math-question {
    margin-bottom: 2rem;
}

.math-question p {
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.math-question input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group input {
    flex: 1;
}

#solve-btn {
    background: var(--math-accent);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.math-footer {
    text-align: center;
    padding: 2rem 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

/* --- CATALOG MODE --- */
#catalog-mode {
    background-color: var(--main-bg);
    min-height: 100vh;
    color: var(--main-text);
}

.main-nav {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.main-nav .container {
    display: flex;
    justify-content: center;
}

.search-bar {
    background: var(--main-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    font-size: 1rem;
}

.main-content {
    padding: 4rem 0;
}

.catalog-header {
    margin-bottom: 2rem;
}

.catalog-header h2 {
    font-size: 1.25rem;
    color: var(--main-text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.item-card {
    background: var(--main-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s;
    aspect-ratio: 1 / 1.2;
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    transform: translateY(-5px);
    border-color: var(--main-accent);
}

.card-img {
    flex: 1;
    overflow: hidden;
    padding: 1rem;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.card-info {
    padding: 1.5rem;
    text-align: center;
}

.card-info h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.launch-btn {
    background: var(--main-accent);
    color: #0f172a;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s;
}

/* --- OVERLAY --- */
#content-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#overlay-frame-container {
    flex: 1;
    width: 100%;
    height: 100%;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
}
