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

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #10b981;
    --danger-color: #ef4444;
    --dark-bg: #1a1a2e;
    --darker-bg: #0f0f1e;
    --card-bg: #16213e;
    --text-light: #ffffff;
    --text-gray: #a0a0a0;
    --border-color: #2d2d4a;
}

/* Prevent horizontal overflow on mobile */
html {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 120px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--darker-bg);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Fix for pre and code blocks */
pre, code {
    overflow-x: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Fix for long URLs and text */
a, p, li, td, th, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

header.header-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

header.header-compact {
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.app-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.header-text h1 {
    font-size: 2em;
    margin: 0;
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin: 0;
}

nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.3s;
}

nav a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    padding: 80px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.hero-description {
    font-size: 1.3em;
    color: var(--text-gray);
    max-width: 800px;
    margin: 0 auto 30px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 50px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.version-label {
    color: var(--text-gray);
}

.version-number {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--accent-color);
}

.version-date {
    color: var(--text-gray);
    font-size: 0.9em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-secondary {
    background: var(--card-bg);
    color: white;
    border: 2px solid var(--primary-color);
}

.btn-download {
    background: var(--accent-color);
    color: white;
    font-size: 1.1em;
}

.btn-download-debug {
    background: var(--card-bg);
    color: white;
    border: 2px solid var(--accent-color);
}

/* Sections */
section {
    padding: 60px 0;
    scroll-margin-top: 120px;
}

section h2 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 40px;
    color: var(--primary-color);
}

.section-intro {
    text-align: center;
    font-size: 1.2em;
    color: var(--text-gray);
    max-width: 800px;
    margin: 0 auto 40px;
}

/* Features Grid */
.features {
    background: var(--dark-bg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-color);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.feature-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-gray);
}

.feature-list {
    text-align: left;
    margin-top: 15px;
    line-height: 1.8;
}

/* Downloads Section */
.downloads {
    background: var(--darker-bg);
}

.download-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.download-box.latest {
    border: 2px solid var(--accent-color);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
}

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

.download-header h3 {
    color: var(--accent-color);
    margin: 0;
}

.release-date {
    color: var(--text-gray);
    font-size: 0.9em;
}

.download-description {
    color: var(--text-gray);
    margin-bottom: 20px;
}

.download-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.requirements {
    color: var(--text-gray);
    font-size: 0.95em;
    padding: 10px;
    background: var(--dark-bg);
    border-radius: 8px;
}

.previous-versions-title {
    text-align: center;
    color: var(--primary-color);
    margin: 40px 0 30px;
}

.versions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.version-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.version-name {
    font-weight: 600;
    color: var(--primary-color);
}

.version-links {
    display: flex;
    gap: 10px;
}

.version-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9em;
}

.version-links a:hover {
    text-decoration: underline;
}

.install-guide {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
}

.install-guide h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.install-guide ol {
    margin-left: 20px;
}

.install-guide li {
    margin-bottom: 10px;
    color: var(--text-gray);
}

/* Changelog Section */
.changelog {
    background: var(--dark-bg);
}

.changelog-entry {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow: visible;
    max-width: 100%;
}

/* Desktop-specific: ensure proper display on larger screens */
@media (min-width: 769px) {
    .changelog-entry {
        overflow: visible;
        white-space: normal;
    }
    
    .changelog-entry ul,
    .changelog-entry ol {
        overflow: visible;
        max-width: 100%;
    }
    
    .changelog-entry code {
        white-space: normal;
        word-break: normal;
    }
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.version-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.date {
    color: var(--text-gray);
}

.changes h4 {
    color: var(--accent-color);
    margin: 15px 0 10px;
}

.changes ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.changes li {
    margin-bottom: 8px;
    color: var(--text-gray);
}

.view-full-changelog {
    text-align: center;
    margin-top: 40px;
}

/* About Section */
.about {
    background: var(--darker-bg);
}

.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.about-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.about-box h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.about-box p, .about-box ul {
    color: var(--text-gray);
}

.about-box ul {
    margin-left: 20px;
}

.about-box li {
    margin-bottom: 8px;
}

.links-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.links-box h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: var(--dark-bg);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.link-icon {
    font-size: 1.5em;
}

.developer-box {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.developer-box h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.developer-box p {
    margin-bottom: 10px;
    color: var(--text-gray);
}

.developer-box a {
    color: var(--accent-color);
    text-decoration: none;
}

.developer-box a:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    background: var(--darker-bg);
    padding: 40px 0 20px;
    border-top: 2px solid var(--border-color);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.footer-section p {
    color: var(--text-gray);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 8px;
}

.footer-section a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-gray);
    margin-bottom: 8px;
    font-size: 0.9em;
}

.license-notice, .trademark-notice {
    font-size: 0.85em;
    opacity: 0.8;
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Donation Section */
.about-box a[href*="github.com/sponsors"]:hover,
.about-box a[href*="cash.app"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-content h2 {
        font-size: 2em;
    }
    
    .hero-description {
        font-size: 1.1em;
    }
    
    section h2 {
        font-size: 2em;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-text h1 {
        font-size: 1.5em;
    }
    
    .download-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .version-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    section {
        padding: 40px 0;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .versions-grid {
        grid-template-columns: 1fr;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .hero-content h2 {
        font-size: 1.5em;
    }
    
    section h2 {
        font-size: 1.75em;
    }
    
    .header-text h1 {
        font-size: 1.3em;
    }
    
    .feature-card, .about-box, .download-box, .changelog-entry {
        padding: 20px;
    }
    
    .hero {
        padding: 60px 0;
    }
    
    .hero-description {
        font-size: 1em;
    }
    
    .version-badge {
        font-size: 0.9em;
        padding: 12px 20px;
    }
}
/* Additional fixes for inline code and changelog overflow */

/* Inline code tags should wrap and not overflow */
code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    background: var(--darker-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Pre blocks should scroll horizontally but stay in bounds */
pre {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
    -webkit-overflow-scrolling: touch;
    background: var(--darker-bg);
    padding: 15px;
    border-radius: 8px;
}

/* Pre code should not add extra overflow */
pre code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    background: transparent;
    padding: 0;
}

/* Changelog specific fixes */

.changelog-entry ul,
.changelog-entry ol {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.changelog-entry li {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.changelog-entry code {
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Ensure changes section doesn't overflow */
.changes {
    overflow: hidden;
    max-width: 100%;
}

.changes ul,
.changes ol {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.changes li {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Additional mobile-specific fixes */
@media (max-width: 768px) {
    code {
        font-size: 0.85em;
        padding: 2px 4px;
        word-break: break-all;
    }
    
    .changelog-entry {
        padding: 20px 15px;
    }
    
    .changes li {
        font-size: 0.95em;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    code {
        font-size: 0.8em;
        padding: 1px 3px;
        word-break: break-all;
    }
    
    .changelog-entry {
        padding: 15px 10px;
    }
    
    .changes li {
        font-size: 0.9em;
        margin-bottom: 10px;
    }
    
    /* Force text to wrap in all list items */
    .changelog-entry li,
    .changes li,
    .about-box li,
    .feature-list li {
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
    }
}

/* Additional aggressive fixes for changelog technical terms */
.changelog-entry strong,
.changes strong {
    display: inline;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Force all text content in changelog to wrap */
.changelog-entry li strong,
.changes li strong {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Special handling for technical terms with special chars */
.changelog-entry li,
.changes li,
.about-box li,
.feature-list li,
.install-guide li {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

/* Ensure no element can exceed container width */
.changelog-entry *,
.changes * {
    max-width: 100%;
    word-wrap: break-word;
}

/* Ultra aggressive mobile fixes */
@media (max-width: 480px) {
    /* Break absolutely everything if needed */
    .changelog-entry,
    .changelog-entry *,
    .changes,
    .changes * {
        word-break: break-word;
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }
    
    /* Force strong tags to break */
    .changelog-entry strong,
    .changes strong {
        word-break: break-all;
        overflow-wrap: anywhere;
    }
    
    /* Ensure list items wrap aggressively */
    .changelog-entry li,
    .changes li {
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        font-size: 0.9em;
        line-height: 1.7;
    }
    
    /* Make sure the changelog entry itself doesn't overflow */
    .changelog-entry {
        overflow: hidden;
        overflow-x: hidden;
        max-width: 100%;
        width: 100%;
    }
    
    /* Download section and install guide */
    .install-guide li {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* Extra aggressive for very small screens */
@media (max-width: 375px) {
    .changelog-entry li,
    .changes li {
        font-size: 0.85em;
        word-break: break-all;
    }
    
    .changelog-entry strong {
        word-break: break-all;
    }
}

/* Play Online Game Button Styles */
.btn-game {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);


/* COMPREHENSIVE OVERFLOW FIX FOR CHANGELOG SECTION */
#changelog,
#changelog *,
.changelog,
.changelog * {
    box-sizing: border-box !important;
}

#changelog {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

#changelog .container {
    overflow-x: hidden !important;
    max-width: 1200px !important;
    width: 100% !important;
    padding: 0 20px !important;
}

.changelog-entry,
.changelog-entry * {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* Force break on all text elements */
.changelog-entry p,
.changelog-entry li,
.changelog-entry h3,
.changelog-entry h4,
.changelog-entry span,
    word-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 100% !important;
}

/* NUCLEAR OVERFLOW FIX - CLIP EVERYTHING (Modified for better spacing) */
* {
    box-sizing: border-box;
}

/* Only apply max-width to potentially overflowing elements */
img, video, iframe, embed, object,
table, pre, code, textarea, input {
    max-width: 100%;
}

html, body {
    overflow-x: clip !important;
    max-width: 100vw !important;
}
