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

.code-source-widget {
    margin-top: 8px;
}

.code-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 135, 0.3);
}

.code-tab {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #c8c8c8;
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
}

.code-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.code-tab.active {
    background: #272822;
    color: #00ff87;
    border-bottom-color: #272822;
    margin-bottom: -1px;
}

.code-panels {
    position: relative;
    height: 500px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0 8px 8px 8px;
    overflow: hidden;
    background: #272822;
}

.code-panel {
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
}

.code-panel.active {
    visibility: visible;
    pointer-events: auto;
}

.ace-editor-host {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    height: 100%;
    width: 100%;
}

.demo {
    background-color: #fff;
    margin: 20px auto;
    max-width: 700px;
    min-width: 700px;
    min-height: 700px;
    max-height: 700px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.demo-header {
    background-color: #007bff;
    color: #fff;
    padding: 15px 20px;
    font-size: 20px;
}

.demo-content {
    padding: 20px;
}

#canvas {
    margin: 0 auto;
    display: block;
    float: left;
}

body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #ffffff;
    line-height: 1.6;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
}

.back-link {
    color: #00ff87;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

.back-link:hover {
    text-decoration: underline;
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.container h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #00ff87, #60efff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.game-media {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    overflow-x: hidden;
}

.game-media img {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 20px;
}

.game-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
}

.game-info h2 {
    margin-bottom: 20px;
    color: #00ff87;
}

.game-info ul {
    list-style: none;
    margin-bottom: 20px;
}

.game-info li {
    margin-bottom: 10px;
}

.play-button {
    display: inline-block;
    background: linear-gradient(45deg, #00ff87, #60efff);
    color: #1a1a2e;
    padding: 15px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: transform 0.3s ease;
}

.play-button:hover {
    transform: scale(1.05);
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px auto;
    width: fit-content;
    max-width: 100%;
}

.print-button {
    display: inline-block;
    background: linear-gradient(45deg, #00ff87, #60efff);
    color: #1a1a2e;
    padding: 15px 30px;
    border-radius: 25px;
    border: none;
    text-decoration: none;
    font: inherit;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: fit-content;
}

.print-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.print-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.run-button {
    display: inline-block;
    background: linear-gradient(45deg, #60efff, #00ff87);
    color: #1a1a2e;
    padding: 15px 30px;
    border-radius: 25px;
    border: none;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: transform 0.3s ease;
    width: fit-content;
}

.run-button:hover:not(:disabled) {
    transform: scale(1.05);
}

.run-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.python-output-region {
    width: 100%;
    margin: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.python-output-title {
    font-size: 1rem;
    font-weight: 600;
    color: #00ff87;
    margin-bottom: 8px;
}

.python-output {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid rgba(0, 255, 135, 0.28);
    border-radius: 8px;
    padding: 12px 14px;
    min-height: 3.5rem;
    margin: 0;
    overflow: visible;
    box-sizing: border-box;
    width: max-content;
    min-width: 100%;
}

@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
    }
}

@media print {
    body.print-output-only header,
    body.print-output-only .game-header,
    body.print-output-only .media-actions,
    body.print-output-only .game-info {
        display: none !important;
    }

    body.print-output-only {
        background: #fff;
        color: #000;
    }

    body.print-output-only .container {
        max-width: none;
        padding: 12px;
    }

    body.print-output-only .game-content {
        gap: 0;
        margin: 0;
    }

    body.print-output-only .game-media {
        background: transparent;
        padding: 0;
        border-radius: 0;
        overflow: visible;
    }

    body.print-output-only .python-output-region {
        overflow: visible;
        overscroll-behavior: auto;
    }

    body.print-output-only .python-output-title {
        color: #000;
        -webkit-text-fill-color: #000;
        font-size: 0.8rem;
    }

    body.print-output-only .python-output {
        max-height: none;
        overflow: visible;
        background: #fff;
        color: #000;
        border: 1px solid #ccc;
        font-size: 0.8rem;
        line-height: 1.35;
        white-space: pre-wrap;
        word-break: break-word;
        width: auto;
        min-width: 0;
    }
}
