/* ========================================================================
   Captiosus Games Core — futuristic dark theme.
   Palette:
     bg deep:       #050818
     bg gradient:   #050818 → #0d1140 → #0a2840
     card:          #0c1230
     border:        #1d2a55
     accent cyan:   #00e5ff
     accent violet: #7c4dff
     text primary:  #e6ecff
     text muted:    #93a4cb
     text dim:      #5c6f9c
   ======================================================================== */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #e6ecff;
    background: #050818;
    line-height: 1.55;
    min-height: 100vh;
}

body.page {
    background: #050818 linear-gradient(135deg, #050818 0%, #0d1140 50%, #0a2840 100%) fixed;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Shared maze backdrop used by:
   - page-hero: anonymous landing (full-bleed; also strips main padding below)
   - page-maze: pages that want the texture but keep the standard content layout
                (currently /profile). */
body.page-hero,
body.page-maze {
    background:
        linear-gradient(135deg, rgba(5, 8, 24, 0.78) 0%, rgba(13, 17, 64, 0.78) 50%, rgba(10, 40, 64, 0.78) 100%),
        url('/images/maze_bkgrnd.png') center center / cover no-repeat,
        #050818;
    background-attachment: fixed, fixed, fixed;
}

a { color: #00e5ff; text-decoration: none; }
a:hover { color: #7cf4ff; }

/* ----------------------- Topbar (full-width) ---------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: rgba(5, 8, 24, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #1d2a55;
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
}
.topbar-brand:hover { color: #ffffff; text-decoration: none; }

.topbar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.35));
}

.topbar-brand-text {
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 3px;
    font-weight: 700;
    color: #ffffff;
}
.topbar-brand-accent {
    color: #00e5ff;
    margin-left: 4px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-link {
    color: #c4d0ec;
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 6px 4px;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.topbar-link:hover {
    color: #00e5ff;
    border-bottom-color: #00e5ff;
    text-decoration: none;
}

.topbar-cta {
    display: inline-block;
    padding: 8px 18px;
    background: #00e5ff;
    background-image: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color: #050818 !important;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-radius: 6px;
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.32);
}
.topbar-cta:hover {
    box-shadow: 0 0 28px rgba(0, 229, 255, 0.55);
    text-decoration: none;
}

/* Authenticated profile cluster */
.topbar-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    border-left: 1px solid #1d2a55;
}

.topbar-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e6ecff;
    padding: 4px;
    border-radius: 8px;
}
.topbar-profile-link:hover {
    background: rgba(0, 229, 255, 0.06);
    text-decoration: none;
    color: #ffffff;
}

.topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color: #050818;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.topbar-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

.topbar-profile-name {
    font-size: 14px;
    color: #e6ecff;
}

.topbar-logout {
    color: #93a4cb;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.topbar-logout:hover {
    color: #ff5577;
    background: rgba(255, 85, 119, 0.08);
    text-decoration: none;
}

/* ----------------------- Main + footer ---------------------------------- */
.site-main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

body.page-hero .site-main {
    max-width: none;
    padding: 0;
    display: flex;
}

/* Games page: full-width so the detail pane can fill the screen
   while the left-hand card column stays a fixed compact size. */
body.page-games .site-main {
    max-width: none;
    padding: 32px 32px 64px;
}

.site-footer {
    text-align: center;
    padding: 18px 24px 28px;
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 11px;
    letter-spacing: 3px;
    color: #3b4a73;
}

/* ----------------------- Hero (anonymous /) ----------------------------- */
.hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 48px 24px;
    text-align: center;
}

.hero-inner {
    max-width: 720px;
    width: 100%;
}

.hero-logo {
    width: 280px;
    max-width: 60vw;
    height: auto;
    filter: drop-shadow(0 0 36px rgba(0, 229, 255, 0.35)) drop-shadow(0 0 80px rgba(124, 77, 255, 0.2));
    margin-bottom: 24px;
}

.hero-eyebrow {
    margin: 0 0 16px;
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #00e5ff;
}

.hero-title {
    margin: 0 0 18px;
    font-size: 56px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.5px;
    color: #ffffff;
    text-shadow: 0 0 32px rgba(0, 229, 255, 0.25);
}

.hero-lead {
    margin: 0 auto 40px;
    max-width: 540px;
    font-size: 18px;
    color: #c4d0ec;
}

.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ----------------------- Authenticated dashboard ------------------------ */
.dashboard {
    text-align: left;
}

.dashboard-eyebrow {
    margin: 0 0 10px;
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00e5ff;
}

.dashboard-title {
    margin: 0 0 6px;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
}

.accent { color: #00e5ff; }

.dashboard-sub {
    margin: 0 0 32px;
    font-size: 15px;
    color: #93a4cb;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px 22px 24px;
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 10px;
    color: #e6ecff;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.dashboard-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.12);
    text-decoration: none;
    color: #e6ecff;
}

.dashboard-card-eyebrow {
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00e5ff;
}
.dashboard-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}
.dashboard-card-desc {
    font-size: 13px;
    color: #93a4cb;
}

/* ----------------------- Buttons ---------------------------------------- */
.btn {
    display: inline-block;
    padding: 12px 28px;
    background: rgba(228, 240, 255, 0.04);
    border: 1px solid #1d2a55;
    border-radius: 8px;
    color: #e6ecff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}
.btn:hover {
    background: rgba(228, 240, 255, 0.08);
    border-color: #00e5ff;
    color: #ffffff;
    text-decoration: none;
}

.btn-primary {
    background: #00e5ff;
    background-image: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    border-color: transparent;
    color: #050818 !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.35);
}
.btn-primary:hover {
    box-shadow: 0 0 36px rgba(0, 229, 255, 0.6);
    color: #050818 !important;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(0, 229, 255, 0.5);
    color: #00e5ff;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}
.btn-ghost:hover {
    background: rgba(0, 229, 255, 0.08);
    color: #00e5ff;
}

/* Generic eyebrow microcopy — auth cards, section heads, etc. */
.eyebrow {
    margin: 0 0 10px;
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00e5ff;
}

/* ----------------------- Auth cards (login/register/etc.) --------------- */
.auth-card {
    max-width: 440px;
    margin: 40px auto;
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 12px;
    padding: 36px 36px 32px;
    box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.08), 0 24px 64px rgba(0, 0, 0, 0.4);
}
.auth-card h1 {
    margin-top: 0;
    font-size: 22px;
    color: #ffffff;
    letter-spacing: 0.5px;
}
.auth-card p { color: #93a4cb; }
.auth-card p.subtle { color: #5c6f9c; font-size: 13px; margin-top: 14px; }

.form-field { display: block; margin-bottom: 16px; }
.form-field label {
    display: block;
    font-size: 12px;
    color: #93a4cb;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    background: rgba(5, 8, 24, 0.6);
    border: 1px solid #1d2a55;
    border-radius: 6px;
    color: #e6ecff;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus {
    outline: none;
    border-color: #00e5ff;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}

.form-actions { margin-top: 22px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.alert {
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error   { background: rgba(255, 85, 119, 0.08); border: 1px solid rgba(255, 85, 119, 0.32); color: #ff8aa3; }
.alert-info    { background: rgba(0, 229, 255, 0.08);  border: 1px solid rgba(0, 229, 255, 0.32);  color: #7cf4ff; }
.alert-success { background: rgba(0, 255, 153, 0.06);  border: 1px solid rgba(0, 255, 153, 0.32);  color: #58e8a8; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #93a4cb; }

/* ----------------------- Section blocks (Profile) ----------------------- */
.section-block {
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 10px;
    padding: 24px 24px 26px;
    margin-bottom: 20px;
}
.section-block h2 { margin-top: 0; font-size: 18px; color: #ffffff; }

/* ----------------------- Profile picture upload ------------------------- */
.profile-picture-row {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.profile-picture-current {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #1d2a55;
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.25);
}
.profile-picture-current img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-picture-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color: #050818;
    font-weight: 700;
    font-size: 36px;
    text-transform: uppercase;
}
.profile-picture-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 220px;
}
.profile-picture-input {
    color: #e6ecff;
    font-size: 13px;
}
.profile-picture-input::file-selector-button {
    background: #1d2a55;
    color: #e6ecff;
    border: 1px solid #2a3a70;
    border-radius: 6px;
    padding: 6px 12px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 13px;
}
.profile-picture-input::file-selector-button:hover {
    background: #2a3a70;
}

/* ----------------------- Games page (two-column) ------------------------ */
.games-split {
    display: grid;
    grid-template-columns: minmax(280px, 320px) 1fr;
    gap: 22px;
    align-items: start;
}

/* Left column: list of compact cards */
.games-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-list-item {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 12px;
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.game-list-item:hover {
    border-color: rgba(0, 229, 255, 0.4);
    background: #0d143a;
}
.game-list-item:focus-visible {
    outline: 2px solid #00e5ff;
    outline-offset: 2px;
}
.game-list-item.selected {
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.15), inset 0 0 0 1px rgba(0, 229, 255, 0.25);
    background: #0d143a;
}

.game-list-icon {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-self: center;
}
.game-list-icon img,
.game-list-icon .icon-placeholder {
    width: 72px;
    height: 72px;
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
.game-list-icon .icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    color: #050818;
    font-size: 32px;
    font-weight: 800;
}

.game-list-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.game-list-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.game-list-body .status-badge {
    align-self: flex-start;
}

/* Right column: selected game detail */
.game-detail {
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 10px;
    padding: 26px 28px 30px;
    min-height: 360px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
}

.game-detail-empty {
    color: #93a4cb;
    text-align: center;
    padding: 80px 20px;
}

.game-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid #1d2a55;
    margin-bottom: 20px;
}
.game-detail-title {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.game-detail-header h1 {
    display: block;
    margin: 0;
    font-size: 24px;
    color: #ffffff;
}
.game-detail-tagline {
    display: block;
    margin: 0;
    color: #c4d0ec;
    font-size: 14px;
}

/* ----------------------- Play button (detail header) ------------------- */
/* Animated rim technique: a ::before pseudo holds a conic gradient that spins
   continuously; an ::after pseudo sits 3px inset over it and carries the
   button's actual gradient fill, leaving only a 3px animated rim visible.
   `transform: rotate` is the most reliably animated property — no @property
   tricks, no mask-composite quirks. */
.game-detail-play {
    flex-shrink: 0;
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.game-detail-play:not(.disabled) {
    /* Neutralize .btn-primary's solid fill — ::after will paint it instead. */
    background: transparent;
    background-image: none;
}
.game-detail-play:not(.disabled)::before {
    content: '';
    position: absolute;
    /* Inscribe a square at least as wide as the button's diagonal so the
       spinning conic covers every pixel of the button at every rotation. */
    width: 200%;
    aspect-ratio: 1 / 1;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: conic-gradient(
        from 0deg,
        #00e5ff 0%,
        #7c4dff 25%,
        #ff4dcb 50%,
        #7c4dff 75%,
        #00e5ff 100%
    );
    animation: play-spin 3.5s linear infinite;
    z-index: -2;
    pointer-events: none;
}
.game-detail-play:not(.disabled)::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 5px;
    background: linear-gradient(135deg, #00e5ff 0%, #7c4dff 100%);
    z-index: -1;
    pointer-events: none;
}
@keyframes play-spin {
    from { transform: translate(-50%, -50%) rotate(0deg);   }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .game-detail-play:not(.disabled)::before { animation: none; }
}
.game-detail-play.disabled {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.4;
    background: #1d2a55;
    color: #93a4cb;
    box-shadow: none;
}

/* Rendered markdown inside the detail panel */
.game-detail-readme { color: #d8e1f5; line-height: 1.65; font-size: 15px; }
.game-detail-readme h1,
.game-detail-readme h2,
.game-detail-readme h3,
.game-detail-readme h4 { color: #ffffff; margin: 1.6em 0 0.4em; }
.game-detail-readme h1 { font-size: 22px; }
.game-detail-readme h2 { font-size: 19px; padding-bottom: 6px; border-bottom: 1px solid #1d2a55; }
.game-detail-readme h3 { font-size: 16px; }
.game-detail-readme h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 1.5px; color: #93a4cb; }
.game-detail-readme p  { margin: 0 0 12px; }
.game-detail-readme a  { color: #00e5ff; text-decoration: underline; text-underline-offset: 3px; }
.game-detail-readme strong { color: #ffffff; }
.game-detail-readme code {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.18);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
    font-size: 13px;
    color: #e6ecff;
}
.game-detail-readme pre {
    background: rgba(5, 8, 24, 0.6);
    border: 1px solid #1d2a55;
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
}
.game-detail-readme pre code { background: none; border: none; padding: 0; }
.game-detail-readme ul, .game-detail-readme ol { padding-left: 24px; margin: 0 0 14px; }
.game-detail-readme li { margin-bottom: 4px; }
.game-detail-readme blockquote {
    border-left: 3px solid #00e5ff;
    margin: 0 0 14px;
    padding: 6px 14px;
    background: rgba(0, 229, 255, 0.04);
    color: #c4d0ec;
}
.game-detail-readme table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 14px;
}
.game-detail-readme th, .game-detail-readme td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #1d2a55;
}
.game-detail-readme th { color: #93a4cb; font-weight: 600; }
.game-detail-readme hr { border: none; border-top: 1px solid #1d2a55; margin: 24px 0; }
.game-detail-readme img { max-width: 100%; border-radius: 8px; }

.games-empty {
    text-align: center;
    padding: 80px 20px;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.status-running  { background: rgba(0, 255, 153, 0.1); color: #58e8a8; border: 1px solid rgba(0, 255, 153, 0.3); }
.status-inactive { background: rgba(255, 200, 0, 0.1);  color: #ffd55a; border: 1px solid rgba(255, 200, 0, 0.3); }
.status-failed   { background: rgba(255, 85, 119, 0.1);  color: #ff8aa3; border: 1px solid rgba(255, 85, 119, 0.3); }
.status-unknown  { background: rgba(147, 164, 203, 0.1); color: #93a4cb; border: 1px solid #1d2a55; }

/* ----------------------- Stats table ------------------------------------ */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: #0c1230;
    border: 1px solid #1d2a55;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}
.stats-table th, .stats-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #1d2a55;
    font-size: 14px;
    color: #e6ecff;
}
.stats-table th {
    background: rgba(0, 229, 255, 0.04);
    color: #93a4cb;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.stats-table tr:last-child td { border-bottom: none; }

.subtle { color: #93a4cb; font-size: 14px; }

/* ----------------------- Responsive ------------------------------------- */
@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .topbar-brand-text { display: none; }
    .topbar-nav { gap: 10px; }
    .topbar-profile-name { display: none; }
    .hero-title { font-size: 38px; }
    .hero-logo { width: 200px; }

    /* Games page collapses to a single column on mobile */
    .games-split { grid-template-columns: 1fr; }
    .game-detail-header { flex-direction: column; align-items: stretch; }
}
