/* Kerstins Mallorca-Quiz — gemeinsames Stylesheet für Web und MAUI-App. */

:root {
    --sky: #7ec4ec;
    --sea: #12758f;
    --sea-deep: #0b5468;
    --sand: #f6e3b4;
    --sand-deep: #e4c98d;
    --sun: #ffce4f;
    --ink: #1e2a33;
    --ink-soft: #4a5b68;
    --card: rgba(255, 255, 255, 0.92);
    --correct: #4caf50;
    --wrong: #e53935;
    --shadow: 0 10px 30px rgba(11, 84, 104, 0.18);
    color-scheme: light only;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, var(--sky) 0%, #46a3c9 38%, var(--sea) 62%, var(--sand) 100%) fixed;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

/* ---------- Grundgerüst ---------- */

.q-app {
    width: 100%;
    max-width: 34rem;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 1.25rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.q-header {
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 8px rgba(9, 60, 76, 0.45);
}

.q-header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 6vw, 2.1rem);
    letter-spacing: 0.01em;
}

.q-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ---------- Fortschritt: fünf Geschenk-Kacheln ---------- */

.q-progress {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.q-tile {
    aspect-ratio: 1;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.22);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.75);
    font-size: clamp(1.1rem, 5vw, 1.6rem);
    transition: transform 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.q-tile.is-unlocked {
    background: linear-gradient(160deg, var(--sun), #f4a63a);
    border-color: #fff;
    color: #5a3d05;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.q-tile-number {
    font-weight: 800;
    font-size: clamp(1.3rem, 6vw, 1.9rem);
}

/* ---------- Fragekarte ---------- */

.q-card {
    background: var(--card);
    border-radius: 1.25rem;
    padding: 1.1rem;
    box-shadow: var(--shadow);
}

.q-counter {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.q-question {
    margin: 0 0 1rem;
    font-size: clamp(1.05rem, 4.4vw, 1.3rem);
    line-height: 1.35;
}

.q-answers {
    display: grid;
    gap: 0.6rem;
}

.q-answer {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.7rem 0.9rem;
    text-align: left;
    font: inherit;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--ink);
    background: #fff;
    border: 2px solid #d8e3ea;
    border-radius: 0.9rem;
    cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease;
}

.q-answer:hover:not(:disabled) {
    border-color: var(--sea);
}

.q-answer:active:not(:disabled) {
    transform: scale(0.99);
}

.q-answer:disabled {
    cursor: default;
}

.q-answer-letter {
    flex: none;
    width: 1.9rem;
    height: 1.9rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef4f8;
    color: var(--sea-deep);
    font-weight: 700;
    font-size: 0.9rem;
}

.q-answer.is-correct {
    background: var(--correct);
    border-color: var(--correct);
    color: #fff;
}

.q-answer.is-wrong {
    background: var(--wrong);
    border-color: var(--wrong);
    color: #fff;
    animation: q-shake 320ms ease;
}

.q-answer.is-correct .q-answer-letter,
.q-answer.is-wrong .q-answer-letter {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
}

@keyframes q-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- Reveal-Overlay ---------- */

.q-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(8, 52, 68, 0.72);
    backdrop-filter: blur(6px);
    cursor: pointer;
    animation: q-fade 240ms ease;
}

.q-overlay-card {
    width: 100%;
    max-width: 26rem;
    padding: 1.5rem 1.25rem;
    text-align: center;
    background: var(--card);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    animation: q-pop 320ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

.q-overlay-title {
    margin: 0 0 0.75rem;
    font-size: clamp(1.15rem, 5vw, 1.5rem);
    font-weight: 700;
}

.q-reveal-number {
    font-size: clamp(6rem, 34vw, 11rem);
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(160deg, #f4a63a, var(--sun));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.q-overlay-hint {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

@keyframes q-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes q-pop {
    from { opacity: 0; transform: scale(0.86) translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Bild für Geschenk 4 ---------- */

.q-gift-image-wrap {
    display: block;
    line-height: 0;
}

.q-gift-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
}

.q-tile .q-gift-image-wrap,
.q-tile .q-gift-image {
    width: 100%;
    height: 100%;
}

.q-tile .q-gift-image {
    border-radius: 0;
    object-fit: cover;
    /* Hochformat auf ein Quadrat beschnitten: etwas nach oben rücken,
       damit in der Mini-Kachel der Taubenkopf zu sehen ist. */
    object-position: 50% 34%;
}

/* Das Bild ist hochformatig: im Overlay begrenzen, damit die Karte auf
   kleinen Displays komplett sichtbar bleibt. */
.q-overlay-card .q-gift-image {
    max-height: 58dvh;
    width: auto;
    margin: 0 auto;
}

/* ---------- Begrüßung ---------- */

.q-intro {
    background: var(--card);
    border-radius: 1.25rem;
    padding: 1.4rem 1.2rem;
    box-shadow: var(--shadow);
    animation: q-pop 380ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

.q-intro h2 {
    margin: 0 0 0.8rem;
    font-size: clamp(1.25rem, 5.5vw, 1.6rem);
    text-align: center;
}

.q-intro p {
    margin: 0 0 0.9rem;
    line-height: 1.5;
    color: var(--ink-soft);
}

.q-start {
    display: block;
    width: 100%;
    min-height: 3.5rem;
    margin-top: 1.2rem;
    padding: 0.8rem 1rem;
    font: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    color: #5a3d05;
    background: linear-gradient(160deg, var(--sun), #f4a63a);
    border: none;
    border-radius: 0.9rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 120ms ease;
}

.q-start:active {
    transform: scale(0.99);
}

/* ---------- Abschluss ---------- */

.q-final {
    background: var(--card);
    border-radius: 1.25rem;
    padding: 1.4rem 1.1rem;
    text-align: center;
    box-shadow: var(--shadow);
    animation: q-pop 400ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

.q-final h2 {
    margin: 0 0 0.4rem;
    font-size: clamp(1.3rem, 5.5vw, 1.7rem);
}

.q-final p {
    margin: 0 0 1rem;
    color: var(--ink-soft);
    line-height: 1.45;
}

.q-restart {
    background: none;
    border: none;
    padding: 0.5rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--ink-soft);
    text-decoration: underline;
    cursor: pointer;
}

/* Konfetti — rein dekorativ, deshalb aria-hidden im Markup. */

.q-confetti {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
}

.q-confetti span {
    position: absolute;
    top: -8vh;
    font-size: 1.4rem;
    animation: q-fall linear infinite;
}

@keyframes q-fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(540deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
    .q-confetti { display: none; }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Blazor-Fehlerleiste ---------- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #333;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
