/* ========================================
   Livedemo (js/livedemo.js)
   ======================================== */

.ld-start {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + var(--spacing-sm));
    left: max(var(--spacing-md), calc((100vw - 1200px) / 2 + var(--spacing-md)));
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%; /* rund wie der Farbschema-Knopf rechts */
    background: linear-gradient(135deg, #059669 0%, #047857 100%); /* Smaragdgrün */
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(10px);
    z-index: 990; /* unter dem Zitat-Fenster (1000) */
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.ld-start:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.ld-start:focus-visible, .ld-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.ld-shield {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: transparent;
    cursor: progress;
}

.ld-ghost {
    position: fixed;
    top: 0;
    left: 0;
    width: 34px;
    height: 34px;
    z-index: 9100;
    pointer-events: none;
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.45, 0, 0.2, 1);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.ld-ring {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 22px;
    height: 22px;
    border: 3px solid #10b981;
    border-radius: 50%;
    opacity: 0;
}

.ld-ghost.ld-tap .ld-ring { animation: ld-tap 0.5s ease-out; }

@keyframes ld-tap {
    0% { transform: scale(0.4); opacity: 0.9; }
    100% { transform: scale(2.2); opacity: 0; }
}

.ld-caption {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 68px);
    transform: translateX(-50%);
    width: min(640px, calc(100% - 2 * var(--spacing-md)));
    min-height: 70px;
    display: flex;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-md) 72px;
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    font-size: var(--font-size-base);
    line-height: 1.5;
    text-align: left;
    z-index: 9200;
    pointer-events: none;
}

/* App-Icon links in jedem Demo-Text (wie der Fuchskopf bei TourFuchs) */
.ld-caption::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    border-radius: 12px;
    background: url('../assets/icons/icon-192.png') center / cover no-repeat;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.15);
}

/* Neuer Text: Icon nickt kurz, damit der Blick zum Text geht */
.ld-caption.ld-new::before {
    animation: ld-icon-wiggle 1.5s ease-in-out;
}

/* Deutlich sichtbares Wackeln (ca. 1,5 s, mehrere Ausschläge, kurzes Leuchten) */
@keyframes ld-icon-wiggle {
    0%   { transform: translateY(-50%) scale(0.6) rotate(-14deg); }
    12%  { transform: translateY(-50%) scale(1.2) rotate(12deg);
           box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.75), 0 0 18px 6px rgba(16, 185, 129, 0.55); }
    26%  { transform: translateY(-50%) scale(1.08) rotate(-11deg); }
    40%  { transform: translateY(-50%) scale(1.15) rotate(9deg);
           box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.6), 0 0 16px 5px rgba(16, 185, 129, 0.45); }
    54%  { transform: translateY(-50%) scale(1.05) rotate(-7deg); }
    68%  { transform: translateY(-50%) scale(1.1) rotate(5deg); }
    82%  { transform: translateY(-50%) scale(1.03) rotate(-3deg); }
    100% { transform: translateY(-50%) scale(1) rotate(0deg);
           box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.15); }
}

.ld-caption.ld-top {
    bottom: auto;
    top: calc(env(safe-area-inset-top, 0px) + var(--spacing-md));
}

.ld-bar {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--spacing-sm));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(15, 23, 42, 0.94);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    z-index: 9300;
}

.ld-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 10px;
    border: 0;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.ld-btn:hover { background: rgba(255, 255, 255, 0.24); }
.ld-tempo { font-size: 0.85rem; font-weight: 700; min-width: 54px; }

.ld-progress {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 9300;
}

.ld-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: #10b981;
    transition: width 0.6s ease;
}

body.ld-active .install-prompt { display: none; }

/* Werbefilm-Modus: nur App und Zeiger */
body.ld-clean .ld-bar,
body.ld-clean .ld-progress,
body.ld-clean .ld-caption {
    display: none !important;
}

/* Ein ruhiges Bild: während der Demo kein Scrollen, alles auf einem Bildschirm */
html.ld-lock,
html.ld-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}

body.ld-active .app-footer {
    display: none;
}

body.ld-active .calendar-wrapper {
    height: var(--ld-cal-height, 60vh) !important;
    min-height: 0 !important;
    max-height: none !important;
}

/* Nachfrage beim Tippen auf den Bildschirm */
.ld-ask {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, calc(100% - 2 * var(--spacing-md)));
    padding: var(--spacing-lg);
    background: rgba(15, 23, 42, 0.97);
    color: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    text-align: center;
    z-index: 9400;
}

.ld-ask::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto var(--spacing-sm);
    border-radius: 12px;
    background: url('../assets/icons/icon-192.png') center / cover no-repeat;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.ld-ask-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.ld-ask-text {
    font-size: var(--font-size-sm);
    opacity: 0.8;
    margin-bottom: var(--spacing-md);
}

.ld-ask-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.ld-ask-buttons button {
    flex: 1 1 0;
    min-height: 44px;
    padding: 0 var(--spacing-sm);
    white-space: nowrap;
    font-size: var(--font-size-sm);
    border: 0;
    border-radius: 22px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.ld-ask-continue {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #fff;
}

.ld-ask-stop {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.ld-ask-buttons button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
body.ld-active .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }

/* Auswahl der Vorführungen */
.ld-menu {
    width: min(420px, calc(100% - 2 * var(--spacing-md)));
    margin: auto;
    padding: var(--spacing-xl);
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-xl);
}

.ld-menu::backdrop {
    background: rgba(10, 25, 41, 0.6);
    backdrop-filter: blur(3px);
}

.ld-menu-title {
    color: var(--primary);
    font-size: var(--font-size-xl);
    margin: 0 48px var(--spacing-xs) 0;
}

.ld-menu-intro {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.ld-menu-list {
    display: grid;
    gap: var(--spacing-sm);
}

.ld-menu-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-base), transform var(--transition-base);
}

.ld-menu-item:first-child {
    border-color: #10b981;
}

.ld-menu-item:hover,
.ld-menu-item:focus-visible {
    border-color: var(--primary);
    outline: none;
    transform: translateY(-1px);
}

.ld-menu-label {
    font-weight: 700;
}

.ld-menu-meta {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.ld-menu-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

/* Kopfzeile nicht unter den runden Knöpfen links (Livedemo) und rechts (Farbschema) */
@media (max-width: 1240px) {
    .app-header:not(.hidden) { padding-left: 72px; padding-right: 72px; }
}

@media (max-width: 480px) {
    .app-header:not(.hidden) { padding-left: 72px; padding-right: 72px; }
    .ld-caption { font-size: var(--font-size-sm); padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 56px; min-height: 56px; }
    .ld-caption::before { left: 10px; width: 36px; height: 36px; border-radius: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .ld-ghost.ld-tap .ld-ring { animation: none; opacity: 0; }
    .ld-caption.ld-new::before { animation: none; }
}

@media print {
    .ld-start, .ld-shield, .ld-ghost, .ld-caption, .ld-bar, .ld-progress { display: none !important; }
}
