/* Shuffle (spec 101): one project at a time, full bleed, bottom rail. */

.shuffle-body {
    margin: 0;
    height: 100vh;
    overflow: hidden;
    background: #0b0d12;
    color: #e8eaf0;
    display: flex;
    flex-direction: column;
}

/* The stage takes everything the rail does not. Content is centered and
   letterboxed rather than cropped: a pixel-art sprite and a 3D scene have
   nothing in common but their aspect ratio, and cropping either one loses
   the part the maker cared about. */
.shuffle-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.shuffle-frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 220ms ease;
}
.shuffle-frame.is-live { opacity: 1; }

/* width/height rather than max-*: stored previews run from 53x40 up to
   600x450, and max-* only ever shrinks, so every small sprite was rendering at
   its natural size as a postage stamp in the middle of a full-size stage.
   contain keeps the aspect ratio while letting the small ones scale up. */
.shuffle-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Pixel art is a large share of the pool and blurring it is the one
       failure the makers would notice instantly. It matters far more now that
       a 53px sprite is scaled up more than twenty times to fill the frame. */
    image-rendering: auto;
}
.shuffle-frame img.is-pixel { image-rendering: pixelated; }

.shuffle-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #0b0d12;
}

/* Slow push-in for still cards. Enough motion that the reel does not read as
   a slideshow, small enough that nobody has to watch it move. */
@keyframes shuffle-push-in {
    from { transform: scale(1); }
    to   { transform: scale(1.06); }
}
.shuffle-frame.is-still img {
    animation: shuffle-push-in 9s ease-out forwards;
}
@media (prefers-reduced-motion: reduce) {
    .shuffle-frame.is-still img { animation: none; }
    .shuffle-frame { transition: none; }
}

.shuffle-loading {
    position: absolute;
    color: #7c8496;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

/* Progress hairline: how long this card has before it advances. Doubles as
   the pause indicator, which is why it is a real element and not a pseudo. */
.shuffle-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 3;
    height: 2px;
    width: 0;
    background: #5b8dd9;
    opacity: 0.8;
}
.shuffle-progress.is-paused { background: #4a5162; }

.shuffle-rail {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.1rem;
    background: #12151d;
    border-top: 1px solid #232838;
}

/* flex: 1 gives the creator the space the buttons do not need. Without it the
   block sized to content and lost every fight with an eight-button action row,
   collapsing to about 105px of a 1280px rail, which is not enough for a name
   like andrewcarrier2011 and a title. */
.shuffle-creator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1 1 auto;
    min-width: 0;
}
.shuffle-creator .avatar { flex: 0 0 auto; }

.shuffle-meta { min-width: 0; overflow: hidden; }
/* No max-width: the flex row above decides how much room there is, and a
   viewport-relative cap only ever fought with it. */
.shuffle-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shuffle-byline {
    font-size: 0.78rem;
    color: #8b93a7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shuffle-byline a { color: #a9b3c9; text-decoration: none; }
.shuffle-byline a:hover { text-decoration: underline; }

/* Never shrinks: the buttons carry keyboard hints and reading "Remix thi..."
   would be worse than a shorter title. */
.shuffle-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.shuffle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #1c2130;
    color: #d4d9e4;
    border: 1px solid #2b3244;
    border-radius: 7px;
    padding: 0.42rem 0.72rem;
    font-size: 0.84rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.shuffle-btn:hover:not(:disabled) { background: #242b3c; }
.shuffle-btn:disabled { opacity: 0.55; cursor: default; }
.shuffle-btn.liked { color: #ff7089; border-color: #4a2733; }
.shuffle-btn-primary {
    background: #3f6fc4;
    border-color: #3f6fc4;
    color: #fff;
    font-weight: 600;
}
.shuffle-btn-primary:hover:not(:disabled) { background: #4b7ed6; }
.shuffle-btn-quiet {
    background: transparent;
    border-color: transparent;
    color: #8b93a7;
    padding: 0.42rem 0.5rem;
}
.shuffle-btn-quiet:hover:not(:disabled) { background: #1c2130; color: #d4d9e4; }

/* A keycap, and it has to read as one. These used to sit inline against a
   button label with a 0.15rem gap, so "Follow" and its F badge ran together as
   "FollowF" and looked like a username that had been cut off. They now appear
   only where there is room to read them as keys: the ? panel and the play
   hint. Everywhere else the shortcut lives in the tooltip. */
.shuffle-key {
    display: inline-block;
    min-width: 1.05em;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #aab3c5;
    background: #232838;
    border: 1px solid #39415a;
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 0.35rem;
    margin: 0 0.35rem;
}

/* Top-left return and top-right honesty label. Both float over the stage so
   the project keeps the whole frame. */
.shuffle-corner {
    position: absolute;
    top: 0.8rem;
    z-index: 3;
    font-size: 0.78rem;
    color: #8b93a7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.shuffle-corner-left { left: 1rem; }
.shuffle-corner-right { right: 1rem; }
.shuffle-corner a { color: #8b93a7; text-decoration: none; }
.shuffle-corner a:hover { color: #d4d9e4; }

.shuffle-empty {
    text-align: center;
    color: #8b93a7;
    max-width: 30rem;
    padding: 2rem;
}
.shuffle-empty h2 { color: #e8eaf0; margin: 0 0 0.6rem; font-size: 1.15rem; }

/* Pause between stretches. Not a paywall or a nag: an offer to go make
   something, which is the only reason this surface exists. */
.shuffle-interstitial {
    position: absolute;
    inset: 0;
    z-index: 4;
    background: rgba(11, 13, 18, 0.94);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
}
.shuffle-interstitial h2 { margin: 0; font-size: 1.3rem; }
.shuffle-interstitial p { margin: 0; color: #8b93a7; }
.shuffle-interstitial .shuffle-actions { margin-left: 0; }

.shuffle-comments {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(380px, 92vw);
    z-index: 5;
    background: #12151d;
    border-left: 1px solid #232838;
    display: flex;
    flex-direction: column;
}
.shuffle-comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #232838;
    font-weight: 600;
}
.shuffle-comments-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.8rem 1rem;
    font-size: 0.87rem;
}
.shuffle-comment { margin-bottom: 0.9rem; }
.shuffle-comment-who { color: #8b93a7; font-size: 0.76rem; margin-bottom: 0.15rem; }
.shuffle-comments-form { padding: 0.8rem 1rem; border-top: 1px solid #232838; }
.shuffle-comments-form textarea {
    width: 100%;
    box-sizing: border-box;
    background: #0b0d12;
    color: #e8eaf0;
    border: 1px solid #2b3244;
    border-radius: 6px;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.86rem;
    resize: vertical;
}

/* The name is what a viewer needs to recognise a creator they like, so it gets
   room before the title does. */
.shuffle-byline { font-weight: 500; }

@media (max-width: 900px) {
    /* Report is the first thing to fold away when the rail is tight: it stays
       reachable on the project page, which Open still gets to. */
    #shuffle-report { display: none; }
}
@media (max-width: 720px) {
    .shuffle-btn span.shuffle-label { display: none; }
}

/* First music card, before the viewer has touched anything. The press is both
   the gesture the browser insists on and the instruction to start. */
.shuffle-tap {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(18, 21, 29, 0.9);
    color: #e8eaf0;
    border: 1px solid #3f6fc4;
    border-radius: 999px;
    padding: 0.7rem 1.4rem;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}
.shuffle-tap:hover { background: #1c2130; }
.shuffle-tap-glyph { color: #7fa4e0; }

/* Shown while a card is being operated, so the way back out is never a guess. */
.shuffle-playing {
    position: absolute;
    top: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    background: rgba(18, 21, 29, 0.85);
    color: #8b93a7;
    border: 1px solid #2b3244;
    border-radius: 999px;
    padding: 0.3rem 0.9rem;
    font-size: 0.76rem;
    pointer-events: none;
}
.shuffle-playing b { color: #d4d9e4; font-weight: 600; }

/* The playable-card hint must NOT take the click. The game underneath binds
   its keyboard recovery to mousedown, so a click spent on an overlay leaves it
   sitting on its own title screen looking like a prompt that will not clear. */
.shuffle-tap-hint {
    pointer-events: none;
    bottom: 8%;
    background: rgba(18, 21, 29, 0.78);
}

/* Autoplay off: stated plainly rather than shown as a disabled control, since
   it is a choice the viewer made and can undo. */
.shuffle-btn-off {
    color: #c98a3c;
    border-color: #4a3a22;
    background: #241d12;
}
.shuffle-btn-off:hover:not(:disabled) { background: #2e2416; color: #e0a558; }

/* The one place the shortcuts are spelled out. Opened by the ? button or by
   pressing ?, and it pauses the timer while it is up, because reading a list
   of keys is not a reason to lose the card you were looking at. */
.shuffle-keys-panel {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 5;
    background: rgba(18, 21, 29, 0.96);
    border: 1px solid #2b3244;
    border-radius: 10px;
    padding: 0.9rem 1rem;
    font-size: 0.83rem;
    color: #8b93a7;
    min-width: 15rem;
}
.shuffle-keys-title {
    color: #e8eaf0;
    font-weight: 600;
    margin-bottom: 0.6rem;
}
.shuffle-keys-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0;
}
.shuffle-keys-row .shuffle-key { margin-left: 0; flex: 0 0 auto; }

/* Said once, near the bottom, and it goes away by itself. A viewer who does not
   care what a WebGL context is should not have to make a decision here. */
.shuffle-note {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: min(46rem, 92vw);
    background: rgba(18, 21, 29, 0.95);
    border: 1px solid #2b3244;
    border-radius: 999px;
    padding: 0.5rem 0.6rem 0.5rem 1rem;
    font-size: 0.82rem;
    color: #8b93a7;
}

/* Reporting has to be reachable from the card itself: the reel is the one
   surface that shows a viewer work they did not choose to open. */
.shuffle-report {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    width: min(24rem, 92vw);
    background: #12151d;
    border: 1px solid #2b3244;
    border-radius: 10px;
    padding: 1rem;
    color: #d4d9e4;
}
.shuffle-report-title { font-weight: 600; margin-bottom: 0.7rem; }
.shuffle-report-field {
    width: 100%;
    box-sizing: border-box;
    background: #0b0d12;
    color: #e8eaf0;
    border: 1px solid #2b3244;
    border-radius: 6px;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.86rem;
    margin-bottom: 0.55rem;
}
.shuffle-report-msg {
    font-size: 0.8rem;
    color: #8b93a7;
    min-height: 1.1em;
    margin-bottom: 0.4rem;
}
.shuffle-report-actions { display: flex; justify-content: flex-end; gap: 0.45rem; }

/* The play hint retires on its own if detection never fires, so nothing is left
   sitting over a game somebody is already playing. */
.shuffle-tap-hint.is-fading {
    opacity: 0;
    transition: opacity 900ms ease;
}
@media (prefers-reduced-motion: reduce) {
    .shuffle-tap-hint.is-fading { transition: none; }
}
