@font-face {
    font-family: 'Plus Jakarta Sans';
    src: url('../misc/fonts/PlusJakartaSans-Variable.woff2') format('woff2');
    font-weight: 300 800;
    font-style: normal;
    font-display: optional;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --accent: #4C47E2;
    --black: #111;
    --mid: #5c5c5c;
    --border: #bdbdbd;
    --bg: #d7d7d7;
    --shadow: #a8a8a8;
    --surface: #cbcbcb;
}
html.dark {
    --black: #f0f0f0;
    --mid: #a0a0a0;
    --border: #2a2a2a;
    --bg: #111111;
    --shadow: #000000;
    --surface: #222222;
}
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--surface);
    color: var(--black);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease, color 0.3s ease;
}
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 28px 70px 28px 40px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.github-btn {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px; font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--black);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.github-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: 2px 2px 0 0 var(--accent); }

.close-btn {

    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 50;
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.close-btn:hover { border-color: #fff; background: rgba(0, 0, 0, 0.55); }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.7px; }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 40px 60px;
}
#stage {
    position: relative;
    width: fit-content;
    max-width: 1100px;
    border-radius: 12px;
    transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1), height 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
#stage.active {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
html.dark #stage.active { background: #222; }
#stage.setting-up #video-clip { visibility: hidden; }

#video-clip {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 12px;
}
#video, #overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

#overlay {
    opacity: 0;
    transition: opacity 0.4s ease;
}
#stage.tracking-visible #overlay { opacity: 1; transition: opacity 1.2s ease; }

#club-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: var(--surface);
}
html.dark #club-bg { background: #222; }
#stage.camera-hidden #video { opacity: 0; }
#stage.camera-hidden #club-bg { display: block; }

#live-indicator {
    position: absolute;
    top: 0; left: 50%;
    transform: translate(-50%, -50%);
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #d92b2b;
    z-index: 2;
}
#live-indicator[hidden] { display: none; }

#btn-stop, #btn-hide-camera {
    position: absolute;
    top: 14px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px; font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 2;
}
#btn-stop { left: 14px; }
#btn-hide-camera { right: 14px; }
#btn-stop[hidden], #btn-hide-camera[hidden] { display: none; }

#btn-hide-camera {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--black);
    transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
#btn-hide-camera:hover { border-color: var(--accent); color: var(--accent); box-shadow: 2px 2px 0 0 var(--accent); }

#btn-stop {
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    transition: box-shadow 0.15s;
}
#btn-stop:hover { box-shadow: 2px 2px 0 0 var(--shadow); }

#placeholder {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 56px 88px;
}
#placeholder.hidden { display: none; }

button#btn-start {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px; font-weight: 600;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    cursor: pointer;
    transition: box-shadow 0.15s;
}
button#btn-start:hover:not(:disabled) { box-shadow: 3px 3px 0 0 var(--shadow); }
button#btn-start:disabled { opacity: 0.6; cursor: default; }

#status { font-size: 12px; font-weight: 500; color: var(--mid); min-height: 1.2em; }

#stage-caption {
    width: 100%;
    max-width: 1100px;
    margin-top: 10px;
    font-size: 12px; font-weight: 500; color: var(--mid);
    opacity: 0.75;
}

#info {
    width: 100%;
    max-width: 1100px;
    margin-bottom: 32px;
}
.info-about p {
    font-size: 13px; font-weight: 400; color: var(--mid);
    line-height: 1.7;
}
.info-about p + p { margin-top: 14px; }

.github-btn-bottom { display: none; }

@media (max-width: 640px) {
    header { padding: 20px 20px; }
    main { padding: 0 20px 40px; }
    #placeholder { padding: 40px 32px; }

    .header-actions .github-btn { display: none; }
    .github-btn-bottom {
        display: inline-block;
        margin-top: 24px;
        font-family: 'Plus Jakarta Sans', sans-serif;
        font-size: 12px; font-weight: 600;
        padding: 8px 14px;
        border-radius: 6px;
        border: 1px solid var(--border);
        background: var(--bg);
        color: var(--black);
        text-decoration: none;
    }

    main.camera-active #info,
    main.camera-active #stage-caption,
    main.camera-active .github-btn-bottom { display: none; }
}
