/* Shared Styles for Mini-Games (Unity, Python, Power BI) */
@import url('https://fonts.googleapis.com/css2?family=consolas:wght@400;700&family=segoe+ui:wght@400;600&display=swap');

:root {
    --bg-dark: #121212;
    --panel-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --accent: #3776AB;
    --accent-hover: #2A5B84;
    --success: #4CAF50;
    --error: #F44336;
    --warning: #FFD43B;

    /* Legacy/Unity Vars */
    --sidebar-width: 300px;
    --sidebar-bg: #1e1e1e;
    --sidebar-border: #333;
    --card-bg: #2d2d2d;
    --accent-color: #00bcd4;
    --text-muted: #b0bec5;

    /* Power BI Specifics */
    --pbi-yellow: #F2C811;
    --pbi-bg: #252526;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Layout Systems --- */

/* Python Simple Layout */
.game-container {
    width: 100%;
    height: 100%;
    max-width: 1000px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

/* Unity & Power BI Layout (Full Screen with Overlay Sidebar) */
.game-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
}

.game-content {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* App Container (Unity) */
.game-content .app-container {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

/* --- Common Components --- */

/* Header */
.header,
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    border-bottom: 1px solid #333;
    background: var(--panel-bg);
}

.game-title,
h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
button,
input,
select,
textarea {
    font-family: inherit;
    color: var(--text-main);
}

button {
    cursor: pointer;
}

.btn-action,
.btn-primary,
.btn-restart {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
}

.btn-action:hover,
.btn-primary:hover {
    background-color: var(--accent-hover);
}

.back-btn,
.btn-secondary,
.btn-cancel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #555;
    color: #e0e0e0;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* --- Power BI Games Specific Styles (RESTORED) --- */

/* Wrapper */
.game-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #252526;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.header-bar h1 {
    font-size: 1.2rem;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-row {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
}

/* Power Query Quest Styles */
.actions-panel {
    width: 280px;
    background: #1e1e1e;
    border-right: 1px solid #333;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex-shrink: 0;
}

.actions-panel h3 {
    color: #eee;
    font-size: 1rem;
    margin-bottom: 10px;
    border-bottom: 2px solid #F2C811;
    /* Power BI Yellow */
    padding-bottom: 5px;
}

.pq-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #333;
    color: #ddd;
    border: 1px solid #444;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.9rem;
}

.pq-btn:hover {
    background: #444;
    border-color: #F2C811;
    color: #fff;
}

.pq-btn i {
    width: 18px;
    height: 18px;
    color: #F2C811;
}

.table-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #121212;
    overflow: hidden;
    position: relative;
}

.table-header {
    padding: 10px 20px;
    background: #2d2d2d;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #aaa;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.data-grid {
    flex: 1;
    overflow: auto;
    padding: 20px;
    position: relative;
}

/* Data Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #ddd;
}

th {
    background: #333;
    color: #fff;
    padding: 10px;
    text-align: left;
    position: sticky;
    top: 0;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

td {
    padding: 8px 10px;
    border-bottom: 1px solid #333;
    background: #1e1e1e;
}

tr:hover td {
    background: #2a2a2a;
}

.dirty-cell {
    color: #e57373;
    /* Red/Pink for errors */
    font-style: italic;
}

em {
    color: #888;
}

/* Report Ranger / General Grid Styles */
.visual-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    height: 100%;
    width: 100%;
    overflow: auto;
}

.report-cell {
    border: 2px dashed #444;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 100px;
}

.report-cell:hover {
    border-color: #666;
    background: rgba(255, 255, 255, 0.05);
}

.report-cell.filled {
    border: 1px solid #333;
    background: #252526;
    cursor: default;
}

.placed-visual {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pv-header {
    background: #333;
    padding: 5px;
    font-size: 0.8rem;
    text-align: center;
    color: #eee;
    border-radius: 6px 6px 0 0;
}

.pv-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    background: #1e1e1e;
    border-radius: 0 0 6px 6px;
}

/* Measure Master / DAX Puzzler Styles */
.blocks-area {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    background: #1e1e1e;
    min-height: 100px;
    border-top: 1px solid #333;
}

.dax-block,
.dax-option {
    background: #333;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    font-family: 'Consolas', monospace;
    border: 1px solid #444;
    color: #e0e0e0;
}

.dax-block:active,
.dax-option:active {
    cursor: grabbing;
}

.dax-block.func {
    color: #569CD6;
}

/* Blue */
.dax-block.col {
    color: #9CDCFE;
}

/* Light Blue */
.dax-block.table {
    color: #CE9178;
}

/* Orange/Red */
.dax-block.keyword {
    color: #C586C0;
}

/* Purple */

.formula-bar-container {
    display: flex;
    align-items: center;
    background: #252526;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
    margin-bottom: 10px;
}

.fx-label {
    font-weight: bold;
    margin-right: 15px;
    color: #888;
    font-family: serif;
    font-style: italic;
    font-size: 1.2rem;
}

.drop-zone {
    flex: 1;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    min-height: 36px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.drop-placeholder {
    color: #666;
    font-style: italic;
    font-size: 0.9rem;
}

/* Relationship Repair Styles */
.diagram-container {
    flex: 1;
    position: relative;
    background: #1a1a1a;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px;
    overflow: hidden;
}

.table-node {
    position: absolute;
    width: 160px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.table-node .header {
    background: #333;
    padding: 5px 10px;
    font-weight: bold;
    border-bottom: 1px solid #444;
    font-size: 0.85rem;
    color: white;
}

.table-node .table-cols {
    padding: 8px 10px;
    font-size: 0.8rem;
    color: #ccc;
    line-height: 1.4;
}

.table-node.fact {
    border-top: 3px solid #F2C811;
    /* Highlight Fact */
}

.rel-marker {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #1e1e1e;
    border: 2px solid #555;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    font-size: 0.75rem;
    font-weight: bold;
    color: #aaa;
}

.rel-marker:hover {
    transform: scale(1.1);
    border-color: #fff;
}

.info-panel {
    padding: 15px;
    background: #252526;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    color: #ccc;
    flex-shrink: 0;
}

svg#lines-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

line {
    z-index: 1;
}

/* Star Builder Specifics */
.tables-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.items-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.draggable-item {
    background: #2d2d2d;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    color: #eee;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.draggable-item:hover {
    border-color: #F2C811;
}

.draggable-item i {
    color: #F2C811;
    width: 16px;
    height: 16px;
}

.left-panel {
    width: 300px;
    background: #1e1e1e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.right-panel {
    flex: 1;
    background: #121212;
    position: relative;
    overflow: hidden;
}

.canvas-area {
    width: 100%;
    height: 100%;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px;
    position: relative;
}

.header-section {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.header-section h1 {
    font-size: 1.2rem;
    margin: 0;
    margin-bottom: 5px;
}

.score-badge {
    color: #F2C811;
    font-weight: bold;
}

.instructions {
    padding: 15px;
    background: #252526;
    font-size: 0.85rem;
    color: #ccc;
    line-height: 1.4;
    border-bottom: 1px solid #333;
}

.controls-footer {
    padding: 15px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: center;
}

.btn-check {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    width: 100%;
    justify-content: center;
}

.btn-check:hover {
    background: #43A047;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background-color: #1e1e1e;
    margin: auto;
    padding: 30px;
    border: 1px solid #444;
    border-radius: 8px;
    width: 80%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* --- Fixed Sidebar (Right Overlay) --- */
.review-sidebar {
    position: fixed !important;
    right: 0 !important;
    top: 0 !important;
    height: 100% !important;
    width: 300px;
    background-color: #1e1e1e;
    border-left: 1px solid #333;
    padding: 20px;
    padding-top: 80px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2147483647 !important;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    font-family: 'Segoe UI', sans-serif;
}

.review-sidebar.collapsed {
    transform: translateX(300px);
}

.sidebar-toggle {
    position: absolute;
    left: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #00bcd4;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.sidebar-toggle:hover {
    color: #fff;
    background: #252526;
}

.sidebar-header {
    margin-bottom: 10px;
}

.sidebar-header h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header p {
    color: #888;
    font-size: 0.9rem;
    margin: 0;
}

/* Course Cards */
.course-card {
    display: block;
    background-color: #2d2d2d;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.course-card:hover {
    border-color: #00bcd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.1);
}

.course-badge {
    display: inline-block;
    background-color: rgba(0, 188, 212, 0.1);
    color: #00bcd4;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-weight: 600;
}

.course-title {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 8px;
    line-height: 1.4;
    font-weight: 500;
}

.course-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b0bec5;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* --- DAX Puzzler Specific Styles (RESTORED) --- */

/* The Victory Screen in DAX Puzzler uses .victory-screen, NOT #game-modal structure */
.victory-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.victory-screen.visible {
    display: flex !important;
}

/* Progress Bar (Dots) */
.progress-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dot {
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    transition: all 0.3s;
}

.dot.active {
    background: #F2C811;
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(242, 200, 17, 0.5);
}

.dot.completed {
    background: #4CAF50;
}

/* Challenge Card */
.challenge-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scenario-text {
    background: #252526;
    padding: 15px;
    border-left: 4px solid #00bcd4;
    color: #eee;
    font-size: 1rem;
    line-height: 1.5;
}

/* Code Editor */
.code-editor {
    background: #111;
    padding: 20px;
    border-radius: 6px;
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
    color: #d4d4d4;
    line-height: 1.8;
    border: 1px solid #333;
}

.dax-keyword {
    color: #C586C0;
    font-weight: bold;
}

/* Drop Targets */
.drop-target {
    display: inline-block;
    min-width: 100px;
    height: 30px;
    border: 2px dashed #555;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    vertical-align: middle;
    margin: 0 5px;
    text-align: center;
    line-height: 26px;
    color: #888;
    font-size: 0.9rem;
    cursor: default;
    transition: all 0.2s;
}

.drop-target.drag-over {
    background: rgba(242, 200, 17, 0.1);
    border-color: #F2C811;
    transform: scale(1.05);
}

.drop-target.filled {
    border-style: solid;
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    color: #fff;
    font-weight: bold;
}

/* Options Pool */
.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: #252526;
    border-radius: 6px;
    border: 1px solid #333;
}

.dax-option {
    background: #333;
    color: #eee;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: grab;
    font-family: 'Consolas', monospace;
    border: 1px solid #444;
    transition: all 0.2s;
    user-select: none;
}

.dax-option:hover {
    background: #444;
    border-color: #aaa;
}

.dax-option:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* Feedback & Buttons */
.feedback {
    min-height: 24px;
    font-weight: bold;
    text-align: center;
}

.feedback.success {
    color: #4CAF50;
}

.feedback.error {
    color: #F44336;
}

.btn-validate {
    background: #F2C811;
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.btn-validate:active {
    transform: scale(0.98);
}

.score-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ccc;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 4px;
}

/* --- Final Restoration Pack: Dashboard Designer & Performance Profiler --- */

/* Dashboard Designer Specifics */
.workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #121212;
    padding: 20px;
    gap: 20px;
    position: relative;
    justify-content: center;
}

.palette {
    width: 250px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.draggable-visual {
    background: #2d2d2d;
    padding: 15px;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #eee;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.draggable-visual:hover {
    border-color: #F2C811;
    transform: translateY(-2px);
}

.draggable-visual.used {
    opacity: 0.5;
    cursor: default;
    border-style: dashed;
    background: #222;
}

.phone-mockup {
    width: 320px;
    height: 600px;
    background: #111;
    border: 10px solid #333;
    border-radius: 30px;
    padding: 15px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    position: relative;
}

.phone-screen {
    flex: 1;
    background: #fff;
    /* Light theme for phone preview usually */
    background: #1e1e1e;
    /* Dark theme preference */
    border-radius: 4px;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.drop-hint {
    border: 2px dashed #555;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #666;
    margin-top: auto;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.drop-hint.drag-over {
    background: rgba(242, 200, 17, 0.1);
    border-color: #F2C811;
    color: #F2C811;
}

.mobile-item {
    background: #2d2d2d;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ccc;
}

/* Performance Profiler Specifics */
.perf-meter {
    width: 200px;
    height: 12px;
    background: #333;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #444;
}

.perf-fill {
    width: 100%;
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s, background 0.3s;
}

.game-area {
    flex: 1;
    position: relative;
    background: #121212;
    background-image: radial-gradient(#222 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

.tools-panel {
    height: 80px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.tool-btn {
    background: #2d2d2d;
    border: 2px solid #555;
    color: #eee;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    gap: 5px;
    width: 120px;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: #333;
    border-color: #888;
}

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

.query-enemy {
    position: absolute;
    padding: 10px 15px;
    background: #252526;
    border: 2px solid #F44336;
    border-radius: 8px;
    color: #eee;
    cursor: crosshair;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    animation: pulse-red 1s infinite;
    z-index: 10;
}

.query-enemy .time {
    color: #F44336;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

.splat {
    position: absolute;
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
    animation: float-up 1s forwards;
    z-index: 20;
}

@keyframes float-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

/* Dataflow Drifter (likely uses similar node/diagram styles to Relationship Repair, check if anything specific is needed) */
/* Assuming standard button/header styles cover it, or .diagram-container which is already restored */

/* Deployment Pipeline (Kanban Style) */
.pipeline-board {
    display: flex;
    height: 100%;
    padding: 20px;
    gap: 20px;
    overflow-x: auto;
}

.stage-column {
    flex: 1;
    min-width: 250px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.stage-header {
    padding: 15px;
    background: #252526;
    border-bottom: 1px solid #333;
    font-weight: bold;
    color: #eee;
    display: flex;
    justify-content: space-between;
}

.stage-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.pipeline-item {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #444;
    cursor: grab;
    color: #eee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pipeline-item:hover {
    border-color: #F2C811;
}

/* --- FINAL COMPREHENSIVE RESTORATION (AUDITED) --- */

/* --- Gateway Guardian Styles --- */
.network-map {
    flex: 1;
    position: relative;
    background: #121212;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 40px 40px;
    overflow: hidden;
    display: flex;
}

.zone {
    flex: 1;
    position: relative;
    border-right: 2px dashed #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 40px;
}

.zone::before {
    content: attr(data-label);
    position: absolute;
    top: 10px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cloud-zone {
    background: rgba(55, 118, 171, 0.05);
}

.onprem-zone {
    background: rgba(244, 67, 54, 0.05);
    border-right: none;
}

.node {
    width: 120px;
    height: 80px;
    background: #252526;
    border: 1px solid #555;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #eee;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 50px;
    position: relative;
}

.node i {
    margin-bottom: 5px;
    color: #F2C811;
}

.gateway-slot {
    width: 60px;
    height: 60px;
    border: 2px dashed #666;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.inventory {
    height: 100px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    display: flex;
    padding: 10px;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.draggable-gateway {
    width: 50px;
    height: 50px;
    background: #F2C811;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(242, 200, 17, 0.5);
}

.conn-line {
    position: absolute;
    height: 2px;
    background: #444;
    z-index: 1;
    transform-origin: 0 50%;
}

.conn-line.valid {
    background: #4CAF50;
    box-shadow: 0 0 8px #4CAF50;
}

/* --- Report Ranger Styles --- */
.top-bar {
    padding: 15px;
    background: #252526;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}

.score {
    color: #F2C811;
    font-weight: bold;
    font-size: 1.2rem;
}

.report-canvas {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    background: #121212;
}

.grid-cell {
    border: 2px dashed #444;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
}

.visuals-pane {
    width: 250px;
    background: #1e1e1e;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.pane-header {
    padding: 15px;
    background: #252526;
    font-weight: bold;
    border-bottom: 1px solid #333;
}

.visual-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.visual-item {
    background: #2d2d2d;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.visual-item:hover {
    border-color: #F2C811;
}

.visual-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* --- Deployment Pipeline Styles --- */
.pipeline-container {
    flex: 1;
    display: flex;
    padding: 20px;
    gap: 20px;
    overflow-x: auto;
    background: #121212;
}

.artifact-card {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #F2C811;
    margin-bottom: 10px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #eee;
}

.artifact-card.new {
    border-left-color: #4CAF50;
}

.deploy-action {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #444;
    text-align: center;
}

.btn-deploy {
    background: transparent;
    border: 1px solid #F2C811;
    color: #F2C811;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-deploy:hover {
    background: #F2C811;
    color: black;
}

/* --- Dataflow Drifter Styles --- */
.lineage-canvas {
    flex: 1;
    position: relative;
    background: #1a1a1a;
    overflow: hidden;
}

.layer-column {
    position: absolute;
    top: 0;
    bottom: 0;
    border-right: 1px dashed #333;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.layer-title {
    font-weight: bold;
    color: #666;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.artifact {
    width: 180px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.socket {
    width: 12px;
    height: 12px;
    background: #666;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.socket:hover {
    background: #F2C811;
    transform: translateY(-50%) scale(1.2);
}

.socket.left {
    left: -6px;
}

.socket.right {
    right: -6px;
}

/* --- Measure Master Styles --- */
.challenge-box {
    background: #252526;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #444;
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}

.challenge-title {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 10px;
}

.challenge-desc {
    color: #aaa;
    margin-bottom: 20px;
    line-height: 1.5;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #1e1e1e;
    border-top: 1px solid #333;
}

.btn-run {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #388E3C;
    transition: all 0.1s;
}

.btn-run:active {
    transform: translateY(4px);
    box-shadow: none;
}

.success-msg {
    color: #4CAF50;
    margin-top: 10px;
    font-weight: bold;
}

/* --- Row Level Raider Styles --- */
.report-container {
    flex: 1;
    background: #fff;
    /* Paper look typically */
    background: #1e1e1e;
    /* Dark theme override */
    padding: 20px;
    display: flex;
    flex-direction: column;
}

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

.role-selector {
    width: 250px;
    background: #252526;
    border-right: 1px solid #333;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.role-btn {
    padding: 12px;
    background: #333;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.role-btn:hover,
.role-btn.active {
    background: #F2C811;
    color: black;
    border-color: #F2C811;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid #333;
    text-align: left;
}

.status-bar {
    padding: 10px 20px;
    background: #333;
    color: #aaa;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

/* --- Final Polish (Audit Clean-up) --- */

/* Star Builder */
.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: #fff;
}

.col-item {
    background: #333;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #ccc;
    cursor: grab;
    border: 1px solid #444;
}

.t-header {
    background: #444;
    color: white;
    padding: 8px;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
    text-align: center;
}

.t-body {
    background: #252526;
    padding: 10px;
    min-height: 50px;
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 4px 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Gateway Guardian */
.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- EMERGENCY FIXES: Game 1 & Game 10 --- */

/* GAME 10: Dataflow Drifter Layout Fix */
/* Switch from absolute columns to Flexbox for stability */
.lineage-canvas {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    position: relative !important;
    background: #1a1a1a !important;
    padding: 20px 0;
    /* Add some spacing */
}

.layer-column {
    position: relative !important;
    /* Override absolute */
    flex: 1 !important;
    height: 100% !important;
    border-right: 1px dashed #333;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    top: auto !important;
    bottom: auto !important;
    padding-top: 20px;
}

/* Ensure SVG connections overlay is correctly positioned */
#connections-layer {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to nodes */
    z-index: 100;
    /* Lines above columns? No, usually below nodes */
}

/* Ensure Nodes are interactive and above lines */
.artifact {
    position: relative !important;
    z-index: 200 !important;
    background: #252526 !important;
    cursor: pointer !important;
}

/* GAME 1: Star Builder Drop Target Fix */
/* Ensure the drop zone has explicit size and is not covered */
.canvas-area {
    width: 100% !important;
    height: 100% !important;
    min-height: 500px !important;
    /* Force minimum height */
    position: relative !important;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px;
    z-index: 5 !important;
}

/* Fix z-index for dragged items */
.draggable-item {
    cursor: grab !important;
    user-select: none;
    z-index: 50 !important;
}

.draggable-item:active {
    cursor: grabbing !important;
}

/* Ensure the wrapper doesn't collapse */
.right-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: 100% !important;
    overflow: hidden !important;
}

/* --- FIX GAME 1: STAR BUILDER --- */
/* Dropped Table Card Styling */
.canvas-table {
    position: absolute;
    width: 200px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    color: #eee;
    font-size: 0.85rem;
    z-index: 10;
    overflow: hidden;
    user-select: none;
}

.canvas-table .t-header {
    background: #2d2d2d;
    padding: 8px;
    font-weight: bold;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.canvas-table .t-body {
    padding: 8px;
}

.canvas-table.fact {
    border: 1px solid #F2C811;
    /* Gold border for Fact Table */
}

.canvas-table.fact .t-header {
    background: #3a3310;
    color: #F2C811;
}

.col-item {
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.col-item.pk {
    color: #aaa;
}

/* --- FIX GAME 7: GATEWAY GUARDIAN --- */


.network-map {
    position: relative;
    width: 100%;
    height: 400px;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    margin-bottom: 20px;
}

.zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    font-weight: bold;
    color: #666;
    border-right: 1px dashed #333;
    position: relative;
    /* Context for absolute nodes */
}

.zone:last-child {
    border-right: none;
}

.cloud-zone {
    background: radial-gradient(circle at top, #1a2332 0%, #0f0f0f 70%);
}

.onprem-zone {
    background: radial-gradient(circle at top, #1f1f1f 0%, #0f0f0f 70%);
}

/* Node Styling for Game 7 */
.node {
    width: 100px;
    height: 80px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ccc;
    font-size: 0.8rem;
    z-index: 20;
    position: absolute;
    /* Using absolute positioning within flex zones is tricky, usually managed by top/left */
}

/* Specific Positions for Game 7 Nodes */
#pbi-service {
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
}

/* In Cloud Zone */
#sql-server {
    top: 250px;
    left: 30%;
}

/* In On-Prem Zone */
#file-server {
    top: 250px;
    left: 70%;
}

/* In On-Prem Zone */

/* Gateway Slot */
.gateway-slot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border: 2px dashed #666;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    z-index: 15;
    background: #000;
}

.gateway-slot.active {
    border-color: #F2C811;
    background: #332b00;
    color: #F2C811;
}

/* Inventory Footer */
.inventory {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 10px;
}

.draggable-gateway {
    width: 80px;
    height: 80px;
    background: #252526;
    border: 1px solid #444;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: grab;
    transition: transform 0.2s;
}

.draggable-gateway:hover {
    border-color: #666;
    transform: translateY(-2px);
}

/* --- FIX GAME 10: DATAFLOW DRIFTER --- */
/* Connection Line Styling */
.conn-line {
    fill: none;
    stroke: #666;
    stroke-width: 2px;
    pointer-events: none;
}

.conn-line.valid {
    stroke: #4CAF50;
    animation: dash 20s linear infinite;
    /* Flow effect */
    stroke-dasharray: 10;
}

@keyframes dash {
    to {
        stroke-dashoffset: -1000;
    }
}

/* Socket Styling */
.socket {
    width: 12px;
    height: 12px;
    background: #666;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
    transition: background 0.2s, transform 0.2s;
}

.socket:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.2);
}

.socket.left {
    left: -6px;
}

.socket.right {
    right: -6px;
}

.socket.highlight {
    background: #F2C811;
    box-shadow: 0 0 5px #F2C811;
}


/* --- RELATED CLASSES WIDGET --- */
.rc-fab {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 60px;
    height: 60px;
    background: #449cb9;
    /* Accent */
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: float 6s ease-in-out infinite;
}

.rc-fab:hover {
    transform: scale(1.1);
    background: #26c6da;
}

.rc-fab.active {
    background: #333;
    /* No rotation for book icon */
}

.rc-menu {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 280px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.rc-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rc-header {
    padding: 12px 15px;
    background: #252526;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #eee;
    font-size: 0.9rem;
}

.rc-close {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 0;
    display: flex;
}

.rc-close:hover {
    color: #fff;
    background: transparent;
}

.rc-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rc-card {
    background: #2d2d2d;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s;
    display: block;
}

.rc-card:hover {
    background: #333;
    border-color: #00bcd4;
}

.rc-card-title {
    color: #e0e0e0;
    font-size: 0.85rem;
    margin-bottom: 4px;
    line-height: 1.3;
}

.rc-card-meta {
    font-size: 0.75rem;
    color: #00bcd4;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Python Games - Stats Pill */
.instructions-panel .level-info {
    display: flex;
    width: fit-content;
    margin: 15px auto;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.95rem;
    color: #ccc;
    margin-top: 15px;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}

.instructions-panel .level-info span {
    color: var(--warning);
    font-weight: bold;
    font-family: 'Consolas', monospace;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(255, 212, 59, 0.2);
}

/* Dots inside pill */
.instructions-panel .level-info .progress-indicator {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.instructions-panel .level-info .dot {
    width: 10px;
    height: 10px;
    background: #444;
    border-radius: 50%;
    transition: all 0.3s;
}

.instructions-panel .level-info .dot.active {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
    transform: scale(1.2);
}

.instructions-panel .level-info .dot.done {
    background: var(--success);
}