:root {
    --primary: #2E4467;
    --dark: #0D0D0D;
    --secondary: #1D2C40;
    --accent: #4A6FA5;
    --bg-color: #f9f9f9;
    --text-color: #0D0D0D;
    --card-bg: #ffffff;
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    --section-alt-bg: #f2f2f2;
    --text-secondary: #666;
    --nav-height: 80px;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f0f0f0;
    --card-bg: #1e1e1e;
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    --section-alt-bg: #181818;
    --text-secondary: #b0b0b0;
}

.section-title {
    text-align: center;
    color: var(--text-color);
    margin: 20px 0 20px;
    font-size: 2em;
}

.main-container {
    padding-top: var(--nav-height);
    overflow: hidden;
}

.main-frame {
    width: calc(100vw - 70px);
    max-width: 1250px;
    margin: 20px auto;
    height: calc(100vw - 100px);
    max-height: 70vh;
    border: 2px solid #2E4467;
}

.main-frame iframe {
    width: 100%;
    height: 100%;
}

.main {
    width: calc(100vw - 70px);
    max-width: 1250px;
    margin: 20px auto;
}

.controls-container {
    background: var(--card-bg);
    border: 2px solid var(--secondary);
    border-radius: 15px;
    padding: 5px;
    margin: 5px auto;
    box-shadow: var(--card-shadow);
    text-align: center;
}

.control {
    display: inline-block;
    background-color: var(--accent);
    color: white;
    border: 2px solid var(--secondary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    margin: 8px;
    min-width: 120px;
}

.control:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control .fa {
    margin-left: 8px;
}

/* Responsive design for controls */
@media (max-width: 768px) {
    .controls-container {
        padding: 20px 15px;
        margin: 15px auto;
    }
    
    .control {
        display: block;
        width: 100%;
        margin: 8px 0;
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .controls-container {
        padding: 15px 10px;
        margin: 10px auto;
    }
    
    .controls-title {
        font-size: 1.3em;
        margin-bottom: 15px;
    }
    
    .control {
        padding: 12px 16px;
        font-size: 14px;
        min-width: auto;
    }
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--section-alt-bg) 100%);
    color: var(--text-color);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--section-alt-bg);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.game-title {
    color: var(--primary);
    padding: 10px;
}

.back-button {
    color: var(--primary);
    border: none;
    border-bottom: 2px solid var(--primary);
    padding: 10px;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

/* Theme toggle button styles */
#theme-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

#theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#theme-toggle svg {
    width: 22px;
    height: 22px;
}

#theme-toggle .sun {
    display: none;
}

[data-theme="dark"] #theme-toggle .moon {
    display: none;
}

[data-theme="dark"] #theme-toggle .sun {
    display: block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 30px;
    border: 2px solid var(--secondary);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: var(--card-shadow);
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover,
.close:focus {
    color: var(--text-color);
}

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 20px;
    margin-right: 30px;
}

.modal-content p {
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-content ol {
    color: var(--text-color);
    margin: 20px 0;
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.modal-content strong {
    color: var(--accent);
}

/* Settings Modal Styles */
.settings-controls {
    margin-top: 20px;
}

.setting-group {
    margin-bottom: 20px;
    text-align: left;
}

.setting-group label {
    display: block;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--section-alt-bg);
    outline: none;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--secondary);
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--secondary);
}

.reset-btn {
    background-color: var(--accent);
    color: white;
    border: 2px solid var(--secondary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    width: 100%;
}

.reset-btn:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
}

.crumbs {
    width: calc(100vw - 70px);
    max-width: 1250px;
    margin: 0 auto;
    font-size: 14px;
    color: var(--text-secondary);
}

.crumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.crumbs li + li::before {
    content: "/";
    margin-right: 6px;
    opacity: 0.5;
}

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

.game-detail section {
    padding: 48px 0;
}

.game-detail section h2 {
    margin-bottom: 32px;
}

.game-detail .about-content {
    text-align: left;
}

.game-detail .about-content p {
    margin-bottom: 18px;
    line-height: 1.6;
}

.game-meta {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.game-meta div {
    background: var(--card-bg);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--card-shadow);
}

.game-meta dt {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.game-meta dd {
    margin: 0;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.4;
}

.game-meta dd a {
    color: var(--accent);
}

.controls-table {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border-collapse: collapse;
    background: var(--card-bg);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.controls-table th,
.controls-table td {
    padding: 12px 16px;
    text-align: left;
    color: var(--text-color);
    border-bottom: 1px solid var(--section-alt-bg);
}

.controls-table tr:last-child th,
.controls-table tr:last-child td {
    border-bottom: none;
}

.controls-table th {
    width: 38%;
    font-weight: 500;
    white-space: nowrap;
}

kbd {
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    background: var(--section-alt-bg);
    border: 1px solid var(--secondary);
    border-bottom-width: 3px;
    border-radius: 6px;
    padding: 3px 8px;
    color: var(--text-color);
}

.tips-list {
    max-width: 800px;
    margin: 0 auto;
    padding-left: 0;
    list-style: none;
    counter-reset: tip;
}

.tips-list li {
    counter-increment: tip;
    position: relative;
    padding: 14px 16px 14px 60px;
    margin-bottom: 12px;
    background: var(--card-bg);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    color: var(--text-color);
    line-height: 1.55;
    box-shadow: var(--card-shadow);
}

.tips-list li::before {
    content: counter(tip);
    position: absolute;
    left: 16px;
    top: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-list details {
    background: var(--card-bg);
    border: 1px solid var(--secondary);
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow);
}

.faq-list summary {
    cursor: pointer;
    padding: 16px 18px;
    font-weight: 600;
    color: var(--text-color);
    list-style: none;
    position: relative;
    padding-right: 44px;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::after {
    content: "+";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    color: var(--accent);
}

.faq-list details[open] summary::after {
    content: "−";
}

.faq-list p {
    padding: 0 18px 16px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.related-grid .game-card {
    background-color: var(--card-bg);
    border: 1px solid var(--primary);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-grid .game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.related-grid .game-icon {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 10px;
}

.related-grid .game-title {
    font-size: 15px;
    text-align: center;
    padding: 0;
    color: var(--text-color);
}

.embed-box {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.embed-box textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 14px;
    border: 1px solid var(--secondary);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-color);
    resize: vertical;
    margin-bottom: 12px;
}

@media (max-width: 600px) {
    .controls-table th {
        width: auto;
        white-space: normal;
    }
}

/* Full Page Mode Styles */
.fullpage-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: var(--bg-color);
    margin: 0 !important;
    padding: 0 !important;
}

.fullpage-mode .main-frame {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
}

.fullpage-mode header,
.fullpage-mode .main,
.fullpage-mode section,
.fullpage-mode footer {
    display: none !important;
}

.fullpage-mode .section-title,
.fullpage-mode .crumbs {
    display: none !important;
}

.fullpage-mode .exit-fullpage-btn {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
    background: var(--accent) !important;
    color: white !important;
    border: 2px solid var(--secondary) !important;
    padding: 12px 20px !important;
    border-radius: 25px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.fullpage-mode .exit-fullpage-btn:hover {
    background: var(--secondary) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}