/* ============================================================================
   SCORECARD OVERLAY

   Ported from the EXL "Beyond Word Search" build (css/main.css) so the two
   games present an identical end-of-round screen. Class names and ids are kept
   byte-identical to that project on purpose - edit them in both or neither.

   EXL Orange (#FB4E0B) is a signature-moment colour. On this screen it appears
   in exactly one place: the score itself. Keep it out of the buttons.
   ============================================================================ */

:root {
    --exl-orange:    #FB4E0B;
    --exl-navy:      #001632;
    --exl-navy-grad: #001439;
    --exl-navy-800:  #172F50;
    --exl-slate:     #384D6A;
    --exl-grey:      #A6A7B2;
    --exl-greige:    #D9CFC8;
    --exl-cream:     #FEF7F4;

    --exl-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.sc {
    position: fixed;
    inset: 0;
    /* The game canvas is position:fixed and #mainLoader sits at z-index 5,
       so this has to clear both. */
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    background: rgba(0, 20, 57, 0.82);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 240ms ease;
}

.sc[hidden] { display: none; }
.sc.is-open { opacity: 1; }

.sc__panel {
    width: 100%;
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(14px);
    transition: transform 300ms cubic-bezier(.2, .8, .3, 1);
}

.sc.is-open .sc__panel { transform: translateY(0); }
.sc__panel:focus { outline: none; }

.sc__sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* The card is an <img> on purpose: iOS Safari ignores <a download>, but a
   long-press on an image always offers Save Image. main.css switches selection
   off globally, so it has to be switched back on here. */
.sc__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid rgba(166, 167, 178, 0.35);
    box-shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
    -webkit-touch-callout: default;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

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

.sc__btn {
    font-family: var(--exl-font);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 15px 18px;
    border-radius: 10px;
    border: 1px solid rgba(166, 167, 178, 0.5);
    background: rgba(23, 47, 80, 0.9);
    color: var(--exl-cream);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: background 160ms ease, transform 120ms ease, border-color 160ms ease;
}

.sc__btn:hover { background: var(--exl-slate); }
.sc__btn:active { transform: scale(0.985); }

.sc__btn:focus-visible {
    outline: 2px solid var(--exl-orange);
    outline-offset: 3px;
}

/* The download button is the one call to action on this screen, but orange is
   reserved - so it earns emphasis through contrast, not hue. */
.sc__btn--primary {
    background: var(--exl-cream);
    color: var(--exl-navy);
    border-color: var(--exl-cream);
}

.sc__btn--primary:hover { background: #FFFFFF; border-color: #FFFFFF; }

.sc__hint {
    margin: 0;
    padding: 11px 14px;
    border-radius: 8px;
    background: rgba(251, 78, 11, 0.12);
    border: 1px solid rgba(251, 78, 11, 0.45);
    color: var(--exl-cream);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.sc__hint[hidden] { display: none; }

.sc__share {
    margin: 0;
    text-align: center;
    font-size: 13px;
    line-height: 1.55;
    color: var(--exl-grey);
}

@media (min-height: 780px) {
    .sc__panel { max-width: 460px; }
}

@media (prefers-reduced-motion: reduce) {
    .sc, .sc__panel, .sc__btn { transition: none; }
}
