:root {
    color-scheme: light;
    --background: #f3f6f8;
    --panel: #ffffff;
    --text: #172026;
    --muted: #5d6b76;
    --primary: #176b87;
    --primary-dark: #0f4e62;
    --border: #d9e1e7;
    --error: #a02b2b;
    --success: #16643b;
    --surface: #edf2f5;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--background);
}

button {
    min-height: 46px;
    margin-top: 10px;
    border: 0;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    background: var(--primary);
    cursor: pointer;
}

button:hover {
    background: var(--primary-dark);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(100%, 420px);
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(23, 32, 38, 0.12);
}

.brand-logo {
    display: block;
    width: min(240px, 80%);
    height: auto;
    margin: 0 auto 24px;
}

h1 {
    margin: 0 0 24px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
}

.auth-form {
    display: grid;
    gap: 10px;
}

label {
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
}

input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 16px;
    color: var(--text);
    background: #ffffff;
}

input:focus {
    outline: 3px solid rgba(23, 107, 135, 0.18);
    border-color: var(--primary);
}

.form-link {
    margin: 18px 0 0;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
}

a {
    color: var(--primary);
    font-weight: 700;
}

.message {
    min-height: 22px;
    margin: 18px 0 0;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
    overflow-wrap: anywhere;
}

.message.error {
    color: var(--error);
}

.message.success {
    color: var(--success);
}

.app-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 16px;
}

.app-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 12px 0 18px;
}

.app-logo {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.app-user {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.app-user strong,
.app-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user strong {
    font-size: 18px;
}

.app-user span {
    font-size: 12px;
    color: var(--muted);
}

.secondary-button {
    min-height: 40px;
    margin-top: 0;
    padding: 0 14px;
    color: var(--primary);
    background: #ffffff;
    border: 1px solid var(--border);
}

.secondary-button:hover {
    color: #ffffff;
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}

.compact-button {
    min-height: 36px;
    font-size: 14px;
}

.player-section,
.upload-section,
.video-list-section {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.player-section {
    margin-bottom: 16px;
}

.upload-section {
    margin-bottom: 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-heading h1,
.section-heading h2 {
    margin: 0;
    font-size: 22px;
    text-align: left;
}

.section-heading h2 {
    font-size: 20px;
}

.section-heading span {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.video-player {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 68vh;
    background: #101820;
    border-radius: 8px;
}

.player-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.current-video {
    min-height: 22px;
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.upload-form {
    display: grid;
    gap: 10px;
}

.upload-form input[type="file"] {
    padding: 9px;
    cursor: pointer;
}

.upload-form button {
    margin-top: 0;
}

.video-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.video-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.video-item span {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}

.video-select-button {
    min-height: 38px;
    margin: 0;
    padding: 0 10px;
    color: var(--text);
    text-align: left;
    overflow-wrap: anywhere;
    background: transparent;
}

.video-select-button:hover,
.video-select-button.is-active {
    color: #ffffff;
    background: var(--primary);
}

.empty-state {
    margin: 0;
    padding: 18px;
    color: var(--muted);
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
}

@media (min-width: 640px) {
    .app-shell {
        padding: 24px;
    }

    .player-controls {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 920px) {
    .app-shell {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
        gap: 18px;
    }

    .app-header {
        grid-column: 1 / -1;
        padding-bottom: 4px;
    }

    .upload-section,
    .video-list-section {
        grid-column: 2;
    }

    .player-section {
        grid-column: 1;
        grid-row: 2 / span 2;
        margin-bottom: 0;
    }
}
