/* System bars are already outside some app WebViews: their CSS insets are 0.
   Use the reported overlap once; never infer it from a phone model or density. */
:root {
    --gg-safe-top: 0px;
    --gg-safe-right: 0px;
    --gg-safe-bottom: 0px;
    --gg-safe-left: 0px;
}

@supports (padding-top: constant(safe-area-inset-top)) {
    :root {
        --gg-safe-top: constant(safe-area-inset-top);
        --gg-safe-right: constant(safe-area-inset-right);
        --gg-safe-bottom: constant(safe-area-inset-bottom);
        --gg-safe-left: constant(safe-area-inset-left);
    }
}

@supports (padding-top: env(safe-area-inset-top)) {
    :root {
        --gg-safe-top: env(safe-area-inset-top, 0px);
        --gg-safe-right: env(safe-area-inset-right, 0px);
        --gg-safe-bottom: env(safe-area-inset-bottom, 0px);
        --gg-safe-left: env(safe-area-inset-left, 0px);
    }
}

body.ggongsul-page {
    padding-top: var(--gg-safe-top);
    padding-right: var(--gg-safe-right);
    padding-left: var(--gg-safe-left);
}

body.ggongsul-page .gg-bottom-bar {
    box-sizing: border-box;
    padding-bottom: var(--gg-safe-bottom);
}

body.ggongsul-page .gg-bottom-bar:not(.btn-bottom) {
    background-color: #fff;
}

/* Fixed controls also need to fit between the cutouts in landscape. */
@media (max-width: 767px) {
    body.ggongsul-page .gg-bottom-bar {
        width: calc(100% - var(--gg-safe-left) - var(--gg-safe-right));
    }
}

/* The keyboard moves the input bar, but is never used as safe-area padding. */
body.ggongsul-page .gg-input-bar {
    bottom: var(--gg-input-bottom, 0px) !important;
    padding-bottom: var(--gg-input-padding, var(--gg-safe-bottom));
}

/* Anchor to the actual menu height, including its bottom safe area. */
body.ggongsul-page .foot-menu .talk-write {
    bottom: calc(100% + 8px);
}

body.ggongsul-page .gg-cart-bar .talk-write {
    bottom: calc(100% + 60px);
}

/* Reserve the measured fixed bar height so the last item stays reachable. */
.gg-bottom-spacer {
    height: var(--gg-footer-height, var(--gg-safe-bottom));
    flex-shrink: 0;
}

body.ggongsul-chat .gg-bottom-spacer {
    display: none;
}

body.ggongsul-page .chat-box-wrap {
    box-sizing: border-box;
    min-height: 0;
    padding-bottom: 0;
    overscroll-behavior-y: contain;
}
