@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500&display=swap');

/* Global styles for Ansoku.app */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: #555 #333;
}

html {
    height: 100%;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    overflow-y: scroll; /* Always show vertical scrollbar to avoid layout shift */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Cinzel', serif;
    color: white;
    text-align: center;
    position: relative;
    height: 100%;
    min-height: 100vh;
    -webkit-text-size-adjust: 100%; /* Normalize iOS text sizing */
}

.background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black url('/shared_assets/BackgroundNightHighRes.png') no-repeat 25% center;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    filter: hue-rotate(-5deg);
    -webkit-filter: hue-rotate(-5deg);
    z-index: 0;
}

.background-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/shared_assets/BackgroundNightHighRes.png') no-repeat 25% center;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    filter: hue-rotate(-5deg);
    -webkit-filter: hue-rotate(-5deg);
    mask: linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
    -webkit-mask: linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
    z-index: 1;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Thicker, more readable center band behind menu buttons */
    background: linear-gradient(
        to right,
        transparent 30%,
        rgba(0, 0, 0, 0.6) 42%,
        rgba(0, 0, 0, 0.6) 58%,
        transparent 70%
    );
    z-index: 1;
}

body.landing-page::before, body.page-element::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

body.landing-page::before {
    background: rgba(0, 0, 0, 0.7);
    animation: fadeInToNormal 2s forwards;
}

body.page-element::before {
    background: rgba(0, 0, 0, 0);
    animation: fadeOutToDark 2s forwards;
}

@keyframes fadeInToNormal {
    from {
        background: rgba(0, 0, 0, 0.7);
    }
    to {
        background: rgba(0, 0, 0, 0);
    }
}

@keyframes fadeOutToDark {
    from {
        background: rgba(0, 0, 0, 0);
    }
    to {
        background: rgba(0, 0, 0, 0.7);
    }
}

.content, h2, h3, h4, p, a, .back-button {
    position: relative;
    z-index: 2;
}

.content {
    max-width: 800px;
    width: 100%;
    padding: 0 15px;
    line-height: 1.6;
    text-shadow: 2px 2px 4px black;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h2 {
    font-size: 3em;
    text-shadow: 2px 2px 4px black;
    margin: 30px 0 20px 0;
    font-weight: normal;
}

h3 {
    font-size: 1.8em;
    text-shadow: 2px 2px 4px black;
    margin: 20px 0;
    font-weight: normal;
}

h4 {
    font-size: 1.5em;
    margin: 10px 0;
    font-weight: normal;
}

p {
    margin: 10px 0;
    font-size: 1em;
}

a {
    color: rgb(255, 255, 255);
    text-decoration: none;
}

.back-button, a.back-button, button.back-button {
    font-family: 'Cinzel', serif;
    font-size: 2.5em;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    text-shadow: 3px 3px 6px black;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 10px 20px;
    margin: 0;
    width: 100%;
    max-width: 350px;
    justify-content: center;
}

.back-button:hover, a.back-button:hover, button.back-button:hover {
    color: rgb(219, 219, 219);
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: 10vh;
    width: 90%;
    max-width: 350px;
    margin-left: auto;
    margin-right: auto;
}

.menu-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 5px;
}

.menu-group a.menu-button:nth-child(2) {
    border-top: none;
}

.menu-group a.menu-button:nth-child(2)::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 45%;
    width: 10%;
    height: 0.3px;
    background-color: rgba(255, 255, 255, 0.4);
}

.menu-group button.menu-button:nth-child(2) {
    border-top: none;
}

.menu-group button.menu-button:nth-child(2)::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 45%;
    width: 10%;
    height: 0.3px;
    background-color: rgba(255, 255, 255, 0.4);
}

.menu-group:not(:last-child) {
    margin-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 20px;
}

a.menu-button, button.menu-button {
    display: flex;
    padding: 10px 20px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-family: 'Cinzel', serif;
    font-size: 2.125em;
    cursor: pointer;
    transition: background-color 0.3s;
    text-shadow: 3px 3px 6px black;
    z-index: 2;
    position: relative;
    border: none;
    align-items: center;
    gap: 10px;
    margin: 0;
    width: 100%;
    max-width: 350px;
    justify-content: center;
    background: none;
}

a.menu-button:hover, button.menu-button:hover {
    color: rgb(219, 219, 219);
}

input[type="text"],
input[type="password"],
input[type="email"] {
    font-family: 'Cinzel', serif;
    font-size: 1.2em;
    padding: 10px;
    width: 100%;
    max-width: 300px;
    border-radius: 5px;
    border: 1px solid white;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    text-align: center;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
    outline: none;
    border-color: rgb(219, 219, 219);
}

.icon {
    font-size: 0.8em;
}

#form-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

#form-modal > div {
    background: white;
    width: 300px;
    margin: 100px auto;
    padding: 20px;
    border-radius: 5px;
    text-align: center;
}

#modal-message {
    color: black;
    margin-bottom: 20px;
}

.wallet-address {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
    word-break: break-all;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    margin: 5px 0;
    font-size: 1em;
    line-height: 1.4;
    box-sizing: border-box;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin-left: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid white;
    border-radius: 5px;
    cursor: pointer;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    font-size: 0.9em;
    color: white;
    text-shadow: 1px 1px 2px black;
    transition: background-color 0.3s;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Centralized mobile responsiveness for scaling the "box" */
@media (max-width: 767px) {
    html {
        font-size: 13px; /* Adjusted from 12px */
    }

    body {
        font-size: 0.95rem; /* Adjusted from 0.86rem */
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 100vh;
        width: 100vw;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .background-image {
    /* Nudge right on mobile by ~20% relative to desktop (25% -> 45%) */
    background: black url('/shared_assets/BackgroundNightHighRes.png') no-repeat 45% center;
        background-size: cover;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        height: 100%;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        filter: hue-rotate(-5deg);
        -webkit-filter: hue-rotate(-5deg);
        z-index: -1;
    }

    .background-image::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: url('/shared_assets/BackgroundNightHighRes.png') no-repeat 45% center;
        background-size: cover;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        filter: hue-rotate(-5deg);
        -webkit-filter: hue-rotate(-5deg);
        mask: linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
        -webkit-mask: linear-gradient(to right, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,0.6) 100%);
        z-index: 1;
    }

    .content {
        padding: calc(10px + 2vw); /* Slightly responsive padding */
        margin-top: calc(60px + 2vw); /* Space for top back button */
        max-width: 100%;
        box-sizing: border-box;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        min-height: 100vh;
    }

    .back-button, a.back-button, button.back-button {
        position: fixed;
        top: calc(10px + 1vw);
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        font-size: 1.71em; /* Adjusted from 1.55em */
        padding: calc(8px + 1vw) calc(15px + 1vw);
        min-width: 120px;
        max-width: 300px;
        width: auto;
        margin: 0 auto;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 5px;
    }

    h2 {
        font-size: 2.5em; /* Adjusted from 1.9em */
        margin: calc(20px + 1vw) 0 calc(15px + 1vw);
    }

    h3 {
        font-size: 1.62em; /* Adjusted from 1.47em */
        margin: calc(15px + 1vw) 0;
    }

    h4 {
        font-size: 1.33em; /* Adjusted from 1.21em */
        margin: calc(8px + 1vw) 0;
    }

    p, label {
        font-size: 0.95rem; /* Adjusted from 0.86rem */
        word-break: break-word;
        margin: calc(8px + 1vw) 0;
    }

    a.menu-button, button.menu-button {
        font-size: 1.45em; /* Adjusted from 1.55em */
        padding: calc(8px + 1vw) calc(15px + 1vw);
        max-width: 300px;
        width: auto;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"] {
        font-size: 0.95rem; /* Adjusted from 0.86rem */
        padding: calc(8px + 1vw);
        max-width: 250px;
        margin: calc(8px + 1vw) 0;
    }

    .button-container {
        margin-top: calc(5vh + 1vw);
        max-width: 300px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
        font-size: 0.95rem; /* Adjusted from 0.86rem */
    }

    #search-form {
        width: 100%;
        max-width: 300px;
    }

    .wallet-address {
        font-size: 0.9em; /* Adjusted from 0.82em */
        flex-wrap: wrap; /* Allow wrapping to prevent overflow */
        padding: 8px 10px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .copy-button {
        margin-left: 8px;
        width: 28px;
        height: 28px;
        font-size: 0.7em; /* Adjusted from 0.64em */
        padding: 5px;
    }    .crypto-section {
        margin-bottom: calc(15px + 1vw);
    }

    #password-reset-form {
        padding-top: calc(50px + 2vw); /* Extra space for keyboard */
    }

    input:focus, button:focus {
        outline: none;
    }
}

/* Extra query for very small screens */
@media (max-width: 320px) {
    html {
        font-size: 10px; /* Adjusted from 9px */
    }

    .back-button, a.back-button, button.back-button {
        font-size: 1.32em; /* Adjusted from 1.2em */
        min-width: 100px;
        max-width: 200px;
        top: calc(8px + 1vw);
    }

    .content {
        margin-top: calc(50px + 1vw); /* Adjusted for smaller button */
    }

    .wallet-address {
        font-size: 0.9em; /* Adjusted from 0.82em */
        padding: 6px 8px;
    }

    .copy-button {
        margin-left: 6px;
        width: 24px;
        height: 24px;
        font-size: 0.66em; /* Adjusted from 0.6em */
        padding: 4px;
    }
}

/* Custom scrollbar for WebKit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #333;
}

::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 10px;
    border: 2px solid #333;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #555 #333;
}