@import url('https://fonts.googleapis.com/css2?family=Cutive+Mono&display=swap');

:root {
    --bg-color: white;
    --text-color: black;
    --text-shadow: 
          1px 1px 1px white,
          2px 2px 3px white;
    --box-shadow: 
          1px 1px 1px white,           /* Outside shadow */
          2px 2px 3px white,           /* Outside shadow (softer) */
          inset 1px 1px 1px white,     /* Inside shadow */
          inset 2px 2px 3px white;     /* Inside shadow (softer) */
    --transition-duration: 2s;
    --transition-easing: ease-in-out;
}


body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--bg-color);
    color: var(--text-color);
    text-shadow: var(--text-shadow);
    transition: background-color var(--transition-duration) var(--transition-easing), 
                color var(--transition-duration) var(--transition-easing);
}

#themeOverlay {
    position: relative;
    top: 0;
    left: 0;
    width: 100vw;    /* Use viewport units */
    height: 100vh;
    pointer-events: none;
    background-color: transparent;
    z-index: 2;
    transition: background-color var(--transition-duration) var(--transition-easing);
}

.frame-overlay {
    /* Position in the center of the viewport */
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    /* Centers it both horizontally and vertically */
    margin: auto;
    
    /* Use viewport units with consistent ratio */
    width: min(calc(100vh * (1920/1080)), 100vw); /* Width based on ratio but limited by viewport width */
    height: min(100vh, calc(100vw * (1080/1920))); /* Height based on ratio but limited by viewport height */
    
    pointer-events: none;
    z-index: 1;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    box-sizing: border-box;
    opacity: 0;
    animation: fadeIn 10s ease-in-out forwards;
}

.game-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    
    /* Calculate sizes based on the same ratio as the frame */
    /* Make game container consistently 90.5% of the frame size */
    width: min(calc(100vh * (1920/1080) * 0.91), calc(100vw * 0.91));
    height: min(calc(100vh * 0.91), calc(100vw * (1080/1920) * 0.91));
    
    /* Other styling */
    text-align: center;
    background: transparent;
    color: inherit;
    font-family: 'Cutive Mono', monospace;
    font-weight: 500;
    overflow: hidden;
    font-size: 22px;
}

.text-container {
    position: absolute;
    bottom: calc(70%);
    width: 100%;
    transform: translateY(0);
    will-change: transform;
    z-index: 3;
}

.story-text {
    padding: 3px;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.choice-button {
    background: none;
    border: 1px solid var(--text-color);
    box-shadow: var(--box-shadow);
    color: inherit;
    text-shadow: inherit;
    padding: 4px 6px;
    margin: 5px 4px;
    cursor: pointer;
    display: inline-block;
    text-align: center;
    font-size: inherit;
    font-family: inherit;
    transition: border-color var(--transition-duration) var(--transition-easing);
}

.choice-button:hover {
    text-decoration: underline;
}

.choice-button:disabled {
    cursor: default;
    text-decoration: none;
    pointer-events: none;
}

#imageContainer {
    position: relative;
    width: 100%;
    height: 100%;
}

.game-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 0;
}

.new-video {
    opacity: 1;
    transition: opacity 0.05s ease-in-out;
    z-index: 0;
}

.old-video {
    opacity: 0;
    transition: opacity 0.05s ease-in-out;
    z-index: 0;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.credits-button {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 4px 6px;
    margin: 5px 4px;
    color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow: var(--box-shadow);
    text-decoration: none;
    z-index: 1000;
    transition: color 0.3s, border-color 0.3s, text-decoration-color 0.3s;
    font-size: inherit;
    font-family: inherit;
}

.credits-button:hover {
    color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.8);
    text-decoration: underline;
}

/* credit button hyperlinks */
.credits a {
    display: inline-block;
    background: none;
    border: 1px solid var(--text-color);
    color: inherit;
    padding: 4px 6px;
    margin: 5px 4px;
    cursor: pointer;
    text-align: center;
    font-size: inherit;
    font-family: inherit;
    text-decoration: none;
    transition: border-color var(--transition-duration) var(--transition-easing);
}

.credits a:hover {
    text-decoration: underline;
}