body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    overflow: hidden; font-family: 'Inter', sans-serif; 
    background-color: #dbdbdb; 
}

:root{
    --mobile-bar-h: 64px;
}

#loader {
    position: fixed; inset: 0; background: #dbdbdb; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}

.loader-card{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap: 12px;
}

.loader-logo{
    width: 200px;
    height: auto;
    display:block;
}

.loader-text{
    font-weight: 750;
    color: #222;
}

.loader-bar{
    width: 220px;
    height: 6px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow:hidden;
}

.loader-bar span{
    display:block;
    height:100%;
    width: 0%;
    background: rgba(0,0,0,0.22);
    border-radius: 999px;
    transition: width 160ms ease;
}
.loader-percent{
    font-size: 0.85rem;
    font-weight: 700;
    color: #222;
}
    100%{ transform: translateX(280%); }
}

/* Mobile Topbar */
#mobile-bar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-bar-h) + env(safe-area-inset-top));
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: env(safe-area-inset-top) 16px 0 16px;
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(10px);
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);

    pointer-events: auto;
    border-bottom: 1px solid rgba(0,0,0,0.06);}

.mobile-logo{
    width: 200px;
    height: auto;
    display:block;
}

/* Floating FAB (mobile): gleiche Position für Open/Close */
.mobile-fab{
    display: none;
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 2200;
    border: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    font-size: 22px;
    line-height: 1;
    padding: 12px 14px;
    border-radius: 14px;
    cursor: pointer;
    color: #222;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.mobile-fab:active{ transform: scale(0.98); }

#viewer{
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 300px; /* Platz für Sidebar */

    z-index: 0;}

body.sidebar-collapsed #viewer{
    left: 0;
}

#sidebar {
    position: fixed; left: 0; top: 0; width: 300px; height: 100%;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
    box-sizing: border-box; z-index: 100;
    box-shadow: 5px 0 25px rgba(0,0,0,0.05);
    display: flex; flex-direction: column;
    overflow: hidden;
    touch-action: pan-y;

    z-index: 1000;}

.sidebar-topbar{
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0; /* user request: kein extra gap */
    padding: 16px 22px;
}

.sidebar-logo{
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

.sidebar-toggle{
    display: none;
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: #222;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset;
}



.sidebar-toggle:active{ transform: scale(0.98); }

.sidebar-scroll{
    flex: 1;
    overflow-y: auto;
    padding: 0 22px 24px 22px;
    touch-action: pan-y;
}

h1 { font-size: 1.4rem; margin: 0 0 10px 0; color: #222; }
.step-hint { font-size: 0.85rem; color: #E6215B; font-weight: 600; margin-bottom: 30px; }

.section { margin-bottom: 25px; }
.label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 12px; }

.preset-grid{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Presets: wie vorher (farbige Quadrate), aber NUR Name im Kasten */
.preset-swatch{
    appearance: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-radius: 14px;
    aspect-ratio: 1 / 1;
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
    outline: 2px solid rgba(0,0,0,0.06);
    transition: transform 120ms ease, outline-color 120ms ease;
}

.preset-swatch:hover{ transform: translateY(-1px); }
.preset-swatch:active{ transform: translateY(0px); }

.preset-swatch.active{ outline-color: #FF3864; }

.preset-meta{
    position:absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px 7px;
    border-radius: 10px;
    background: rgba(255,255,255,0.24);
    backdrop-filter: blur(6px);
}

.preset-meta .n{
    font-size: 0.70rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.2px;
    text-align: left;
}

.sidebar-scroll{ -webkit-overflow-scrolling: touch; }

.custom-picker-container { display: flex; align-items: center; gap: 15px; background: #eee; padding: 10px; border-radius: 8px; cursor: pointer; }
.custom-picker-container.active{ outline: 2px solid #FF3864; outline-offset: 2px; }
input[type="color"] { border: none; width: 40px; height: 40px; cursor: pointer; background: none; }
#hex-display { font-size: 0.9rem; font-weight: bold; }

.finish-row{
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 12px;
    background: #eee;
    padding: 12px;
    border-radius: 8px;
}

.finish-label{
    font-size: 0.85rem;
    font-weight: 700;
    color: #222;
    user-select:none;
}

/* Toggle Switch */
.switch{ position: relative; display:inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input{ opacity:0; width:0; height:0; }
.slider{
    position:absolute; cursor:pointer; inset:0;
    background: #cfcfcf; border-radius: 999px;
    transition: 0.18s;
}
.slider:before{
    position:absolute; content:"";
    height: 20px; width: 20px;
    left: 3px; top: 3px;
    background: white;
    border-radius: 999px;
    transition: 0.18s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.switch input:checked + .slider{ background:#8a8a8a; }
.switch input:checked + .slider:before{ transform: translateX(20px); }


/* Share / Short-URL */
.share-btn{
    width: 100%;
    border: 0;
    background: #ff3864;
    color: #fff;
    font-weight: 800;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}
.share-btn:active{ transform: scale(0.99); }

.share-row{
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.share-url{
    width: 100%;
    border: 0;
    background: #eee;
    border-radius: 10px;
    padding: 12px 12px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #222;
}

.share-open{
    border: 0;
    background: #ff3864;
    color: #fff;
    font-weight: 900;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.share-open:active{ transform: scale(0.99); }

.share-status{
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #222;
    opacity: 0.85;
    min-height: 1.1em;
}

/* After copying a share link, we show a clickable status link.
   Must be regular weight and VC46 pink/red. */
.share-status .share-status-link{
    font-weight: 400;
    color: #FF3864;
    text-decoration: none;
}
.share-status .share-status-link:hover{
    text-decoration: underline;
}

@media (max-width: 1024px) {
    
#mobile-bar{
z-index: 999;
        position: relative;
        padding: 10px 20px;
}

    /* Floating toggle button */
    .mobile-fab{ display: block; }

    /* Sidebar-Header auf Mobile: Logo sitzt in mobile-bar */
    .sidebar-topbar{
        display: none;
    }
    .sidebar-logo{ display: none; }


    /* verhindert initiales Einblenden vor JS (Flash) */
    body:not(.sidebar-initialized) #sidebar{
        transform: translateY(105%);
        box-shadow: none;
    }
    /* Sidebar als Bottom-Sheet (von unten ein/aus) */
    #sidebar{
        width: 100vw;
        height: calc(100dvh - (var(--mobile-bar-h) + env(safe-area-inset-top)));
        top: calc(var(--mobile-bar-h) + env(safe-area-inset-top));
        left: 0;
        right: 0;
        bottom: auto;
        transform: translateY(0);
        transition: transform 240ms ease;
        border-radius: 0;

    }

    body.sidebar-collapsed #sidebar{
        transform: translateY(105%);
        box-shadow: none;
    }

    /* Viewer nimmt volle Breite ein, Sidebar liegt darüber */
    #viewer{ left: 0; }

    /* Wenn Sidebar offen ist, darf Canvas keine Touch-Events abfangen */
    body:not(.sidebar-collapsed) #viewer{ pointer-events: none; }

    .sidebar-scroll{
        padding: 0 20px calc(22px + env(safe-area-inset-bottom)) 20px; /* unten nicht von Browserbar verdeckt */
        overscroll-behavior: contain;
    }

    .preset-grid{
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .share-btn{ font-size: 0.85rem; }
}

p { line-height: 1.4; }

.help{margin-top:18px;}

#disclaimer-line{
    display:block;
    margin-top:6px;
    /* gleiche Textfarbe wie die beiden Zeilen drumherum */
    opacity:1;
}

.top-controls{
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 50;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.top-btn{
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    color: #222;
    -webkit-text-fill-color: #222;
    -webkit-appearance: none;
    appearance: none;

}
.top-btn:active{ transform: translateY(1px); }

.share-section{ margin-bottom: 18px; }

.top-btn.is-active{ background:#ff3864; color:#fff; }


#site-by-line{
    display:block;
    margin-top:6px;
}
#site-by-line a{
    color:#ff3864;
    text-decoration:none;
    font-weight:700;
}
#site-by-line a:hover{ text-decoration:underline; }

@media (max-width: 768px){
    .top-controls{ top: 75px; }
}



/* Language dropdown (Topbar) */
.lang-dropdown{ display:flex; flex-direction:column; gap:8px; }
.lang-toggle{ width:100%; display:flex; align-items:center; justify-content:center; gap:8px; }
/* Hidden until opened */
.lang-options[hidden]{ display:none !important; }
.lang-options{ display:none; flex-direction:column; gap:8px; }
.lang-dropdown.is-open .lang-options{ display:flex; }

.lang-option{
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    color: #222;
    -webkit-text-fill-color: #222;
    -webkit-appearance: none;
    appearance: none;
}

.lang-toggle .caret{ margin-left: 2px; }


.flag-icon{
  width: 22px;
  height: 16px;
  display: inline-block;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 2px;
}
.flag-de{ background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2222%22%20height=%2216%22%20viewBox=%220%200%2022%2016%22%3E%3Crect%20width=%2222%22%20height=%2216%22%20fill=%22%23000%22/%3E%3Crect%20y=%225.33%22%20width=%2222%22%20height=%225.34%22%20fill=%22%23DD0000%22/%3E%3Crect%20y=%2210.66%22%20width=%2222%22%20height=%225.34%22%20fill=%22%23FFCE00%22/%3E%3C/svg%3E"); }
.flag-en{ background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2222%22%20height%3D%2216%22%20viewBox%3D%220%200%2022%2016%22%3E%3Crect%20width%3D%2222%22%20height%3D%2216%22%20fill%3D%22%23fff%22%2F%3E%3Cg%20fill%3D%22%23B22234%22%3E%3Crect%20y%3D%220%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%222.46%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%224.92%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%227.38%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%229.84%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%2212.3%22%20width%3D%2222%22%20height%3D%221.23%22%2F%3E%3Crect%20y%3D%2214.76%22%20width%3D%2222%22%20height%3D%221.24%22%2F%3E%3C%2Fg%3E%3Crect%20width%3D%228.8%22%20height%3D%228.62%22%20fill%3D%22%233C3B6E%22%2F%3E%3C%2Fsvg%3E"); }
.flag-it{ background-image: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2222%22%20height=%2216%22%20viewBox=%220%200%2022%2016%22%3E%3Crect%20width=%2222%22%20height=%2216%22%20fill=%22%23fff%22/%3E%3Crect%20width=%227.33%22%20height=%2216%22%20fill=%22%23009246%22/%3E%3Crect%20x=%2214.66%22%20width=%227.34%22%20height=%2216%22%20fill=%22%23CE2B37%22/%3E%3C/svg%3E"); }


/* iOS: prevent blue text on buttons/links */
button, .top-btn{ color: inherit; -webkit-text-fill-color: inherit; }
.share-btn{ color:#fff; -webkit-text-fill-color:#fff; }

/* Mobile: share button same size as URL field */
@media (max-width: 768px){
  .share-btn{ font-size: 0.85rem; }
}

/* Footer link color */
.site-by a{ color: #ff3864; -webkit-text-fill-color:#ff3864; }


/* Mobile: fully opaque white UI backgrounds */
@media (max-width: 1024px){
  #sidebar {
    background: #fff !important;
    backdrop-filter: none !important;
  }
}

}
