/* Hint UI: responsive frosted-glass surfaces with crisp, readable content. */

/* The app occupies the browser's visible viewport; do not allow the document itself to scroll. */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    margin: 0;
}

#layers-edge-handle {
    height: 100vh;
    height: 100dvh;
}

#hint-panel, #hint-detail-panel, #hint-list, #hint-list .hint-item {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hint panel */
#hint-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 24px;
    width: auto;
    max-width: none;
    max-height: min(52vh, 520px);
    max-height: min(52dvh, 520px);
    display: none;
    flex-direction: column;
    box-sizing: border-box;
    z-index: 9999;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 22px;
    background: rgba(235, 244, 250, 0.16);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
    box-shadow: 0 18px 45px rgba(0, 12, 28, 0.24),
                inset 0 1px 0 rgba(255, 255, 255, 0.45);
    overflow: hidden;
}

#hint-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.18) 0%,
        rgba(255, 255, 255, 0.04) 38%,
        rgba(255, 255, 255, 0) 62%,
        rgba(255, 255, 255, 0.08) 100%);
}

/* Hint cards */
#hint-list {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 8px 3px 3px;
}

#hint-list .hint-item {
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
    margin: 0;
    padding: 12px 13px;
    border-radius: 16px;
    background: rgba(248, 252, 255, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.58);
    box-shadow: 0 5px 16px rgba(0, 20, 40, 0.10),
                inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
    cursor: pointer;
    overflow: visible;
}

#hint-list .hint-item:hover {
    transform: translateY(-1px);
    background: rgba(252, 254, 255, 0.68);
    box-shadow: 0 7px 20px rgba(0, 20, 40, 0.12),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#hint-list .hint-item.selected {
    background: rgba(241, 248, 255, 0.78);
    border-color: rgba(37, 99, 235, 0.58);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

#hint-list .hint-card-header {
    display: flex;
    align-items: center;
    gap: 9px;
}

#hint-list .hint-card-header .hint-score {
    margin-left: auto;
}

#hint-list .hint-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 0.97rem;
    line-height: 1.25;
    font-weight: 800;
    color: #061321;
    overflow-wrap: anywhere;
    word-break: normal;
}

#hint-list .hint-description {
    margin-top: 6px;
    font-size: 0.88rem;
    line-height: 1.42;
    font-weight: 500;
    color: #102234;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
}

#hint-list .hint-technique {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

#hint-list .hint-technique-item {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.58);
    color: #0a2938;
    font-size: 0.76rem;
    line-height: 1.25;
    font-weight: 700;
    overflow-wrap: anywhere;
}

#hint-list .hint-info-button {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.52);
    color: #061321;
    cursor: pointer;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: background 150ms ease, transform 150ms ease;
}

#hint-list .hint-info-button:hover {
    background: rgba(255, 255, 255, 0.78);
    transform: scale(1.06);
}

/* Detail panel */
.hint-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(235, 244, 250, 0.025);
    pointer-events: all;
}

#hint-detail-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(680px, calc(100% - 32px));
    max-height: min(86vh, 720px);
    max-height: min(86dvh, 720px);
    box-sizing: border-box;
    z-index: 100001;
    padding: 25px;
    border: 2px solid transparent;
    border-radius: 26px;
    background:
        linear-gradient(rgba(235, 244, 250, 0.20), rgba(235, 244, 250, 0.20)) padding-box,
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.82) 10%,
            rgba(255, 255, 255, 0.30) 28%,
            rgba(255, 255, 255, 0.10) 52%,
            rgba(140, 190, 225, 0.28) 78%,
            rgba(255, 255, 255, 0.58) 100%) border-box;
    -webkit-backdrop-filter: blur(30px) saturate(155%);
    backdrop-filter: blur(30px) saturate(155%);
    box-shadow: 0 30px 65px rgba(0, 8, 20, 0.32),
                0 0 0 1px rgba(255, 255, 255, 0.18),
                0 0 30px rgba(255, 255, 255, 0.20),
                inset 0 2px 0 rgba(255, 255, 255, 0.95),
                inset 2px 0 0 rgba(255, 255, 255, 0.58),
                inset 0 -2px 0 rgba(100, 160, 205, 0.24),
                inset -2px 0 0 rgba(100, 160, 205, 0.12);
    overflow-y: auto;
    overflow-x: hidden;
}

/* The detail dialog is opt-in. The HTML hidden attribute must always win over the
   component's display/layout rules above. */
#hint-detail-panel[hidden],
.hint-detail-backdrop[hidden] {
    display: none !important;
}

#hint-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.18) 0%,
        rgba(255, 255, 255, 0.04) 38%,
        rgba(255, 255, 255, 0) 62%,
        rgba(255, 255, 255, 0.08) 100%);
}

#hint-detail-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(118deg,
        rgba(255, 255, 255, 0.42) 0%,
        rgba(255, 255, 255, 0.20) 7%,
        rgba(255, 255, 255, 0.06) 19%,
        rgba(255, 255, 255, 0) 42%,
        rgba(255, 255, 255, 0) 76%,
        rgba(255, 255, 255, 0.10) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.displace-layer {
    position: absolute;
    inset: 0;
    border-radius: 26px;
    pointer-events: none;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.18);
}

.inner-shadow {
    position: absolute;
    inset: 0;
    border-radius: 26px;
    pointer-events: none;
    z-index: 2;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.10),
        rgba(255, 255, 255, 0) 45%,
        rgba(255, 255, 255, 0.05));
}

.reading {
    position: relative;
    z-index: 3;
    background: transparent;
    padding: 0;
}

.hint-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.hint-detail-title {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.25;
    font-weight: 850;
    letter-spacing: -0.01em;
    color: #020a14;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.72);
}

.hint-detail-close {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.52);
    color: #020a14;
    cursor: pointer;
    font-size: 1.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hint-detail-summary {
    margin: 14px 0 0;
    font-size: 1.05rem;
    line-height: 1.5;
    font-weight: 550;
    color: #081726;
    overflow-wrap: anywhere;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.48);
}

.hint-detail-label {
    margin: 22px 0 6px;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1a3c57;
}

.hint-detail-body {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.6;
    font-weight: 450;
    color: #030d1a;
    overflow-wrap: anywhere;
    white-space: pre-line;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.hint-score {
    color: grey;
    font-size: 0.8rem;
    display: flex;
    justify-content: flex-end;
}

/* Responsive behaviour */
@media (min-width: 601px) {
    #hint-panel {
        left: 24px;
        right: 24px;
        bottom: 28px;
        max-width: none;
        max-height: min(55vh, 560px);
        max-height: min(55dvh, 560px);
        padding: 10px;
    }

    #hint-list .hint-item {
        padding: 13px 15px;
    }
}

@media (max-width: 600px) {
    #hint-panel {
        left: 8px;
        right: 8px;
        bottom: max(12px, env(safe-area-inset-bottom));
        max-width: none;
        max-height: min(74vh, 680px);
        max-height: min(74dvh, 680px);
        padding: 7px;
        border-radius: 19px;
    }

    #hint-list {
        gap: 7px;
        padding: 7px 2px 2px;
    }

    #hint-list .hint-item {
        padding: 11px 12px;
        border-radius: 15px;
    }

    #hint-list .hint-description {
        font-size: 0.86rem;
        line-height: 1.4;
    }

    #hint-detail-panel {
        width: calc(100% - 20px);
        max-height: calc(100dvh - 20px);
        padding: 18px;
        border-radius: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #hint-list .hint-item,
    #hint-list .hint-info-button {
        transition: none;
    }
}
