/* Brand: Школа спортивной гимнастики Андрея Гребенникова.
   Palette taken from the logo — red #c00000, black, white. */
:root {
    --brand-red: #c00000;
    --brand-red-dark: #9a0000;
    --brand-red-soft: rgba(192, 0, 0, 0.08);
    --bg: #ffffff;
    --bg-soft: #f5f5f7;
    --panel: #ffffff;
    --text: #1a1a1a;
    --text-on-dark: #ffffff;
    --muted: #6b6b6b;
    --border: #e5e5e7;
    --header-bg: #000000;
    --danger: #c00000;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-red); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; margin: 0 0 1rem; font-weight: 700; letter-spacing: -0.01em; }
h2 {
    font-size: 0.95rem;
    margin: 2rem 0 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-soft);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* --- Top bar (black, with red accent stripe) --- */
.topbar {
    background: var(--header-bg);
    color: var(--text-on-dark);
    border-bottom: 4px solid var(--brand-red);
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-on-dark);
    text-decoration: none;
    font-weight: 700;
}
.brand:hover { text-decoration: none; }
.brand img {
    height: 38px;
    width: auto;
    display: block;
    border-radius: 4px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .brand-title { font-size: 0.95rem; }
.brand-text .brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.topbar-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}
.topbar-right button.link {
    color: rgba(255,255,255,0.85);
}
.topbar-right button.link:hover { color: white; }

/* --- Cards --- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* --- Login --- */
.login-card {
    width: 100%;
    max-width: 380px;
    padding: 1.75rem 1.5rem;
    text-align: center;
    border-top: 4px solid var(--brand-red);
}
.login-logo {
    display: block;
    width: 120px;
    height: auto;
    margin: 0 auto 1rem;
    border-radius: 6px;
}
.login-card h1 {
    font-size: 1.2rem;
    margin: 0.25rem 0 0.2rem;
    line-height: 1.25;
}
.login-card .tagline {
    color: var(--muted);
    font-size: 0.88rem;
    margin: 0 0 1.25rem;
}
.login-card label {
    display: block;
    margin: 0.6rem 0;
    color: var(--muted);
    font-size: 0.85rem;
    text-align: left;
}
.login-card input {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.65rem 0.8rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}
.login-card input:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-soft);
}

/* --- Buttons --- */
button.primary {
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--brand-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.15s ease;
    text-transform: uppercase;
}
button.primary:hover { background: var(--brand-red-dark); }

button.link {
    background: none;
    border: none;
    color: var(--brand-red);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0;
    font: inherit;
}
button.link:hover { text-decoration: underline; }

/* --- Flash messages --- */
.flash {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
.flash-error {
    background: var(--brand-red-soft);
    color: var(--brand-red);
    border: 1px solid rgba(192,0,0,0.2);
}

/* --- Camera grid --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.small-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.cam-card {
    color: var(--text);
    display: block;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.cam-card:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: var(--brand-red);
    box-shadow: 0 6px 18px rgba(192,0,0,0.14);
}

/* Diagonal red/black thumbnail, echoing the logo background. */
.cam-thumb {
    aspect-ratio: 16 / 9;
    background:
        linear-gradient(115deg, var(--brand-red) 0%, var(--brand-red) 48%,
                                #000000 52%, #000000 100%);
    border-radius: 8px;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.4rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.cam-title { font-weight: 700; margin-bottom: 0.2rem; font-size: 1rem; }

/* --- Player --- */
.player-wrap {
    background: black;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border: 1px solid #111;
}
.player-wrap video {
    display: block;
    width: 100%;
    height: auto;
    background: black;
}
#player-status {
    padding: 0.5rem 0.25rem 0;
}

/* --- Mobile --- */
@media (max-width: 520px) {
    .brand img { height: 32px; }
    .brand-text .brand-title { font-size: 0.85rem; }
    .brand-text .brand-sub { display: none; }
    h1 { font-size: 1.35rem; }
}
