/* rps-remote.css – UI for the Remote‑RPS flow
   All selectors are namespaced to avoid leaking onto the rest of the site.
   Palette:
     • Overlay background   rgba(40,12,30,.72)
     • Card background      #fff0f6
     • Card border          #ff8fb8
     • Accent / primary     #ff8fb8
     • Highlight (selected) #ffd6e7
     • Text primary         #a0225a
     • Text secondary       #4a0f2a
   Font stack: ui-rounded, Nunito, system-ui, sans-serif.
   Optional title font: Fraunces.
   Z‑index: 180 (above existing HUD & menus). */

/* ------------------------------------------------------------------
   GLOBAL OVERLAY (covers whole viewport)
------------------------------------------------------------------- */
.rps-overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 12, 30, .72);
    z-index: 180;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top)
             env(safe-area-inset-right)
             env(safe-area-inset-bottom)
             env(safe-area-inset-left);
    font-family: ui-rounded, Nunito, system-ui, sans-serif;
    color: #a0225a;
}

/* ------------------------------------------------------------------
   LAYOUT CONTAINERS (picker, share, vs, reveal)
------------------------------------------------------------------- */
.rps-picker,
.rps-share,
.rps-vs,
.rps-reveal {
    background: #fff0f6;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    max-width: 92vw;
    width: 100%;
    max-height: 96vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------------------------------
   HEADER / TITLE
------------------------------------------------------------------- */
.rps-header {
    font-family: Fraunces, ui-rounded, Nunito, system-ui, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: #a0225a;
    padding: 1rem 0.5rem 0.5rem;
}

/* ------------------------------------------------------------------
   CARD GRID
------------------------------------------------------------------- */
.rps-card-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
}

/* Card container – will shrink/grow to fit 3 per row on wide screens */
.rps-card {
    background: #fff0f6;
    border: 2px solid #ff8fb8;
    border-radius: 12px;
    flex: 1 1 calc(33.333% - 1rem);
    max-width: calc(33.333% - 1rem);
    min-width: 200px;
    text-align: center;
    padding: 0.5rem;
    transition: border-color .2s ease, box-shadow .2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Reduce to single column on narrow viewports */
@media (max-width: 699px) {
    .rps-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* Card image */
.rps-card img {
    max-height: 220px;          /* desktop */
    width: 100%;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

/* Phone‑size image limit */
@media (max-width: 440px) {
    .rps-card img {
        max-height: 140px;
    }
}

/* Card title */
.rps-card .rps-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #a0225a;
    margin-top: 0.25rem;
}

/* ------------------------------------------------------------------
   STATE MODIFIERS
------------------------------------------------------------------- */
/* Card that is already taken (disabled) */
.rps-card.rps-taken {
    filter: grayscale(1) opacity(.45);
    cursor: default;
    pointer-events: none;
}

/* Card currently selected by the player */
.rps-card.rps-selected {
    border-color: #ffd6e7;
    box-shadow: 0 0 12px 4px rgba(255, 214, 231, .6);
}

/* Hover / focus (unless reduced motion) */
@media (prefers-reduced-motion: no-preference) {
    .rps-card:not(.rps-taken):hover,
    .rps-card:not(.rps-taken):focus-visible {
        transform: scale(1.02);
    }
}

/* ------------------------------------------------------------------
   BUTTONS (pill‑shaped, accessible)
------------------------------------------------------------------- */
.rps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;                 /* touch‑target minimum */
    padding: 0 1rem;
    background: #ff8fb8;
    color: #4a0f2a;
    border: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s ease, transform .2s ease;
}

/* Hover / active (respect reduced‑motion) */
@media (prefers-reduced-motion: no-preference) {
    .rps-btn:hover,
    .rps-btn:focus-visible {
        background: #ffd6e7;
        transform: scale(1.03);
    }
}

/* Disabled button */
.rps-btn[disabled],
.rps-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Focus indicator – always visible for keyboard users */
.rps-btn:focus-visible {
    outline: 2px solid #ffd6e7;
    outline-offset: 2px;
}

/* ------------------------------------------------------------------
   SPECIFIC SECTIONS
------------------------------------------------------------------- */

/* Picker footer – contains the “Create room” button */
.rps-picker .rps-footer,
.rps-share .rps-footer,
.rps-vs .rps-footer,
.rps-reveal .rps-footer {
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    background: #fff0f6;
}

/* VS screen – character showdown */
.rps-vs .rps-vs-grid {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1rem;
    gap: 1rem;
}

/* VS character block */
.rps-vs .rps-player {
    text-align: center;
    flex: 1;
}

/* VS label (“VS”) */
.rps-vs .rps-vs-label {
    font-family: Fraunces, ui-rounded, Nunito, system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #ff8fb8;
}

/* Reveal screen – shows both moves */
.rps-reveal .rps-moves {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
}

/* Individual move block */
.rps-reveal .rps-move {
    text-align: center;
    flex: 1;
}

/* Message area (e.g., “friend left”, “round 2”) */
.rps-message {
    text-align: center;
    font-size: 1.125rem;
    color: #4a0f2a;
    padding: 0.5rem 1rem;
}

/* ------------------------------------------------------------------
   UTILITIES
------------------------------------------------------------------- */
.rps-hidden { display: none !important; }   /* only for JS toggling – safe because scoped */

/* ------------------------------------------------------------------
   RESPONSIVE / Viewport‑specific tweaks
------------------------------------------------------------------- */

/* Ensure no overflow on very small phones */
@media (max-width: 390px) {
    .rps-picker,
    .rps-share,
    .rps-vs,
    .rps-reveal {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Wider desktop layout – keep the overlay content centred */
@media (min-width: 1440px) {
    .rps-picker,
    .rps-share,
    .rps-vs,
    .rps-reveal {
        max-width: 960px;
    }
}

/* ------------------------------------------------------------------
   PREFER REDUCED MOTION – disable any non‑essential animation
------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0s !important;
        transition-duration: 0s !important;
    }
}
