:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --card-hover: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #1e3799;
    /* Dark Blue */
    --radius-std: 16px;
    --font-heading: 'Segoe UI', sans-serif;
    --font-body: 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Titles */
h1,
h2 {
    text-align: center;
    color: #fff;
    margin-bottom: 2rem;
}

.form-group-title {
    display: block;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    padding-bottom: 0.5rem;
}

.form-group-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent);
}

/* --- New Content Styles --- */

.experience-intro {
    max-width: 800px;
    margin: 0 auto 2rem;
    text-align: center;
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid var(--accent);
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 900px;
    margin: 2rem auto;
}

.benefit-item {
    background: #1e1e1e;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #333;
    transition: transform 0.2s;
}

.benefit-item:hover {
    transform: translateY(-2px);
    border-color: #444;
}

.benefit-icon {
    color: var(--accent);
    font-size: 1.2rem;
}

.benefit-text {
    font-size: 0.9rem;
    color: #ddd;
    font-weight: 500;
}

.legal-disclaimer {
    max-width: 800px;
    margin: 4rem auto 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.5;
    padding: 1rem;
    border-top: 1px solid #222;
}

.legal-disclaimer a {
    color: #666;
    text-decoration: underline;
}

.legal-disclaimer a:hover {
    color: #888;
}

/* Form */
#game-form {
    max-width: 1000px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease-in-out;
}

/* Grid */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1.2rem;
}

.selection-grid input {
    display: none;
}

/* Card */
.selection-card {
    background: var(--card-bg);
    border-radius: var(--radius-std);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    min-height: 140px;
}

.selection-card svg {
    width: 48px;
    height: 48px;
    fill: var(--text-secondary);
    margin-bottom: 0.8rem;
    transition: transform 0.3s, fill 0.3s;
}

.selection-card span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.3s;
}

/* Hover */
.selection-card:hover {
    background: #252525;
    border-color: rgba(30, 55, 153, 0.5);
    transform: translateY(-5px);
}

.selection-card:hover svg {
    fill: #fff;
    transform: scale(1.1);
}

/* Selected (Dark Blue) */
.selection-grid input:checked+.selection-card {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 20px rgba(30, 55, 153, 0.6);
    opacity: 1;
}

.selection-grid input:checked+.selection-card svg {
    fill: #fff;
}

.selection-grid input:checked+.selection-card span {
    color: #fff;
    font-weight: 700;
}

/* Inputs */
.input-modern {
    width: 100%;
    padding: 1rem 1.2rem;
    margin-bottom: 0.5rem;
    background: #2c2c2c;
    border: 2px solid #333;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: all 0.2s;
}

.input-modern:focus {
    border-color: var(--accent);
    outline: none;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 1rem;
}

/* File Input */
.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    margin-bottom: 1rem;
    width: 100%;
}

.file-input-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
}

.btn-file {
    display: block;
    background: #2c2c2c;
    border: 2px dashed #444;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-file:hover {
    border-color: var(--accent);
    color: #fff;
}

/* Submit */
.submit-btn {
    background: linear-gradient(135deg, #1e3799, #0984e3);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(30, 55, 153, 0.4);
    width: 100%;
    max-width: 400px;
    display: block;
    margin: 2rem auto;
    letter-spacing: 1px;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(30, 55, 153, 0.6);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Preview Card Styles */
.preview-card {
    position: relative;
    width: 350px;
    height: 350px;
    border-radius: 0;
    /* Square - Removed 20px radius */
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: #000;
}

.preview-card img,
.preview-card #preview-img-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ignored by div bg, but harmless */
    transition: transform 0.5s ease;
    display: block;
}

.preview-card:hover img,
.preview-card:hover #preview-img-bg {
    transform: scale(1.05);
}

.preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.6), transparent);
    padding: 2rem 1.5rem 1.5rem;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

#preview-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.15rem;
    /* Reduced ~6px from 1.5rem (24px->18px is 1.125rem) */
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.preview-desc-small {
    font-size: 0.65rem;
    /* Reduced ~3px from 0.8rem (12.8px->9.8px) */
    color: #ddd;
    margin-bottom: 0.8rem;
    font-style: italic;
    opacity: 0.9;
}

.preview-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    /* Reduced 2px from 1rem (16px->14px) */
    font-weight: 700;
    color: #eee;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    color: #fff;
}

/* Specific colors for icons inside stats could be handled via JS injection, 
   but here we make the container 'pop' a bit more or rely on the emoji color (which is native). 
   To force color, we can add a border or specific text color. */

.stat-divider {
    display: none;
    /* Hide textual dividers for cleaner look if we use bubbles */
}

/* Re-target nth-child correctly considering dividers are spans */
/* 1st span = Age */
.stat-item:nth-of-type(1) {
    border: 1px solid #ff9f43;
    color: #ff9f43;
    background: rgba(255, 159, 67, 0.1);
}

/* 3rd span = Players (2nd is divider) */
.stat-item:nth-of-type(3) {
    border: 1px solid #2ecc71;
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

/* 5th span = Time (4th is divider) */
.stat-item:nth-of-type(5) {
    border: 1px solid #00a8ff;
    color: #00a8ff;
    background: rgba(0, 168, 255, 0.1);
}

.stat-item span {
    color: inherit;
}

/* Detail Section */
.preview-details h2 {
    text-align: left;
    margin-bottom: 0.5rem;
    color: var(--accent);
    /* Colorized title */
}

#detail-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

/* Small Action Buttons in Preview */
.action-btn-small {
    background: #444;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #555;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Specific button colors - Deep Orange */
#preview-review-btn,
#preview-shop-btn {
    background: #e67e22;
    border-color: #e67e22;
    color: #fff;
}

.action-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* --- FRONTEND SPECIFIC --- */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    justify-content: center;
}

/* Wizard Steps */
.wizard-step {
    background: #181818;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
}

/* Frontend Game Card */
.game-card-front {
    background: #1e1e1e;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.game-card-front:hover {
    transform: translateY(-5px);
}

.card-image {
    width: 100%;
    aspect-ratio: 1/1;
    background-size: cover;
    background-position: center;
    position: relative;
}

.top-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    color: var(--accent);
}

.card-desc-small {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-bottom: 1rem;
}

.card-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.stat-bubble {
    background: #333;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #ddd;
}

.stat-bubble.age {
    border: 1px solid rgba(255, 159, 67, 0.4);
    color: #ff9f43;
}

.stat-bubble.pl {
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.stat-bubble.dur {
    border: 1px solid rgba(0, 168, 255, 0.4);
    color: #00a8ff;
}

.card-desc-full {
    font-size: 0.95rem;
    color: #ccc;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex: 1;
    /* Pushes actions down */
}

.card-actions {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.btn-action {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: filter 0.2s;
}

.btn-action.review {
    background: #444;
    color: #fff;
    border: 1px solid #555;
}

.btn-action.shop {
    background: #e67e22;
    /* Deep Orange */
    color: #fff;
}

.btn-action:hover {
    filter: brightness(1.1);
}

/* Experience Stars Override */
.selection-card .stars-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
}

.selection-card .stars-container svg {
    width: 24px !important;
    height: 24px !important;
    margin-bottom: 0 !important;
    fill: #ff9f43;
}

/* New Card Tags */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1rem;
}

.tag {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: #333;
    color: #ccc;
    border: 1px solid #444;
}

.tag.type {
    color: #74b9ff;
    border-color: rgba(116, 185, 255, 0.3);
}

.tag.theme {
    color: #a29bfe;
    border-color: rgba(162, 155, 254, 0.3);
}

@media (max-width: 768px) {
    .games-grid {

        grid-template-columns: 1fr;
    }

    .wizard-step {
        padding: 1.5rem 1rem;
    }
}

.archetype-card {
    align-items: flex-start !important;
    text-align: left !important;
    padding: 1.5rem !important;
    min-height: 180px;
    /* Bit taller for desc */
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-std);
    width: 100%;
    max-width: 800px;
    max-height: 90vh; /* Adjust for responsiveness */
    overflow-y: auto;
    position: relative;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    border: 1px solid #444;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-image {
    width: 100%;
    border-radius: 12px;
    aspect-ratio: 1/1;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    position: relative;
}

.modal-title {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.modal-desc {
    font-size: 1.05rem;
    color: #ccc;
    line-height: 1.6;
}

#modal-similar-games {
    margin-top: 3rem;
    border-top: 1px solid #333;
    padding-top: 2rem;
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-content {
        padding: 1.5rem;
        border-radius: 12px;
        max-height: 95vh;
    }
    
    .modal-image {
        aspect-ratio: 1/1;
    }
    
    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .modal-title {
        font-size: 1.6rem;
    }

    .modal-content .card-actions {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .modal-content .card-actions .btn-action {
        width: 100% !important;
        max-width: 250px !important;
        margin: 0 auto;
    }
}