:root {
    --bg-primary: #000000;
    --bg-secondary: #0f1016; /* Keeping slightly tinted for cards to differentiate from deep black bg */
    --bg-secondary-apple: #1c1c1e; /* Pure Apple Dark Mode Card */
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-color: #ffffff;
    --accent-text: #000000;
    --border-color: #38383a;
    --input-bg: #1c1c1e;
    --hover-bg: #2c2c2e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
}

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

/* Navbar */
header {
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.logo i {
    font-size: 18px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
    font-weight: 400;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.auth-buttons {
    display: flex;
    align-items: center;
}

.btn {
    padding: 8px 18px;
    border-radius: 980px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.btn-login {
    color: var(--text-primary);
    margin-right: 15px;
}

.btn-login:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.btn-signup, .search-btn {
    background-color: var(--accent-color);
    color: var(--accent-text);
    border: none;
}

.btn-signup:hover {
    opacity: 0.9;
}

/* Hero / Search Section */
.hero {
    text-align: center;
    padding: 120px 0 100px;
}

.hero h1 {
    font-size: 56px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    letter-spacing: -1.5px;
}

.hero p {
    color: var(--text-secondary);
    margin-bottom: 50px;
    font-size: 24px;
    font-weight: 400;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.3;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 18px 24px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 17px;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar:focus {
    border-color: var(--text-secondary);
}

.search-bar::placeholder {
    color: #555;
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-bottom: 120px;
}

.feature-card {
    background-color: transparent;
    padding: 0; 
    border-radius: 0;
    text-align: left;
    border: none; 
}

.feature-card h3 {
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.5;
}

.feature-card i {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 15px;
    display: block;
}

/* Integration Promo Section */
.integration-promo {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 24px;
    padding: 80px 40px;
    margin-bottom: 120px;
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Subtle glow effect behind the text */
.integration-promo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0) 70%);
    z-index: 0;
    pointer-events: none;
}

.integration-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.integration-content h2 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #fff, #a5a5a5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.integration-content p {
    font-size: 21px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 30px;
}

.integration-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.link-arrow {
    color: var(--accent-color);
    font-size: 17px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.link-arrow:hover {
    opacity: 0.8;
}

.link-arrow i {
    font-size: 12px;
}

/* Recent Scripts */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 0 5px;
}

.recent-scripts h2 {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
}

.scripts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 100px;
}

.script-card {
    background-color: var(--bg-secondary-apple);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: none; 
}

.script-card:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    z-index: 10;
}

.card-image {
    width: 100%;
    height: 190px;
    background-color: #111;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.script-card:hover .card-image img {
    opacity: 1;
}

.card-overlay {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.views-badge, .time-badge {
    background-color: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(10px);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #e5e5e5;
}

.card-content {
    padding: 24px;
}

.script-tags {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.script-title {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

.game-name {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo {
        width: 100%;
        justify-content: center;
    }

    .nav-links {
        display: none; /* Hide nav on mobile for simplicity in this prototype */
    }
    
    .auth-buttons {
        position: absolute;
        top: 18px;
        right: 20px;
    }

    .hero h1 {
        font-size: 40px;
    }
    
    .hero p {
        font-size: 20px;
    }
    
    .scripts-grid {
       grid-template-columns: 1fr;
    }
}

/* Script Detail Styling - Apple Style */
.script-detail-container {
    max-width: 1000px;
    margin: 60px auto;
}

.script-detail-hero {
    display: flex;
    gap: 40px;
    margin-bottom: 50px;
    align-items: flex-start;
}

.script-meta-left {
    flex: 1;
}

.detail-game-name {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.detail-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
    color: var(--text-primary);
}

.detail-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.detail-tag {
    background: rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 13px;
    color: var(--text-primary);
}

.detail-author-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 30px;
}

.script-preview-image {
    width: 450px;
    height: 300px;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.script-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-actions {
    display: flex;
    gap: 15px;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--accent-text);
    border: none;
    font-weight: 600;
    padding: 12px 24px;
}

.btn-secondary {
    background-color: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border: none;
    font-weight: 600;
    padding: 12px 24px;
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Code Block */
.script-content-box {
    background-color: #111;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    margin-bottom: 60px;
}

.code-header {
    background-color: rgba(255,255,255,0.03);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
}

.copy-small {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
}

pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
}

#lua-code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    color: #e0e0e0;
    line-height: 1.5;
}

/* Toast */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.toast.show {
    visibility: visible;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}

/* Responsive Detail */
@media (max-width: 800px) {
    .script-detail-hero {
        flex-direction: column-reverse;
    }
    
    .script-preview-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
    }
}
