/* =========================================
   SUNIVA Portal Home
========================================= */

.suniva-map-create-portal {
    position: absolute;
    right: 18px;
    bottom: max(164px, calc(env(safe-area-inset-bottom) + 150px));
    left: 18px;
    z-index: 790;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(213,174,78,.52);
    border-radius: 999px;
    color: #17354a;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    background: rgba(255,253,247,.94);
    box-shadow: 0 12px 32px rgba(39,72,76,.16);
    backdrop-filter: blur(15px);
}

.suniva-map-create-portal span {
    color: #cc9828;
    font-size: 19px;
}

html.is-suniva-scope-open
.suniva-map-create-portal,
html.is-suniva-portal-open
.suniva-map-create-portal {
    opacity: 0;
    pointer-events: none;
}

.suniva-portal-home {
    position: absolute;
    inset: 0;
    z-index: 100030;
    display: none;
    pointer-events: none;
}

html.is-suniva-portal-open
.suniva-portal-home {
    display: block;
}

.suniva-portal-home__intro {
    position: absolute;
    top: max(82px, calc(env(safe-area-inset-top) + 64px));
    left: 50%;
    width: min(300px, calc(100% - 42px));
    padding: 11px 16px;
    transform: translateX(-50%);
    border: 1px solid rgba(255,226,157,.55);
    border-radius: 18px;
    color: #fff;
    text-align: center;
    background: rgba(8,28,43,.70);
    box-shadow: 0 12px 35px rgba(0,0,0,.25);
    backdrop-filter: blur(13px);
}

.suniva-portal-home__intro small,
.suniva-portal-home__intro strong {
    display: block;
}

.suniva-portal-home__intro small {
    color: #f1d48d;
    font-size: 8px;
    letter-spacing: .16em;
}

.suniva-portal-home__intro strong {
    overflow: hidden;
    margin-top: 3px;
    font-family: serif;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suniva-portal-home__intro p {
    margin: 4px 0 0;
    color: rgba(255,255,255,.83);
    font-size: 9px;
}

.suniva-portal-home__dock {
    position: absolute;
    right: 13px;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 13px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.78);
    border-radius: 24px;
    background: rgba(255,253,248,.94);
    box-shadow: 0 16px 42px rgba(9,31,45,.28);
    backdrop-filter: blur(18px);
    pointer-events: auto;
}

.suniva-portal-home__dock button {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 7px 3px;
    border: 0;
    border-radius: 17px;
    color: #415761;
    font-size: 8px;
    font-weight: 800;
    background: transparent;
}

.suniva-portal-home__dock button:first-child {
    color: #9a711b;
    background:
        linear-gradient(
            145deg,
            #fff8e7,
            #f7e3ac
        );
}

.suniva-portal-home__dock button span {
    font-size: 19px;
    line-height: 1;
}

.suniva-portal-home__sheet {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: flex-end;
    pointer-events: auto;
}

.suniva-portal-home__sheet.is-open {
    display: flex;
}

.suniva-portal-home__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(4,20,31,.58);
    backdrop-filter: blur(3px);
}

.suniva-portal-home__content {
    position: relative;
    z-index: 1;
    overflow-y: auto;
    width: 100%;
    max-height: 78%;
    padding:
        26px 20px
        max(28px, calc(env(safe-area-inset-bottom) + 18px));
    border-radius: 30px 30px 0 0;
    color: #19364a;
    background:
        linear-gradient(
            180deg,
            #fffdf8,
            #f8f3e8
        );
    box-shadow: 0 -18px 52px rgba(0,0,0,.24);
}

.suniva-portal-home__close {
    position: absolute;
    top: 13px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(169,135,60,.25);
    border-radius: 50%;
    color: #53656e;
    background: #fff;
}

.suniva-portal-home__content small {
    color: #b0852b;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .15em;
}

.suniva-portal-home__content h2 {
    margin: 5px 42px 8px 0;
    font-family: serif;
    font-size: 21px;
}

.suniva-portal-home__content > p {
    margin: 0 0 18px;
    color: #718087;
    font-size: 10px;
    line-height: 1.8;
}

.suniva-portal-home__actions {
    display: grid;
    gap: 9px;
}

.suniva-portal-home__action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 57px;
    padding: 11px 14px;
    border: 1px solid rgba(198,167,96,.25);
    border-radius: 18px;
    color: #1c3b4e;
    text-align: left;
    text-decoration: none;
    background: #fff;
    box-shadow: 0 8px 22px rgba(41,65,68,.07);
}

.suniva-portal-home__action > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    font-size: 18px;
    background: #fff4d3;
}

.suniva-portal-home__action strong,
.suniva-portal-home__action small {
    display: block;
}

.suniva-portal-home__action strong {
    font-size: 11px;
}

.suniva-portal-home__action small {
    margin-top: 3px;
    color: #7c898e;
    font-size: 8px;
    letter-spacing: 0;
}

.suniva-portal-home__empty {
    padding: 20px;
    border: 1px dashed rgba(187,150,66,.34);
    border-radius: 18px;
    color: #777f80;
    font-size: 10px;
    line-height: 1.8;
    text-align: center;
    background: rgba(255,255,255,.65);
}

html.is-suniva-portal-open
#sunivaPortalCommunityOpen {
    display: none !important;
}

/* =========================================
   Portal Home Final Polish
========================================= */

/*
 * 通常マップでは中央の起動ボタンだけを表示。
 * スコープを開いた時だけ上部ハンドルを表示。
 */
html:not(.is-suniva-scope-open)
.suniva-scope-handle {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

html.is-suniva-scope-open
.suniva-scope-handle {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/*
 * 「この場所の物語」はポータル内部メニューへ統合。
 * 従来の独立した浮遊ボタンは非表示。
 */
#sunivaPortalCommunityOpen {
    display: none !important;
}

.suniva-map-create-portal {
    right: 18px !important;
    bottom:
        max(
            174px,
            calc(env(safe-area-inset-bottom) + 160px)
        ) !important;
    left: 18px !important;
    z-index: 805 !important;
    min-height: 42px !important;
    padding: 9px 16px !important;
}

.sworld-map-portal-card {
    z-index: 810 !important;
}

@media (max-height: 700px) {
    .suniva-map-create-portal {
        bottom:
            max(
                158px,
                calc(env(safe-area-inset-bottom) + 144px)
            ) !important;
    }
}

/*
 * ポータル内部では周辺ポータル切替を隠す。
 * ポータルの切替はWORLDマップで行う。
 */
html.is-suniva-portal-open
#sunivaPortalNavigator {
    display: none !important;
}

/*
 * ポータル名の重複を避け、
 * 「ここでできること」の案内として表示。
 */
html.is-suniva-portal-open
.suniva-portal-home__intro {
    top:
        max(
            94px,
            calc(env(safe-area-inset-top) + 76px)
        ) !important;
    width:
        min(
            280px,
            calc(100% - 116px)
        ) !important;
    padding: 8px 13px !important;
}

html.is-suniva-portal-open
.suniva-portal-home__intro small {
    font-size: 7px !important;
}

html.is-suniva-portal-open
.suniva-portal-home__intro strong {
    font-size: 14px !important;
}

html.is-suniva-portal-open
.suniva-portal-home__intro p {
    margin-top: 2px !important;
    font-size: 8px !important;
}

/*
 * 下部メニューを安全領域内へ収める。
 */
html.is-suniva-portal-open
.suniva-portal-home__dock {
    right: 10px !important;
    bottom:
        max(
            12px,
            calc(env(safe-area-inset-bottom) + 8px)
        ) !important;
    left: 10px !important;
    z-index: 100 !important;
}

html.is-suniva-portal-open
.suniva-portal-home__dock button {
    min-height: 52px !important;
    font-size: 7px !important;
}

html.is-suniva-portal-open
.suniva-portal-home__dock button span {
    font-size: 17px !important;
}

/*
 * ポータル内部のチェックイン表示を
 * 下部メニューより上へ配置。
 */
html.is-suniva-portal-open
#sunivaCheckinMount {
    position: absolute !important;
    right: 18px !important;
    bottom:
        max(
            88px,
            calc(env(safe-area-inset-bottom) + 80px)
        ) !important;
    left: 18px !important;
    z-index: 80 !important;
}

/*
 * 花ボタンは4つの入口へ統合。
 * 機能は残し、直接表示だけを隠す。
 */
html.is-suniva-portal-open
#sunivaFlowerOpenBtn {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* =========================================
   Compass / Portal Navigation Restore
========================================= */

/*
 * ポータル内部でも近くのポータル案内を表示する。
 */
html.is-suniva-portal-open
#sunivaPortalNavigator:not([hidden]) {
    display: flex !important;
    z-index: 100040 !important;
    pointer-events: auto !important;
}

/*
 * 新しく追加した案内文は、
 * 既存ポータル案内と内容が重複するため非表示。
 */
html.is-suniva-portal-open
.suniva-portal-home__intro {
    display: none !important;
}

html.is-suniva-portal-open
#sunivaTreasureCompass {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 100050 !important;
    pointer-events: auto !important;
}

html.is-suniva-portal-open
#sunivaCompassButton {
    pointer-events: auto !important;
    cursor: pointer !important;
}

html.is-suniva-portal-open
#sunivaPortalNavigator {
    top:
        max(
            92px,
            calc(env(safe-area-inset-top) + 76px)
        ) !important;
    right: 18px !important;
    left: 18px !important;
    width: auto !important;
}

html.is-suniva-portal-open
.suniva-portal-home__dock {
    z-index: 100030 !important;
}

html.is-suniva-portal-open
#sunivaCheckinMount {
    z-index: 100020 !important;
}

html.is-suniva-portal-open
.suniva-scope-close {
    z-index: 100060 !important;
}
