* {
    margin: auto;
    padding: 0;
  }

html{
    scroll-behavior: smooth;
    /* background-color: #212121; */
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: url('/assets/images/themis-image.png'); /* Replace 'your-image.jpg' with the path to your background image */
    background-size:contain;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: bottom right; /* Adjust the position as needed */
    font-family: 'Kulim Park';
    background-color: #f0f0f0;
}

/* Override the global `* { margin: auto }` for the page columns so the
   flex layout can keep the footer pinned to the bottom. */
header, footer {
    margin: 0;
}

main {
    margin: 0;
    flex: 1 0 auto;
}

footer {
    flex-shrink: 0;
}

#logo-image{
    padding-top: 3em;
    padding-left: 2em;
    /* Keep the logo at its full, large size on every viewport; only shrink if
       it would otherwise overflow a very narrow screen. */
    width: min(360px, 90vw);
    height: auto;
    box-sizing: border-box;
}

/* Keep clear space between the logo and the page content. */
header{
    position: relative;
    width: fit-content;
    max-width: 100%;
    padding-bottom: clamp(2rem, 6vw, 4rem);
    box-sizing: border-box;
}

/* Stop the THEMIS logo from being intercepted by the fixed goddess background
   in square / portrait-tablet viewports (where the figure's top-left corner
   rises into the logo). A soft radial wash sits behind the logo only and fades
   to transparent, so the rest of the figure stays fully visible. It's a
   pseudo-element so its size never affects page layout/spacing. */
header::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 540px;
    height: 320px;
    max-width: 100vw;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        ellipse 480px 240px at 40px 60px,
        #f0f0f0 0,
        #f0f0f0 68%,
        rgba(240, 240, 240, 0) 100%
    );
}

#main-upload{
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    text-align: left;
    min-height: 90vh;
    padding-left: 1em;
    width: 50%;
    margin-left: 10em;
}

#main-upload p {
    padding: 0.75em 1em 0.75em 0;
}

.hidden-button {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0;
}

/* Upload button (index.html) keeps a consistent size ratio across viewports:
   it fills its content column (so it scales proportionally as the column
   shrinks) and caps at the large initial size on wide screens. */
#main-upload form img {
    width: 100%;
    max-width: 760px;
    height: auto;
}

/* Back button now lives outside #stats-verdict so no card/panel is painted
   behind it. Keep it aligned under the content column and transparent. Its
   left margin matches #stats-verdict so it lines up with the content. */
#back-form {
    display: flex;
    align-items: center;
    gap: 0;
    background: transparent;
    margin: 0 0 clamp(1.5em, 4vw, 2.5em);
    padding-left: clamp(1.5rem, 6vw, 8em);
}

#back-form form,
#back-form .hidden-button {
    background: transparent;
}

#back-form form {
    margin: 0;
    line-height: 0;
}

#back-form .hidden-button {
    padding: 0;
    margin: 0;
}

#back-form form img {
    width: clamp(56px, 9vw, 84px);
    height: auto;
    display: block;
}

#back-label {
    font-size: clamp(1.5rem, 5vw, 2.75rem) !important;
    font-weight:bolder;
    margin: 0;
}

main p{
    font-size: larger;
}

#stats, #verdict{
    text-transform: uppercase;
}

#stats-verdict{
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: clamp(1em, 3vw, 1.5em);
    width: clamp(300px, 45%, 600px);
    /* Override the global `* { margin: auto }`: pin the column to the left so
       it never overlaps the goddess background image on wide viewports. */
    margin: 0 auto 0 clamp(1.5rem, 6vw, 8em);
    padding: clamp(1em, 4vw, 2em) clamp(0.75em, 3vw, 1em);
    box-sizing: border-box;
}

#stats-verdict > section,
#stats-verdict > div {
    width: 100%;
    box-sizing: border-box;
}

#stats-verdict #verdict{
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.4rem, 4.5vw, 2.4rem);
    width: 100%;
    padding: .3em .5em;
    border-radius: 25px;
    overflow: hidden;
}

#verdict-text {
    margin: 0;
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
}

#stats{
    width: 100%;
    justify-content: space-around;
    align-items: center;
    gap: clamp(0.25em, 1.5vw, 0.75em);
    padding: clamp(1em, 4vw, 2em) clamp(0.5em, 2vw, 1em);
    border-radius: 25px;
}

#stats .line{
    height: clamp(60px, 14vw, 110px);
    width: auto;
}


.stats-items{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#lang-err, #discrepency-error, #percent-err{
    font-size: clamp(2rem, 7vw, 4rem);
    margin: 0;
    line-height: 1.1;
}

.err-title{
    padding: 2px 10px;
    background-color: #f0f0f0;
    color: #212121;
    border-radius: 25px;
    font-size: clamp(0.7rem, 2.2vw, 1rem);
    text-align: center;
}

#image-verdict{
    display: none;
}

.dark-background{
    display: flex;
    background-color: #212121;
    color:#f0f0f0;
}

form{
    margin-top: 0;
}

footer {
    width: 100%;
    background-color: #212121;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.4em;
    padding: 1.5em 1em;
    text-align: center;
    box-sizing: border-box;
  }
  
  footer .footerText {
    margin: 0;
    font-size: 1em;
    color: #f0f0f0;
    flex-shrink: 0;
  }

/* Responsive layout: font sizes scale fluidly via clamp(), so these
   breakpoints adjust structure (widths, spacing, dividers) and keep the
   decorative goddess background from crowding the text. */

/* Calm the goddess background before content overlaps it. Index has a wider
   content column, so it needs the swap sooner than the verdict page. */
@media (max-width: 1700px) {
    body.page-index {
        background-image: none;
    }

    body.page-index::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 0;
        pointer-events: none;
        background-image: url('/assets/images/themis-image.png');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: bottom right;
        filter: blur(5px);
        opacity: 0.3;
        transform: scale(1);
        transform-origin: bottom right;
    }

    body.page-index header,
    body.page-index main,
    body.page-index footer {
        position: relative;
        z-index: 1;
    }

    /* With the goddess calmed, the content no longer needs to dodge her on the
       left, so center the intro paragraphs and upload button on the page. */
    body.page-index #main-upload {
        width: min(90%, 800px);
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        align-items: center;
        text-align: left;
    }

    body.page-index #main-upload p {
        padding: 0.75em 0;
    }
}

@media (max-width: 1500px) {
    body.page-verdict {
        background-image: none;
    }

    body.page-verdict::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 0;
        pointer-events: none;
        background-image: url('/assets/images/themis-image.png');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: bottom right;
        filter: blur(5px);
        opacity: 0.3;
        transform: scale(1);
        transform-origin: bottom right;
    }

    body.page-verdict header,
    body.page-verdict main,
    body.page-verdict footer {
        position: relative;
        z-index: 1;
    }

    /* With the goddess calmed, also center the content vertically by making
       the (already flex-grown) main a centered flex column. */
    body.page-verdict main#info-verdict {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    /* With the goddess calmed, the content no longer needs to dodge her on the
       left. Center the stats/verdict column on the page; the back button keeps
       the SAME centered width so it left-aligns with the column's left edge
       (button stays left, the block is centered). High specificity here keeps
       this consistent across every smaller breakpoint below. */
    body.page-verdict #stats-verdict,
    body.page-verdict #back-form {
        width: clamp(280px, 90%, 600px);
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    body.page-verdict #back-form {
        margin-top: 0.5em;
        margin-bottom: clamp(1.5em, 4vw, 2.5em);
        /* Match #stats-verdict's horizontal padding so the button lines up
           under the cards' left edge rather than the column edge. */
        padding-left: clamp(0.75em, 3vw, 1em);
        justify-content: flex-start;
    }
}

/* Tablet / mid-range: keep the left-hand content column clear of the goddess
   background (anchored bottom-right) by narrowing it and pinning it left. */
@media (max-width: 1024px) {
    #main-upload {
        width: 60%;
        margin-left: clamp(1.5rem, 5vw, 6em);
    }
}

@media (max-width: 768px) {
    #logo-image {
        padding-top: 1.5em;
        padding-left: 1.5em;
    }

    /* index.html intro/context block */
    #main-upload {
        width: auto;
        margin-left: 0;
        padding: 0 1.5em;
        min-height: auto;
    }

    footer .footerText {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    /* Drop the vertical divider lines so the three stats fit side-by-side. */
    #stats .line {
        display: none;
    }

    #stats {
        gap: 0.25em;
        padding: 1em 0.5em;
    }

    /* Allow a long verdict word to wrap instead of being clipped by the
       overflow:hidden container. */
    #verdict-text {
        white-space: normal;
    }
}

/* Add your content styles below */

#verdict.verdict-loading #verdict-text {
    color: #f0f0f0;
    opacity: 0.85;
}

#verdict.verdict-error #verdict-text {
    color: #ff6b6b;
}

/* Status messages (Reading screenshot…, Analyzing…, Error) are longer than a
   one-word verdict, so let them shrink and wrap to fit inside the banner. */
#verdict.verdict-loading #verdict-text,
#verdict.verdict-error #verdict-text {
    font-size: clamp(1rem, 3.2vw, 1.5rem);
    white-space: normal;
}

/* Verdict info card: holds the verdict description + safe-contact panel in a
   dark card that matches the verdict/stats blocks above it. */
#verdict-info {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 0;
    padding: clamp(1.25em, 4vw, 1.75em);
    border-radius: 25px;
}

#verdict-description {
    margin: 0;
    line-height: 1.5;
}

.analysis-error {
    color: #ff6b67;
    font-weight: bold;
    margin: 0.75em 0 0;
}

.safe-contact-panel {
    margin-top: 1.25em;
    padding-top: 1.25em;
    border-top: 1px solid rgba(240, 240, 240, 0.2);
}

.safe-contact-panel:empty {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.safe-contact-heading {
    font-size: 1em;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 1.25em 0 0.5em;
    font-weight: bold;
    color: #ffffff;
}

.safe-contact-heading:first-child,
.safe-contact-intro:first-child {
    margin-top: 0;
}

.safe-contact-intro {
    margin: 0 0 0.5em;
    line-height: 1.45;
}

.safe-contact-context {
    margin: 0.75em 0 0.25em;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.75;
}

.safe-contact-tip {
    margin: 0.25em 0 0;
    font-size: 0.95em;
    line-height: 1.45;
    opacity: 0.9;
}

.safe-contact-official-links,
.safe-contact-official-phones,
.safe-contact-generic-list,
.safe-contact-found-list {
    margin: 0.35em 0 0;
    padding-left: 1.2em;
    line-height: 1.5;
}

.safe-contact-official-links li,
.safe-contact-official-phones li,
.safe-contact-generic-list li {
    margin-bottom: 0.5em;
}

.safe-contact-official-links a {
    color: #ffce1f;
    font-weight: bold;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.safe-contact-official-links a:hover,
.safe-contact-official-links a:focus {
    color: #ffffff;
}

.safe-contact-link-note {
    font-weight: normal;
    opacity: 0.75;
}

.safe-contact-warning-heading {
    color: #ff6b67;
}

.safe-contact-warning {
    color: #f0f0f0;
    background-color: rgba(255, 107, 103, 0.18);
    border-left: 3px solid #ff6b67;
    padding: 0.6em 0.75em;
    border-radius: 8px;
    margin-top: 0.5em;
    line-height: 1.45;
}

.safe-contact-found-label {
    margin: 0.75em 0 0.25em;
    font-weight: bold;
    font-size: 0.95em;
}

.safe-contact-found-list {
    margin-top: 0;
}

.safe-contact-found-list li {
    opacity: 0.75;
    word-break: break-all;
}

.upload-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5em;
    box-sizing: border-box;
}

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

.upload-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 33, 33, 0.55);
}

.upload-modal-dialog {
    position: relative;
    width: min(100%, 420px);
    background: #f0f0f0;
    color: #212121;
    border-radius: 20px;
    padding: 1.75em 1.5em 1.5em;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    box-sizing: border-box;
}

.upload-modal-close {
    position: absolute;
    top: 0.6em;
    right: 0.75em;
    border: none;
    background: transparent;
    color: #212121;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15em 0.35em;
}

.upload-modal-dialog h2 {
    margin: 0 2rem 0.5em 0;
    font-size: 1.35rem;
}

.upload-modal-intro {
    margin: 0 0 1.25em;
    font-size: 0.98rem;
    line-height: 1.45;
}

.upload-modal-primary,
.upload-modal-sample {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    font-family: 'Kulim Park', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    box-sizing: border-box;
}

.upload-modal-primary {
    background: #212121;
    color: #f0f0f0;
    padding: 0.85em 1em;
    font-weight: bold;
}

.upload-modal-primary:hover,
.upload-modal-sample:hover {
    filter: brightness(1.05);
}

.upload-modal-samples {
    margin-top: 1.25em;
    padding-top: 1.1em;
    border-top: 1px solid rgba(33, 33, 33, 0.15);
}

.upload-modal-samples-label {
    margin: 0 0 0.65em;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.upload-modal-samples-hint {
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
    font-size: 0.85em;
}

.upload-modal-sample-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6em;
}

.upload-modal-sample {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4em;
    margin: 0;
    padding: 0.4em;
    background: #fff;
    border: 1px solid rgba(33, 33, 33, 0.18);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.upload-modal-sample:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.upload-modal-thumb {
    width: 100%;
    height: 84px;
    object-fit: cover;
    object-position: top;
    border-radius: 8px;
    display: block;
    background: #f0f0f0;
}

.upload-modal-sample figcaption {
    font-size: 0.7rem;
    line-height: 1.25;
    color: #212121;
    word-break: break-word;
    text-align: center;
}

.upload-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5em;
    box-sizing: border-box;
}

.upload-lightbox[hidden] {
    display: none;
}

.upload-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 33, 33, 0.78);
}

.upload-lightbox-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85em;
    width: min(96vw, 1100px);
    max-height: 92vh;
    overflow-y: auto;
    background: #f0f0f0;
    color: #212121;
    border-radius: 16px;
    padding: 2.5em 1.5em 1.5em;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

.upload-lightbox-close {
    position: absolute;
    top: 0.5em;
    right: 0.75em;
    border: none;
    background: transparent;
    color: #212121;
    font-size: 1.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1em 0.3em;
}

#upload-lightbox-img {
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
}

#upload-lightbox-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: bold;
    text-align: center;
    word-break: break-word;
}

.upload-lightbox-dialog .upload-modal-primary {
    position: sticky;
    bottom: 0;
    width: auto;
    min-width: 220px;
    box-shadow: 0 -8px 16px rgba(240, 240, 240, 0.9);
}

@media (max-width: 480px) {
    .upload-modal-sample-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

#main-upload #upload-button-label img {
    width: 100%;
    max-width: 760px;
    height: auto;
}
