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

body {
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ======= Two-column Layout ======= */

#app {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 20px;
}

#emulator-col {
    text-align: center;
}

/* ======= Header ======= */

#header-row {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

header h1 {
    font-size: 1.4rem;
    color: #c0c0c0;
}

#lang-toggle {
    font-size: 0.75rem;
    user-select: none;
}

.lang-btn {
    cursor: pointer;
    color: #555;
    transition: color 0.15s;
}

.lang-btn:hover {
    color: #c0c0c0;
}

.lang-btn.active {
    color: #5390d9;
    font-weight: 600;
}

.lang-sep {
    color: #333;
    margin: 0 2px;
}

#controls-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

#reset-btn {
    padding: 6px 16px;
    background: #16213e;
    border: 1px solid #0f3460;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

#reset-btn:hover:not(:disabled) {
    background: #0f3460;
}

#reset-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ======= Game Selector ======= */

#game-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.game-card {
    padding: 8px 14px;
    background: #16213e;
    border: 1px solid #0f3460;
    color: #c0c0c0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s, border-color 0.15s;
}

.game-card:hover {
    background: #0f3460;
    color: #e0e0e0;
}

.game-card.active {
    background: #0f3460;
    border-color: #5390d9;
    color: #fff;
}

/* ======= Screen ======= */

#screen {
    display: block;
    margin: 0 auto;
    width: 512px;
    height: 480px;
    background: #000;
    image-rendering: pixelated;
    border: 2px solid #0f3460;
    border-radius: 4px;
}

#status {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #888;
    min-height: 1.2em;
}

/* ======= Controls ======= */

footer {
    margin-top: 16px;
}

#keybinds {
    margin: 0 auto;
    border-collapse: collapse;
    font-size: 0.75rem;
}

#keybinds th {
    padding: 4px 12px;
    color: #888;
    font-weight: normal;
}

#keybinds td {
    padding: 2px 12px;
    color: #aaa;
}

#keybinds td:first-child {
    text-align: right;
    color: #ccc;
}

/* ======= CTA Panel ======= */

#cta {
    width: 400px;
    text-align: center;
    padding: 32px 24px;
    border-left: 1px solid #0f3460;
}

.book-cover {
    width: 180px;
    height: auto;
    margin-bottom: 20px;
    border-radius: 4px;
}

#cta h2 {
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.4;
}

#cta p {
    font-size: 0.82rem;
    color: #aaa;
    line-height: 1.55;
    margin-bottom: 8px;
}

.cta-editions {
    font-size: 0.85rem;
    color: #5390d9;
    font-style: italic;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.cta-btn {
    display: block;
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cta-primary {
    background: #5390d9;
    color: #fff;
    border: 1px solid #5390d9;
}

.cta-primary:hover {
    background: #4a80c4;
}

.cta-ghost {
    background: transparent;
    color: #5390d9;
    border: 1px solid #0f3460;
}

.cta-ghost:hover {
    border-color: #5390d9;
    background: rgba(83, 144, 217, 0.08);
}

.cta-link {
    background: transparent;
    color: #888;
    border: 1px solid transparent;
    font-size: 0.8rem;
}

.cta-link:hover {
    color: #5390d9;
}

/* ======= Sample Modal ======= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 32px;
    width: 360px;
    max-width: 90vw;
    position: relative;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #e0e0e0;
}

.modal h3 {
    font-size: 1.05rem;
    color: #e0e0e0;
    margin-bottom: 8px;
    font-weight: 600;
}

.modal p {
    font-size: 0.82rem;
    color: #aaa;
    margin-bottom: 20px;
    line-height: 1.4;
}

.modal-lang-picker {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #c0c0c0;
}

.lang-option input[type="radio"] {
    accent-color: #5390d9;
}

#sample-email {
    width: 100%;
    padding: 10px 14px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    margin-bottom: 14px;
    outline: none;
}

#sample-email:focus {
    border-color: #5390d9;
}

#sample-email::placeholder {
    color: #555;
}

#sample-form .cta-btn {
    width: 100%;
    cursor: pointer;
    border: none;
    font-size: 0.85rem;
}

/* ======= Responsive: stack on narrow screens ======= */

@media (max-width: 900px) {
    #app {
        flex-direction: column;
        align-items: center;
    }

    #cta {
        width: 100%;
        max-width: 540px;
        border-left: none;
        border-top: 1px solid #0f3460;
        margin-top: 24px;
        padding-top: 28px;
    }

    .cta-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .cta-btn {
        flex: 0 1 auto;
    }
}
