:root {
    --bg-color: #030712;
    --panel-bg: rgba(15, 23, 42, 0.85);
    --accent-color: #38bdf8;
    --success-color: #4ade80;
    --error-color: #f87171;
    --text-color: #f1f5f9;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at center, #0f172a 0%, #030712 100%);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* Background Canvas */
#molecule-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
}

/* Landing Page Styles */
.title-container {
    text-align: center;
    padding: 50px 30px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border: 2px solid rgba(56, 189, 248, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 40px rgba(56, 189, 248, 0.25);
    max-width: 600px;
    width: 90%;
    position: relative;
    z-index: 10;
}

h1 {
    font-size: 3.8rem;
    margin: 0 0 10px 0;
    color: #38bdf8;
    letter-spacing: 3px;
    text-shadow: 0 0 25px rgba(56, 189, 248, 0.6), 0 0 50px rgba(56, 189, 248, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-bottom: 35px;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.menu-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.start-btn {
    display: inline-block;
    text-decoration: none;
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    color: #030712;
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 10px;
    transition: all 0.25s ease;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.start-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 0 35px rgba(56, 189, 248, 0.7);
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}

/* Gameplay Container & Navigation */
.game-wrapper {
    width: 100%;
    max-width: 620px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.back-home-btn {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 8px 14px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid #334155;
    border-radius: 8px;
    transition: all 0.2s;
}

.back-home-btn:hover {
    color: white;
    background-color: #334155;
}

.nav-tabs {
    display: flex;
    gap: 8px;
}

.nav-tabs a {
    text-decoration: none;
}

.tab-btn {
    background-color: rgba(30, 41, 59, 0.8);
    color: #94a3b8;
    border: 1px solid #334155;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-color);
    background-color: #334155;
}

.tab-btn.active-tab {
    background-color: #0369a1;
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.game-container {
    background-color: var(--panel-bg);
    border: 2px solid #1e293b;
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.15);
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #334155;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.stats {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.level-badge {
    background-color: #0369a1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.question-box {
    font-size: 1.2rem;
    margin: 15px 0;
    text-align: center;
    background: #0f172a;
    padding: 18px;
    border-radius: 8px;
    border: 1px dashed #475569;
}

.equation-display {
    font-family: monospace;
    font-size: 2.2rem;
    letter-spacing: 2px;
    color: var(--accent-color);
    margin: 10px 0;
}

/* Equipment Display Box */
.image-box {
    width: 100%;
    height: 220px;
    background: #000;
    border-radius: 10px;
    border: 2px solid #334155;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.image-box img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

/* Multiple Choice Grid */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.option-btn {
    background: #0f172a;
    color: var(--text-color);
    border: 1px solid #334155;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn:hover {
    border-color: var(--accent-color);
    background: #1e293b;
}

.inputs-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

input[type="number"], input[type="text"] {
    padding: 10px;
    font-size: 1.2rem;
    text-align: center;
    background: #0f172a;
    border: 2px solid #475569;
    color: white;
    border-radius: 6px;
}

input:focus {
    border-color: var(--accent-color);
    outline: none;
}

.action-btn {
    background-color: var(--accent-color);
    color: #0f172a;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.action-btn:hover {
    background-color: #7dd3fc;
}

.feedback {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
    min-height: 24px;
}

.success { color: var(--success-color); }
.error { color: var(--error-color); }

.progress-bar-container {
    width: 100%;
    background: #0f172a;
    height: 10px;
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--success-color);
    transition: width 0.4s ease;
}
/* ---- Portal: tabs + expeditions (added for Starbound Lab) ---- */
.portal-card { max-width: 760px; }
.portal-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: -10px 0 22px; }
.portal-tab {
    background-color: rgba(30, 41, 59, 0.8); color: #94a3b8; border: 1px solid #334155;
    padding: 10px 18px; font-size: 0.95rem; font-weight: bold; border-radius: 999px; cursor: pointer;
    letter-spacing: 1px; text-transform: uppercase; transition: all 0.2s;
}
.portal-tab:hover { color: var(--text-color); background-color: #334155; }
.portal-tab.active-tab { background-color: #0369a1; color: white; border-color: var(--accent-color); box-shadow: 0 0 15px rgba(56, 189, 248, 0.3); }
.portal-panel[hidden] { display: none; }
.portal-panel { display: grid; gap: 14px; text-align: left; }
.expedition {
    position: relative; display: block; overflow: hidden; text-decoration: none; color: var(--text-color);
    border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 16px; padding: 22px 24px;
    background: linear-gradient(90deg, rgba(3, 7, 18, 0.94) 0%, rgba(3, 7, 18, 0.78) 55%, rgba(3, 7, 18, 0.35) 100%), var(--art, none) center/cover no-repeat, #0f172a;
    transition: transform 0.2s, box-shadow 0.2s;
}
.expedition.open:hover { transform: translateY(-3px); box-shadow: 0 0 30px rgba(56, 189, 248, 0.45); }
.expedition h2 { margin: 6px 0 6px; font-size: 1.6rem; color: #e0f2fe; }
.expedition p { margin: 0 0 10px; color: #cbd5e1; line-height: 1.5; max-width: 52ch; }
.expedition.soon { opacity: 0.7; border-style: dashed; }
.exp-tag { display: inline-block; font-size: 0.7rem; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: #064e3b; color: #6ee7b7; border: 1px solid #10b981; }
.expedition.soon .exp-tag { background: #1e1b4b; color: #c4b5fd; border-color: #6d28d9; }
.exp-go { font-weight: bold; color: #7dd3fc; }
@media (max-width: 520px) { h1 { font-size: 2.6rem; } .subtitle { letter-spacing: 2px; font-size: 1rem; } }
.nav-tabs { flex-wrap: wrap; }
