/* =========================================
   Monopong – Complete Stylesheet
   ========================================= */

/* --- Reset / Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

body {
    background-color: #000;
    color: #fff;
    transition: background-color 0.4s ease, color 0.4s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- Page Layout --- */
.page {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.toggle-bar {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    z-index: 10000;
    position: relative;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    padding-top: 2rem;
    gap: 2rem;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

/* --- Info Panel (left column) --- */
.info-panel {
    text-align: center;
}

@media (min-width: 768px) {
    .main-grid {
        grid-template-columns: repeat(3, 1fr);
        padding-top: 0;
    }

    .info-panel {
        text-align: right;
        margin-top: -0.75rem;
    }
}

.title {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.gbc-subtitle {
    display: none;
}

.download-section {
    margin-top: 1rem;
}

/* --- Ring / Ball Area (center column) --- */
.ring-area {
    margin: auto;
    width: 24rem;
    height: 24rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ring-ios {
    border: 2px solid #fff;
    border-radius: 9999px;
    width: 24rem;
    height: 24rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ring-ios .ball-img {
    height: 4rem;
}

#ring-gbc {
    display: none;
    position: relative;
    width: 384px;
    height: 384px;
}

#ring-gbc .ring-img {
    width: 384px;
    height: 384px;
}

#ring-gbc .ball-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 62px;
    width: 62px;
}

/* --- GBC pixel graphics — nearest-neighbor scaling --- */
#ring-gbc img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

/* --- Emulator Container --- */
#emulator-container {
    display: none;
    width: 100%;
    height: 100%;
    padding: 1rem 0;
    box-sizing: border-box;
}

/* Border wrapper sits under the LCD overlays so it gets tinted/filtered */
#emulator-border {
    width: 100%;
    height: 100%;
    border: 2px solid #fff;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

/* Iframe sits above the LCD overlays so the game content is unfiltered */
#emulator-frame {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
    z-index: 10005;
}

/* When emulator is active, let the grid expand to fill viewport */
body.emulator-active .main-grid {
    flex: 1;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
}

@media (min-width: 768px) {
    body.emulator-active .main-grid {
        grid-template-columns: 1fr 2fr 1fr;
    }
}

body.emulator-active .ring-area {
    width: auto;
    height: auto;
    margin: 0;
    overflow: hidden;
}

body.emulator-active .info-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Small screens: emulator fills width, fixed height fitting viewport, no side borders */
@media (max-width: 767px) {
    body.emulator-active .main-grid {
        grid-template-rows: auto 1fr auto;
    }

    body.emulator-active .ring-area {
        padding: 0;
        min-height: 0;
    }

    #emulator-container {
        padding: 0;
    }

    #emulator-border {
        border-left: none;
        border-right: none;
    }
}

/* --- Footer --- */
.footer {
    text-align: center;
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.footer-link {
    color: #737373;
    font-size: 0.75rem;
    line-height: 1rem;
}

.footer-link:hover {
    color: #fff;
}

/* --- App Store Badge --- */
.appstore-badge {
    display: inline-block;
    overflow: hidden;
    border-radius: 13px;
    width: 150px;
    height: 56px;
}

.appstore-badge img {
    border-radius: 13px;
    width: 150px;
    height: 56px;
}

/* --- Mode Toggle Switch --- */
.mode-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    transition: border-color 0.3s, border-radius 0.3s, font-family 0.3s;
    font-weight: 500;
}

.mode-toggle-option {
    padding: 10px 24px;
    transition: background-color 0.3s, color 0.3s;
    color: rgba(255, 255, 255, 0.8);
}

.mode-toggle-option.active {
    background-color: #fff;
    color: #000;
}

/* --- GBC Download Buttons (hidden in iOS mode) --- */
#gbc-download {
    display: none;
}

.gbc-download-btn,
.gbc-play-btn {
    display: inline-block;
    padding: 10px 22px;
    border: 2px solid #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.gbc-download-btn:hover,
.gbc-play-btn:hover {
    background-color: #fff;
    color: #000;
}

.gbc-btn-spacer {
    margin-top: 0.5rem;
}

/* --- LCD / Scanline + RGB subpixel Overlay --- */
#lcd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10002;
    opacity: 0;
    transition: opacity 0.5s ease;
    background:
        /* Horizontal scanlines */
        repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 3px),
        /* Vertical pixel columns */
        repeating-linear-gradient(90deg,
            rgba(0, 0, 0, 0.08) 0px,
            rgba(0, 0, 0, 0.08) 1px,
            transparent 1px,
            transparent 3px);
}

/* RGB subpixel pattern + birefringence rainbow — applied in GBC mode only */
body[data-mode="gbc"] #lcd-overlay {
    background:
        /* Horizontal scanlines */
        repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.12) 0px,
            rgba(0, 0, 0, 0.12) 1px,
            transparent 1px,
            transparent 3px),
        /* RGB subpixel columns */
        repeating-linear-gradient(90deg,
            rgba(255, 0, 0, 0.06) 0px,
            rgba(255, 0, 0, 0.06) 1px,
            rgba(0, 255, 0, 0.03) 1px,
            rgba(0, 255, 0, 0.03) 2px,
            rgba(0, 0, 255, 0.06) 2px,
            rgba(0, 0, 255, 0.06) 3px),
        /* Birefringence — long-range faint rainbow sweep across the plastic */
        linear-gradient(135deg,
            rgba(255, 0, 0, 0.03) 0%,
            rgba(255, 140, 0, 0.025) 12%,
            rgba(255, 255, 0, 0.02) 24%,
            rgba(0, 255, 0, 0.025) 36%,
            rgba(0, 200, 255, 0.03) 48%,
            rgba(80, 0, 255, 0.025) 60%,
            rgba(200, 0, 255, 0.02) 72%,
            rgba(255, 0, 100, 0.025) 84%,
            rgba(255, 0, 0, 0.03) 100%);
}

body[data-mode="gbc"] #bloom-overlay {
    opacity: 0.4;
}

/* --- Vignette Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10004;
    opacity: 0;
    transition: opacity 0.5s ease;
    background: radial-gradient(ellipse at center,
            transparent 50%,
            rgba(0, 0, 0, 0.55) 100%);
}

/* =========================================
   GBC Mode – LCD filter + pixel font
   ========================================= */

body[data-mode="gbc"] {
    background-color: #42433c;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
}

/* Green tint overlay (mix-blend-mode: multiply shifts toward LCD green) */
body[data-mode="gbc"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10001;
    background: rgba(218, 243, 169, 0.50);
    mix-blend-mode: multiply;
}

body[data-mode="gbc"] #lcd-overlay {
    opacity: 1;
}

body[data-mode="gbc"]::after {
    opacity: 1;
}

/* Bloom glow on text */
body[data-mode="gbc"] .page {
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}

/* Bloom glow on pixel graphics */
body[data-mode="gbc"] #ring-gbc img {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

/* Typography */
body[data-mode="gbc"] .title {
    font-size: 0.9rem;
    line-height: 1.8;
    letter-spacing: 0.12em;
}

body[data-mode="gbc"] .gbc-subtitle {
    display: block;
    margin-top: 0.25rem;
}

body[data-mode="gbc"] .footer-link {
    font-size: 0.45rem;
    line-height: 1.6;
}

/* Downloads */
body[data-mode="gbc"] #ios-download {
    display: none;
}

body[data-mode="gbc"] #gbc-download {
    display: block;
}

body[data-mode="gbc"] .gbc-download-btn,
body[data-mode="gbc"] .gbc-play-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    border-radius: 0;
    padding: 12px 22px;
    min-width: 10rem;
    text-align: center;
    box-sizing: border-box;
}

body[data-mode="gbc"] .gbc-download-btn {
    border-color: #e69659;
    color: #e69659;
}

body[data-mode="gbc"] .gbc-download-btn:hover {
    background-color: #e69659;
    color: #1a1a2e;
}

body[data-mode="gbc"] .gbc-play-btn {
    border-color: #fff;
    color: #fff;
}

body[data-mode="gbc"] .gbc-play-btn:hover {
    background-color: #fff;
    color: #1a1a2e;
}

/* Footer */
body[data-mode="gbc"] .footer-link {
    color: #fff;
}

body[data-mode="gbc"] .footer-link:hover {
    color: #e69659;
}

/* Toggle */
body[data-mode="gbc"] .mode-toggle {
    border-radius: 0;
    border: 2px solid rgba(255, 255, 255, 1.0);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
}

body[data-mode="gbc"] .mode-toggle-option {
    color: #fff;
    padding: 10px 20px;
}

body[data-mode="gbc"] .mode-toggle-option.active {
    background-color: #fff;
    color: #1a1a2e;
}

/* LCD flicker */
@keyframes lcd-flicker {
    0% {
        opacity: 1;
    }

    92% {
        opacity: 1;
    }

    93% {
        opacity: 0.96;
    }

    94% {
        opacity: 1;
    }

    100% {
        opacity: 1;
    }
}

body[data-mode="gbc"] #lcd-overlay {
    animation: lcd-flicker 4s infinite;
}

/* =========================================
   Privacy Page
   ========================================= */

.privacy-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100vh;
}

.privacy-header {
    padding: 1rem 4rem 2rem;
}

.privacy-header h1 {
    font-weight: 700;
}

.privacy-body {
    margin: 0 auto;
    padding: 0 4rem 1rem;
}

.privacy-footer {
    padding: 1rem 4rem 2rem;
}

.privacy-footer a {
    color: #737373;
    font-size: 0.875rem;
}

.privacy-footer a:hover {
    color: #fff;
}

@media (max-width: 767px) {

    .privacy-header,
    .privacy-body,
    .privacy-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}