/* dice-pillage web shell styles.
   Dark, minimal, game-focused. The canvas is the hero; chrome stays out of the
   way until the lobby/networking layer (web/main.js) needs it. */

:root
{
    --bg:           #16161e;
    --bg-elev:      #1c1c26;
    --fg:           #e8e8ec;
    --fg-dim:       #8a8a96;
    --accent:       #f0c566;   /* gold — matches the in-game selection highlight */
    --accent-dim:   rgba(240, 197, 102, 0.45);
    --danger:       #e06c75;
    --bar-h:        56px;
    --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

*
{
    box-sizing: border-box;
}

html, body
{
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

/* --- Top bar ----------------------------------------------------------- */

#top-bar
{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--bar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 10;
    pointer-events: none; /* let clicks fall through to the canvas by default */
}

#top-bar h1
{
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--accent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Slot for future lobby/status indicators (created by main.js). */
#status-slot
{
    pointer-events: auto;
    font-size: 13px;
    color: var(--fg-dim);
    font-family: var(--font-mono);
}

/* --- Stage / canvas ---------------------------------------------------- */

#stage
{
    position: fixed;
    inset: 0;
    /* Push the canvas down below the top bar so its top isn't covered.
       The game itself fills the whole #stage; ImGui chrome is drawn inside
       the canvas. */
    padding-top: var(--bar-h);
}

/* The canvas *must not* have any border or padding, or mouse coords will be
   wrong (Emscripten requirement — same as the default shell). */
#canvas
{
    display: block;
    width: 100%;
    height: 100%;
    border: 0 none;
    background: var(--bg);
    outline: none;
}

/* --- Loading overlay --------------------------------------------------- */

#loader
{
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: var(--bg);
    z-index: 100;
    transition: opacity 0.35s ease;
}

#loader.hidden
{
    opacity: 0;
    pointer-events: none;
}

#loader-text
{
    font-size: 14px;
    color: var(--fg-dim);
    letter-spacing: 0.4px;
}

/* Pure-CSS spinner — three dots bouncing in gold. No external asset. */
.spinner
{
    width: 48px;
    height: 14px;
    position: relative;
}

.spinner::before,
.spinner::after,
.spinner > *
{
    /* Rendered via ::before/::after + a dummy child span so we get 3 dots
       without extra markup. */
}

.spinner::before,
.spinner::after
{
    content: "";
    position: absolute;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.1s infinite ease-in-out both;
}

.spinner::before
{
    left: 0;
    animation-delay: -0.32s;
}

.spinner::after
{
    right: 0;
    animation-delay: -0.16s;
}

.spinner > *
{
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.1s infinite ease-in-out both;
}

@keyframes bounce
{
    0%, 80%, 100%
    {
        transform: scale(0.5);
        opacity: 0.4;
    }
    40%
    {
        transform: scale(1);
        opacity: 1;
    }
}

/* Respect users who prefer reduced motion: drop the bounce, just show dots. */
@media (prefers-reduced-motion: reduce)
{
    .spinner::before,
    .spinner::after,
    .spinner > *
    {
        animation: none;
        opacity: 0.7;
    }
}
