/* ============================================================
   SnapMyCloud — App-Styles
   Mobile-first · Farbwelt aus dem Logo (Blau / Himmelblau / Orange)
   ============================================================ */

:root {
    --bg:        #0a0e1a;
    --bg-soft:   #101627;
    --card:      #141b2e;
    --card-2:    #1a2340;
    --border:    rgba(140, 170, 255, .14);
    --txt:       #eef2ff;
    --txt-m:     #93a0c4;
    --txt-d:     #5c6a8f;
    --blue:      #2e6bff;
    --blue-2:    #1e56e8;
    --sky:       #7cc0f4;
    --orange:    #f5941e;
    --orange-2:  #ff7043;
    --red:       #ff4d6d;
    --ring:      linear-gradient(45deg, #f5941e, #ff7043, #7cc0f4, #2e6bff);
    --radius:    18px;
    --tabbar-h:  calc(60px + env(safe-area-inset-bottom));
    --topbar-h:  54px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--txt);
    font-family: "Outfit", system-ui, sans-serif;
    overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; }


/* ── Phone-Rahmen: mobil unsichtbar, am Desktop ein Gerät ── */

#phone { height: 100%; }

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

@media (min-width: 700px) {

    body {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        background:
            radial-gradient(1200px 800px at 15% -10%, rgba(46, 107, 255, .22), transparent 60%),
            radial-gradient(1000px 700px at 110% 110%, rgba(245, 148, 30, .14), transparent 55%),
            #05070f;
    }

    #phone {
        width: 410px;
        height: min(880px, 94vh);
        border-radius: 44px;
        padding: 12px;
        background: linear-gradient(160deg, #232a3d, #0d1120);
        box-shadow:
            0 40px 90px rgba(0, 0, 0, .65),
            0 0 0 1px rgba(255, 255, 255, .07),
            inset 0 0 0 1px rgba(255, 255, 255, .05);
        position: relative;
    }

    #phone::after {                       /* Notch */
        content: "";
        position: absolute;
        top: 22px; left: 50%;
        transform: translateX(-50%);
        width: 110px; height: 24px;
        border-radius: 14px;
        background: #05070f;
        z-index: 60;
    }

    #app { border-radius: 34px; }

}


/* ── Topbar ── */

#topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(10, 14, 26, .96), rgba(10, 14, 26, .85));
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 20;
}

@media (min-width: 700px) {
    #topbar { padding-top: 34px; height: calc(var(--topbar-h) + 34px); }
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand span {
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: .01em;
    background: linear-gradient(90deg, #fff 30%, var(--sky));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}


/* ── Views / Scrollbereich ── */

#views { flex: 1; overflow: hidden; position: relative; }

.view {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }

#viewFeed { padding-bottom: var(--tabbar-h); }


/* ── Tabbar ── */

#tabbar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(13, 18, 34, .92);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    z-index: 30;
}

.tab {
    width: 74px; height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--txt-d);
    transition: color .15s, transform .1s;
}
.tab svg { width: 26px; height: 26px; }
.tab.is-active { color: var(--txt); }
.tab:active { transform: scale(.9); }

.tab-new {
    width: 52px; height: 52px;
    margin-top: -14px;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--orange), var(--orange-2));
    color: #fff;
    box-shadow: 0 8px 22px rgba(245, 148, 30, .38);
}
.tab-new svg { width: 24px; height: 24px; }


/* ── Stories-Leiste ── */

.stories-rail {
    display: flex;
    gap: 14px;
    padding: 14px 14px 10px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
}
.stories-rail::-webkit-scrollbar { display: none; }

.story-bubble {
    flex-shrink: 0;
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.story-avatar {
    width: 62px; height: 62px;
    border-radius: 50%;
    padding: 3px;
    background: var(--ring);
    position: relative;
}
.story-avatar.is-seen { background: #2a3350; }
.story-avatar.is-empty { background: #2a3350; }

.story-avatar .ava {
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 3px solid var(--bg);
    overflow: hidden;
    background: var(--card-2);
}

.story-add-badge {
    position: absolute;
    right: -1px; bottom: -1px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    border: 3px solid var(--bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.story-bubble span {
    font-size: .68rem;
    color: var(--txt-m);
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ── Avatare allgemein ── */

.ava {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--card-2), #232f55);
    color: var(--sky);
    font-weight: 600;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}
.ava img { width: 100%; height: 100%; object-fit: cover; }


/* ── Feed-Karten ── */

.post {
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 6px;
}

.post-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}
.post-head .ava { width: 36px; height: 36px; font-size: .8rem; }
.post-head-names { flex: 1; min-width: 0; }
.post-head-names b { display: block; font-size: .9rem; font-weight: 600; }
.post-head-names small { color: var(--txt-d); font-size: .72rem; }
.post-menu { color: var(--txt-d); padding: 6px; }

.post-media {
    position: relative;
    background: #060910;
}

.carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel .slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
}
.carousel img {
    width: 100%;
    max-height: 72vh;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.carousel-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    padding-top: 10px;
}
.carousel-dots i {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #38456e;
    transition: background .15s, transform .15s;
}
.carousel-dots i.on { background: var(--sky); transform: scale(1.25); }

.multi-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(6px);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: .7rem;
    color: #fff;
}

/* Herz-Animation beim Doppeltipp */
.heart-burst {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 96px; height: 96px;
    color: #fff;
    filter: drop-shadow(0 4px 22px rgba(0, 0, 0, .5));
    pointer-events: none;
    animation: burst .9s ease forwards;
}
@keyframes burst {
    12%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    30%  { transform: translate(-50%, -50%) scale(.95); }
    45%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -55%) scale(1); opacity: 0; }
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px 0;
}
.icon-btn {
    padding: 8px;
    color: var(--txt);
    display: flex;
    transition: transform .1s;
}
.icon-btn:active { transform: scale(.82); }
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn.liked { color: var(--red); }
.icon-btn.liked svg { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.3); } }

.post-likes { padding: 2px 14px; font-size: .88rem; font-weight: 600; }

.post-caption {
    padding: 3px 14px 0;
    font-size: .88rem;
    line-height: 1.45;
    color: var(--txt);
    word-wrap: break-word;
}
.post-caption b { font-weight: 600; margin-right: 6px; }

.post-comments-link {
    padding: 4px 14px 0;
    font-size: .82rem;
    color: var(--txt-d);
}

.post-preview-comment {
    padding: 2px 14px 0;
    font-size: .84rem;
    color: var(--txt-m);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-preview-comment b { color: var(--txt); font-weight: 600; margin-right: 6px; }


/* ── Leerzustand / Laden ── */

.empty {
    padding: 70px 30px;
    text-align: center;
    color: var(--txt-m);
}
.empty img { width: 84px; margin: 0 auto 16px; opacity: .9; }
.empty h3 { font-size: 1.05rem; margin-bottom: 6px; color: var(--txt); }
.empty p { font-size: .86rem; line-height: 1.5; }

.feed-sentinel { height: 40px; }

.skeleton {
    background: linear-gradient(100deg, var(--card) 40%, var(--card-2) 50%, var(--card) 60%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: 12px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.spinner {
    width: 26px; height: 26px;
    margin: 18px auto;
    border: 3px solid var(--card-2);
    border-top-color: var(--sky);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ── Auth ── */

#viewAuth {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(500px 380px at 80% -5%, rgba(46, 107, 255, .28), transparent 60%),
        radial-gradient(420px 320px at 0% 105%, rgba(245, 148, 30, .16), transparent 55%),
        var(--bg);
}

.auth-wrap { width: 100%; max-width: 330px; padding: 24px; text-align: center; }
.auth-logo { width: 86px; margin: 0 auto 14px; border-radius: 22px; box-shadow: 0 14px 40px rgba(30, 86, 232, .4); }
.auth-title {
    font-size: 1.9rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff 30%, var(--sky));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-sub { color: var(--txt-m); font-size: .9rem; margin: 4px 0 26px; }

.auth-tabs {
    display: flex;
    background: var(--card);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1;
    padding: 9px;
    border-radius: 9px;
    color: var(--txt-m);
    font-weight: 500;
    font-size: .9rem;
}
.auth-tab.is-active { background: var(--card-2); color: var(--txt); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }

.inp {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
    color: var(--txt);
    font-size: .92rem;
    outline: none;
    width: 100%;
    transition: border-color .15s;
}
.inp:focus { border-color: var(--blue); }
.inp::placeholder { color: var(--txt-d); }

textarea.inp { resize: none; min-height: 84px; }

.btn {
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 600;
    font-size: .95rem;
    transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    color: #fff;
    box-shadow: 0 8px 24px rgba(30, 86, 232, .35);
}
.btn-orange {
    background: linear-gradient(135deg, var(--orange), var(--orange-2));
    color: #fff;
    box-shadow: 0 8px 24px rgba(245, 148, 30, .3);
}
.btn-ghost {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--txt-m);
}

.auth-err {
    margin-top: 14px;
    color: var(--red);
    font-size: .84rem;
    background: rgba(255, 77, 109, .1);
    border: 1px solid rgba(255, 77, 109, .3);
    border-radius: 10px;
    padding: 10px;
}


/* ── Profil ── */

.profile-head { padding: 22px 18px 14px; }

.profile-top { display: flex; align-items: center; gap: 20px; }
.profile-top .ava { width: 84px; height: 84px; font-size: 1.6rem; }

.profile-stats { flex: 1; display: flex; justify-content: space-around; }
.profile-stats div { text-align: center; }
.profile-stats b { display: block; font-size: 1.15rem; }
.profile-stats span { font-size: .72rem; color: var(--txt-m); }

.profile-names { margin-top: 14px; }
.profile-names b { font-size: 1rem; }
.profile-names small { display: block; color: var(--txt-d); font-size: .8rem; }
.profile-bio { margin-top: 6px; font-size: .86rem; color: var(--txt-m); line-height: 1.5; white-space: pre-line; }

.profile-btns { display: flex; gap: 10px; margin-top: 16px; }
.profile-btns .btn { flex: 1; padding: 10px; font-size: .86rem; }

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding-bottom: var(--tabbar-h);
}
.grid-item { position: relative; aspect-ratio: 1; overflow: hidden; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; }
.grid-item .gi-multi {
    position: absolute;
    top: 6px; right: 6px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .7));
}
.gi-multi svg { width: 16px; height: 16px; }

.back-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px 0;
    color: var(--txt-m);
    font-size: .9rem;
}
.back-row button { display: flex; padding: 6px; color: var(--txt); }
.back-row svg { width: 22px; height: 22px; }


/* ── Sheets (Upload, Kommentare, Profil bearbeiten) ── */

.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 5, 12, .6);
    backdrop-filter: blur(3px);
    z-index: 40;
    opacity: 0;
    transition: opacity .22s;
}
.sheet-backdrop.open { opacity: 1; }

.sheet {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    max-height: 88%;
    background: var(--bg-soft);
    border-radius: 22px 22px 0 0;
    border-top: 1px solid var(--border);
    z-index: 41;
    display: flex;
    flex-direction: column;
    transform: translateY(102%);
    transition: transform .26s cubic-bezier(.32, .72, .28, 1);
}
.sheet.open { transform: translateY(0); }

.sheet-grip {
    width: 40px; height: 4px;
    border-radius: 4px;
    background: #38456e;
    margin: 10px auto 2px;
    flex-shrink: 0;
}

.sheet-title {
    text-align: center;
    font-weight: 600;
    font-size: .95rem;
    padding: 8px 0 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sheet-body {
    overflow-y: auto;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar { display: none; }


/* Upload-Vorschau */
.up-previews {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px;
    scrollbar-width: none;
}
.up-previews::-webkit-scrollbar { display: none; }
.up-thumb {
    position: relative;
    flex-shrink: 0;
    width: 92px; height: 92px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-thumb button {
    position: absolute;
    top: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    font-size: 13px;
    line-height: 1;
}

.up-drop {
    border: 2px dashed #2c3a63;
    border-radius: 16px;
    padding: 34px 20px;
    text-align: center;
    color: var(--txt-m);
    font-size: .88rem;
    margin-bottom: 12px;
}
.up-drop svg { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--sky); display: block; }

/* Dauer-Auswahl für Stories */
.dur-row { display: flex; gap: 8px; margin: 4px 0 14px; }
.dur-chip {
    flex: 1;
    padding: 9px 0;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--txt-m);
    font-size: .84rem;
    font-weight: 500;
}
.dur-chip.on {
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    border-color: transparent;
    color: #fff;
}

/* Kommentare */
.cmt-list { display: flex; flex-direction: column; gap: 14px; min-height: 120px; }
.cmt {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.cmt .ava { width: 32px; height: 32px; font-size: .72rem; }
.cmt-body { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.45; }
.cmt-body b { font-weight: 600; margin-right: 6px; }
.cmt-body small { display: block; color: var(--txt-d); font-size: .72rem; margin-top: 2px; }
.cmt-del { color: var(--txt-d); padding: 4px; font-size: .95rem; }

.cmt-form {
    display: flex;
    gap: 8px;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-soft);
}
.cmt-form .inp { flex: 1; padding: 11px 14px; border-radius: 999px; }
.cmt-send {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cmt-send svg { width: 20px; height: 20px; }


/* ── Story-Viewer ── */

.story-viewer {
    position: absolute;
    inset: 0;
    background: #000;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sv-progress {
    display: flex;
    gap: 4px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 0;
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 3;
}
@media (min-width: 700px) { .sv-progress { padding-top: 40px; } }

.sv-progress i {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .28);
    overflow: hidden;
    position: relative;
}
.sv-progress i b {
    position: absolute;
    inset: 0;
    background: #fff;
    transform-origin: left;
    transform: scaleX(0);
}

.sv-head {
    position: absolute;
    top: calc(22px + env(safe-area-inset-top));
    left: 0; right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    z-index: 3;
    color: #fff;
}
@media (min-width: 700px) { .sv-head { top: 52px; } }
.sv-head .ava { width: 34px; height: 34px; font-size: .74rem; }
.sv-head b { font-size: .88rem; font-weight: 600; flex: 1; }
.sv-head small { color: rgba(255, 255, 255, .75); font-size: .76rem; }
.sv-head button { color: #fff; padding: 6px; display: flex; }
.sv-head svg { width: 24px; height: 24px; }

.sv-img-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.sv-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: svIn .25s ease;
}
@keyframes svIn { from { opacity: 0; transform: scale(1.04); } }

.sv-tap { position: absolute; top: 0; bottom: 0; width: 34%; z-index: 2; }
.sv-tap.left { left: 0; }
.sv-tap.right { right: 0; width: 66%; }


/* ── Toast ── */

.toast {
    position: absolute;
    left: 50%;
    bottom: calc(var(--tabbar-h) + 18px);
    transform: translateX(-50%) translateY(20px);
    background: var(--card-2);
    border: 1px solid var(--border);
    color: var(--txt);
    padding: 11px 20px;
    border-radius: 999px;
    font-size: .86rem;
    z-index: 55;
    opacity: 0;
    transition: all .25s;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
