:root {
    --player-bg: #0f1419;
    --player-panel: #1a222d;
    --player-border: rgba(255, 255, 255, 0.08);
    --player-text: #f4f7fb;
    --player-muted: #9aa8b8;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --glow: rgba(34, 197, 94, 0.35);
    --max-player: 960px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body.play-page {
    margin: 0;
    min-height: 100%;
    background: var(--player-bg);
    color: var(--player-text);
    font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    overflow-x: hidden;
}

body.play-page {
    overflow-y: auto;
}

a {
    color: #7dd3fc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.play-site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(15, 20, 25, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--player-border);
}

.play-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.play-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--player-text);
    text-decoration: none;
}

.play-logo img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.play-logo span {
    color: #4ade80;
}

.play-header-nav {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 0.92rem;
    font-weight: 600;
}

.play-header-nav a {
    color: var(--player-muted);
    text-decoration: none;
}

.play-header-nav a:hover {
    color: var(--player-text);
    text-decoration: none;
}

.play-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.game-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.game-meta-left {
    display: flex;
    gap: 14px;
    align-items: center;
}

.game-meta-left img {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid var(--player-border);
}

.game-meta h1 {
    margin: 0 0 4px;
    font-size: clamp(1.35rem, 3vw, 1.75rem);
    letter-spacing: -0.02em;
}

.breadcrumb {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: var(--player-muted);
}

.breadcrumb a {
    color: var(--player-muted);
}

.plays-stat {
    margin: 0;
    font-size: 0.85rem;
    color: var(--player-muted);
}

.game-meta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.chip {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--player-panel);
    border: 1px solid var(--player-border);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--player-muted);
}

.chip-accent {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.35);
}

/* Player shell — inspired by game portals */
.player-stage {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #0a0e12;
    border: 1px solid var(--player-border);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 24px 80px rgba(0, 0, 0, 0.55),
        0 0 60px var(--glow);
}

.player-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(15, 20, 25, 0.35) 0%, rgba(15, 20, 25, 0.75) 100%),
        url("../assets/super-bear-cover.png") center / cover no-repeat;
    filter: blur(18px) saturate(1.2);
    transform: scale(1.08);
    z-index: 0;
}

.player-frame-wrap {
    position: relative;
    z-index: 1;
    padding: clamp(16px, 3vw, 28px);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: min(72vh, 640px);
}

.player-frame {
    position: relative;
    width: min(100%, var(--max-player));
    aspect-ratio: 16 / 10;
    max-height: min(68vh, 580px);
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.player-frame.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 500;
    width: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

#unity-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#unity-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #1a3a2a;
}

.player-toolbar {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    background: rgba(26, 34, 45, 0.95);
    border-top: 1px solid var(--player-border);
}

.player-toolbar-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.toolbar-btns {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--player-border);
    background: #252f3d;
    color: var(--player-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.toolbar-btn:hover {
    background: #2f3b4d;
}

/* Start overlay inside player */
#play-screen {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.25) 100%),
        url("../assets/super-bear-cover.png") center / cover no-repeat;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#play-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.play-overlay-content {
    text-align: center;
    padding: 24px;
    max-width: 420px;
}

.play-overlay-content .overlay-title {
    margin: 0 0 8px;
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 800;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
}

.play-overlay-content p {
    margin: 0 0 22px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.95rem;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}

#play-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 220px;
    min-height: 56px;
    padding: 0 32px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #4ade80 0%, var(--accent) 45%, var(--accent-hover) 100%);
    color: #fff;
    font: 800 1.15rem/1 system-ui, sans-serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow:
        0 12px 32px rgba(34, 197, 94, 0.45),
        0 0 0 4px rgba(34, 197, 94, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#play-button:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow:
        0 16px 40px rgba(34, 197, 94, 0.5),
        0 0 0 4px rgba(34, 197, 94, 0.25);
}

#play-button:disabled {
    opacity: 0.75;
    cursor: wait;
}

.play-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Loading overlay inside frame */
#loading-cover {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 18, 0.92);
    backdrop-filter: blur(8px);
}

#loading-cover.loading,
#loading-cover.error {
    display: flex;
}

#loading-cover.hide {
    display: none !important;
}

.loader-box {
    width: min(90%, 360px);
    text-align: center;
    padding: 28px 24px;
    border-radius: 16px;
    background: var(--player-panel);
    border: 1px solid var(--player-border);
}

.loader-box h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

#loading-status {
    margin: 0 0 16px;
    color: var(--player-muted);
    font-size: 0.9rem;
    min-height: 1.2em;
}

#unity-progress-bar-empty {
    display: none;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #252f3d;
    overflow: hidden;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 999px;
    transition: width 0.2s ease;
}

.loading-percent {
    display: none;
    margin-top: 10px;
    font-weight: 800;
    font-size: 1.1rem;
    color: #86efac;
}

.spinner {
    display: none;
}

#loading-refresh-button {
    display: none;
    margin-top: 16px;
    padding: 10px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#loading-cover.error .loading-error-message {
    display: block;
    color: #fca5a5;
    font-size: 0.9rem;
}

.loading-error-message {
    display: none;
    margin: 8px 0 0;
}

.play-info {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-card {
    background: var(--player-panel);
    border: 1px solid var(--player-border);
    border-radius: 16px;
    padding: 20px;
}

.info-card h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.info-card p,
.info-card ul {
    margin: 0;
    color: var(--player-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.info-card ul {
    padding-left: 1.2em;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag {
    padding: 6px 12px;
    border-radius: 8px;
    background: #252f3d;
    font-size: 0.78rem;
    font-weight: 600;
    color: #cbd5e1;
}

.play-intro {
    margin: 0 0 18px;
    max-width: 72ch;
    color: var(--player-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.play-intro a {
    color: #7dd3fc;
    font-weight: 600;
}

.play-content {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.content-block {
    background: var(--player-panel);
    border: 1px solid var(--player-border);
    border-radius: 16px;
    padding: clamp(18px, 3vw, 26px);
}

.content-block h2 {
    margin: 0 0 12px;
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    color: var(--player-text);
}

.content-block h3 {
    margin: 18px 0 8px;
    font-size: 1rem;
    color: #cbd5e1;
}

.content-block p,
.content-block li {
    color: var(--player-muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.content-block ul,
.content-block ol {
    margin: 0;
    padding-left: 1.25em;
}

.content-block li + li {
    margin-top: 6px;
}

.play-screenshot {
    margin: 16px 0 0;
    text-align: center;
}

.play-screenshot img {
    width: min(100%, 420px);
    height: auto;
    border-radius: 14px;
    border: 1px solid var(--player-border);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.play-screenshot figcaption {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--player-muted);
}

.play-faq details {
    background: #252f3d;
    border: 1px solid var(--player-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.play-faq summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--player-text);
}

.play-faq details p {
    margin: 10px 0 0;
}

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

.play-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--player-border);
    font-size: 0.82rem;
    color: var(--player-muted);
    text-align: center;
}

.play-footer a {
    font-weight: 600;
}

@media (max-width: 768px) {
    .game-meta {
        flex-direction: column;
    }

    .player-frame {
        aspect-ratio: 4 / 3;
        max-height: 52vh;
    }

    .play-info {
        grid-template-columns: 1fr;
    }

    .play-header-nav {
        display: none;
    }
}
