:root { 
    --primary-color: #8b4513; 
    --header-bg: #4a2c17; 
    --list-bg: #f5ede4; 
    --highlight-orange: #ff5722; 
    --cat-essen: #DEB223; --cat-kunst: #BA1955;
    --highlight-yellow: #f1c40f; --highlight-green: #2ecc71;
    --dark-blue: #1e293b;
    --svg-secret-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 150'%3E%3Cdefs%3E%3CradialGradient id='grad' cx='60%25' cy='30%25' r='50%25'%3E%3Cstop offset='0%25' stop-color='%23aaaaaa'/%3E%3Cstop offset='30%25' stop-color='%23222222'/%3E%3Cstop offset='100%25' stop-color='%23000000'/%3E%3C/radialGradient%3E%3C/defs%3E%3Cellipse cx='30' cy='145' rx='15' ry='4' fill='rgba(0,0,0,0.3)'/%3E%3Cpolygon points='30,145 55,60 65,63' fill='%23dddddd' stroke='%23999999' stroke-width='1'/%3E%3Ccircle cx='65' cy='50' r='35' fill='url(%23grad)'/%3E%3C/svg%3E");
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Verhindert Font-Boosting auf Android */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

* { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; box-sizing: border-box; }
input { -webkit-user-select: auto !important; user-select: auto !important; }

html, body { margin: 0; padding: 0; width: 100%; height: 100%; height: 100dvh; overflow: hidden; background-color: #4a2c17; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; display: flex; flex-direction: column; }

/* Navigations-Schutz vor Adressleisten */
.top-nav { z-index: 25000; flex-shrink: 0; background: var(--header-bg); box-shadow: 0 4px 15px rgba(0,0,0,0.25); position: relative; touch-action: none; padding-top: var(--safe-top) !important; }

.header { background: var(--header-bg); position: relative; z-index: 20; color: white; display: flex; align-items: center; justify-content: center; padding-top: 12px; padding-bottom: 5px; }
.header h1 { font-family: 'Roboto Condensed', sans-serif; font-size: 16px; margin: 0; text-transform: uppercase; letter-spacing: 1.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.title-thin { font-weight: 300; } 

#calib-banner { position: absolute; top: 0; left: 0; right: 0; background: rgba(155, 89, 182, 0.95); color: white; text-align: center; padding-top: calc(var(--safe-top) + 4px); padding-bottom: 6px; font-weight: bold; font-size: 13px; line-height: 1.3; z-index: 30000; display: none; box-shadow: 0 4px 10px rgba(0,0,0,0.3); backdrop-filter: blur(4px); transition: background 0.3s; }

.toolbar-fixed { display: flex; padding: 5px 12px 15px 12px; gap: 8px; background: var(--header-bg); position: relative; z-index: 20; align-items: center; justify-content: center; border-bottom: none; }

.search-wrapper-m { flex: 1; display: flex; align-items: center; background: rgba(255,255,255,0.15); border-radius: 30px; padding: 4px 4px 4px 14px; border: 1px solid rgba(255,255,255,0.3); transition: all 0.3s ease; }
.search-wrapper-m:focus-within { background: white; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(139, 69, 19, 0.3); }

.search-box { flex: 1; width: 100%; min-width: 40px; height: 32px; padding: 0; border: none; font-size: 15px; outline: none; background: transparent; color: white; -webkit-appearance: none; transition: color 0.3s ease; touch-action: auto; }
.search-wrapper-m:focus-within .search-box { color: #333; }
.search-box::placeholder { color: rgba(255,255,255,0.8); }
.search-wrapper-m:focus-within .search-box::placeholder { color: #a0aec0; }

.btn-m { width: 40px; height: 40px; border: none; border-radius: 50%; font-weight: bold; display: flex; align-items: center; justify-content: center; cursor: pointer; color: white; flex-shrink: 0; padding: 0; line-height: normal; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: transform 0.2s, background 0.3s; }
.btn-m:active { transform: scale(0.92); }

.btn-clear-m { width: 32px; height: 32px; background: rgba(255,255,255,0.2); color: white; font-size: 16px; box-shadow: none; margin-left: 5px; transition: 0.2s; }
.search-wrapper-m:focus-within .btn-clear-m { background: #fee2e2; color: #ef4444; }
.btn-clear-m:active { background: #ef4444 !important; color: white !important; transform: scale(1.1); }
.btn-list-m { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); font-size: 18px; }

@keyframes gpsBtnPulse {
    0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 0 0 0 rgba(59, 130, 246, 0.8); transform: scale(1); }
    50% { transform: scale(1.08); }
    70% { box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 0 0 12px rgba(59, 130, 246, 0); }
}
#btn-gps { animation: gpsBtnPulse 2s infinite ease-in-out; }

.btn-safety-m { background: #3b82f6; font-size: 27px; border: 1px solid rgba(255,255,255,0.3); } 
.btn-safety-m.active { background: #ef4444; }
.btn-safety-m.waiting { background: var(--highlight-yellow); color: var(--header-bg); }

@keyframes editBlinkRed { 0%, 100% { background: #ef4444; box-shadow: 0 0 15px rgba(239,68,68,0.8); } 50% { background: #7f1d1d; box-shadow: none; } }
.btn-edit-blinking { animation: editBlinkRed 1.2s infinite ease-in-out !important; }

.master-switch-m { width: 36px; height: 18px; background: rgba(255,255,255,0.4); border-radius: 20px; cursor: pointer; transition: 0.3s; position: relative; flex-shrink: 0; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.master-switch-m::before { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; top: 2px; left: 2px; background: white; transition: 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.master-switch-m.active { background: #2ecc71; }
.master-switch-m.active::before { left: 20px; }

.safety-dropdown { 
    position: absolute; 
    top: 100%; 
    left: 0; 
    right: 0; 
    background: rgba(255,255,255,0.15); 
    display: flex; 
    padding: 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.2); 
    border-bottom-left-radius: 20px; 
    border-bottom-right-radius: 20px; 
    z-index: 1; 
    border-top: 1px solid rgba(255,255,255,0.2); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.35s, visibility 0.35s;
}
.safety-dropdown.open { 
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.safety-options-row { display: flex; justify-content: center; gap: 6px; width: 100%; align-items: center; flex-wrap: wrap; }

.safety-opt-btn { flex: 1; min-width: 34px; max-width: 48px; height: 38px; border-radius: 10px; border: none; display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 3px 8px rgba(0,0,0,0.3); position: relative; padding: 0; transition: transform 0.2s; line-height: normal; }
.safety-opt-btn:active { transform: scale(0.94); }
.safety-opt-btn .status-dot { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid white; display: none; background: #2ecc71; }
.safety-opt-btn.active .status-dot { display: block; }

.admin-capture-group { display: flex; gap: 6px; }
body.admin-mode .admin-capture-group { padding: 4px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 14px; background: rgba(255, 255, 255, 0.05); box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.advanced-tool { display: none !important; }
body.admin-unlocked .advanced-tool { display: flex !important; }
.admin-only-tool { display: none !important; }
body.admin-mode .admin-only-tool { display: flex !important; }

/* Planung-Mode overrides */
body.planung-mode #fab-editmode, body.planung-mode #fab-pins, body.planung-mode #fab-uxlabel, body.planung-mode #fab-calib { display: none !important; }
body.planung-mode .secret-pin, body.planung-mode .calib-pin { pointer-events: none !important; display: none !important; }

.icon-secret-pin { width: 16px; height: 22px; background-image: var(--svg-secret-pin); background-size: contain; background-repeat: no-repeat; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3)); }

.map-area { flex: 1; position: relative; overflow: hidden; background: var(--header-bg); display: flex; justify-content: center; align-items: center; touch-action: none; transition: box-shadow 0.3s ease-out; }

/* Visuelle Effekte für iOS Workaround (Bounce & Reset) */
@keyframes edgeBounceFlash { 0% { box-shadow: inset 0 0 0 0px rgba(255,255,255,0); } 50% { box-shadow: inset 0 0 20px 4px rgba(255,255,255,0.4); } 100% { box-shadow: inset 0 0 0 0px rgba(255,255,255,0); } }
.bounce-flash { animation: edgeBounceFlash 0.4s ease-out; }

@keyframes resetFlash { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.3); filter: brightness(1.5); } }
.reset-flash { animation: resetFlash 0.4s ease-out; }

#container { position: absolute; top: 0; left: 0; background: transparent; display: inline-block; line-height: 0; transform-origin: 0 0; will-change: transform; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; }
#plan-img { display: block; height: 80vh; width: auto; pointer-events: none; position: relative; z-index: 1; }
.smooth-transform { transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) !important; }

/* Custom Box (z.B. Fläche für die Bühne) */
.custom-box { position: absolute; border: none; z-index: 5000; transform-origin: center center; border-radius: 4px; pointer-events: none; display: flex; align-items: center; justify-content: center; }
body.admin-mode .custom-box { pointer-events: auto; cursor: pointer; }

.is-dragging { z-index: 99999 !important; filter: drop-shadow(0 8px 16px rgba(59, 130, 246, 0.8)) !important; opacity: 0.85; }

.marker { position: absolute; width: calc(var(--base-size, 80px) * var(--s, 1)); height: calc(var(--base-size, 80px) * var(--s, 1)); border-radius: 50%; font-size: calc(40px * var(--s, 1)); font-weight: bold; display: flex; justify-content: center; align-items: center; color: white; background: var(--primary-color); border: 4px solid white; z-index: 6000; transition: opacity 0.3s; transform: translate(-50%, -50%) scale(0.25); transform-origin: center center; }
.marker[data-cat="E"] { background-color: var(--cat-essen) !important; color: black !important; }
.marker[data-cat="K"] { background-color: var(--cat-kunst) !important; color: white !important; }
.marker.unassigned { display: none; }
.hide-markers .marker { opacity: 0; pointer-events: none; }

@keyframes markerPulse { 0%, 100% { transform: translate(-50%, -50%) scale(0.25); background: var(--highlight-orange); } 70% { transform: translate(-50%, -50%) scale(0.45); background: #f39c12; } }
.blink { animation: markerPulse 0.8s infinite !important; background: var(--highlight-orange) !important; color: white !important; z-index: 9999 !important; }

.safety-wrapper { position: absolute; z-index: 7000; transform-origin: center center; display: none; justify-content: center; align-items: center; border-radius: 50%; border: 2px solid white; box-shadow: 0 4px 8px rgba(0,0,0,0.5); cursor: pointer; width: 40px; height: 40px; transform: rotate(var(--r, 0deg)) scale(var(--s, 1)); }
.safety-wrapper.type-exit { border-radius: 2px; width: 60px; height: 30px; }
.safety-wrapper[class*="type-wc"] { background-color: #1ea8e6; border: none !important; border-radius: 6px; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
.safety-wrapper.is-visible { display: flex; }
.safety-wrapper.active-blink { animation: wrapperThrobFixed 1.2s infinite ease-in-out; }

.safety-wrapper[class*="type-leg_"] { --flair-color: 255, 255, 255; background: transparent !important; border: none !important; border-radius: 8px !important; box-shadow: none !important; transition: transform 0.2s ease !important; }
.safety-wrapper.type-leg_essen { --flair-color: 222, 178, 35; }
.safety-wrapper.type-leg_kunst { --flair-color: 186, 25, 85; }
.safety-wrapper.type-leg_wc { --flair-color: 30, 168, 230; }
.safety-wrapper.type-leg_info { --flair-color: 30, 46, 108; }
.safety-wrapper[class*="type-leg_"]::after { content: ''; position: absolute; top: -5px; left: -5px; right: -5px; bottom: -5px; border-radius: 12px; background: rgba(var(--flair-color), 0.7); z-index: -1; pointer-events: none; filter: blur(8px); animation: legFlairPulse 2.5s infinite ease-in-out; }
.safety-wrapper[class*="type-leg_"]:active { transform: rotate(var(--r, 0deg)) scale(0.95) !important; }
.safety-wrapper[class*="type-leg_"]:active::after { animation: none !important; opacity: 1 !important; transform: scale(0.9); }
.safety-wrapper[class*="type-leg_"].active-hitbox::after { animation: none !important; background: rgba(var(--flair-color), 0.9); transform: scale(1.1); }

@keyframes legFlairPulse { 0%, 100% { transform: scale(0.85); opacity: 0.3; } 50% { transform: scale(1.15); opacity: 0.9; } }
@keyframes wrapperThrobFixed { 0%, 100% { transform: rotate(var(--r, 0deg)) scale(var(--s, 1)); } 50% { transform: rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 1.15)); } }

.safety-wrapper.type-speaker { background-color: var(--primary-color); }
.safety-wrapper.type-light { background-color: #ffffff; border-color: black; }
.safety-wrapper.type-notstrom { background-color: #dc2626; border-color: white; }
.safety-wrapper.type-exit { background-color: #27ae60; }
.safety-wrapper.type-trinkwasser { background-color: #3b82f6; border-color: white; }
.safety-wrapper.type-abwasser { background-color: #7f8c8d; border-color: white; }
.safety-wrapper.type-stromkasten { background-color: #ffffff; border-color: #f1c40f; border-width: 2px; }
.safety-wrapper.type-firstaid { background-color: #dc2626; border-color: white; border-width: 2px; }

.safety-img { width: 100%; height: 100%; background-size: cover; background-repeat: no-repeat; background-position: center; border-radius: 50%; position: relative; z-index: 20; pointer-events: none; }
.safety-wrapper.type-light .safety-img, .safety-wrapper.type-notstrom .safety-img { mix-blend-mode: multiply; background-size: 85%; }
.safety-wrapper.type-exit .safety-img { border-radius: 2px; }
.safety-wrapper.type-trinkwasser .safety-img, .safety-wrapper.type-abwasser .safety-img { background-size: cover; border-radius: 50%; }
.safety-wrapper.type-stromkasten .safety-img { background-size: 75%; background-position: center; border-radius: 0; }

.safety-pulse-ring { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; z-index: 1; transform-origin: center center; pointer-events: none; display: none; }
.safety-wrapper.type-speaker .safety-pulse-ring, .safety-wrapper.type-light .safety-pulse-ring { background-color: var(--highlight-orange); }
.safety-wrapper.type-notstrom .safety-pulse-ring { background-color: #dc2626; }
.safety-wrapper.type-exit .safety-pulse-ring { background-color: #2ecc71; border-radius: 2px; z-index: 10; clip-path: polygon(0% 0%, 20% 0%, 50% 50%, 20% 100%, 0% 100%, 30% 50%); }
.safety-wrapper.type-speaker .safety-pulse-ring { clip-path: polygon(50% 50%, 150% -50%, 150% 150%); }
.safety-wrapper.type-light .safety-pulse-ring { clip-path: polygon(50% 50%, -1000% -100%, -1000% 200%); }
.safety-wrapper.type-trinkwasser .safety-pulse-ring { background-color: #3b82f6; }
.safety-wrapper.type-abwasser .safety-pulse-ring { background-color: #7f8c8d; }
.safety-wrapper.type-stromkasten .safety-pulse-ring { background-color: #f1c40f; }
.safety-wrapper.type-firstaid .safety-pulse-ring { background-color: #dc2626; }
.safety-wrapper[class*="type-wc"] .safety-pulse-ring { background-color: #1ea8e6; border-radius: 6px; z-index: 10; }

.safety-wrapper.active-blink:not(.type-exit):not(.type-light) .safety-pulse-ring { display: block; animation: safetyPulseFixed 1.2s infinite ease-out; }
.safety-wrapper.type-light.active-blink .safety-pulse-ring { display: block; animation: lightBeamPulseFixed 1.2s infinite ease-out; }
.safety-wrapper.type-exit.active-blink .safety-pulse-ring { display: block; animation: exitMoveForward 1.2s infinite linear; }

@keyframes safetyPulseFixed { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes lightBeamPulseFixed { 0% { transform: scale(1); opacity: 0.9; } 100% { transform: scale(6.0); opacity: 0; } }
@keyframes exitMoveForward { 0% { transform: translateX(-120%); opacity: 0; } 50% { opacity: 0.9; } 100% { transform: translateX(150%); opacity: 0; } }

.mic-wrapper, .bus-wrapper { position: absolute; z-index: 7500; transform-origin: center center; display: flex; justify-content: center; align-items: center; border-radius: 50%; box-shadow: 0 4px 8px rgba(0,0,0,0.4); background: white; cursor: pointer; transform: rotate(var(--r, 0deg)) scale(var(--s, 1)); }
.mic-wrapper { width: 45px; height: 45px; animation: itemThrob 2.5s infinite ease-in-out; }
.bus-wrapper { width: 32px; height: 32px; animation: itemThrob 2.5s infinite ease-in-out; }

.mic-wrapper::after, .bus-wrapper::after { content: ''; position: absolute; top: -20%; left: -20%; right: -20%; bottom: -20%; border-radius: 50%; background: rgba(255, 255, 255, 0.5); z-index: -1; animation: flairPulse 2.5s infinite ease-in-out; pointer-events: none; filter: blur(4px); }
.bus-wrapper.type-bus1::after { background: rgba(39, 174, 96, 0.5); }
.bus-wrapper.type-bus2::after { background: rgba(241, 196, 15, 0.5); }
@keyframes flairPulse { 0%, 100% { transform: scale(0.7); opacity: 0.1; } 50% { transform: scale(1.3); opacity: 1; } }

.mic-wrapper:active, .bus-wrapper:active { animation: none; transform: rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 0.9)) !important; }
.mic-wrapper:active::after, .bus-wrapper:active::after { animation: none; opacity: 0; }
.mic-img, .bus-img { width: 100%; height: 100%; background-size: contain; background-repeat: no-repeat; background-position: center; border-radius: 50%; pointer-events: none; position: relative; z-index: 2; }
.bus-wrapper.type-bus1 { border: 2px solid #27ae60; }
.bus-wrapper.type-bus2 { border: none !important; background: transparent !important; box-shadow: none !important; }

.info-wrapper { position: absolute; z-index: 7600; transform-origin: center center; display: flex; justify-content: center; align-items: center; border-radius: 50%; box-shadow: 0 4px 8px rgba(0,0,0,0.4); width: 38px; height: 38px; background: rgb(30, 46, 108); color: white; font-weight: bold; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 20px; line-height: 1; border: 2px solid white; cursor: pointer; transform: rotate(var(--r, 0deg)) scale(var(--s, 1)); animation: infoBlinkFixed 2s infinite ease-in-out; }
@keyframes infoBlinkFixed { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(30,46,108,0.7); transform: rotate(var(--r, 0deg)) scale(var(--s, 1)); } 50% { opacity: 0.85; box-shadow: 0 0 0 10px rgba(30,46,108,0); transform: rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 1.05)); } }
.info-wrapper:active { animation: none; transform: rotate(var(--r, 0deg)) scale(calc(var(--s, 1) * 0.9)) !important; }

.secret-pin { position: absolute; width: calc(20px * var(--s, 1)); height: calc(30px * var(--s, 1)); background-image: var(--svg-secret-pin); background-size: contain; background-repeat: no-repeat; z-index: 6800; transform: translate(-30%, -96%); transform-origin: 30% 96%; cursor: pointer; display: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
body.admin-mode .secret-pin { display: block; }
.secret-pin::after { content: ''; position: absolute; top: -15px; left: -15px; right: -15px; bottom: -15px; background: transparent; }

.calib-pin { position: absolute; width: calc(14px * var(--s, 1)); height: calc(14px * var(--s, 1)); background: rgba(155, 89, 182, 0.8); border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); z-index: 6900; box-shadow: 0 2px 6px rgba(0,0,0,0.4); display: none; cursor: pointer; }
body.admin-mode .calib-pin { display: block; }
.calib-pin::after { content: ''; position: absolute; top: -20px; left: -20px; right: -20px; bottom: -20px; background: transparent; border-radius: 50%; }

.user-location-dot { position: absolute; width: 12px; height: 12px; background-color: #3b82f6; border: 2px solid white; border-radius: 50%; transform: translate(-50%, -50%); z-index: 8000; box-shadow: 0 2px 6px rgba(0,0,0,0.3); pointer-events: none; }
body.admin-mode .user-location-dot { pointer-events: auto; cursor: crosshair; }
.user-location-dot::after { content: ''; position: absolute; top: -10px; left: -10px; right: -10px; bottom: -10px; background: rgba(59, 130, 246, 0.4); border-radius: 50%; z-index: -1; animation: gpsPulse 2s infinite ease-out; }
@keyframes gpsPulse { 0% { transform: scale(0.3); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

.ux-label-wrapper { position: absolute; z-index: 8500; width: 0; height: 0; display: flex; align-items: center; justify-content: flex-end; pointer-events: none; }
body.admin-mode .ux-label-wrapper { pointer-events: auto; cursor: grab; }
.ux-label-scaler { display: flex; align-items: center; justify-content: flex-end; }
.ux-label { background: #1e293b; color: white; font-size: 15px; font-weight: bold; padding: 16px 10px; border-radius: 8px; box-shadow: 0 6px 12px rgba(0,0,0,0.4); position: relative; animation: floatRight 1.5s infinite ease-in-out; display: flex; align-items: center; justify-content: center; }
.ux-label::after { content: ''; position: absolute; right: -12px; top: 50%; transform: translateY(-50%); border-width: 10px 0 10px 12px; border-style: solid; border-color: transparent transparent transparent #1e293b; }
.ux-text { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; letter-spacing: 1.5px; }
@keyframes floatRight { 0%, 100% { transform: translateX(-16px); } 50% { transform: translateX(-26px); } }

/* Ausrichtungssperre CSS */
#portrait-lock { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--header-bg); z-index: 999999; display: none; flex-direction: column; align-items: center; justify-content: center; color: white; text-align: center; padding: 20px; }
.portrait-icon { width: 60px; height: 60px; margin-bottom: 20px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M16 1H8C6.34 1 5 2.34 5 4v16c0 1.66 1.34 3 3 3h8c1.66 0 3-1.34 3-3V4C19 2.34 17.66 1 16 1zm1 19c0 .55-.45 1-1 1H8c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h8c.55 0 1 .45 1 1v16zM7 4h10v15H7z'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; animation: rotatePhone 1.5s infinite ease-in-out; }
@keyframes rotatePhone { 0%, 100% { transform: rotate(-90deg); } 50% { transform: rotate(0deg); } }
@media screen and (orientation: landscape) { #portrait-lock { display: flex; } }

.mobile-overlay { position: fixed; top: 0; bottom: 0; left: 0; right: 0; height: 100dvh; background: var(--header-bg); padding-bottom: var(--safe-bottom); z-index: 30000; transform: translateY(100%); transition: transform 0.3s ease-out; display: flex; flex-direction: column; visibility: hidden; }
.mobile-overlay.active { transform: translateY(0); visibility: visible; }

#overlay-search { top: calc(var(--safe-top) + 75px); bottom: 0; height: auto !important; z-index: 24000; border-top: 1px solid rgba(255,255,255,0.1); }
#overlay-search .overlay-header { padding-top: 50px !important; }
#overlay-search .drag-indicator { top: 36px !important; }

.overlay-header { position: relative; padding: 20px 15px; background: var(--header-bg); color: white; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--primary-color); padding-top: calc(var(--safe-top) + 20px); touch-action: none; }
.drag-indicator { position: absolute; top: calc(var(--safe-top) + 8px); left: 50%; transform: translateX(-50%); width: 40px; height: 5px; background: rgba(255, 255, 255, 0.4); border-radius: 4px; pointer-events: none; }

.scroll-area { flex: 1; overflow-y: auto; padding: 15px 15px calc(var(--safe-bottom) + 80px) 15px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--list-bg); }

.sort-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 6px; padding: 6px 12px; font-size: 13px; font-weight: bold; cursor: pointer; transition: 0.2s; color: white; display: flex; align-items: center; gap: 4px; margin-left: 0px; }
.sort-btn:active { background: rgba(255,255,255,0.25); transform: scale(0.95); }

@media all and (display-mode: standalone) { .btn-install { display: none !important; } }

.list-item { padding: 14px 12px; border-bottom: 1px solid rgba(139, 69, 19, 0.15); display: flex; align-items: center; cursor: pointer; transition: background-color 0.15s; }
.list-item:active { background-color: rgba(139, 69, 19, 0.08); }
.list-item.empty-msg { cursor: default; }
.list-item.empty-msg:active { background-color: transparent; }
.list-item:not(.empty-msg)::after { content: ''; width: 7px; height: 12px; margin-left: auto; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1 L7 7 L1 13' fill='none' stroke='%238b4513' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='0.5'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; flex-shrink: 0; }
.list-nr { width: 30px; height: 30px; border-radius: 50%; background: #999; color: white; display: flex; align-items: center; justify-content: center; margin-right: 12px; font-weight: bold; font-size: 11px; flex-shrink: 0; }
.list-info { display: flex; flex-direction: column; flex: 1; padding-right: 10px; }
.list-info b { display: block; font-size: 15px; color: #3e2723; }
.list-info small { display: block; font-size: 12px; color: #8b4513; margin-top: 2px; }

/* Popup & Tooltip Styles */
.mobile-tip { position: absolute; top: 0; left: 0; background: white; padding: 12px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.3); z-index: 12000; display: none; width: 180px; text-align: center; border: 1px solid #ddd; line-height: 1.3; pointer-events: none; color: #111 !important; }
.mobile-tip b { color: #000 !important; }
.mobile-tip small { color: #333 !important; }
.mobile-tip button { pointer-events: auto; }
.mobile-tip::after { content: ''; position: absolute; bottom: -8px; left: var(--arrow-x, 50%); transform: translateX(-50%); border-width: 8px 8px 0; border-style: solid; border-color: white transparent transparent; pointer-events: none; }
.mobile-tip.flip-arrow::after { bottom: auto; top: -8px; border-width: 0 8px 8px; }

/* Admin Popup Buttons CSS */
.pop-action-row { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; justify-content: center; align-items: center; width: 100%; }
.pop-btn-group { display: flex; gap: 6px; width: 100%; flex-direction: row; }
.pop-btn { flex: 1; border: none; padding: 8px 12px; border-radius: 8px; font-weight: bold; cursor: pointer; font-size: 13px; pointer-events: auto; box-shadow: 0 2px 4px rgba(0,0,0,0.2); width: 100%; color: white; }
.btn-blue { background: #3b82f6; }
.btn-red { background: #ef4444; }
.btn-green { background: #10b981; }
.btn-orange { background: #f39c12; }
.btn-gray { background: #94a3b8; }
.btn-black { background: #222; }
.btn-lila { background: #9b59b6; border: 2px solid white; }
.btn-wc { background: #1ea8e6; }
.btn-outline-y { background: #ffffff; color: black; border: 2px solid #f1c40f; }
.btn-outline-r { background: #dc2626; border: 2px solid white; }

.impressum-content { padding: 30px 20px calc(var(--safe-bottom) + 80px) 20px; text-align: left; height: auto; min-height: 100%; }
.impressum-box-m { background: white; padding: 30px 20px; border-radius: 16px; box-shadow: 0 8px 20px rgba(139,69,19,0.1); border-top: 5px solid var(--primary-color); margin-bottom: 35px; color: #3e2723; }

@keyframes badgeBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes dayBadgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); } 70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); } 0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.6); } }

.prog-day { color: #d35400; font-size: 20px; font-weight: bold; text-transform: uppercase; margin-top: 20px; margin-bottom: 10px; letter-spacing: 1px; font-family: 'Roboto Condensed', sans-serif; transition: 0.3s;} 
.day-active { background: #e74c3c; color: white !important; padding: 4px 14px; border-radius: 8px; display: inline-block; animation: dayBadgePulse 2s infinite; }
.prog-item { display: flex; margin-bottom: 12px; font-size: 15px; line-height: 1.4; color: #3e2723; font-family: 'Roboto Condensed', sans-serif; transition: 0.3s; }
.act-active { background: #ffffff; border-left: 6px solid #e74c3c; padding: 14px 10px 14px 15px; margin-left: -19px; border-radius: 0 12px 12px 0; box-shadow: 0 8px 25px rgba(139,69,19,0.3); position: relative; z-index: 5; }
.act-active .prog-time { color: #e74c3c; font-size: 17px; }
.act-active .prog-title { color: #000; font-size: 16px; }
.act-active .prog-desc { color: #222; font-weight: 500; }
.prog-title { font-weight: bold; text-transform: uppercase; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 3px; color: #1e1008; }
.status-badge { font-size: 11px; font-weight: bold; color: #e74c3c; animation: badgeBlink 1.5s infinite; background: rgba(231, 76, 60, 0.15); padding: 3px 8px; border-radius: 12px; display: inline-block; border: 1px solid rgba(231, 76, 60, 0.3); text-transform: none; letter-spacing: normal; }
.prog-time { width: 85px; font-weight: bold; flex-shrink: 0; color: #8b4513; }
.prog-info { flex: 1; }
.prog-desc { font-size: 14px; color: #555; }

/* Startscreen Anpassung an dynamische Viewport-Höhe (Android Fix) */
#welcome-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; min-height: 100vh; min-height: 100%; background: var(--header-bg); z-index: 29000; display: flex; flex-direction: column; align-items: center; justify-content: space-between; color: white; text-align: center; transition: opacity 0.4s ease, visibility 0.4s ease; box-sizing: border-box; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
#welcome-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.welcome-top-area, .welcome-bottom-area { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; padding: 15px; box-sizing: border-box; }
.welcome-top-area { padding-top: calc(var(--safe-top) + 15px); }
.welcome-bottom-area { padding-bottom: calc(var(--safe-bottom) + 100px); } 
.welcome-content { background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 25px 20px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.2); max-width: 400px; width: calc(100% - 40px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 1; flex-shrink: 0; margin: 5px 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.welcome-logo { max-width: 140px; width: 100%; max-height: 12vh; object-fit: contain; filter: invert(1); mix-blend-mode: screen; z-index: 2; pointer-events: none; margin-top: 5px; }

/* Präzise Skalierung der Überschrift */
.welcome-title { font-family: 'Roboto Condensed', sans-serif; font-size: clamp(18px, 6vw, 24px); margin: 5px 0; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.2); line-height: 1.2; padding: 0 15px; text-align: center; }
.welcome-text { font-size: 13px; line-height: 1.4; margin-bottom: 15px; color: rgba(255,255,255,0.9); }
.btn-start { background: #ff6600; color: white; border: none; padding: 16px 22px; border-radius: 30px; font-size: 17px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 20px rgba(255, 102, 0, 0.6); transition: transform 0.2s, box-shadow 0.2s; width: 100%; margin-bottom: 16px; font-family: 'Roboto Condensed', sans-serif; text-transform: uppercase; letter-spacing: 1px; }
.btn-start:active { transform: scale(0.96); box-shadow: 0 2px 10px rgba(255, 102, 0, 0.6); }
.welcome-links { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.welcome-links a { color: white; text-decoration: none; font-size: 15px; padding: 14px; border: 1px solid rgba(255,255,255,0.3); border-radius: 12px; transition: background 0.2s; font-weight: bold; display: flex; justify-content: center; align-items: center; gap: 8px;}
.welcome-links a:active { background: rgba(255,255,255,0.2); }

.btn-install { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.4); padding: 12px 20px; border-radius: 30px; font-size: 15px; font-weight: bold; cursor: pointer; transition: background 0.2s, transform 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 320px; margin: 0 auto; backdrop-filter: blur(5px); }
.btn-install:active { background: rgba(255,255,255,0.25); transform: scale(0.96); }

#data-status-icon { transition: stroke 0.3s ease, color 0.3s ease; }
.status-onedrive { stroke: var(--highlight-orange) !important; color: var(--highlight-orange) !important; }

#install-guide { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 35000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.install-box { background: white; color: #333; padding: 25px; border-radius: 20px; max-width: 320px; width: 100%; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.install-box h3 { margin-top: 0; color: var(--primary-color); font-family: 'Roboto Condensed', sans-serif; font-size: 22px; text-transform: uppercase; margin-bottom: 10px;}
.install-step { display: flex; align-items: center; gap: 15px; margin: 20px 0; font-size: 15px; text-align: left; line-height: 1.4; color: #444; }
.install-icon { width: 46px; height: 46px; background: #f5ede4; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid rgba(139,69,19,0.1); }
.install-icon svg { width: 24px; height: 24px; stroke: var(--primary-color); }
.btn-close-install { background: var(--primary-color); color: white; border: none; padding: 14px 20px; border-radius: 12px; font-weight: bold; font-size: 16px; margin-top: 15px; cursor: pointer; width: 100%; box-shadow: 0 4px 10px rgba(139,69,19,0.3); transition: transform 0.2s; }
.btn-close-install:active { transform: scale(0.96); }

/* Edit-Modal Styles */
#text-edit-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 40000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.edit-modal-box { background: white; padding: 25px; border-radius: 20px; width: 100%; max-width: 320px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); text-align: center; }
.edit-modal-box h3 { margin-top: 0; color: var(--primary-color); font-family: 'Roboto Condensed', sans-serif; font-size: 22px; text-transform: uppercase; margin-bottom: 15px; }
#text-edit-area { width: 100%; height: 80px; margin-bottom: 20px; border: 1px solid rgba(139,69,19,0.3); border-radius: 8px; padding: 10px; font-family: sans-serif; font-size: 15px; resize: none; outline: none; box-sizing: border-box; }
#text-edit-area:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(139, 69, 19, 0.2); }
.edit-modal-btn-row { display: flex; gap: 10px; }

/* ZENTRALE TOAST NOTIFICATION */
.action-toast {
    position: fixed;
    top: calc(var(--safe-top) + 38px); 
    left: 50%;
    transform: translateX(-50%) translateY(-15px) scale(0.95);
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 10px 22px;
    border-radius: 30px;
    font-family: 'Roboto Condensed', sans-serif;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    z-index: 50000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border: 2px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.action-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.action-toast.state-on {
    border-color: #2ecc71;
    color: #2ecc71;
    background: rgba(20, 40, 30, 0.95);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.3);
}

.action-toast.state-off {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(40, 20, 20, 0.95);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* =========================================
   MASSBAND (MOBILE VERSION) - FILIGRAN
   ========================================= */
.m-ruler-wrapper { position: absolute; z-index: 6600; transform-origin: 0 0; pointer-events: auto; }
.m-ruler-line { position: absolute; top: 0; left: 0; height: 2px; background-color: #e74c3c; transform: translateY(-50%); box-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.m-ruler-label { position: absolute; left: 50%; top: -25px; transform: translate(-50%, -50%); background: #1e293b; color: white; padding: 4px 8px; border-radius: 4px; font-size: 15px; font-weight: bold; white-space: nowrap; pointer-events: none; border: 1px solid #e74c3c; box-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.m-ruler-tick { position: absolute; top: 0; width: 2px; height: 12px; background-color: #e74c3c; transform: translateY(-50%); }
.m-ruler-tick-text { position: absolute; top: -16px; transform: translateX(-50%); font-size: 12px; color: #111; font-weight: bold; text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; white-space: nowrap; }
.m-ruler-handle { position: absolute; top: 0; width: 60px; height: 60px; background: transparent; display: flex; align-items: center; justify-content: center; touch-action: none; z-index: 6601; }
.m-ruler-handle-ring { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #e74c3c; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; transition: transform 0.1s; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.m-ruler-handle:active .m-ruler-handle-ring { transform: scale(1.4); background: rgba(231, 76, 60, 0.4); }
.m-ruler-handle-dot { width: 6px; height: 6px; background: #e74c3c; border-radius: 50%; }