:root {
    --primary-red: #e30613; /* GfA-Rot */
    --bg-dark: #000000;
    --bg-light: #ffffff;
    --text-on-dark: #ffffff;
    --text-on-light: #000000;
    --input-bg: #ffffff;
    --border-gray: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%);
    color: var(--text-on-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px 0;
}

/* iPhone-Umgebung */
/* iPhone 14/15 Längenverhältnis: 390 × 844 (ca. 19,5 : 9) */
.iphone-frame {
    width: min(390px, calc(90vh * 390 / 844), calc(100vw - 32px));
    aspect-ratio: 390 / 844;
    max-height: 90vh;
    background: #1c1c1e;
    border-radius: 44px;
    padding: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 3px #2c2c2e, inset 0 0 0 2px rgba(255, 255, 255, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
}

#results-area {
    margin-top: 10px;
}

.iphone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 126px;
    height: 34px;
    background: #1c1c1e;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.iphone-screen {
    flex: 1;
    min-height: 0;
    background: #000;
    border-radius: 34px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.iphone-screen .app-container {
    padding-top: max(env(safe-area-inset-top, 0), 38px);
}

.iphone-home {
    flex-shrink: 0;
    height: 24px;
    margin: 8px auto;
    width: 140px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
}

.app-container {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Header im satten Rot */
.app-header {
    position: relative;
    padding: 30px 20px;
    background-color: var(--primary-red);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.header-logo {
    display: block;
    height: 36px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    object-position: left center;
}

.status-badge {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-on-dark);
    opacity: 0.95;
}

/* Burger-Menü */
.burger-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 36px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.burger-line {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-on-dark);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

.burger-btn-active .burger-line:nth-child(1) {
    transform: translateY(12.5px) rotate(45deg);
}

.burger-btn-active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-btn-active .burger-line:nth-child(3) {
    transform: translateY(-12.5px) rotate(-45deg);
}

.burger-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    max-width: 280px;
    background-color: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 20px 0;
    display: none;
    flex-direction: column;
    z-index: 100;
}

.burger-menu-open {
    display: flex;
}

.burger-menu a {
    color: var(--text-on-dark);
    text-decoration: none;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s, color 0.2s;
}

.burger-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-red);
}

/* Main Section */
.scan-section {
    padding: 40px 0;
    background: linear-gradient(180deg, var(--primary-red) 0%, var(--bg-dark) 100%);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scan-section .instruction-title {
    padding: 0 20px;
}

.instruction-text {
    font-weight: normal;
    color: #ffffff;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.4;
    padding: 0 20px;
}

.instruction-text strong {
    color: #ffffff;
    font-weight: normal;
}

/* Upload Area */
.upload-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-zone {
    position: relative;
    width: 96%;
    margin: 2%;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
}

.upload-zone.camera-on {
    background-image: url('Start.png');
    background-color: #b0b0b0;
}

.upload-zone.profile-placed .camera-overlay {
    opacity: 0;
    pointer-events: none;
}

.placed-profile-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.placed-profile-img.visible {
    opacity: 1;
}

.camera-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.85;
}

.upload-zone:not(.camera-on) .camera-overlay {
    opacity: 0.9;
}

.guide-coin {
    width: 80px;
    height: 80px;
    border: 2px solid var(--primary-red);
    border-radius: 50%;
    color: var(--primary-red);
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
}

.guide-seal {
    width: 120px;
    height: 120px;
    border: 2px solid var(--text-on-dark);
    font-size: 0.7rem;
    display: flex; align-items: center; justify-content: center;
}

/* Button unter der Kamerabox */
.scan-btn {
    display: inline-block;
    background-color: var(--primary-red);
    color: white;
    padding: 14px 48px;
    border: none;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 24px;
    margin-left: 20px;
    margin-right: 20px;
    transition: transform 0.1s, background-color 0.2s;
}

.scan-btn:active {
    transform: scale(0.97);
}

.scan-btn:hover {
    background-color: #c40511;
}

/* Preloader styles */
#preloader {
    width: 96%;
    margin: 2%;
    aspect-ratio: 1 / 1;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Ergebnis Panel (Weißer Hintergrund wie der "Über mich" Teil) */
.results-panel {
    background-color: var(--bg-light);
    color: var(--text-on-light);
    padding: 30px 20px;
    border-radius: 20px;
    display: none;
}

.results-panel-heading {
    margin-bottom: 20px;
    border-bottom: 3px solid var(--primary-red);
    padding-bottom: 4px;
}

.results-panel-heading h3 {
    text-transform: uppercase;
    font-weight: 900;
    margin-bottom: 4px;
    display: block;
}

.results-panel-sub {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
}

.results-placeholder {
    min-height: 170px;
    background: #e0e0e0;
    border-radius: 8px;
}

.guide-seal-large {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    text-align: center;
    padding: 12px 20px;
}

.results-placeholder.hidden {
    display: none;
}

.results-content-hidden {
    display: none !important;
}

/* Ein Profil in Originalgröße + Pfeil rechts zum Nächstwahrscheinlichen */
.results-with-arrow {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-track-container {
    overflow: hidden;
    flex: 1;
    min-width: 0;
    container-type: inline-size;
    container-name: results-slide;
}

.results-track {
    display: flex;
    gap: 15px;
    transition: transform 0.3s ease;
}

.results-track .match-card {
    box-sizing: border-box;
    overflow: hidden;
}

.next-profile-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--primary-red);
    background: white;
    color: var(--primary-red);
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}

.next-profile-btn:hover {
    background: var(--primary-red);
    color: white;
}

.next-profile-btn[style*="visibility: hidden"] {
    pointer-events: none;
}

.match-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #f4f4f4;
    padding: 14px 16px 16px;
    border-radius: 10px;
    gap: 12px;
    border: 2px solid transparent;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.match-card.match-card-correct {
    border-color: #1f9d55;
    background: #f3fbf6;
    box-shadow:
        0 0 0 3px rgba(31, 157, 85, 0.18),
        0 6px 20px rgba(31, 157, 85, 0.12);
}

.match-card.match-card-not-correct {
    border-color: #d64545;
    background: #fff8f8;
    box-shadow:
        0 0 0 3px rgba(214, 69, 69, 0.14),
        0 4px 14px rgba(214, 69, 69, 0.08);
}

.match-thumb {
    flex-shrink: 0;
    align-self: center;
    width: min(140px, 52%);
    aspect-ratio: 1;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px;
    cursor: pointer;
}

.match-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.match-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.match-info h4 {
    font-weight: 900;
    font-size: 0.8rem;
    line-height: 1.25;
    text-transform: uppercase;
    word-break: break-word;
    hyphens: auto;
}

.match-info p {
    font-size: 0.85rem;
    line-height: 1.35;
    color: #333;
}

.match-info strong {
    color: var(--primary-red);
}

.action-link-btn {
    display: inline-block;
    align-self: center;
    color: var(--primary-red);
    font-weight: bold;
    text-decoration: none;
    font-size: 0.75rem;
    line-height: 1.3;
    margin-top: 4px;
    max-width: 100%;
    text-align: center;
}

.action-link-btn:hover {
    text-decoration: underline;
}

.match-feedback {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.match-feedback-question {
    font-size: 0.75rem;
    line-height: 1.3;
    color: #333;
    font-weight: 500;
}

.match-feedback-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.feedback-btn {
    min-width: 64px;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}

.feedback-btn-yes {
    border: 2px solid var(--primary-red);
    background: var(--primary-red);
    color: white;
}

.feedback-btn-yes:hover:not(:disabled) {
    background: #c00510;
    border-color: #c00510;
}

.feedback-btn-no {
    border: 2px solid var(--primary-red);
    background: white;
    color: var(--primary-red);
}

.feedback-btn-no:hover:not(:disabled) {
    background: rgba(227, 6, 19, 0.08);
}

.feedback-btn-yes.feedback-selected {
    background: #1f9d55;
    border-color: #1f9d55;
    box-shadow: 0 0 0 3px rgba(31, 157, 85, 0.28);
}

.feedback-btn-no.feedback-selected {
    background: #d64545;
    border-color: #d64545;
    color: white;
    box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.22);
}

.match-feedback-status {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}

.match-feedback-status-correct {
    color: #1f9d55;
}

.feedback-btn:disabled:not(.feedback-selected) {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-btn:disabled.feedback-selected {
    cursor: default;
    opacity: 1;
}

/* Horizontal layout when the slide is wide enough (e.g. wider frame / desktop) */
@container results-slide (min-width: 260px) {
    .match-card {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 12px 14px;
    }

    .match-thumb {
        width: 108px;
        max-width: none;
        align-self: center;
        flex-shrink: 0;
    }

    .match-info {
        text-align: left;
        align-items: flex-start;
    }

    .match-info h4 {
        font-size: 0.85rem;
    }

    .action-link-btn {
        align-self: flex-start;
        font-size: 0.8rem;
    }

    .match-feedback {
        align-items: flex-start;
    }

    .match-feedback-actions {
        justify-content: flex-start;
    }
}

.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-preview-modal.image-preview-open {
    display: flex;
}

body.image-preview-active {
    overflow: hidden;
}

.image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.image-preview-content {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 720px);
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.image-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.image-preview-close:hover {
    background: #fff;
}

#file-input { display: none; }

/* Footer – angepasst an dichtologe.de */
.app-footer {
    background-color: var(--bg-dark);
    color: rgba(255, 255, 255, 0.9);
    padding: 40px 20px 30px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand {
    margin-bottom: 24px;
}

.footer-new-seal-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 14px 24px;
    background: var(--primary-red);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin: 20px auto 24px;
}

.footer-new-seal-btn:hover {
    background: #c40511;
}

.footer-new-seal-btn:active {
    transform: scale(0.98);
}

.footer-tagline {
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--text-on-dark);
    margin-bottom: 10px;
}

.footer-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.85;
}

.footer-contact {
    margin-bottom: 24px;
}

.footer-contact h4 {
    font-size: 0.85rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: var(--text-on-dark);
}

.footer-contact p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 4px;
}

.footer-contact a {
    color: var(--primary-red);
    text-decoration: none;
}

.footer-contact a:hover {
    text-decoration: underline;
}

.footer-links,
.footer-services {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.footer-links a,
.footer-services a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover,
.footer-services a:hover {
    color: var(--primary-red);
}

.footer-cta {
    margin-bottom: 24px;
}

.footer-cta-btn {
    display: inline-block;
    background-color: var(--primary-red);
    color: white !important;
    padding: 14px 28px;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.9rem;
    transition: transform 0.1s, background-color 0.2s;
}

.footer-cta-btn:hover {
    background-color: #c40511;
    transform: scale(1.02);
}

.footer-social {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.footer-social a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-social a:hover {
    color: var(--primary-red);
}

.footer-bottom {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    font-size: 0.8rem;
    opacity: 0.7;
}
