/* Tip Notification Styles */
#tipNotification {
    position: absolute;
    top: 5%; /* Position near the top of the game box */
    left: 50%;
    transform: translate(-50%, 0);
    z-index: 1000;
    width: 448px; /* Consistent width */
    max-width: 448px;
    height: 70px; /* Adjusted for compact notification */
    padding: 10px 20px; /* Padding for inner content */
    display: flex;
    align-items: center;
    opacity: 0;
    animation: fadeInNotification 2s forwards, fadeOutNotification 2s 5s forwards; /* Fade-in and fade-out */
    font-family: Arial, Helvetica, sans-serif;

    /* Full Border Styling */
    border: 6px solid transparent; /* Set the border width to match the border image */
    border-image-source: url('UIAssets/box_main.png'); /* Use the box_main.png image */
    border-image-slice: 6; /* Slice the image into 6px-wide segments */
    border-image-width: 6px; /* Match the border-image width to the border size */
    border-image-repeat: stretch; /* Stretch the sides to fit the notification */
    background-color: #111b2e; /* Dark navy background inside the notification */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Add shadow for depth */
}

/* Tip Notification Text Container */
#tipNotification .notification-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Space text evenly */
    height: 100%; /* Match the height of the notification */
    padding: 0; /* Remove any padding */
    color: #fff;
}

/* Tip Title */
#tipNotification .tip-title {
    font-size: 18px;
    font-weight: bold;
    color: #a3d0ff; /* Light blue for emphasis */
    margin: 0;
    text-transform: uppercase;
    align-self: flex-start; /* Align to the top of the container */
}

/* Tip Message */
#tipNotification .tip-message {
    font-size: 16px;
    font-weight: bold;
    margin: 5px 0 0 0;
    color: #ffffff; /* Bright white for visibility */
    text-align: left;
    width: 100%; /* Ensure full width to match the container */
}

/* Fade-in Animation */
@keyframes fadeInNotification {
    from {
        opacity: 0;
        transform: translate(-50%, -20px); /* Slight upward movement */
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Fade-out Animation */
@keyframes fadeOutNotification {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Notification Closing */
#tipNotification.hide {
    animation: fadeOutNotification 2s forwards;
}

/* Right-edge mini notification */
#miniNotification {
    --mini-notification-width: clamp(280px, 22vw, 330px);
    position: absolute;
    top: 10px;
    right: 0;
    z-index: 12000;
    box-sizing: border-box;
    width: 14px;
    height: 100px;
    padding: 0;
    display: block;
    overflow: hidden;
    border: 6px solid transparent;
    border-right-width: 0;
    border-image-source: url('UIAssets/box_main.png');
    border-image-slice: 6;
    border-image-width: 6px 0 6px 6px;
    border-image-repeat: stretch;
    background: #111b2e;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
    color: #fff;
    font-family: var(--dashboard-font-family);
    text-align: left;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition:
        width 1500ms cubic-bezier(0.22, 0.72, 0.18, 1) 120ms,
        opacity 180ms ease-out;
}

#miniNotification.is-visible {
    width: var(--mini-notification-width);
    opacity: 1;
    pointer-events: auto;
}

#miniNotification.is-hiding {
    width: 14px;
    opacity: 0;
    pointer-events: none;
    transition:
        width 850ms cubic-bezier(0.55, 0, 0.8, 0.25),
        opacity 220ms ease-in 820ms;
}

#miniNotification:focus-visible {
    outline: 2px solid #c8e6ff;
    outline-offset: -8px;
}

.mini-notification-inner {
    position: absolute;
    inset: 0 auto 0 0;
    box-sizing: border-box;
    width: var(--mini-notification-width);
    padding: 14px 16px 14px 14px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.mini-notification-icon-wrap {
    position: relative;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    overflow: visible;
}

.mini-notification-icon-wrap,
.mini-notification-copy {
    opacity: 0;
    transition: opacity 500ms ease-out 280ms;
}

#miniNotification.is-visible .mini-notification-icon-wrap,
#miniNotification.is-visible .mini-notification-copy {
    opacity: 1;
}

#miniNotification.is-hiding .mini-notification-icon-wrap,
#miniNotification.is-hiding .mini-notification-copy {
    opacity: 0;
    transition-delay: 0ms;
}

.mini-notification-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    transform: translate(-50%, -50%);
    object-fit: contain;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.mini-notification-copy {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-notification-label {
    color: transparent;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.15;
    text-transform: uppercase;
    background: linear-gradient(
        to bottom,
        rgba(46, 118, 208, 0.96) 0%,
        rgba(92, 181, 255, 0.92) 100%
    );
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mini-notification-title {
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#miniNotification.is-achievement .mini-notification-title {
    font-size: 14px;
}

.mini-notification-description {
    color: #b9dcf8;
    font-size: 11px;
    font-weight: bold;
    font-style: italic;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#miniNotification.is-edge .mini-notification-title {
    white-space: nowrap;
}

@media (max-width: 820px) {
    #miniNotification {
        --mini-notification-width: min(76vw, 300px);
        top: -58px;
        right: calc(var(--phone-ui-inset-x, 0px) - 28px);
        height: 96px;
    }

    .mini-notification-icon-wrap {
        flex-basis: 50px;
        width: 50px;
        height: 50px;
    }

    .mini-notification-icon {
        width: 64px;
        height: 64px;
    }

    #miniNotification.is-achievement .mini-notification-inner {
        /* The panel extends 28px past the viewport; keep all copy inside its visible edge. */
        padding-right: 48px;
    }

    #miniNotification.is-achievement {
        /* Keep the right edge overhanging while giving achievement copy more
           room by extending the notification toward the left. */
        --mini-notification-width: min(calc(100vw + 28px), 390px);
    }

    .mini-notification-label {
        font-size: 13px;
        overflow-wrap: anywhere;
    }

    #miniNotification.is-achievement .mini-notification-label {
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
    }

    .mini-notification-title {
        font-size: 12px;
    }

    #miniNotification.is-achievement .mini-notification-title {
        font-size: 14px;
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
    }

    .mini-notification-description {
        font-size: 11px;
    }

}

@media (max-width: 820px) {
    html.phone-optimised #miniNotification,
    body.phone-optimised #miniNotification {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 48px);
        right: -28px;
        z-index: 12000;
    }
}
