@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,700|Quattrocento:700');

body {
    font-family: 'Open Sans', sans-serif;
    font-weight: lighter;
    background: white;
    overflow: hidden;
}

@media screen and (prefers-reduced-motion: no-preference) {
    body.switched {
        transition: color 0.6s, background-color 0.6s;
    }
}

h1,
h2 {
    text-align: center;
    font-family: "Quattrocento", Georgia, 'Times New Roman', Times, serif;
    margin: 0;
    padding: 0;
}

h1 {
    font-size: 30pt;
    margin-bottom: 10px;
}

h2 {
    font-size: 14pt;
    font-style: italic;
    font-family: sans-serif;
    font-weight: lighter;
    color: #BBB;
}

.header {
    padding-top: 3em;
    padding-bottom: 3em;
}

/*
  Built-in class:
    # author: Name
*/
.byline {
    font-style: italic;
}

.written-in-ink {
    z-index: 3;
    font-size: 9pt;
    font-family: sans-serif;
    text-align: center;
    font-weight: 700;
    position: fixed;
    display: block;
    width: 100%;
    background: white;
    margin: 0;
    padding-top: 6px;
    padding-bottom: 6px;
    height: 14px;
    top: 0;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .written-in-ink {
        transition: color 0.6s, background 0.6s;
    }
}

/* 
  Enables <iframe> support work on itch.io when using mobile iOS
*/
.outerContainer {
    position: absolute;
    display: block;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
}

@media screen and (max-width: 980px) {
    .outerContainer {
        margin-top: 44px;
        background-size: cover;
        background-repeat: no-repeat;
    }
}

.container {
    display: block;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 4em;
    background: white;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .switched .container {
        transition: background-color 0.6s;
    }
}

p {
    font-size: 13pt;
    color: #888;
    line-height: 1.7em;
    font-weight: lighter;
}

a {
    font-weight: 700;
    color: #0b037e;
    font-family: sans-serif;
    text-decoration: none;
}

.unclickable {
    font-weight: 700;
    color: #4f3411;
    font-family: sans-serif;
    text-decoration: none;
    cursor: not-allowed;
}

a:hover {
    color: black;
}

@media screen and (prefers-reduced-motion: no-preference) {
    a {
        transition: color 0.6s;
    }

    a:hover {
        transition: color 0.1s;
    }
}

strong {
    color: black;
    font-weight: bold;
}

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

.container .hide {
    opacity: 0.0;
}

.container .invisible {
    display: none;
}

.container>* {
    opacity: 1.0;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .container>* {
        transition: opacity 1.0s;
    }
}

.choice {
    text-align: center;
    line-height: 1.7em;
}

:not(.choice)+.choice {
    padding-top: 1em;
}

.choice a, .choice span {
    font-size: 15pt;
}

.end {
    text-align: center;
    font-weight: bold;
    color: black;
    padding-top: 20px;
    padding-bottom: 20px;
}

#controls {
    z-index: 4;
    font-size: 9pt;
    text-align: center;
    padding-bottom: 6px;
    position: fixed;
    right: 14px;
    top: 4px;
    user-select: none;
    background: white;
}

@media screen and (prefers-reduced-motion: no-preference) {
    #controls {
        transition: color 0.6s, background 0.6s;
    }
}

#controls [disabled] {
    color: #ccc;
}

#controls>*:not(:last-child):after {
    content: " | ";
}

@media screen and (max-width: 980px) {
    #controls {
        z-index: 2;
        padding-top: 24px;
        top: 0;
        left: 0;
        right: 0;
    }
}

body.dark {
    background: black;
    color: white;
}

.dark h2 {
    color: #666;
}

.dark .container {
    background: black;
}

.dark .written-in-ink {
    background: black;
}

.dark a {
    color: #cc8f1a;
}
.dark .unclickable{
    color: #c4af87;
    cursor:not-allowed;
}

.dark a:hover {
    color: white;
}

@media screen and (prefers-reduced-motion: no-preference) {
    .dark a {
        transition: color 0.6s;
    }
}

.dark strong {
    color: white;
}

.dark #controls [disabled] {
    color: #444;
}

.dark .end {
    color: white;
}

.dark #controls {
    background: black;
}

#show-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, #5ce2c5 0%, #0b1c7a 100%);
    z-index: -1;
}


#character-stage {
    position: fixed;
    bottom: 0; 
    height: 90%; 
    width: 100%; 
    pointer-events: none; 
    z-index: 1;
    display: flex;
    align-items: flex-end; 
    justify-content: center;
}

.stage-sarah {
    transform: translateX(20%); 
}

.stage-kyra {
    transform: translateX(-20%); 
}

#character-sprite {
    max-height: 60vh; 
    width: auto;
    max-width: 80vw; 
    display: block;
    object-fit: contain;
    object-position: bottom; 
    opacity: 0;
}

#character-sprite.visible {
    opacity: 1;
}

#pokemon-dialogue-box {
    position: fixed;
    bottom: 10px; 
    left: 50%;
    transform: translateX(-50%);
    width: 92%; 
    max-width: 800px;
    min-height: 120px; 
    max-height: 35vh; 
    background: white;
    border: 4px solid #040d42; 
    border-radius: 12px;
    padding: 15px;
    z-index: 2;
    box-shadow: 0 0 20px rgba(20, 13, 124, 0.4);
    overflow-y: auto; 
    /* Fix for smooth scrolling on iOS */
    -webkit-overflow-scrolling: touch; 
    display: flex;
    flex-direction: column;
}

#speaker-name {
    font-weight: bold;
    color: #5aa1d1;
    background: #040d42;
    display: inline-block;
    padding: 2px 10px;
    margin-bottom: 10px;
    border-radius: 4px;
}

#storyText {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem; 
    color: #333;
    line-height: 1.4;
    margin-bottom: 10px;
}

#choices-container {
    display: flex;
    flex-wrap: wrap; 
    gap: 8px;
    margin-top: auto;
    align-items: flex-start; 
    justify-content: flex-start;
}

#choices-container button {
    background: #338fe6;
    /* FIX: Force white text color for iPhone visibility */
    color: #ffffff !important; 
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    flex: 0 0 auto;  
    -webkit-flex: 0 0 auto;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
}

@media screen and (min-width: 768px) {
    #storyText {
        font-size: 1.4rem;
    }
    #pokemon-dialogue-box {
        bottom: 20px;
        padding: 20px;
    }
}

@media screen and (max-width: 767px) {
    #choices-container button {
        padding: 12px 20px;
        font-size: 1.1rem;
        min-height: 44px; 
    }
}

@media screen and (max-width: 800px) {
    #character-stage {
        bottom: 10%; 
        height: 30vh; 
    }
    
    #pokemon-dialogue-box {
        /* FIX: Increase height on mobile so camera and buttons fit while scrolling */
        max-height: 60vh !important; 
    }
    
    .stage-sarah {
        right: 10%; 
    }
    
    .stage-kyra {
        left: 10%;
    }
    
    #impress-bars-wrapper {
        width: 80%; 
        top: 10px;
    }
}

#next-indicator {
    position: absolute;
    bottom: 10px;
    right: 20px;
    color: #040d42;
    animation: blink 0.8s infinite;
}

@keyframes blink { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

.hide { opacity: 0; pointer-events: none; }

@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake-effect {
  animation: shake 0.5s; 
  animation-iteration-count: 1;
}

#instruction-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8); 
    backdrop-filter: blur(8px);    
    display: flex;
    justify-content: center; 
    align-items: center;     
    z-index: 100;
    flex-direction: column;
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    max-height: 100vh; 
    margin: auto;
}

#instruction-box {
    background: white;
    padding: 20px;
    border-radius: 15px;
    width: 90%;          
    max-width: 500px;    
    margin: auto;        
    text-align: center;
    border: 5px solid #338fe6;
    box-shadow: 0 0 30px rgba(92, 226, 197, 0.5);
    max-height: 85vh;    
    overflow-y: auto;    
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch; 
}

#start-game-btn {
    margin-top: 20px;
    margin-bottom: 10px;
    flex-shrink: 0; 
}

#instruction-box button {
    margin-top: 15px;
    flex-shrink: 0;      
    position: sticky;    
    bottom: 0;
}

#instruction-box h2 {
    color: #040d42;
    margin-bottom: 15px;
}

#instruction-box ul {
    text-align: left;
    margin: 20px 0;
    color: #444;
}

#impress-bars-wrapper {
    position: fixed;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    max-width: 400px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 15px; 
}

.impress-bar-container {
    width: 100%;
    transition: opacity 0.5s ease;
}

.impress-label {
    font-family: 'Quattrocento', serif;
    font-size: 10pt;
    color: white;
    background: #040d42;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px 4px 0 0;
    font-weight: bold;
    letter-spacing: 1px;
}

.progress-track {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid #040d42;
    border-radius: 0 10px 10px 10px;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.impress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f5f0d, #7bd458);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    box-shadow: 0 0 10px rgba(92, 226, 197, 0.8);
}

.flash-green {
    background-color: #a4ff30 !important;
    transition: none !important;
}

#final-gallery {
    margin-top: 20px;
    padding: 15px;
    background: #040d42;
    border-radius: 10px;
    color: white;
}

.gallery-item {
    margin-bottom: 25px;
    border-bottom: 1px solid #338fe6;
    padding-bottom: 15px;
}

.download-btn {
    display: inline-block;
    background: #5ee0f1;
    color: #040d42 !important;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 5px;
}

.download-btn:hover {
    background: white;
}

/* --- CAMERA & FULLSCREEN STYLES --- */

/* FIX: Reduce camera height to allow more room for text and buttons on small screens */
.v-camera-wrapper {
    background:#000; 
    border-radius:8px; 
    overflow:hidden; 
    margin-bottom: 10px; 
    position: relative; 
    width: 100%; 
    height: 180px !important; 
}

.v-full-btn {
    -webkit-appearance: none;
    appearance: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #444 !important; 
    color: white !important;
    border: 1px solid #666 !important;
    padding: 10px !important;
    width: 100% !important;
    border-radius: 5px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    margin-bottom: 5px !important;
    min-height: 44px; 
    text-transform: uppercase;
    letter-spacing: 1px;
}

.v-camera-wrapper.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important; 
    background: black !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.v-camera-wrapper.fullscreen-mode .v-feed {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: cover !important; 
}

.fullscreen-active #pokemon-dialogue-box,
.fullscreen-active #impress-bars-wrapper {
    display: none !important;
}

.fullscreen-active .v-full-btn,
.fullscreen-active .v-cap-btn {
    display: none !important;
}

.v-preview {
    z-index: 100001 !important;
    position: relative;
    display: block;
}

.v-preview.hide {
    display: none !important;
}